diff --git a/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.Designer.vb b/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.Designer.vb new file mode 100644 index 00000000000..e6c7a3e1c0e --- /dev/null +++ b/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.Designer.vb @@ -0,0 +1,202 @@ + _ +Partial Class ucrCellsFootNotes + 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.lblRowExpression = New System.Windows.Forms.Label() + Me.ucrInputRows = New instat.ucrInputTextBox() + Me.lblFooteNotes = New System.Windows.Forms.Label() + Me.btnClear = New System.Windows.Forms.Button() + Me.lblColumns = New System.Windows.Forms.Label() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.dataGrid = New System.Windows.Forms.DataGridView() + Me.colStyles = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.ucrReceiverSingleCol = New instat.ucrReceiverSingle() + Me.btnAdd = New System.Windows.Forms.Button() + Me.ucrTxtFootNote = New instat.ucrInputTextBox() + Me.lblFootNote = New System.Windows.Forms.Label() + CType(Me.dataGrid, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblRowExpression + ' + Me.lblRowExpression.AutoSize = True + Me.lblRowExpression.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblRowExpression.Location = New System.Drawing.Point(238, 46) + Me.lblRowExpression.Name = "lblRowExpression" + Me.lblRowExpression.Size = New System.Drawing.Size(86, 13) + Me.lblRowExpression.TabIndex = 338 + Me.lblRowExpression.Text = "Row Expression:" + ' + 'ucrInputRows + ' + Me.ucrInputRows.AddQuotesIfUnrecognised = True + Me.ucrInputRows.AutoSize = True + Me.ucrInputRows.IsMultiline = False + Me.ucrInputRows.IsReadOnly = False + Me.ucrInputRows.Location = New System.Drawing.Point(240, 62) + Me.ucrInputRows.Name = "ucrInputRows" + Me.ucrInputRows.Size = New System.Drawing.Size(137, 21) + Me.ucrInputRows.TabIndex = 337 + ' + 'lblFooteNotes + ' + Me.lblFooteNotes.AutoSize = True + Me.lblFooteNotes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFooteNotes.Location = New System.Drawing.Point(233, 171) + Me.lblFooteNotes.Name = "lblFooteNotes" + Me.lblFooteNotes.Size = New System.Drawing.Size(62, 13) + Me.lblFooteNotes.TabIndex = 336 + Me.lblFooteNotes.Text = "Foot Notes:" + ' + 'btnClear + ' + Me.btnClear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClear.Location = New System.Drawing.Point(517, 162) + Me.btnClear.Name = "btnClear" + Me.btnClear.Size = New System.Drawing.Size(75, 23) + Me.btnClear.TabIndex = 335 + Me.btnClear.Tag = "" + Me.btnClear.Text = "Clear" + Me.btnClear.UseVisualStyleBackColor = True + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(238, 0) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(45, 13) + Me.lblColumns.TabIndex = 334 + Me.lblColumns.Text = "Column:" + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(5, 0) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 332 + ' + 'dataGrid + ' + Me.dataGrid.AllowUserToAddRows = False + Me.dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGrid.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colStyles}) + Me.dataGrid.Location = New System.Drawing.Point(236, 188) + Me.dataGrid.Name = "dataGrid" + Me.dataGrid.RowHeadersWidth = 62 + Me.dataGrid.Size = New System.Drawing.Size(361, 73) + Me.dataGrid.TabIndex = 331 + ' + 'colStyles + ' + Me.colStyles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colStyles.HeaderText = "Foot Note Expressions" + Me.colStyles.MinimumWidth = 8 + Me.colStyles.Name = "colStyles" + ' + 'ucrReceiverSingleCol + ' + Me.ucrReceiverSingleCol.AutoSize = True + Me.ucrReceiverSingleCol.frmParent = Nothing + Me.ucrReceiverSingleCol.Location = New System.Drawing.Point(235, 13) + Me.ucrReceiverSingleCol.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSingleCol.Name = "ucrReceiverSingleCol" + Me.ucrReceiverSingleCol.Selector = Nothing + Me.ucrReceiverSingleCol.Size = New System.Drawing.Size(142, 20) + Me.ucrReceiverSingleCol.strNcFilePath = "" + Me.ucrReceiverSingleCol.TabIndex = 339 + Me.ucrReceiverSingleCol.ucrSelector = Nothing + ' + 'btnAdd + ' + Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAdd.Location = New System.Drawing.Point(241, 135) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(83, 23) + Me.btnAdd.TabIndex = 333 + Me.btnAdd.Tag = "" + Me.btnAdd.Text = "Add" + Me.btnAdd.UseVisualStyleBackColor = True + ' + 'ucrTxtFootNote + ' + Me.ucrTxtFootNote.AddQuotesIfUnrecognised = True + Me.ucrTxtFootNote.AutoSize = True + Me.ucrTxtFootNote.IsMultiline = False + Me.ucrTxtFootNote.IsReadOnly = False + Me.ucrTxtFootNote.Location = New System.Drawing.Point(241, 107) + Me.ucrTxtFootNote.Name = "ucrTxtFootNote" + Me.ucrTxtFootNote.Size = New System.Drawing.Size(299, 21) + Me.ucrTxtFootNote.TabIndex = 340 + ' + 'lblFootNote + ' + Me.lblFootNote.AutoSize = True + Me.lblFootNote.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFootNote.Location = New System.Drawing.Point(243, 91) + Me.lblFootNote.Name = "lblFootNote" + Me.lblFootNote.Size = New System.Drawing.Size(81, 13) + Me.lblFootNote.TabIndex = 341 + Me.lblFootNote.Text = "Foot Note Text:" + ' + 'ucrCellsFootNotes + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.lblFootNote) + Me.Controls.Add(Me.ucrTxtFootNote) + Me.Controls.Add(Me.lblRowExpression) + Me.Controls.Add(Me.ucrInputRows) + Me.Controls.Add(Me.lblFooteNotes) + Me.Controls.Add(Me.btnClear) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.dataGrid) + Me.Controls.Add(Me.ucrReceiverSingleCol) + Me.Controls.Add(Me.btnAdd) + Me.Name = "ucrCellsFootNotes" + Me.Size = New System.Drawing.Size(602, 265) + CType(Me.dataGrid, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents lblRowExpression As Label + Friend WithEvents ucrInputRows As ucrInputTextBox + Friend WithEvents lblFooteNotes As Label + Friend WithEvents btnClear As Button + Friend WithEvents lblColumns As Label + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents dataGrid As DataGridView + Friend WithEvents colStyles As DataGridViewTextBoxColumn + Friend WithEvents ucrReceiverSingleCol As ucrReceiverSingle + Friend WithEvents btnAdd As Button + Friend WithEvents ucrTxtFootNote As ucrInputTextBox + Friend WithEvents lblFootNote As Label +End Class diff --git a/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.resx b/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.resx new file mode 100644 index 00000000000..a249bebae7f --- /dev/null +++ b/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.vb b/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.vb new file mode 100644 index 00000000000..c7cc5c3cf51 --- /dev/null +++ b/instat/UserTables/Cells/FootNotes/ucrCellsFootNotes.vb @@ -0,0 +1,94 @@ +Public Class ucrCellsFootNotes + + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub InitialiseControl() + ucrReceiverSingleCol.Selector = ucrSelectorCols + ucrReceiverSingleCol.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ' Set up the controls + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + SetupDataGrid(clsOperator) + + End Sub + + + Private Sub SetupDataGrid(clsOperator As ROperator) + Dim lstRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_footnote"}, "locations", "cells_body", clsOperator) + ' Clear grid rgen add contents from operator + dataGrid.Rows.Clear() + For Each clsRParam As RParameter In lstRParams + + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGrid) + row.Cells(0).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the parameter function contents as a row + row.Tag = clsRParam + dataGrid.Rows.Add(row) + Next + End Sub + + Private Sub ucrInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputRows.ControlContentsChanged, ucrReceiverSingleCol.ControlContentsChanged + btnAdd.Enabled = Not ucrReceiverSingleCol.IsEmpty AndAlso Not ucrInputRows.IsEmpty + End Sub + + Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click + + Dim clsTabFootNoteRFunction As New RFunction + Dim clsLocationsRFunction As New RFunction + + + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_body") + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=ucrReceiverSingleCol.GetVariableNames(bWithQuotes:=False), iNewPosition:=0)) + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="rows", strParamValue:=ucrInputRows.GetText, iNewPosition:=1)) + + clsTabFootNoteRFunction.SetPackageName("gt") + clsTabFootNoteRFunction.SetRCommand("tab_footnote") + clsTabFootNoteRFunction.AddParameter(strParameterName:="footnote", strParameterValue:=Chr(34) & ucrTxtFootNote.GetText & Chr(34), iPosition:=0) + clsTabFootNoteRFunction.AddParameter(strParameterName:="locations", clsRFunctionParameter:=clsLocationsRFunction, iPosition:=1) + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="tab_footnote_cells_param" & (dataGrid.Rows.Count + 1), strParamValue:=clsTabFootNoteRFunction, bNewIncludeArgumentName:=False) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGrid) + row.Cells(0).Value = clsTabFootNoteRFunction.Clone.ToScript + + ' Tag the row with the parameter + row.Tag = clsRParam + + ' Add it to grid + dataGrid.Rows.Add(row) + + End Sub + + Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click + dataGrid.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + ' Remove any previous cell footers + Dim lstRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_footnote"}, "locations", "cells_body", clsOperator) + For Each clsRParam As RParameter In lstRParams + clsOperator.RemoveParameter(clsRParam) + Next + + ' Add new changes + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGrid, clsOperator) + End Sub + +End Class diff --git a/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.Designer.vb b/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.Designer.vb new file mode 100644 index 00000000000..a1bc3ea22f3 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.Designer.vb @@ -0,0 +1,79 @@ + _ +Partial Class sdgCellFormatDateOptions + 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.ucrInputCboDateFormat = New instat.ucrInputComboBox() + Me.lblDateFormat = New System.Windows.Forms.Label() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() + Me.SuspendLayout() + ' + 'ucrInputCboDateFormat + ' + Me.ucrInputCboDateFormat.AddQuotesIfUnrecognised = True + Me.ucrInputCboDateFormat.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputCboDateFormat.GetSetSelectedIndex = -1 + Me.ucrInputCboDateFormat.IsReadOnly = False + Me.ucrInputCboDateFormat.Location = New System.Drawing.Point(12, 25) + Me.ucrInputCboDateFormat.Name = "ucrInputCboDateFormat" + Me.ucrInputCboDateFormat.Size = New System.Drawing.Size(137, 21) + Me.ucrInputCboDateFormat.TabIndex = 0 + ' + 'lblDateFormat + ' + Me.lblDateFormat.AutoSize = True + Me.lblDateFormat.Location = New System.Drawing.Point(7, 9) + Me.lblDateFormat.Name = "lblDateFormat" + Me.lblDateFormat.Size = New System.Drawing.Size(103, 13) + Me.lblDateFormat.TabIndex = 1 + Me.lblDateFormat.Text = "Specify Date Format" + ' + 'ucrSdgBaseButtons + ' + Me.ucrSdgBaseButtons.AutoSize = True + Me.ucrSdgBaseButtons.Location = New System.Drawing.Point(10, 65) + Me.ucrSdgBaseButtons.Margin = New System.Windows.Forms.Padding(4) + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" + Me.ucrSdgBaseButtons.Size = New System.Drawing.Size(224, 30) + Me.ucrSdgBaseButtons.TabIndex = 343 + ' + 'sdgCellFormatDateOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(255, 103) + Me.Controls.Add(Me.ucrSdgBaseButtons) + Me.Controls.Add(Me.lblDateFormat) + Me.Controls.Add(Me.ucrInputCboDateFormat) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "sdgCellFormatDateOptions" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Cell Date Format Options" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents ucrInputCboDateFormat As ucrInputComboBox + Friend WithEvents lblDateFormat As Label + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue +End Class diff --git a/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.resx b/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.vb b/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.vb new file mode 100644 index 00000000000..96d2cdc8784 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Date/sdgCellFormatDateOptions.vb @@ -0,0 +1,104 @@ +Public Class sdgCellFormatDateOptions + + Private clsFormatDateRFunction As New RFunction + Private bFirstload As Boolean = True + + Private bUserMadeChanges As Boolean = False + Private bUserClickedReturn As Boolean = False + + Private Sub sdgCellFormatDateOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + SetDefaults() + SetRCode(True) + + bUserMadeChanges = False + bUserClickedReturn = False + End Sub + + Private Sub InitialiseDialog() + Dim dctDateFormat As New Dictionary(Of String, String) From { + {"2000-02-29", Chr(34) & "iso" & Chr(34)}, + {"Tuesday, February 29, 2000", Chr(34) & "wday_month_day_year" & Chr(34)}, + {"Tue, Feb 29, 2000", Chr(34) & "wd_m_day_year" & Chr(34)}, + {"Tuesday 29 February 2000", Chr(34) & "wday_day_month_year" & Chr(34)}, + {"February 29, 2000", Chr(34) & "month_day_year" & Chr(34)}, + {"Feb 29, 2000", Chr(34) & "m_day_year" & Chr(34)}, + {"29 Feb 2000", Chr(34) & "day_m_year" & Chr(34)}, + {"29 February 2000", Chr(34) & "day_month_year" & Chr(34)}, + {"29 February", Chr(34) & "day_month" & Chr(34)}, + {"29 Feb", Chr(34) & "day_m" & Chr(34)}, + {"2000", Chr(34) & "year" & Chr(34)}, + {"February", Chr(34) & "month" & Chr(34)}, + {"29", Chr(34) & "day" & Chr(34)}, + {"2000/02/29", Chr(34) & "year.mn.day" & Chr(34)}, + {"00/02/2", Chr(34) & " y.mn.day" & Chr(34)}, + {"2000-W09", Chr(34) & "year_week" & Chr(34)}, + {"2000-Q1", Chr(34) & "year_quarter" & Chr(34)}, + {"2/29/2000 (flexible)", Chr(34) & "yMd" & Chr(34)}, + {"Tue, 2/29/2000 (flexible)", Chr(34) & "yMEd" & Chr(34)}, + {"Feb 2000 (flexible)", Chr(34) & "yMMM" & Chr(34)}, + {"February 2000 (flexible)", Chr(34) & "yMMMM" & Chr(34)}, + {"Feb 29, 2000 (flexible)", Chr(34) & "yMMMd" & Chr(34)}, + {"Tue, Feb 29, 2000 (flexible)", Chr(34) & "yMMMEd" & Chr(34)}, + {"2/29/2000 A (flexible)", Chr(34) & "GyMd" & Chr(34)}, + {"Feb 29, 2000 AD (flexible)", Chr(34) & "GyMMMd" & Chr(34)}, + {"Tue, Feb 29, 2000 AD (flexible)", Chr(34) & "GyMMMEd" & Chr(34)}, + {"2/2000 (flexible)", Chr(34) & "yM" & Chr(34)}, + {"2/29 (flexible)", Chr(34) & "Md" & Chr(34)}, + {"Tue, 2/29 (flexible)", Chr(34) & "MEd" & Chr(34)}, + {"Feb 29 (flexible)", Chr(34) & "MMMd" & Chr(34)}, + {"Tue, Feb 29 (flexible)", Chr(34) & "MMMEd" & Chr(34)}, + {"February 29 (flexible)", Chr(34) & "MMMMd" & Chr(34)}, + {"Feb 2000 AD (flexible)", Chr(34) & "GyMMM" & Chr(34)}, + {"Q1 2000 (flexible)", Chr(34) & "yQQQ" & Chr(34)}, + {"1st quarter 2000", Chr(34) & "yQQQQ" & Chr(34)}, + {"2000 AD (flexible)", Chr(34) & "Gy" & Chr(34)}, + {"2000 (flexible)", Chr(34) & "y" & Chr(34)}, + {"Feb (flexible)", Chr(34) & "MMM" & Chr(34)}, + {"29 (flexible)", Chr(34) & "d" & Chr(34)}, + {"29 Tue (flexible)", Chr(34) & "Ed" & Chr(34)} + } + + ucrInputCboDateFormat.SetParameter(New RParameter("date_style", 3)) + ucrInputCboDateFormat.SetItems(dctDateFormat) + ucrInputCboDateFormat.SetDropDownStyleAsNonEditable() + ucrInputCboDateFormat.SetRDefault("iso") + + End Sub + + Private Sub SetDefaults() + clsFormatDateRFunction = New RFunction + + clsFormatDateRFunction.SetPackageName("gt") + clsFormatDateRFunction.SetRCommand("fmt_date") + clsFormatDateRFunction.AddParameter(strParameterName:="date_style", strParameterValue:=Chr(34) & "iso" & Chr(34)) + + End Sub + + Private Sub SetRCode(bReset As Boolean) + ucrInputCboDateFormat.SetRCode(clsFormatDateRFunction, bReset) + End Sub + + Public Function GetNewUserInputAsRFunction() As RFunction + If Not bUserClickedReturn OrElse Not bUserMadeChanges Then + Return Nothing + End If + + Return clsFormatDateRFunction + End Function + + + Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn + bUserClickedReturn = True + End Sub + + Private Sub controls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputCboDateFormat.ControlValueChanged + bUserMadeChanges = True + End Sub + + +End Class \ No newline at end of file diff --git a/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.Designer.vb b/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.Designer.vb new file mode 100644 index 00000000000..ffbf40b7935 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.Designer.vb @@ -0,0 +1,197 @@ + _ +Partial Class sdgCellFormatNumberOptions + 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.ucrChkSuffix = New instat.ucrCheck() + Me.ucrInputSeperatorMark = New instat.ucrInputTextBox() + Me.ucrChkSeparatorMark = New instat.ucrCheck() + Me.ucrChkDropTrailingDecimalMark = New instat.ucrCheck() + Me.ucrInputDecimalMark = New instat.ucrInputTextBox() + Me.ucrChkDecimalMark = New instat.ucrCheck() + Me.ucrChkDropTrailingZeros = New instat.ucrCheck() + Me.ucrChkSignificantFigures = New instat.ucrCheck() + Me.ucrChkDecimalPlaces = New instat.ucrCheck() + Me.ucrNudSignificantFigures = New instat.ucrNud() + Me.ucrNudDecimalPlaces = New instat.ucrNud() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() + Me.SuspendLayout() + ' + 'ucrChkSuffix + ' + Me.ucrChkSuffix.AutoSize = True + Me.ucrChkSuffix.Checked = False + Me.ucrChkSuffix.Location = New System.Drawing.Point(8, 187) + Me.ucrChkSuffix.Name = "ucrChkSuffix" + Me.ucrChkSuffix.Size = New System.Drawing.Size(152, 23) + Me.ucrChkSuffix.TabIndex = 28 + ' + 'ucrInputSeperatorMark + ' + Me.ucrInputSeperatorMark.AddQuotesIfUnrecognised = True + Me.ucrInputSeperatorMark.AutoSize = True + Me.ucrInputSeperatorMark.IsMultiline = False + Me.ucrInputSeperatorMark.IsReadOnly = False + Me.ucrInputSeperatorMark.Location = New System.Drawing.Point(166, 96) + Me.ucrInputSeperatorMark.Name = "ucrInputSeperatorMark" + Me.ucrInputSeperatorMark.Size = New System.Drawing.Size(137, 21) + Me.ucrInputSeperatorMark.TabIndex = 27 + ' + 'ucrChkSeparatorMark + ' + Me.ucrChkSeparatorMark.AutoSize = True + Me.ucrChkSeparatorMark.Checked = False + Me.ucrChkSeparatorMark.Location = New System.Drawing.Point(8, 96) + Me.ucrChkSeparatorMark.Name = "ucrChkSeparatorMark" + Me.ucrChkSeparatorMark.Size = New System.Drawing.Size(152, 23) + Me.ucrChkSeparatorMark.TabIndex = 26 + ' + 'ucrChkDropTrailingDecimalMark + ' + Me.ucrChkDropTrailingDecimalMark.AutoSize = True + Me.ucrChkDropTrailingDecimalMark.Checked = False + Me.ucrChkDropTrailingDecimalMark.Location = New System.Drawing.Point(8, 158) + Me.ucrChkDropTrailingDecimalMark.Name = "ucrChkDropTrailingDecimalMark" + Me.ucrChkDropTrailingDecimalMark.Size = New System.Drawing.Size(152, 23) + Me.ucrChkDropTrailingDecimalMark.TabIndex = 25 + ' + 'ucrInputDecimalMark + ' + Me.ucrInputDecimalMark.AddQuotesIfUnrecognised = True + Me.ucrInputDecimalMark.AutoSize = True + Me.ucrInputDecimalMark.IsMultiline = False + Me.ucrInputDecimalMark.IsReadOnly = False + Me.ucrInputDecimalMark.Location = New System.Drawing.Point(166, 67) + Me.ucrInputDecimalMark.Name = "ucrInputDecimalMark" + Me.ucrInputDecimalMark.Size = New System.Drawing.Size(137, 21) + Me.ucrInputDecimalMark.TabIndex = 24 + ' + 'ucrChkDecimalMark + ' + Me.ucrChkDecimalMark.AutoSize = True + Me.ucrChkDecimalMark.Checked = False + Me.ucrChkDecimalMark.Location = New System.Drawing.Point(8, 67) + Me.ucrChkDecimalMark.Name = "ucrChkDecimalMark" + Me.ucrChkDecimalMark.Size = New System.Drawing.Size(152, 23) + Me.ucrChkDecimalMark.TabIndex = 23 + ' + 'ucrChkDropTrailingZeros + ' + Me.ucrChkDropTrailingZeros.AutoSize = True + Me.ucrChkDropTrailingZeros.Checked = False + Me.ucrChkDropTrailingZeros.Location = New System.Drawing.Point(8, 129) + Me.ucrChkDropTrailingZeros.Name = "ucrChkDropTrailingZeros" + Me.ucrChkDropTrailingZeros.Size = New System.Drawing.Size(152, 23) + Me.ucrChkDropTrailingZeros.TabIndex = 22 + ' + 'ucrChkSignificantFigures + ' + Me.ucrChkSignificantFigures.AutoSize = True + Me.ucrChkSignificantFigures.Checked = False + Me.ucrChkSignificantFigures.Location = New System.Drawing.Point(8, 36) + Me.ucrChkSignificantFigures.Name = "ucrChkSignificantFigures" + Me.ucrChkSignificantFigures.Size = New System.Drawing.Size(152, 23) + Me.ucrChkSignificantFigures.TabIndex = 21 + ' + 'ucrChkDecimalPlaces + ' + Me.ucrChkDecimalPlaces.AutoSize = True + Me.ucrChkDecimalPlaces.Checked = False + Me.ucrChkDecimalPlaces.Location = New System.Drawing.Point(8, 7) + Me.ucrChkDecimalPlaces.Name = "ucrChkDecimalPlaces" + Me.ucrChkDecimalPlaces.Size = New System.Drawing.Size(152, 23) + Me.ucrChkDecimalPlaces.TabIndex = 20 + ' + 'ucrNudSignificantFigures + ' + Me.ucrNudSignificantFigures.AutoSize = True + Me.ucrNudSignificantFigures.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSignificantFigures.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSignificantFigures.Location = New System.Drawing.Point(166, 39) + Me.ucrNudSignificantFigures.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSignificantFigures.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSignificantFigures.Name = "ucrNudSignificantFigures" + Me.ucrNudSignificantFigures.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSignificantFigures.TabIndex = 19 + Me.ucrNudSignificantFigures.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudDecimalPlaces + ' + Me.ucrNudDecimalPlaces.AutoSize = True + Me.ucrNudDecimalPlaces.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Location = New System.Drawing.Point(166, 7) + Me.ucrNudDecimalPlaces.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Name = "ucrNudDecimalPlaces" + Me.ucrNudDecimalPlaces.Size = New System.Drawing.Size(50, 20) + Me.ucrNudDecimalPlaces.TabIndex = 18 + Me.ucrNudDecimalPlaces.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrSdgBaseButtons + ' + Me.ucrSdgBaseButtons.AutoSize = True + Me.ucrSdgBaseButtons.Location = New System.Drawing.Point(43, 223) + Me.ucrSdgBaseButtons.Margin = New System.Windows.Forms.Padding(4) + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" + Me.ucrSdgBaseButtons.Size = New System.Drawing.Size(224, 30) + Me.ucrSdgBaseButtons.TabIndex = 342 + ' + 'sdgCellFormatNumberOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(314, 263) + Me.Controls.Add(Me.ucrSdgBaseButtons) + Me.Controls.Add(Me.ucrChkSuffix) + Me.Controls.Add(Me.ucrInputSeperatorMark) + Me.Controls.Add(Me.ucrChkSeparatorMark) + Me.Controls.Add(Me.ucrChkDropTrailingDecimalMark) + Me.Controls.Add(Me.ucrInputDecimalMark) + Me.Controls.Add(Me.ucrChkDecimalMark) + Me.Controls.Add(Me.ucrChkDropTrailingZeros) + Me.Controls.Add(Me.ucrChkSignificantFigures) + Me.Controls.Add(Me.ucrChkDecimalPlaces) + Me.Controls.Add(Me.ucrNudSignificantFigures) + Me.Controls.Add(Me.ucrNudDecimalPlaces) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "sdgCellFormatNumberOptions" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Cell Format Number Options" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents ucrChkSuffix As ucrCheck + Friend WithEvents ucrInputSeperatorMark As ucrInputTextBox + Friend WithEvents ucrChkSeparatorMark As ucrCheck + Friend WithEvents ucrChkDropTrailingDecimalMark As ucrCheck + Friend WithEvents ucrInputDecimalMark As ucrInputTextBox + Friend WithEvents ucrChkDecimalMark As ucrCheck + Friend WithEvents ucrChkDropTrailingZeros As ucrCheck + Friend WithEvents ucrChkSignificantFigures As ucrCheck + Friend WithEvents ucrChkDecimalPlaces As ucrCheck + Friend WithEvents ucrNudSignificantFigures As ucrNud + Friend WithEvents ucrNudDecimalPlaces As ucrNud + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue +End Class diff --git a/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.resx b/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.vb b/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.vb new file mode 100644 index 00000000000..8c944238b12 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Number/sdgCellFormatNumberOptions.vb @@ -0,0 +1,127 @@ +Public Class sdgCellFormatNumberOptions + Private clsFormatNumberRFunction As New RFunction + Private bFirstload As Boolean = True + + Private bUserMadeChanges As Boolean = False + Private bUserClickedReturn As Boolean = False + + + Private Sub sdgCellFormatNumberOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + SetDefaults() + SetRCode(True) + + bUserMadeChanges = False + bUserClickedReturn = False + End Sub + + + Private Sub InitialiseDialog() + + '--------------- + ucrChkDecimalPlaces.SetText("Change Decimal Places") + ucrChkDecimalPlaces.AddToLinkedControls(ucrNudDecimalPlaces, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="2") + + ucrNudDecimalPlaces.SetParameter(New RParameter("decimals", 3)) + '--------------- + + '-------------- + ucrChkSignificantFigures.SetText("Change Significant Figures") + ucrChkSignificantFigures.AddToLinkedControls(ucrNudSignificantFigures, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True) + + ucrNudSignificantFigures.SetParameter(New RParameter("n_sigfig", 4)) + '-------------- + + + '-------------- + ucrChkDecimalMark.SetText("Change Decimal Mark") + ucrChkDecimalMark.AddToLinkedControls(ucrInputDecimalMark, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=".") + + ucrInputDecimalMark.SetParameter(New RParameter("dec_mark", 13)) + '-------------- + + '--------------- + ucrChkSeparatorMark.SetText("Change Digits Separator Mark") + ucrChkSeparatorMark.AddToLinkedControls(ucrInputSeperatorMark, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=",") + + ucrInputSeperatorMark.SetParameter(New RParameter("sep_mark", 14)) + '--------------- + + '--------------- + ucrChkDropTrailingZeros.SetText("Drop Trailing Zeros") + ucrChkDropTrailingZeros.SetParameter(New RParameter("drop_trailing_zeros", 5)) + ucrChkDropTrailingZeros.SetValuesCheckedAndUnchecked("TRUE", False) + ucrChkDropTrailingZeros.SetRDefault("FALSE") + '--------------- + + '--------------- + ucrChkDropTrailingDecimalMark.SetText("Drop Trailing Decimal Mark") + ucrChkDropTrailingDecimalMark.SetParameter(New RParameter("drop_trailing_dec_mark", 6)) + ucrChkDropTrailingDecimalMark.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkDropTrailingDecimalMark.SetRDefault("TRUE") + '--------------- + + '--------------- + ucrChkSuffix.SetText("Suffix Large Numbers") + ucrChkSuffix.SetParameter(New RParameter("suffixing", 10)) + ucrChkSuffix.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkSuffix.SetRDefault("FALSE") + '--------------- + + + End Sub + + Private Sub SetDefaults() + clsFormatNumberRFunction = New RFunction + + clsFormatNumberRFunction.SetPackageName("gt") + clsFormatNumberRFunction.SetRCommand("fmt_number") + + End Sub + + Private Sub SetRCode(bReset As Boolean) + ucrChkDecimalPlaces.SetRCode(clsFormatNumberRFunction, bReset) + ucrNudDecimalPlaces.SetRCode(clsFormatNumberRFunction, bReset) + + ucrChkSignificantFigures.SetRCode(clsFormatNumberRFunction, bReset) + ucrNudSignificantFigures.SetRCode(clsFormatNumberRFunction, bReset) + + ucrChkDecimalMark.SetRCode(clsFormatNumberRFunction, bReset) + ucrInputDecimalMark.SetRCode(clsFormatNumberRFunction, bReset) + + ucrChkSeparatorMark.SetRCode(clsFormatNumberRFunction, bReset) + ucrInputSeperatorMark.SetRCode(clsFormatNumberRFunction, bReset) + + ucrChkDropTrailingZeros.SetRCode(clsFormatNumberRFunction, bReset) + ucrChkDropTrailingDecimalMark.SetRCode(clsFormatNumberRFunction, bReset) + + ucrChkSuffix.SetRCode(clsFormatNumberRFunction, bReset) + + End Sub + + Public Function GetNewUserInputAsRFunction() As RFunction + If Not bUserClickedReturn OrElse Not bUserMadeChanges Then + Return Nothing + End If + + Return clsFormatNumberRFunction + End Function + + Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn + bUserClickedReturn = True + End Sub + + Private Sub controls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDecimalMark.ControlValueChanged, + ucrChkDecimalPlaces.ControlValueChanged, ucrChkDropTrailingDecimalMark.ControlValueChanged, ucrChkDropTrailingZeros.ControlValueChanged, + ucrChkSeparatorMark.ControlValueChanged, ucrChkSignificantFigures.ControlValueChanged, ucrChkSuffix.ControlValueChanged, + ucrInputDecimalMark.ControlValueChanged, ucrInputSeperatorMark.ControlValueChanged, ucrNudDecimalPlaces.ControlValueChanged, + ucrNudSignificantFigures.ControlValueChanged + + bUserMadeChanges = True + End Sub + +End Class \ No newline at end of file diff --git a/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.Designer.vb b/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.Designer.vb new file mode 100644 index 00000000000..0e699d42903 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.Designer.vb @@ -0,0 +1,119 @@ + _ +Partial Class sdgCellFormatTextOptions + 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.rdoEmail = New System.Windows.Forms.RadioButton() + Me.ucrInputFormatExpression = New instat.ucrInputTextBox() + Me.rdoCustom = New System.Windows.Forms.RadioButton() + Me.rdoUnits = New System.Windows.Forms.RadioButton() + Me.ucrCellFormatEmail = New instat.ucrCellFormatEmail() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() + Me.SuspendLayout() + ' + 'rdoEmail + ' + Me.rdoEmail.AutoSize = True + Me.rdoEmail.Location = New System.Drawing.Point(5, 76) + Me.rdoEmail.Name = "rdoEmail" + Me.rdoEmail.Size = New System.Drawing.Size(65, 17) + Me.rdoEmail.TabIndex = 339 + Me.rdoEmail.TabStop = True + Me.rdoEmail.Text = "As Email" + Me.rdoEmail.UseVisualStyleBackColor = True + ' + 'ucrInputFormatExpression + ' + Me.ucrInputFormatExpression.AddQuotesIfUnrecognised = True + Me.ucrInputFormatExpression.AutoSize = True + Me.ucrInputFormatExpression.IsMultiline = False + Me.ucrInputFormatExpression.IsReadOnly = False + Me.ucrInputFormatExpression.Location = New System.Drawing.Point(123, 8) + Me.ucrInputFormatExpression.Name = "ucrInputFormatExpression" + Me.ucrInputFormatExpression.Size = New System.Drawing.Size(137, 21) + Me.ucrInputFormatExpression.TabIndex = 338 + ' + 'rdoCustom + ' + Me.rdoCustom.AutoSize = True + Me.rdoCustom.Location = New System.Drawing.Point(6, 8) + Me.rdoCustom.Name = "rdoCustom" + Me.rdoCustom.Size = New System.Drawing.Size(95, 17) + Me.rdoCustom.TabIndex = 337 + Me.rdoCustom.TabStop = True + Me.rdoCustom.Text = "Custom Format" + Me.rdoCustom.UseVisualStyleBackColor = True + ' + 'rdoUnits + ' + Me.rdoUnits.AutoSize = True + Me.rdoUnits.Location = New System.Drawing.Point(6, 42) + Me.rdoUnits.Name = "rdoUnits" + Me.rdoUnits.Size = New System.Drawing.Size(64, 17) + Me.rdoUnits.TabIndex = 336 + Me.rdoUnits.TabStop = True + Me.rdoUnits.Text = "As Units" + Me.rdoUnits.UseVisualStyleBackColor = True + ' + 'ucrCellFormatEmail + ' + Me.ucrCellFormatEmail.Location = New System.Drawing.Point(123, 76) + Me.ucrCellFormatEmail.Name = "ucrCellFormatEmail" + Me.ucrCellFormatEmail.Size = New System.Drawing.Size(190, 154) + Me.ucrCellFormatEmail.TabIndex = 340 + ' + 'ucrSdgBaseButtons + ' + Me.ucrSdgBaseButtons.AutoSize = True + Me.ucrSdgBaseButtons.Location = New System.Drawing.Point(52, 237) + Me.ucrSdgBaseButtons.Margin = New System.Windows.Forms.Padding(4) + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" + Me.ucrSdgBaseButtons.Size = New System.Drawing.Size(224, 30) + Me.ucrSdgBaseButtons.TabIndex = 341 + ' + 'sdgCellFormatTextOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(341, 271) + Me.Controls.Add(Me.ucrSdgBaseButtons) + Me.Controls.Add(Me.rdoEmail) + Me.Controls.Add(Me.ucrInputFormatExpression) + Me.Controls.Add(Me.rdoCustom) + Me.Controls.Add(Me.rdoUnits) + Me.Controls.Add(Me.ucrCellFormatEmail) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "sdgCellFormatTextOptions" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Cell Text Format Options" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents rdoEmail As RadioButton + Friend WithEvents ucrInputFormatExpression As ucrInputTextBox + Friend WithEvents rdoCustom As RadioButton + Friend WithEvents rdoUnits As RadioButton + Friend WithEvents ucrCellFormatEmail As ucrCellFormatEmail + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue +End Class diff --git a/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.resx b/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.vb b/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.vb new file mode 100644 index 00000000000..01ad42ce4a1 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Text/sdgCellFormatTextOptions.vb @@ -0,0 +1,76 @@ +Imports instat.Translations +Public Class sdgCellFormatTextOptions + Private clsUnitsFormatRFunction, clsCustomFormatRFunction As New RFunction + Private bFirstload As Boolean = True + Private bUserMadeChanges As Boolean = False + Private bUserClickedReturn As Boolean = False + + + Private Sub sdgCellFormatTextOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + SetDefaults() + + bUserMadeChanges = False + bUserClickedReturn = False + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + rdoCustom.Checked = True + ucrCellFormatEmail.Enabled = False + End Sub + + Private Sub SetDefaults() + clsUnitsFormatRFunction = New RFunction + clsCustomFormatRFunction = New RFunction + + clsCustomFormatRFunction.SetPackageName("gt") + clsCustomFormatRFunction.SetRCommand("fmt") + + + clsUnitsFormatRFunction.SetPackageName("gt") + clsUnitsFormatRFunction.SetRCommand("fmt_units") + + + ucrInputFormatExpression.SetName("") + End Sub + + Public Function GetNewUserInputAsRFunction() As RFunction + If Not bUserClickedReturn OrElse Not bUserMadeChanges Then + Return Nothing + End If + + If rdoUnits.Checked Then + Return clsUnitsFormatRFunction + ElseIf rdoCustom.Checked AndAlso Not ucrInputFormatExpression.IsEmpty Then + Return clsCustomFormatRFunction + End If + + Return Nothing + End Function + + Private Sub radioButtons_CheckedChanged(sender As Object, e As EventArgs) Handles rdoCustom.CheckedChanged, rdoUnits.CheckedChanged, rdoEmail.CheckedChanged + ucrInputFormatExpression.Visible = rdoCustom.Checked + ucrCellFormatEmail.Visible = rdoEmail.Checked + bUserMadeChanges = True + End Sub + + Private Sub ucrInputFormatExpression_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputFormatExpression.ControlValueChanged + If ucrInputFormatExpression.IsEmpty Then + clsCustomFormatRFunction.ClearParameters() + Else + clsCustomFormatRFunction.AddParameter(strParameterName:="fns", strParameterValue:="function(x){ " & ucrInputFormatExpression.GetText() & " }") + End If + + bUserMadeChanges = True + + End Sub + + Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn + bUserClickedReturn = True + End Sub +End Class \ No newline at end of file diff --git a/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.Designer.vb b/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.Designer.vb new file mode 100644 index 00000000000..469ef8d0ae2 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.Designer.vb @@ -0,0 +1,115 @@ + _ +Partial Class ucrCellFormatEmail + 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.ucrCboColors = New instat.ucrColors() + Me.lblColor = New System.Windows.Forms.Label() + Me.ucrChkShowUnderline = New instat.ucrCheck() + Me.ucrChkAsButton = New instat.ucrCheck() + Me.ucrReceiverSingleDisplayName = New instat.ucrReceiverSingle() + Me.Label1 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'ucrCboColors + ' + Me.ucrCboColors.AddQuotesIfUnrecognised = True + Me.ucrCboColors.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboColors.GetSetSelectedIndex = -1 + Me.ucrCboColors.IsReadOnly = False + Me.ucrCboColors.Location = New System.Drawing.Point(9, 129) + Me.ucrCboColors.Name = "ucrCboColors" + Me.ucrCboColors.Size = New System.Drawing.Size(137, 21) + Me.ucrCboColors.TabIndex = 1 + ' + 'lblColor + ' + Me.lblColor.AutoSize = True + Me.lblColor.Location = New System.Drawing.Point(6, 113) + Me.lblColor.Name = "lblColor" + Me.lblColor.Size = New System.Drawing.Size(34, 13) + Me.lblColor.TabIndex = 2 + Me.lblColor.Text = "Color:" + ' + 'ucrChkShowUnderline + ' + Me.ucrChkShowUnderline.AutoSize = True + Me.ucrChkShowUnderline.Checked = False + Me.ucrChkShowUnderline.Location = New System.Drawing.Point(6, 80) + Me.ucrChkShowUnderline.Name = "ucrChkShowUnderline" + Me.ucrChkShowUnderline.Size = New System.Drawing.Size(189, 23) + Me.ucrChkShowUnderline.TabIndex = 3 + ' + 'ucrChkAsButton + ' + Me.ucrChkAsButton.AutoSize = True + Me.ucrChkAsButton.Checked = False + Me.ucrChkAsButton.Location = New System.Drawing.Point(6, 47) + Me.ucrChkAsButton.Name = "ucrChkAsButton" + Me.ucrChkAsButton.Size = New System.Drawing.Size(189, 23) + Me.ucrChkAsButton.TabIndex = 4 + ' + 'ucrReceiverSingleDisplayName + ' + Me.ucrReceiverSingleDisplayName.AutoSize = True + Me.ucrReceiverSingleDisplayName.frmParent = Nothing + Me.ucrReceiverSingleDisplayName.Location = New System.Drawing.Point(10, 19) + Me.ucrReceiverSingleDisplayName.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSingleDisplayName.Name = "ucrReceiverSingleDisplayName" + Me.ucrReceiverSingleDisplayName.Selector = Nothing + Me.ucrReceiverSingleDisplayName.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverSingleDisplayName.strNcFilePath = "" + Me.ucrReceiverSingleDisplayName.TabIndex = 5 + Me.ucrReceiverSingleDisplayName.ucrSelector = Nothing + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(7, 5) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(74, 13) + Me.Label1.TabIndex = 6 + Me.Label1.Text = "Link Email To:" + ' + 'ucrCellFormatEmail + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.ucrReceiverSingleDisplayName) + Me.Controls.Add(Me.ucrChkAsButton) + Me.Controls.Add(Me.ucrChkShowUnderline) + Me.Controls.Add(Me.lblColor) + Me.Controls.Add(Me.ucrCboColors) + Me.Name = "ucrCellFormatEmail" + Me.Size = New System.Drawing.Size(205, 154) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents ucrCboColors As ucrColors + Friend WithEvents lblColor As Label + Friend WithEvents ucrChkShowUnderline As ucrCheck + Friend WithEvents ucrChkAsButton As ucrCheck + Friend WithEvents ucrReceiverSingleDisplayName As ucrReceiverSingle + Friend WithEvents Label1 As Label +End Class diff --git a/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.resx b/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Cells/Formats/Text/ucrCellFormatEmail.vb b/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.vb new file mode 100644 index 00000000000..d0f15fc038e --- /dev/null +++ b/instat/UserTables/Cells/Formats/Text/ucrCellFormatEmail.vb @@ -0,0 +1,36 @@ +Public Class ucrCellFormatEmail + + Private clsFormatEmailRFunction, clsFromColumnRFunction As New RFunction + Private bFirstload As Boolean = True + + Private Sub InitialiseControl() + ucrReceiverSingleDisplayName.SetParameter(New RParameter("display_name", 0)) + ucrReceiverSingleDisplayName.SetParameterIsString() + + + ucrChkAsButton.SetText("Display As Button") + ucrChkAsButton.SetParameter(New RParameter("as_button", 5)) + ucrChkAsButton.SetRDefault("FALSE") + + ucrChkShowUnderline.SetText("Show underline") + End Sub + + Public Sub Setup() + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + + + clsFormatEmailRFunction = New RFunction + clsFormatEmailRFunction.SetRCommand("fmt_email") + 'TODO. This gt function is documented in https://gt.rstudio.com/reference/fmt_email.html but RStudio could not find the function. + ' Implement later. + + clsFromColumnRFunction = New RFunction + clsFromColumnRFunction.SetRCommand("from_column") + + End Sub + + +End Class diff --git a/instat/UserTables/Cells/Formats/ucrCellFormats.Designer.vb b/instat/UserTables/Cells/Formats/ucrCellFormats.Designer.vb new file mode 100644 index 00000000000..50da2a9ebce --- /dev/null +++ b/instat/UserTables/Cells/Formats/ucrCellFormats.Designer.vb @@ -0,0 +1,219 @@ + _ +Partial Class ucrCellFormats + 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.lblFormats = New System.Windows.Forms.Label() + Me.btnClearFormats = New System.Windows.Forms.Button() + Me.btnEnterFormat = New System.Windows.Forms.Button() + Me.dataGridFormats = New System.Windows.Forms.DataGridView() + Me.lblColumns = New System.Windows.Forms.Label() + Me.cboSelectFormat = New System.Windows.Forms.ComboBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrRowExpression = New instat.ucrRowExpression() + Me.Label1 = New System.Windows.Forms.Label() + Me.colCodnition = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colLabel = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colRow = New System.Windows.Forms.DataGridViewTextBoxColumn() + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblFormats + ' + Me.lblFormats.AutoSize = True + Me.lblFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFormats.Location = New System.Drawing.Point(231, 220) + Me.lblFormats.Name = "lblFormats" + Me.lblFormats.Size = New System.Drawing.Size(47, 13) + Me.lblFormats.TabIndex = 312 + Me.lblFormats.Text = "Formats:" + ' + 'btnClearFormats + ' + Me.btnClearFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearFormats.Location = New System.Drawing.Point(515, 211) + Me.btnClearFormats.Name = "btnClearFormats" + Me.btnClearFormats.Size = New System.Drawing.Size(75, 23) + Me.btnClearFormats.TabIndex = 311 + Me.btnClearFormats.Tag = "" + Me.btnClearFormats.Text = "Clear" + Me.btnClearFormats.UseVisualStyleBackColor = True + ' + 'btnEnterFormat + ' + Me.btnEnterFormat.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnEnterFormat.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnEnterFormat.Location = New System.Drawing.Point(234, 188) + Me.btnEnterFormat.Name = "btnEnterFormat" + Me.btnEnterFormat.Size = New System.Drawing.Size(126, 23) + Me.btnEnterFormat.TabIndex = 309 + Me.btnEnterFormat.Tag = "" + Me.btnEnterFormat.Text = "Enter Format" + Me.btnEnterFormat.UseVisualStyleBackColor = True + ' + 'dataGridFormats + ' + Me.dataGridFormats.AllowUserToAddRows = False + Me.dataGridFormats.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridFormats.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colCodnition, Me.colLabel, Me.colRow}) + Me.dataGridFormats.Location = New System.Drawing.Point(234, 237) + Me.dataGridFormats.Name = "dataGridFormats" + Me.dataGridFormats.ReadOnly = True + Me.dataGridFormats.RowHeadersWidth = 62 + Me.dataGridFormats.Size = New System.Drawing.Size(361, 73) + Me.dataGridFormats.TabIndex = 307 + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(237, 60) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(56, 13) + Me.lblColumns.TabIndex = 310 + Me.lblColumns.Text = "Column(s):" + ' + 'cboSelectFormat + ' + Me.cboSelectFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cboSelectFormat.FormattingEnabled = True + Me.cboSelectFormat.Items.AddRange(New Object() {"Text", "Number", "Date"}) + Me.cboSelectFormat.Location = New System.Drawing.Point(234, 33) + Me.cboSelectFormat.Name = "cboSelectFormat" + Me.cboSelectFormat.Size = New System.Drawing.Size(132, 21) + Me.cboSelectFormat.TabIndex = 321 + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.Label2.Location = New System.Drawing.Point(231, 17) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(75, 13) + Me.Label2.TabIndex = 322 + Me.Label2.Text = "Select Format:" + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(234, 76) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(132, 55) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 317 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(4, 6) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 308 + ' + 'ucrRowExpression + ' + Me.ucrRowExpression.Location = New System.Drawing.Point(234, 158) + Me.ucrRowExpression.Name = "ucrRowExpression" + Me.ucrRowExpression.Size = New System.Drawing.Size(132, 25) + Me.ucrRowExpression.TabIndex = 334 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.Label1.Location = New System.Drawing.Point(236, 142) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(134, 13) + Me.Label1.TabIndex = 333 + Me.Label1.Text = "Row Expression (Optional):" + ' + 'colCodnition + ' + Me.colCodnition.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells + Me.colCodnition.HeaderText = "Format" + Me.colCodnition.MinimumWidth = 8 + Me.colCodnition.Name = "colCodnition" + Me.colCodnition.ReadOnly = True + Me.colCodnition.Width = 64 + ' + 'colLabel + ' + Me.colLabel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells + Me.colLabel.HeaderText = "Column(s)" + Me.colLabel.MinimumWidth = 8 + Me.colLabel.Name = "colLabel" + Me.colLabel.ReadOnly = True + Me.colLabel.Width = 78 + ' + 'colRow + ' + Me.colRow.HeaderText = "Row Expression" + Me.colRow.Name = "colRow" + Me.colRow.ReadOnly = True + ' + 'ucrCellFormats + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrRowExpression) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.cboSelectFormat) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.lblFormats) + Me.Controls.Add(Me.btnClearFormats) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.btnEnterFormat) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.dataGridFormats) + Me.Name = "ucrCellFormats" + Me.Size = New System.Drawing.Size(602, 312) + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents lblFormats As Label + Friend WithEvents btnClearFormats As Button + Friend WithEvents btnEnterFormat As Button + Friend WithEvents dataGridFormats As DataGridView + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents lblColumns As Label + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents cboSelectFormat As ComboBox + Friend WithEvents Label2 As Label + Friend WithEvents ucrRowExpression As ucrRowExpression + Friend WithEvents Label1 As Label + Friend WithEvents colCodnition As DataGridViewTextBoxColumn + Friend WithEvents colLabel As DataGridViewTextBoxColumn + Friend WithEvents colRow As DataGridViewTextBoxColumn +End Class diff --git a/instat/UserTables/Cells/Formats/ucrCellFormats.resx b/instat/UserTables/Cells/Formats/ucrCellFormats.resx new file mode 100644 index 00000000000..df1d8e46938 --- /dev/null +++ b/instat/UserTables/Cells/Formats/ucrCellFormats.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Cells/Formats/ucrCellFormats.vb b/instat/UserTables/Cells/Formats/ucrCellFormats.vb new file mode 100644 index 00000000000..8a1ecd9ed70 --- /dev/null +++ b/instat/UserTables/Cells/Formats/ucrCellFormats.vb @@ -0,0 +1,146 @@ +Public Class ucrCellFormats + + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + + Private Sub InitialiseControl() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetMeAsReceiver() + + cboSelectFormat.SelectedIndex = 0 + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ' Set up the selector + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + ucrReceiverMultipleCols.SetMeAsReceiver() + ucrRowExpression.Setup(strDataFrameName) + + ' Clear and Set up the data grid with contents + dataGridFormats.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRCommand({"fmt", "fmt_units", "fmt_number", "fmt_currency"}, clsOperator)) + + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter)) + + For Each clsRParam As RParameter In lstRParams + + Dim clsFormatRFunction As RFunction = clsRParam.clsArgumentCodeStructure + + ' Create a new row that represents the tab_row_group() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + + ' Set the function name + row.Cells(0).Value = clsFormatRFunction.strRCommand + + For Each clsRowGroupRParam As RParameter In clsFormatRFunction.clsParameters + If clsRowGroupRParam.strArgumentName = "columns" Then + row.Cells(1).Value = clsTablesUtils.GetStringValue(clsRowGroupRParam.strArgumentValue, False) + ElseIf clsRowGroupRParam.strArgumentName = "rows" Then + row.Cells(2).Value = clsTablesUtils.GetStringValue(clsRowGroupRParam.strArgumentValue, False) + End If + Next + + ' Tag and add the tab_row_group() parameter function contents as a row + row.Tag = clsRParam + dataGridFormats.Rows.Add(row) + + Next + End Sub + + Private Sub ucrReceiverMultipleCols_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + btnEnterFormat.Enabled = Not ucrReceiverMultipleCols.IsEmpty + End Sub + + Private Sub btnEnter_Click(sender As Object, e As EventArgs) Handles btnEnterFormat.Click + Dim clsFormatRFunction As RFunction = Nothing + If cboSelectFormat.Text = "Text" Then + sdgCellFormatTextOptions.ShowDialog(Me.ParentForm) + clsFormatRFunction = sdgCellFormatTextOptions.GetNewUserInputAsRFunction() + ElseIf cboSelectFormat.Text = "Number" Then + sdgCellFormatNumberOptions.ShowDialog(Me.ParentForm) + clsFormatRFunction = sdgCellFormatNumberOptions.GetNewUserInputAsRFunction() + ElseIf cboSelectFormat.Text = "Date" Then + sdgCellFormatDateOptions.ShowDialog(Me.ParentForm) + clsFormatRFunction = sdgCellFormatDateOptions.GetNewUserInputAsRFunction() + ElseIf cboSelectFormat.Text = "Missing" Then + ' TODO + End If + + If clsFormatRFunction Is Nothing Then + Exit Sub + End If + + AddFormatParameterToGrid(clsFormatRFunction) + ucrReceiverMultipleCols.Clear() + ucrRowExpression.Clear() + + End Sub + + + Private Sub AddFormatParameterToGrid(clsFormatRFunction As RFunction) + + Dim strColumnsExpression As String = ucrReceiverMultipleCols.GetVariableNames(bWithQuotes:=False) + Dim strRowsExpression As String = ucrRowExpression.GetText + + ' Add columns parameter + clsFormatRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=strColumnsExpression, iNewPosition:=0)) + + ' Add rows as paramater if present + If Not ucrRowExpression.IsEmpty Then + clsFormatRFunction.AddParameter(New RParameter(strParameterName:="rows", strParamValue:=strRowsExpression, iNewPosition:=1)) + End If + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="fmt_param" & (dataGridFormats.Rows.Count + 1), strParamValue:=clsFormatRFunction, bNewIncludeArgumentName:=False) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsFormatRFunction.strRCommand + row.Cells(1).Value = strColumnsExpression + row.Cells(2).Value = strRowsExpression + + + ' Tag the row with the parameter + row.Tag = clsRParam + + ' Add it to grid + dataGridFormats.Rows.Add(row) + + End Sub + + Private Sub btnClearFormats_Click(sender As Object, e As EventArgs) Handles btnClearFormats.Click + dataGridFormats.Rows.Clear() + End Sub + + Private Sub cboSelectFormat_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboSelectFormat.TextChanged + If cboSelectFormat.Text = "Text" OrElse cboSelectFormat.Text = "Missing" Then + 'ucrReceiverMultipleCols.SetIncludedDataTypes({}) + ucrReceiverMultipleCols.strSelectorHeading = "Select Columns" + ElseIf cboSelectFormat.Text = "Number" Then + 'ucrReceiverMultipleCols.SetIncludedDataTypes({"numeric"}) + ucrReceiverMultipleCols.strSelectorHeading = "Select Numerics" + ElseIf cboSelectFormat.Text = "Date" Then + 'ucrReceiverMultipleCols.SetIncludedDataTypes({"date"}) + ucrReceiverMultipleCols.strSelectorHeading = "Select Dates" + End If + + ucrReceiverMultipleCols.SetMeAsReceiver() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRFunctionsParamsWithRCommand({"fmt", "fmt_units", "fmt_number", "fmt_currency"}, clsOperator) + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGridFormats, clsOperator) + End Sub +End Class diff --git a/instat/UserTables/Cells/Styles/ucrCellStyles.Designer.vb b/instat/UserTables/Cells/Styles/ucrCellStyles.Designer.vb new file mode 100644 index 00000000000..90378b40f8c --- /dev/null +++ b/instat/UserTables/Cells/Styles/ucrCellStyles.Designer.vb @@ -0,0 +1,180 @@ + _ +Partial Class ucrCellStyles + 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.lblRowExpression = New System.Windows.Forms.Label() + Me.lblFormats = New System.Windows.Forms.Label() + Me.btnClearFormats = New System.Windows.Forms.Button() + Me.dataGridFormats = New System.Windows.Forms.DataGridView() + Me.colStyles = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.btnEnterStyle = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.ucrRowExpression = New instat.ucrRowExpression() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblRowExpression + ' + Me.lblRowExpression.AutoSize = True + Me.lblRowExpression.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblRowExpression.Location = New System.Drawing.Point(368, 132) + Me.lblRowExpression.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblRowExpression.Name = "lblRowExpression" + Me.lblRowExpression.Size = New System.Drawing.Size(200, 20) + Me.lblRowExpression.TabIndex = 329 + Me.lblRowExpression.Text = "Row Expression (Optional):" + ' + 'lblFormats + ' + Me.lblFormats.AutoSize = True + Me.lblFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFormats.Location = New System.Drawing.Point(354, 255) + Me.lblFormats.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblFormats.Name = "lblFormats" + Me.lblFormats.Size = New System.Drawing.Size(56, 20) + Me.lblFormats.TabIndex = 326 + Me.lblFormats.Text = "Styles:" + ' + 'btnClearFormats + ' + Me.btnClearFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearFormats.Location = New System.Drawing.Point(712, 242) + Me.btnClearFormats.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnClearFormats.Name = "btnClearFormats" + Me.btnClearFormats.Size = New System.Drawing.Size(112, 35) + Me.btnClearFormats.TabIndex = 5 + Me.btnClearFormats.Tag = "" + Me.btnClearFormats.Text = "Clear" + Me.btnClearFormats.UseVisualStyleBackColor = True + ' + 'dataGridFormats + ' + Me.dataGridFormats.AllowUserToAddRows = False + Me.dataGridFormats.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridFormats.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colStyles}) + Me.dataGridFormats.Location = New System.Drawing.Point(358, 282) + Me.dataGridFormats.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.dataGridFormats.Name = "dataGridFormats" + Me.dataGridFormats.RowHeadersWidth = 62 + Me.dataGridFormats.Size = New System.Drawing.Size(472, 112) + Me.dataGridFormats.TabIndex = 6 + ' + 'colStyles + ' + Me.colStyles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colStyles.HeaderText = "Style Expressions" + Me.colStyles.MinimumWidth = 8 + Me.colStyles.Name = "colStyles" + ' + 'btnEnterStyle + ' + Me.btnEnterStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnEnterStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnEnterStyle.Location = New System.Drawing.Point(366, 209) + Me.btnEnterStyle.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnEnterStyle.Name = "btnEnterStyle" + Me.btnEnterStyle.Size = New System.Drawing.Size(189, 35) + Me.btnEnterStyle.TabIndex = 4 + Me.btnEnterStyle.Tag = "" + Me.btnEnterStyle.Text = "Enter Style" + Me.btnEnterStyle.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.Label1.Location = New System.Drawing.Point(369, 11) + Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(85, 20) + Me.Label1.TabIndex = 331 + Me.Label1.Text = "Column(s):" + ' + 'ucrRowExpression + ' + Me.ucrRowExpression.Location = New System.Drawing.Point(366, 158) + Me.ucrRowExpression.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrRowExpression.Name = "ucrRowExpression" + Me.ucrRowExpression.Size = New System.Drawing.Size(186, 38) + Me.ucrRowExpression.TabIndex = 332 + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(366, 35) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(180, 85) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 2 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(10, 11) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(320, 282) + Me.ucrSelectorCols.TabIndex = 1 + ' + 'ucrCellStyles + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrRowExpression) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.lblRowExpression) + Me.Controls.Add(Me.lblFormats) + Me.Controls.Add(Me.btnClearFormats) + Me.Controls.Add(Me.btnEnterStyle) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.dataGridFormats) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "ucrCellStyles" + Me.Size = New System.Drawing.Size(836, 398) + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents lblRowExpression As Label + Friend WithEvents lblFormats As Label + Friend WithEvents btnClearFormats As Button + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents dataGridFormats As DataGridView + Friend WithEvents btnEnterStyle As Button + Friend WithEvents colStyles As DataGridViewTextBoxColumn + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents Label1 As Label + Friend WithEvents ucrRowExpression As ucrRowExpression +End Class diff --git a/instat/UserTables/Cells/Styles/ucrCellStyles.resx b/instat/UserTables/Cells/Styles/ucrCellStyles.resx new file mode 100644 index 00000000000..d937ee32b35 --- /dev/null +++ b/instat/UserTables/Cells/Styles/ucrCellStyles.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Cells/Styles/ucrCellStyles.vb b/instat/UserTables/Cells/Styles/ucrCellStyles.vb new file mode 100644 index 00000000000..08a22c9f5c6 --- /dev/null +++ b/instat/UserTables/Cells/Styles/ucrCellStyles.vb @@ -0,0 +1,88 @@ +Public Class ucrCellStyles + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub ucrCellStyles_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + End Sub + + Private Sub InitialiseControl() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ' Set up the selector + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + ucrRowExpression.Setup(strDataFrameName) + + ' Clear and Set up the data grid with contents + dataGridFormats.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_body", clsOperator)) + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the tab_style() parameter function contents as a row + row.Tag = clsRParam + dataGridFormats.Rows.Add(row) + Next + End Sub + + Private Sub ucrInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + btnEnterStyle.Enabled = Not ucrReceiverMultipleCols.IsEmpty + End Sub + + Private Sub btnEnterStyle_Click(sender As Object, e As EventArgs) Handles btnEnterStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_body") + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=ucrReceiverMultipleCols.GetVariableNames(bWithQuotes:=False), iNewPosition:=0)) + If Not ucrRowExpression.IsEmpty Then + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="rows", strParamValue:=ucrRowExpression.GetText(), iNewPosition:=1)) + End If + + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsTabStyleRFunction.Clone.ToScript + + ' Create parameter with unique name and tag the row with the parameter + row.Tag = New RParameter(strParameterName:="tab_style_cells_body_param" & (dataGridFormats.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + + ' Add it to grid + dataGridFormats.Rows.Add(row) + End Sub + + Private Sub btnClearFormats_Click(sender As Object, e As EventArgs) Handles btnClearFormats.Click + dataGridFormats.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_body", clsOperator), clsOperator) + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGridFormats, clsOperator) + End Sub + +End Class diff --git a/instat/UserTables/Cells/ucrCells.Designer.vb b/instat/UserTables/Cells/ucrCells.Designer.vb new file mode 100644 index 00000000000..2fb0f5c89d5 --- /dev/null +++ b/instat/UserTables/Cells/ucrCells.Designer.vb @@ -0,0 +1,147 @@ + +Partial Class ucrCells + 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.rdoStyles = New System.Windows.Forms.RadioButton() + Me.rdoFormat = New System.Windows.Forms.RadioButton() + Me.rdoFootNotes = New System.Windows.Forms.RadioButton() + Me.ucrCellsFootNotes = New instat.ucrCellsFootNotes() + Me.ucrCellFormats = New instat.ucrCellFormats() + Me.ucrPnlCells = New instat.UcrPanel() + Me.ucrCellStyles = New instat.ucrCellStyles() + Me.SuspendLayout() + ' + 'rdoStyles + ' + Me.rdoStyles.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoStyles.BackColor = System.Drawing.SystemColors.Control + Me.rdoStyles.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoStyles.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoStyles.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoStyles.FlatAppearance.BorderSize = 2 + Me.rdoStyles.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoStyles.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoStyles.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoStyles.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoStyles.Location = New System.Drawing.Point(279, 3) + Me.rdoStyles.Name = "rdoStyles" + Me.rdoStyles.Size = New System.Drawing.Size(91, 29) + Me.rdoStyles.TabIndex = 292 + Me.rdoStyles.Text = "Styles" + Me.rdoStyles.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoStyles.UseVisualStyleBackColor = True + ' + 'rdoFormat + ' + Me.rdoFormat.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoFormat.BackColor = System.Drawing.SystemColors.Control + Me.rdoFormat.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoFormat.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoFormat.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFormat.FlatAppearance.BorderSize = 2 + Me.rdoFormat.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFormat.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoFormat.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoFormat.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoFormat.Location = New System.Drawing.Point(102, 3) + Me.rdoFormat.Name = "rdoFormat" + Me.rdoFormat.Size = New System.Drawing.Size(91, 29) + Me.rdoFormat.TabIndex = 290 + Me.rdoFormat.Text = "Formats" + Me.rdoFormat.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoFormat.UseVisualStyleBackColor = True + ' + 'rdoFootNotes + ' + Me.rdoFootNotes.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoFootNotes.BackColor = System.Drawing.SystemColors.Control + Me.rdoFootNotes.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoFootNotes.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoFootNotes.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFootNotes.FlatAppearance.BorderSize = 2 + Me.rdoFootNotes.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFootNotes.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoFootNotes.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoFootNotes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoFootNotes.Location = New System.Drawing.Point(191, 3) + Me.rdoFootNotes.Name = "rdoFootNotes" + Me.rdoFootNotes.Size = New System.Drawing.Size(91, 29) + Me.rdoFootNotes.TabIndex = 291 + Me.rdoFootNotes.Text = "Footer Notes" + Me.rdoFootNotes.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoFootNotes.UseVisualStyleBackColor = True + ' + 'ucrCellsFootNotes + ' + Me.ucrCellsFootNotes.Location = New System.Drawing.Point(7, 38) + Me.ucrCellsFootNotes.Name = "ucrCellsFootNotes" + Me.ucrCellsFootNotes.Size = New System.Drawing.Size(604, 318) + Me.ucrCellsFootNotes.TabIndex = 294 + ' + 'ucrCellFormats + ' + Me.ucrCellFormats.Location = New System.Drawing.Point(7, 37) + Me.ucrCellFormats.Name = "ucrCellFormats" + Me.ucrCellFormats.Size = New System.Drawing.Size(604, 319) + Me.ucrCellFormats.TabIndex = 293 + ' + 'ucrPnlCells + ' + Me.ucrPnlCells.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlCells.Location = New System.Drawing.Point(85, 3) + Me.ucrPnlCells.Name = "ucrPnlCells" + Me.ucrPnlCells.Size = New System.Drawing.Size(309, 29) + Me.ucrPnlCells.TabIndex = 289 + ' + 'ucrCellStyles + ' + Me.ucrCellStyles.Location = New System.Drawing.Point(7, 56) + Me.ucrCellStyles.Name = "ucrCellStyles" + Me.ucrCellStyles.Size = New System.Drawing.Size(609, 264) + Me.ucrCellStyles.TabIndex = 295 + ' + 'ucrCells + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrCellsFootNotes) + Me.Controls.Add(Me.ucrCellStyles) + Me.Controls.Add(Me.ucrCellFormats) + Me.Controls.Add(Me.rdoStyles) + Me.Controls.Add(Me.rdoFormat) + Me.Controls.Add(Me.rdoFootNotes) + Me.Controls.Add(Me.ucrPnlCells) + Me.Name = "ucrCells" + Me.Size = New System.Drawing.Size(629, 362) + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents rdoStyles As RadioButton + Friend WithEvents rdoFormat As RadioButton + Friend WithEvents rdoFootNotes As RadioButton + Friend WithEvents ucrPnlCells As UcrPanel + Friend WithEvents ucrCellFormats As ucrCellFormats + Friend WithEvents ucrCellsFootNotes As ucrCellsFootNotes + Friend WithEvents ucrCellStyles As ucrCellStyles +End Class diff --git a/instat/UserTables/Cells/ucrCells.resx b/instat/UserTables/Cells/ucrCells.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Cells/ucrCells.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Cells/ucrCells.vb b/instat/UserTables/Cells/ucrCells.vb new file mode 100644 index 00000000000..9a367caef91 --- /dev/null +++ b/instat/UserTables/Cells/ucrCells.vb @@ -0,0 +1,35 @@ +Public Class ucrCells + + Private bFirstload As Boolean = True + Private Sub InitialiseDialog() + ucrPnlCells.AddRadioButton(rdoFormat) + ucrPnlCells.AddRadioButton(rdoFootNotes) + ucrPnlCells.AddRadioButton(rdoStyles) + rdoFormat.Checked = True + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + ucrCellFormats.Setup(strDataFrameName, clsOperator) + ucrCellsFootNotes.Setup(strDataFrameName, clsOperator) + ucrCellStyles.Setup(strDataFrameName, clsOperator) + + End Sub + + Private Sub ucrPnlRows_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCells.ControlValueChanged + ucrCellFormats.Visible = rdoFormat.Checked + ucrCellsFootNotes.Visible = rdoFootNotes.Checked + ucrCellStyles.Visible = rdoStyles.Checked + End Sub + + Public Sub SetValuesToOperator() + ucrCellFormats.SetValuesToOperator() + ucrCellsFootNotes.SetValuesToOperator() + ucrCellStyles.SetValuesToOperator() + End Sub + +End Class diff --git a/instat/UserTables/Columns/ucrColumnFootNote.Designer.vb b/instat/UserTables/Columns/ucrColumnFootNote.Designer.vb new file mode 100644 index 00000000000..366a55af019 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnFootNote.Designer.vb @@ -0,0 +1,176 @@ + _ +Partial Class ucrColumnFootNote + 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.lblFooteNotes = New System.Windows.Forms.Label() + Me.btnClear = New System.Windows.Forms.Button() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.dataGrid = New System.Windows.Forms.DataGridView() + Me.colStyles = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.lblFootNote = New System.Windows.Forms.Label() + Me.ucrTxtFootNote = New instat.ucrInputTextBox() + Me.btnAdd = New System.Windows.Forms.Button() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.Label1 = New System.Windows.Forms.Label() + CType(Me.dataGrid, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblFooteNotes + ' + Me.lblFooteNotes.AutoSize = True + Me.lblFooteNotes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFooteNotes.Location = New System.Drawing.Point(231, 196) + Me.lblFooteNotes.Name = "lblFooteNotes" + Me.lblFooteNotes.Size = New System.Drawing.Size(62, 13) + Me.lblFooteNotes.TabIndex = 347 + Me.lblFooteNotes.Text = "Foot Notes:" + ' + 'btnClear + ' + Me.btnClear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClear.Location = New System.Drawing.Point(515, 188) + Me.btnClear.Name = "btnClear" + Me.btnClear.Size = New System.Drawing.Size(75, 23) + Me.btnClear.TabIndex = 346 + Me.btnClear.Tag = "" + Me.btnClear.Text = "Clear" + Me.btnClear.UseVisualStyleBackColor = True + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(4, 4) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 343 + ' + 'dataGrid + ' + Me.dataGrid.AllowUserToAddRows = False + Me.dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGrid.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colStyles}) + Me.dataGrid.Location = New System.Drawing.Point(234, 213) + Me.dataGrid.Name = "dataGrid" + Me.dataGrid.RowHeadersWidth = 62 + Me.dataGrid.Size = New System.Drawing.Size(361, 73) + Me.dataGrid.TabIndex = 342 + ' + 'colStyles + ' + Me.colStyles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colStyles.HeaderText = "Foot Note Expressions" + Me.colStyles.MinimumWidth = 8 + Me.colStyles.Name = "colStyles" + ' + 'lblFootNote + ' + Me.lblFootNote.AutoSize = True + Me.lblFootNote.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFootNote.Location = New System.Drawing.Point(241, 118) + Me.lblFootNote.Name = "lblFootNote" + Me.lblFootNote.Size = New System.Drawing.Size(81, 13) + Me.lblFootNote.TabIndex = 352 + Me.lblFootNote.Text = "Foot Note Text:" + ' + 'ucrTxtFootNote + ' + Me.ucrTxtFootNote.AddQuotesIfUnrecognised = True + Me.ucrTxtFootNote.AutoSize = True + Me.ucrTxtFootNote.IsMultiline = False + Me.ucrTxtFootNote.IsReadOnly = False + Me.ucrTxtFootNote.Location = New System.Drawing.Point(239, 134) + Me.ucrTxtFootNote.Name = "ucrTxtFootNote" + Me.ucrTxtFootNote.Size = New System.Drawing.Size(305, 21) + Me.ucrTxtFootNote.TabIndex = 351 + ' + 'btnAdd + ' + Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAdd.Location = New System.Drawing.Point(239, 162) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(83, 23) + Me.btnAdd.TabIndex = 344 + Me.btnAdd.Tag = "" + Me.btnAdd.Text = "Add" + Me.btnAdd.UseVisualStyleBackColor = True + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(239, 24) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(120, 80) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 353 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.Label1.Location = New System.Drawing.Point(242, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(56, 13) + Me.Label1.TabIndex = 354 + Me.Label1.Text = "Column(s):" + ' + 'ucrColumnFootNote + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.lblFooteNotes) + Me.Controls.Add(Me.btnClear) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.dataGrid) + Me.Controls.Add(Me.lblFootNote) + Me.Controls.Add(Me.ucrTxtFootNote) + Me.Controls.Add(Me.btnAdd) + Me.Name = "ucrColumnFootNote" + Me.Size = New System.Drawing.Size(600, 289) + CType(Me.dataGrid, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents lblFooteNotes As Label + Friend WithEvents btnClear As Button + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents dataGrid As DataGridView + Friend WithEvents colStyles As DataGridViewTextBoxColumn + Friend WithEvents lblFootNote As Label + Friend WithEvents ucrTxtFootNote As ucrInputTextBox + Friend WithEvents btnAdd As Button + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents Label1 As Label +End Class diff --git a/instat/UserTables/Columns/ucrColumnFootNote.resx b/instat/UserTables/Columns/ucrColumnFootNote.resx new file mode 100644 index 00000000000..d937ee32b35 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnFootNote.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Columns/ucrColumnFootNote.vb b/instat/UserTables/Columns/ucrColumnFootNote.vb new file mode 100644 index 00000000000..2f07fed5d1c --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnFootNote.vb @@ -0,0 +1,93 @@ +Public Class ucrColumnFootNote + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub ucrColumnFootNote_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + End Sub + + Private Sub InitialiseControl() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + Me.clsOperator = clsOperator + + ' Set up the selector + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + + ' Clear and Set up the data grid with contents + dataGrid.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_footnote"}, "locations", "cells_column_labels", clsOperator)) + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter)) + + For Each clsRParam As RParameter In lstRParams + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGrid) + row.Cells(0).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the tab_style() parameter function contents as a row + row.Tag = clsRParam + dataGrid.Rows.Add(row) + Next + End Sub + + Private Sub ucrInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + btnAdd.Enabled = Not ucrReceiverMultipleCols.IsEmpty + End Sub + + Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click + + Dim clsTabFootNoteRFunction As New RFunction + Dim clsLocationsRFunction As New RFunction + + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_column_labels") + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=ucrReceiverMultipleCols.GetVariableNames(bWithQuotes:=False), iNewPosition:=0)) + + clsTabFootNoteRFunction.SetPackageName("gt") + clsTabFootNoteRFunction.SetRCommand("tab_footnote") + clsTabFootNoteRFunction.AddParameter(strParameterName:="footnote", strParameterValue:=Chr(34) & ucrTxtFootNote.GetText & Chr(34), iPosition:=0) + clsTabFootNoteRFunction.AddParameter(strParameterName:="locations", clsRFunctionParameter:=clsLocationsRFunction, iPosition:=1) + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="tab_footnote_columns_labels_param" & (dataGrid.Rows.Count + 1), strParamValue:=clsTabFootNoteRFunction, bNewIncludeArgumentName:=False) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGrid) + row.Cells(0).Value = clsTabFootNoteRFunction.Clone.ToScript + + ' Tag the row with the parameter + row.Tag = clsRParam + + ' Add it to grid + dataGrid.Rows.Add(row) + + ucrReceiverMultipleCols.Clear() + ucrTxtFootNote.SetName("") + End Sub + + Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click + dataGrid.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + ' Remove any previous cell footers + Dim lstRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_footnote"}, "locations", "cells_column_labels", clsOperator) + For Each clsRParam As RParameter In lstRParams + clsOperator.RemoveParameter(clsRParam) + Next + + ' Add new changes + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGrid, clsOperator) + End Sub + +End Class diff --git a/instat/UserTables/Columns/ucrColumnLabels.Designer.vb b/instat/UserTables/Columns/ucrColumnLabels.Designer.vb new file mode 100644 index 00000000000..e1dc857a503 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnLabels.Designer.vb @@ -0,0 +1,185 @@ + _ +Partial Class ucrColumnLabels + 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.dataGridColLabels = New System.Windows.Forms.DataGridView() + Me.ucrInputColLabel = New instat.ucrInputTextBox() + Me.lblCondition = New System.Windows.Forms.Label() + Me.lblColLabels = New System.Windows.Forms.Label() + Me.btnClearLabels = New System.Windows.Forms.Button() + Me.lblColumns = New System.Windows.Forms.Label() + Me.btnAddLabel = New System.Windows.Forms.Button() + Me.ucrReceiverSingleCol = New instat.ucrReceiverSingle() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.colLabel = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colCodnition = New System.Windows.Forms.DataGridViewTextBoxColumn() + CType(Me.dataGridColLabels, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'dataGridColLabels + ' + Me.dataGridColLabels.AllowUserToAddRows = False + Me.dataGridColLabels.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridColLabels.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colLabel, Me.colCodnition}) + Me.dataGridColLabels.Location = New System.Drawing.Point(230, 159) + Me.dataGridColLabels.Name = "dataGridColLabels" + Me.dataGridColLabels.RowHeadersWidth = 62 + Me.dataGridColLabels.Size = New System.Drawing.Size(266, 95) + Me.dataGridColLabels.TabIndex = 309 + ' + 'ucrInputColLabel + ' + Me.ucrInputColLabel.AddQuotesIfUnrecognised = True + Me.ucrInputColLabel.AutoSize = True + Me.ucrInputColLabel.IsMultiline = False + Me.ucrInputColLabel.IsReadOnly = False + Me.ucrInputColLabel.Location = New System.Drawing.Point(230, 73) + Me.ucrInputColLabel.Name = "ucrInputColLabel" + Me.ucrInputColLabel.Size = New System.Drawing.Size(119, 21) + Me.ucrInputColLabel.TabIndex = 320 + ' + 'lblCondition + ' + Me.lblCondition.AutoSize = True + Me.lblCondition.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblCondition.Location = New System.Drawing.Point(227, 57) + Me.lblCondition.Name = "lblCondition" + Me.lblCondition.Size = New System.Drawing.Size(36, 13) + Me.lblCondition.TabIndex = 319 + Me.lblCondition.Text = "Label:" + ' + 'lblColLabels + ' + Me.lblColLabels.AutoSize = True + Me.lblColLabels.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColLabels.Location = New System.Drawing.Point(227, 140) + Me.lblColLabels.Name = "lblColLabels" + Me.lblColLabels.Size = New System.Drawing.Size(79, 13) + Me.lblColLabels.TabIndex = 315 + Me.lblColLabels.Text = "Column Labels:" + ' + 'btnClearLabels + ' + Me.btnClearLabels.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearLabels.Location = New System.Drawing.Point(414, 135) + Me.btnClearLabels.Name = "btnClearLabels" + Me.btnClearLabels.Size = New System.Drawing.Size(79, 23) + Me.btnClearLabels.TabIndex = 314 + Me.btnClearLabels.Tag = "" + Me.btnClearLabels.Text = "Clear" + Me.btnClearLabels.UseVisualStyleBackColor = True + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(227, 11) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(45, 13) + Me.lblColumns.TabIndex = 313 + Me.lblColumns.Text = "Column:" + ' + 'btnAddLabel + ' + Me.btnAddLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAddLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAddLabel.Location = New System.Drawing.Point(230, 100) + Me.btnAddLabel.Name = "btnAddLabel" + Me.btnAddLabel.Size = New System.Drawing.Size(78, 23) + Me.btnAddLabel.TabIndex = 312 + Me.btnAddLabel.Tag = "" + Me.btnAddLabel.Text = "Add" + Me.btnAddLabel.UseVisualStyleBackColor = True + ' + 'ucrReceiverSingleCol + ' + Me.ucrReceiverSingleCol.AutoSize = True + Me.ucrReceiverSingleCol.frmParent = Nothing + Me.ucrReceiverSingleCol.Location = New System.Drawing.Point(229, 27) + Me.ucrReceiverSingleCol.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSingleCol.Name = "ucrReceiverSingleCol" + Me.ucrReceiverSingleCol.Selector = Nothing + Me.ucrReceiverSingleCol.Size = New System.Drawing.Size(120, 21) + Me.ucrReceiverSingleCol.strNcFilePath = "" + Me.ucrReceiverSingleCol.TabIndex = 311 + Me.ucrReceiverSingleCol.ucrSelector = Nothing + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(6, 5) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 310 + ' + 'colLabel + ' + Me.colLabel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colLabel.HeaderText = "Column" + Me.colLabel.MinimumWidth = 8 + Me.colLabel.Name = "colLabel" + ' + 'colCodnition + ' + Me.colCodnition.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colCodnition.HeaderText = "Label" + Me.colCodnition.MinimumWidth = 8 + Me.colCodnition.Name = "colCodnition" + ' + 'ucrColumnLabels + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.dataGridColLabels) + Me.Controls.Add(Me.ucrInputColLabel) + Me.Controls.Add(Me.lblCondition) + Me.Controls.Add(Me.lblColLabels) + Me.Controls.Add(Me.btnClearLabels) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.btnAddLabel) + Me.Controls.Add(Me.ucrReceiverSingleCol) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Name = "ucrColumnLabels" + Me.Size = New System.Drawing.Size(499, 257) + CType(Me.dataGridColLabels, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents dataGridColLabels As DataGridView + Friend WithEvents ucrInputColLabel As ucrInputTextBox + Friend WithEvents lblCondition As Label + Friend WithEvents lblColLabels As Label + Friend WithEvents btnClearLabels As Button + Friend WithEvents lblColumns As Label + Friend WithEvents btnAddLabel As Button + Friend WithEvents ucrReceiverSingleCol As ucrReceiverSingle + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents colLabel As DataGridViewTextBoxColumn + Friend WithEvents colCodnition As DataGridViewTextBoxColumn +End Class diff --git a/instat/UserTables/Columns/ucrColumnLabels.resx b/instat/UserTables/Columns/ucrColumnLabels.resx new file mode 100644 index 00000000000..f5ee602f97b --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnLabels.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Columns/ucrColumnLabels.vb b/instat/UserTables/Columns/ucrColumnLabels.vb new file mode 100644 index 00000000000..cc4b5d2bcfa --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnLabels.vb @@ -0,0 +1,102 @@ +Imports System.Reflection + +Public Class ucrColumnLabels + + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub InitialiseDialog() + ucrReceiverSingleCol.Selector = ucrSelectorCols + ucrReceiverSingleCol.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + dataGridColLabels.Rows.Clear() + + Dim lstRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRCommand({"cols_label"}, clsOperator) + If lstRParams.Count > 0 Then + For Each clsColLabelRParam As RParameter In lstRParams(0).clsArgumentCodeStructure.clsParameters + Dim row As New DataGridViewRow + row.CreateCells(dataGridColLabels) + row.Cells(0).Value = clsColLabelRParam.strArgumentName + row.Cells(1).Value = clsTablesUtils.GetStringValue(clsColLabelRParam.strArgumentValue, False) + row.Tag = clsColLabelRParam + dataGridColLabels.Rows.Add(row) + Next + End If + + End Sub + + Private Sub btnAddLabel_Click(sender As Object, e As EventArgs) Handles btnAddLabel.Click + + Dim strColumnName As String = ucrReceiverSingleCol.GetVariableNames(bWithQuotes:=False) + Dim strColumnLabel As String = ucrInputColLabel.GetValue() + + Dim clsRParam As New RParameter(strParameterName:=clsTablesUtils.GetStringValue(strColumnName, False), strParamValue:=clsTablesUtils.GetStringValue(strColumnLabel, True)) + Dim row As DataGridViewRow = Nothing + + ' Update column label if column exists + For Each existingRow As DataGridViewRow In dataGridColLabels.Rows + If existingRow.Cells(0).Value = strColumnName Then + row = existingRow + row.Cells(1).Value = strColumnLabel + row.Tag = clsRParam + Exit For + End If + Next + + ' If column does not exist then add new column label + If row Is Nothing Then + row = New DataGridViewRow + row.CreateCells(dataGridColLabels) + row.Cells(0).Value = strColumnName + row.Cells(1).Value = strColumnLabel + row.Tag = clsRParam + dataGridColLabels.Rows.Add(row) + End If + + ' Clear controls + ucrReceiverSingleCol.Clear() + ucrInputColLabel.SetName("") + + End Sub + + Private Sub btnClearLabels_Click(sender As Object, e As EventArgs) Handles btnClearLabels.Click + dataGridColLabels.Rows.Clear() + End Sub + + + Private Sub ucrColSpanner_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSingleCol.ControlContentsChanged, ucrInputColLabel.ControlContentsChanged + btnAddLabel.Enabled = Not ucrReceiverSingleCol.IsEmpty AndAlso Not ucrInputColLabel.IsEmpty + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRFunctionsParamsWithRCommand({"cols_label"}, clsOperator) + + If dataGridColLabels.Rows.Count = 0 Then + Exit Sub + End If + + Dim clsColsLabelRFunction As New RFunction + clsColsLabelRFunction.SetPackageName("gt") + clsColsLabelRFunction.SetRCommand("cols_label") + + For index As Integer = 0 To dataGridColLabels.Rows.Count - 1 + If dataGridColLabels.Rows.Item(index).Tag IsNot Nothing Then + Dim clsRParam As RParameter = dataGridColLabels.Rows.Item(index).Tag + clsColsLabelRFunction.AddParameter(clsRParam) + End If + Next + + clsOperator.AddParameter(New RParameter(strParameterName:="cols_label_param", strParamValue:=clsColsLabelRFunction, bNewIncludeArgumentName:=False)) + End Sub + +End Class diff --git a/instat/UserTables/Columns/ucrColumnNanoPlots.Designer.vb b/instat/UserTables/Columns/ucrColumnNanoPlots.Designer.vb new file mode 100644 index 00000000000..f0182c43b02 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnNanoPlots.Designer.vb @@ -0,0 +1,37 @@ + _ +Partial Class ucrColumnNanoPlots + 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.SuspendLayout() + ' + 'ucrColumnNanoPlots + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Name = "ucrColumnNanoPlots" + Me.Size = New System.Drawing.Size(648, 470) + Me.ResumeLayout(False) + + End Sub + +End Class diff --git a/instat/UserTables/Columns/ucrColumnNanoPlots.resx b/instat/UserTables/Columns/ucrColumnNanoPlots.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnNanoPlots.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Columns/ucrColumnNanoPlots.vb b/instat/UserTables/Columns/ucrColumnNanoPlots.vb new file mode 100644 index 00000000000..4870a201ea9 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnNanoPlots.vb @@ -0,0 +1,13 @@ +Public Class ucrColumnNanoPlots + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + + End Sub + Public Sub SetValuesToOperator() + + End Sub + + Private Sub ucrColumnNanoPlots_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + End Sub +End Class diff --git a/instat/UserTables/Columns/ucrColumnSpanners.Designer.vb b/instat/UserTables/Columns/ucrColumnSpanners.Designer.vb new file mode 100644 index 00000000000..671a01ee140 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnSpanners.Designer.vb @@ -0,0 +1,222 @@ + _ +Partial Class ucrColumnSpanners + 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.lblSpanners = New System.Windows.Forms.Label() + Me.btnClearSpanners = New System.Windows.Forms.Button() + Me.lblColumns = New System.Windows.Forms.Label() + Me.btnAddColSpanner = New System.Windows.Forms.Button() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.dataGridColSpanners = New System.Windows.Forms.DataGridView() + Me.colLabel = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colSpanners = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colStyleExpression = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.lblColSpanner = New System.Windows.Forms.Label() + Me.ucrInputColSpanner = New instat.ucrInputTextBox() + Me.btnStyle = New System.Windows.Forms.Button() + CType(Me.dataGridColSpanners, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblSpanners + ' + Me.lblSpanners.AutoSize = True + Me.lblSpanners.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSpanners.Location = New System.Drawing.Point(368, 263) + Me.lblSpanners.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSpanners.Name = "lblSpanners" + Me.lblSpanners.Size = New System.Drawing.Size(140, 20) + Me.lblSpanners.TabIndex = 297 + Me.lblSpanners.Text = "Column Spanners:" + ' + 'btnClearSpanners + ' + Me.btnClearSpanners.Enabled = False + Me.btnClearSpanners.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearSpanners.Location = New System.Drawing.Point(714, 249) + Me.btnClearSpanners.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnClearSpanners.Name = "btnClearSpanners" + Me.btnClearSpanners.Size = New System.Drawing.Size(112, 35) + Me.btnClearSpanners.TabIndex = 295 + Me.btnClearSpanners.Tag = "" + Me.btnClearSpanners.Text = "Clear" + Me.btnClearSpanners.UseVisualStyleBackColor = True + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(363, 8) + Me.lblColumns.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(85, 20) + Me.lblColumns.TabIndex = 294 + Me.lblColumns.Text = "Column(s):" + ' + 'btnAddColSpanner + ' + Me.btnAddColSpanner.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAddColSpanner.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAddColSpanner.Location = New System.Drawing.Point(364, 212) + Me.btnAddColSpanner.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnAddColSpanner.Name = "btnAddColSpanner" + Me.btnAddColSpanner.Size = New System.Drawing.Size(132, 35) + Me.btnAddColSpanner.TabIndex = 292 + Me.btnAddColSpanner.Tag = "" + Me.btnAddColSpanner.Text = "Add" + Me.btnAddColSpanner.UseVisualStyleBackColor = True + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(6, 8) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(320, 282) + Me.ucrSelectorCols.TabIndex = 290 + ' + 'dataGridColSpanners + ' + Me.dataGridColSpanners.AllowUserToAddRows = False + Me.dataGridColSpanners.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridColSpanners.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colLabel, Me.colSpanners, Me.colStyleExpression}) + Me.dataGridColSpanners.Location = New System.Drawing.Point(360, 289) + Me.dataGridColSpanners.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.dataGridColSpanners.Name = "dataGridColSpanners" + Me.dataGridColSpanners.ReadOnly = True + Me.dataGridColSpanners.RowHeadersWidth = 62 + Me.dataGridColSpanners.Size = New System.Drawing.Size(466, 112) + Me.dataGridColSpanners.TabIndex = 289 + ' + 'colLabel + ' + Me.colLabel.HeaderText = "Label" + Me.colLabel.MinimumWidth = 8 + Me.colLabel.Name = "colLabel" + Me.colLabel.ReadOnly = True + Me.colLabel.Width = 60 + ' + 'colSpanners + ' + Me.colSpanners.HeaderText = "Column(s)" + Me.colSpanners.MinimumWidth = 8 + Me.colSpanners.Name = "colSpanners" + Me.colSpanners.ReadOnly = True + Me.colSpanners.Width = 90 + ' + 'colStyleExpression + ' + Me.colStyleExpression.HeaderText = "Style Expression" + Me.colStyleExpression.MinimumWidth = 8 + Me.colStyleExpression.Name = "colStyleExpression" + Me.colStyleExpression.ReadOnly = True + Me.colStyleExpression.Width = 90 + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(360, 32) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(180, 98) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 299 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'lblColSpanner + ' + Me.lblColSpanner.AutoSize = True + Me.lblColSpanner.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColSpanner.Location = New System.Drawing.Point(368, 145) + Me.lblColSpanner.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblColSpanner.Name = "lblColSpanner" + Me.lblColSpanner.Size = New System.Drawing.Size(117, 20) + Me.lblColSpanner.TabIndex = 301 + Me.lblColSpanner.Text = "Spanner Label:" + ' + 'ucrInputColSpanner + ' + Me.ucrInputColSpanner.AddQuotesIfUnrecognised = True + Me.ucrInputColSpanner.AutoSize = True + Me.ucrInputColSpanner.IsMultiline = False + Me.ucrInputColSpanner.IsReadOnly = False + Me.ucrInputColSpanner.Location = New System.Drawing.Point(364, 171) + Me.ucrInputColSpanner.Margin = New System.Windows.Forms.Padding(14) + Me.ucrInputColSpanner.Name = "ucrInputColSpanner" + Me.ucrInputColSpanner.Size = New System.Drawing.Size(176, 32) + Me.ucrInputColSpanner.TabIndex = 307 + ' + 'btnStyle + ' + Me.btnStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnStyle.Location = New System.Drawing.Point(549, 166) + Me.btnStyle.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnStyle.Name = "btnStyle" + Me.btnStyle.Size = New System.Drawing.Size(74, 35) + Me.btnStyle.TabIndex = 308 + Me.btnStyle.Tag = "" + Me.btnStyle.Text = "Style" + Me.btnStyle.UseVisualStyleBackColor = True + ' + 'ucrColumnSpanners + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.btnStyle) + Me.Controls.Add(Me.ucrInputColSpanner) + Me.Controls.Add(Me.lblColSpanner) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.lblSpanners) + Me.Controls.Add(Me.btnClearSpanners) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.btnAddColSpanner) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.dataGridColSpanners) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "ucrColumnSpanners" + Me.Size = New System.Drawing.Size(831, 408) + CType(Me.dataGridColSpanners, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents lblSpanners As Label + Friend WithEvents btnClearSpanners As Button + Friend WithEvents lblColumns As Label + Friend WithEvents btnAddColSpanner As Button + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents dataGridColSpanners As DataGridView + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents lblColSpanner As Label + Friend WithEvents ucrInputColSpanner As ucrInputTextBox + Friend WithEvents btnStyle As Button + Friend WithEvents colLabel As DataGridViewTextBoxColumn + Friend WithEvents colSpanners As DataGridViewTextBoxColumn + Friend WithEvents colStyleExpression As DataGridViewTextBoxColumn +End Class diff --git a/instat/UserTables/Columns/ucrColumnSpanners.resx b/instat/UserTables/Columns/ucrColumnSpanners.resx new file mode 100644 index 00000000000..9efce73ddc6 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnSpanners.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Columns/ucrColumnSpanners.vb b/instat/UserTables/Columns/ucrColumnSpanners.vb new file mode 100644 index 00000000000..dfae2666d48 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnSpanners.vb @@ -0,0 +1,142 @@ +Imports unvell.ReoGrid.IO.OpenXML.Schema + +Public Class ucrColumnSpanners + + Private clsOperator As ROperator + Private bFirstload As Boolean = True + + Private Sub InitialiseDialog() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + dataGridColSpanners.Rows.Clear() + + ' Note, the sequence of these 2 functions matters + SetupTabSpannersInDataGrid(clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_spanner"}, clsOperator)) + SetupTabSpannersStylesInDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_column_spanners", clsOperator)) + + End Sub + + Private Sub SetupTabSpannersInDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + Dim clsTabSpannerRFunction As RFunction = clsRParam.clsArgumentCodeStructure + Dim row As New DataGridViewRow + row.CreateCells(dataGridColSpanners) + For Each clsTabSpannerRParam As RParameter In clsTabSpannerRFunction.clsParameters + If clsTabSpannerRParam.strArgumentName = "label" Then + row.Cells(0).Value = clsTablesUtils.GetStringValue(clsTabSpannerRParam.strArgumentValue, False) + ElseIf clsTabSpannerRParam.strArgumentName = "columns" Then + row.Cells(1).Value = clsTablesUtils.GetStringValue(clsTabSpannerRParam.strArgumentValue, False) + End If + Next + Dim arrParams(2) As RParameter + arrParams(0) = clsRParam + row.Tag = arrParams + dataGridColSpanners.Rows.Add(row) + Next + End Sub + + Private Sub SetupTabSpannersStylesInDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + Dim clsTabStyleRFunction As RFunction = clsRParam.clsArgumentCodeStructure + ' Get spanner Id + Dim strArgumentValueSpannerId As String = clsTabStyleRFunction.GetParameter("locations").clsArgumentCodeStructure.GetParameter("spanners").strArgumentValue + For index As Integer = 0 To dataGridColSpanners.Rows.Count - 1 + Dim row As DataGridViewRow = dataGridColSpanners.Rows(index) + Dim lstParams() As RParameter = row.Tag + If strArgumentValueSpannerId = lstParams(0).clsArgumentCodeStructure.GetParameter("id").strArgumentValue Then + row.Cells(2).Value = clsTabStyleRFunction.Clone().ToScript + lstParams(1) = clsRParam + row.Tag = lstParams + Exit For + End If + Next + Next + End Sub + + Private Sub btnStyle_Click(sender As Object, e As EventArgs) Handles btnStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + ucrInputColSpanner.Tag = clsListStyleRFunction + End Sub + + Private Sub btnAddColSpanner_Click(sender As Object, e As EventArgs) Handles btnAddColSpanner.Click + Dim strSpannerLabel As String = ucrInputColSpanner.GetText() + Dim strSpannerId As String = strSpannerLabel.Replace(" ", String.Empty) + Dim strSpannerColsRFunction As String = mdlCoreControl.GetRVector(ucrReceiverMultipleCols.GetVariableNamesList(bWithQuotes:=False), bOnlyIfMultipleElement:=False) + Dim strSpannerStyleExpression As String = "" + + Dim clsTabSpannerRFunction As New RFunction + clsTabSpannerRFunction.SetPackageName("gt") + clsTabSpannerRFunction.SetRCommand("tab_spanner") + clsTabSpannerRFunction.AddParameter(New RParameter(strParameterName:="label", strParamValue:=clsTablesUtils.GetStringValue(strSpannerLabel, True), iNewPosition:=0)) + clsTabSpannerRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=strSpannerColsRFunction, iNewPosition:=1)) + clsTabSpannerRFunction.AddParameter(New RParameter(strParameterName:="id", strParamValue:=clsTablesUtils.GetStringValue(strSpannerId, True), iNewPosition:=2)) + + Dim arrParams(2) As RParameter + + ' Add add the spanner parameter as the first element + arrParams(0) = New RParameter(strParameterName:="tab_column_spanner_param" & (dataGridColSpanners.Rows.Count + 1), strParamValue:=clsTabSpannerRFunction, bNewIncludeArgumentName:=False) + + ' Add the spanner style as the second element + If ucrInputColSpanner.Tag IsNot Nothing Then + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_column_spanners") + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="spanners", strParamValue:=clsTablesUtils.GetStringValue(strSpannerId, True), iNewPosition:=0)) + + Dim clsListStyleRFunction As RFunction = ucrInputColSpanner.Tag + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + strSpannerStyleExpression = clsTabStyleRFunction.Clone.ToScript + + arrParams(1) = New RParameter(strParameterName:="tab_style_cells_column_spanner_param" & (dataGridColSpanners.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + End If + + Dim row As New DataGridViewRow + row.CreateCells(dataGridColSpanners) + row.Cells(0).Value = strSpannerLabel + row.Cells(1).Value = strSpannerColsRFunction + row.Cells(2).Value = strSpannerStyleExpression + ' Tag the array of parameters + row.Tag = arrParams + dataGridColSpanners.Rows.Add(row) + + ucrReceiverMultipleCols.Clear() + ucrInputColSpanner.SetName("") + ucrInputColSpanner.Tag = Nothing + End Sub + + Private Sub ucrColSpanner_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged, ucrInputColSpanner.ControlContentsChanged + btnAddColSpanner.Enabled = Not ucrReceiverMultipleCols.IsEmpty AndAlso Not ucrInputColSpanner.IsEmpty + End Sub + + Private Sub btnClearSpanners_Click(sender As Object, e As EventArgs) Handles btnClearSpanners.Click + dataGridColSpanners.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_spanner"}, clsOperator), clsOperator) + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_column_spanners", clsOperator), clsOperator) + + For index As Integer = 0 To dataGridColSpanners.Rows.Count - 1 + Dim lstParams() As RParameter = dataGridColSpanners.Rows(index).Tag + clsOperator.AddParameter(lstParams(0)) + If lstParams(1) IsNot Nothing Then + clsOperator.AddParameter(lstParams(1)) + End If + Next + End Sub +End Class diff --git a/instat/UserTables/Columns/ucrColumnStyles.Designer.vb b/instat/UserTables/Columns/ucrColumnStyles.Designer.vb new file mode 100644 index 00000000000..049fc16592d --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnStyles.Designer.vb @@ -0,0 +1,149 @@ + _ +Partial Class ucrColumnStyles + 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.lblFormats = New System.Windows.Forms.Label() + Me.btnClearFormats = New System.Windows.Forms.Button() + Me.dataGridFormats = New System.Windows.Forms.DataGridView() + Me.colStyles = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.Label1 = New System.Windows.Forms.Label() + Me.btnEnterStyle = New System.Windows.Forms.Button() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblFormats + ' + Me.lblFormats.AutoSize = True + Me.lblFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFormats.Location = New System.Drawing.Point(234, 149) + Me.lblFormats.Name = "lblFormats" + Me.lblFormats.Size = New System.Drawing.Size(38, 13) + Me.lblFormats.TabIndex = 338 + Me.lblFormats.Text = "Styles:" + ' + 'btnClearFormats + ' + Me.btnClearFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearFormats.Location = New System.Drawing.Point(473, 140) + Me.btnClearFormats.Name = "btnClearFormats" + Me.btnClearFormats.Size = New System.Drawing.Size(75, 23) + Me.btnClearFormats.TabIndex = 336 + Me.btnClearFormats.Tag = "" + Me.btnClearFormats.Text = "Clear" + Me.btnClearFormats.UseVisualStyleBackColor = True + ' + 'dataGridFormats + ' + Me.dataGridFormats.AllowUserToAddRows = False + Me.dataGridFormats.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridFormats.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colStyles}) + Me.dataGridFormats.Location = New System.Drawing.Point(237, 166) + Me.dataGridFormats.Name = "dataGridFormats" + Me.dataGridFormats.RowHeadersWidth = 62 + Me.dataGridFormats.Size = New System.Drawing.Size(315, 73) + Me.dataGridFormats.TabIndex = 337 + ' + 'colStyles + ' + Me.colStyles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colStyles.HeaderText = "Style Expressions" + Me.colStyles.MinimumWidth = 8 + Me.colStyles.Name = "colStyles" + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(234, 21) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(120, 80) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 334 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.Label1.Location = New System.Drawing.Point(237, 5) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(56, 13) + Me.Label1.TabIndex = 340 + Me.Label1.Text = "Column(s):" + ' + 'btnEnterStyle + ' + Me.btnEnterStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnEnterStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnEnterStyle.Location = New System.Drawing.Point(237, 110) + Me.btnEnterStyle.Name = "btnEnterStyle" + Me.btnEnterStyle.Size = New System.Drawing.Size(126, 23) + Me.btnEnterStyle.TabIndex = 335 + Me.btnEnterStyle.Tag = "" + Me.btnEnterStyle.Text = "Enter Style" + Me.btnEnterStyle.UseVisualStyleBackColor = True + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(5, 5) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 333 + ' + 'ucrColumnStyles + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.lblFormats) + Me.Controls.Add(Me.btnClearFormats) + Me.Controls.Add(Me.dataGridFormats) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.btnEnterStyle) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Name = "ucrColumnStyles" + Me.Size = New System.Drawing.Size(556, 243) + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents lblFormats As Label + Friend WithEvents btnClearFormats As Button + Friend WithEvents dataGridFormats As DataGridView + Friend WithEvents colStyles As DataGridViewTextBoxColumn + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents Label1 As Label + Friend WithEvents btnEnterStyle As Button + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove +End Class diff --git a/instat/UserTables/Columns/ucrColumnStyles.resx b/instat/UserTables/Columns/ucrColumnStyles.resx new file mode 100644 index 00000000000..d937ee32b35 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnStyles.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Columns/ucrColumnStyles.vb b/instat/UserTables/Columns/ucrColumnStyles.vb new file mode 100644 index 00000000000..fcfe94dd33b --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnStyles.vb @@ -0,0 +1,93 @@ +Public Class ucrColumnStyles + + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub ucrColumnStyles_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + End Sub + + Private Sub InitialiseControl() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + + + Me.clsOperator = clsOperator + + ' Set up the selector + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + + ' Clear and Set up the data grid with contents + dataGridFormats.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_column_labels", clsOperator)) + + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter)) + + For Each clsRParam As RParameter In lstRParams + + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the tab_style() parameter function contents as a row + row.Tag = clsRParam + dataGridFormats.Rows.Add(row) + + Next + End Sub + + Private Sub ucrInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + btnEnterStyle.Enabled = Not ucrReceiverMultipleCols.IsEmpty + End Sub + + Private Sub btnEnterStyle_Click(sender As Object, e As EventArgs) Handles btnEnterStyle.Click + + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_column_labels") + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=ucrReceiverMultipleCols.GetVariableNames(bWithQuotes:=False), iNewPosition:=0)) + + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="tab_style_column_label_param" & (dataGridFormats.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsTabStyleRFunction.Clone.ToScript + + ' Tag the row with the parameter + row.Tag = clsRParam + + ' Add it to grid + dataGridFormats.Rows.Add(row) + + ucrReceiverMultipleCols.Clear() + End Sub + + Private Sub btnClearFormats_Click(sender As Object, e As EventArgs) Handles btnClearFormats.Click + dataGridFormats.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_column_labels", clsOperator), clsOperator) + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGridFormats, clsOperator) + End Sub + + +End Class diff --git a/instat/UserTables/Columns/ucrColumnWidth.Designer.vb b/instat/UserTables/Columns/ucrColumnWidth.Designer.vb new file mode 100644 index 00000000000..263cfcd421c --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnWidth.Designer.vb @@ -0,0 +1,187 @@ + _ +Partial Class ucrColumnWidth + 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.lblColumnWidths = New System.Windows.Forms.Label() + Me.btnClear = New System.Windows.Forms.Button() + Me.lblColumns = New System.Windows.Forms.Label() + Me.btnAdd = New System.Windows.Forms.Button() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.dataGrid = New System.Windows.Forms.DataGridView() + Me.colWidthExpression = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.lblColWidth = New System.Windows.Forms.Label() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.ucrNudWidth = New instat.ucrNud() + CType(Me.dataGrid, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblColumnWidths + ' + Me.lblColumnWidths.AutoSize = True + Me.lblColumnWidths.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumnWidths.Location = New System.Drawing.Point(368, 263) + Me.lblColumnWidths.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblColumnWidths.Name = "lblColumnWidths" + Me.lblColumnWidths.Size = New System.Drawing.Size(120, 20) + Me.lblColumnWidths.TabIndex = 313 + Me.lblColumnWidths.Text = "Column Widths:" + ' + 'btnClear + ' + Me.btnClear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClear.Location = New System.Drawing.Point(801, 249) + Me.btnClear.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnClear.Name = "btnClear" + Me.btnClear.Size = New System.Drawing.Size(112, 35) + Me.btnClear.TabIndex = 312 + Me.btnClear.Tag = "" + Me.btnClear.Text = "Clear" + Me.btnClear.UseVisualStyleBackColor = True + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(363, 8) + Me.lblColumns.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(85, 20) + Me.lblColumns.TabIndex = 311 + Me.lblColumns.Text = "Column(s):" + ' + 'btnAdd + ' + Me.btnAdd.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAdd.Location = New System.Drawing.Point(364, 212) + Me.btnAdd.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(132, 35) + Me.btnAdd.TabIndex = 310 + Me.btnAdd.Tag = "" + Me.btnAdd.Text = "Add" + Me.btnAdd.UseVisualStyleBackColor = True + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(6, 8) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(320, 282) + Me.ucrSelectorCols.TabIndex = 309 + ' + 'dataGrid + ' + Me.dataGrid.AllowUserToAddRows = False + Me.dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGrid.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colWidthExpression}) + Me.dataGrid.Location = New System.Drawing.Point(360, 289) + Me.dataGrid.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.dataGrid.Name = "dataGrid" + Me.dataGrid.RowHeadersWidth = 62 + Me.dataGrid.Size = New System.Drawing.Size(554, 112) + Me.dataGrid.TabIndex = 308 + ' + 'colWidthExpression + ' + Me.colWidthExpression.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colWidthExpression.HeaderText = "Width Expression" + Me.colWidthExpression.MinimumWidth = 8 + Me.colWidthExpression.Name = "colWidthExpression" + Me.colWidthExpression.ReadOnly = True + ' + 'lblColWidth + ' + Me.lblColWidth.AutoSize = True + Me.lblColWidth.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColWidth.Location = New System.Drawing.Point(368, 145) + Me.lblColWidth.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblColWidth.Name = "lblColWidth" + Me.lblColWidth.Size = New System.Drawing.Size(54, 20) + Me.lblColWidth.TabIndex = 315 + Me.lblColWidth.Text = "Width:" + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(360, 32) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(180, 98) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 314 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'ucrNudWidth + ' + Me.ucrNudWidth.AutoSize = True + Me.ucrNudWidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudWidth.Location = New System.Drawing.Point(369, 169) + Me.ucrNudWidth.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) + Me.ucrNudWidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudWidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWidth.Name = "ucrNudWidth" + Me.ucrNudWidth.Size = New System.Drawing.Size(75, 31) + Me.ucrNudWidth.TabIndex = 318 + Me.ucrNudWidth.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrColumnWidth + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrNudWidth) + Me.Controls.Add(Me.lblColumnWidths) + Me.Controls.Add(Me.btnClear) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.btnAdd) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.dataGrid) + Me.Controls.Add(Me.lblColWidth) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "ucrColumnWidth" + Me.Size = New System.Drawing.Size(920, 411) + CType(Me.dataGrid, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents lblColumnWidths As Label + Friend WithEvents btnClear As Button + Friend WithEvents lblColumns As Label + Friend WithEvents btnAdd As Button + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents dataGrid As DataGridView + Friend WithEvents colWidthExpression As DataGridViewTextBoxColumn + Friend WithEvents lblColWidth As Label + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents ucrNudWidth As ucrNud +End Class diff --git a/instat/UserTables/Columns/ucrColumnWidth.resx b/instat/UserTables/Columns/ucrColumnWidth.resx new file mode 100644 index 00000000000..58cffaf9bfe --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnWidth.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Columns/ucrColumnWidth.vb b/instat/UserTables/Columns/ucrColumnWidth.vb new file mode 100644 index 00000000000..9b6ecb92e3f --- /dev/null +++ b/instat/UserTables/Columns/ucrColumnWidth.vb @@ -0,0 +1,83 @@ +Public Class ucrColumnWidth + + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub ucrColumnWidth_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + End Sub + + Private Sub InitialiseControl() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetMeAsReceiver() + + ucrNudWidth.Minimum = 0 + ucrNudWidth.Maximum = Decimal.MaxValue + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + Me.clsOperator = clsOperator + + ' Set up the selector + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + + ' Clear and Set up the data grid with contents + dataGrid.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRCommand({"cols_width"}, clsOperator)) + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGrid) + row.Cells(0).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the tab_style() parameter function contents as a row + row.Tag = clsRParam + dataGrid.Rows.Add(row) + Next + End Sub + + Private Sub ucrInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + btnAdd.Enabled = Not ucrReceiverMultipleCols.IsEmpty + End Sub + + Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click + + Dim clsColWidthRFunction As New RFunction + clsColWidthRFunction.SetPackageName("gt") + clsColWidthRFunction.SetRCommand("cols_width") + clsColWidthRFunction.AddParameter(strParameterName:="column_param", strParameterValue:=ucrReceiverMultipleCols.GetVariableNames(bWithQuotes:=False) & " ~ px(" & ucrNudWidth.Value & ")", iPosition:=0, bIncludeArgumentName:=False) + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="tab_col_width_param" & (dataGrid.Rows.Count + 1), strParamValue:=clsColWidthRFunction, bNewIncludeArgumentName:=False) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGrid) + row.Cells(0).Value = clsColWidthRFunction.Clone.ToScript + + ' Tag the row with the parameter + row.Tag = clsRParam + + ' Add it to grid + dataGrid.Rows.Add(row) + + End Sub + + Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click + dataGrid.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + ' Remove any previous col widths + clsTablesUtils.RemoveRFunctionsParamsWithRCommand({"cols_width"}, clsOperator) + + ' Add new changes + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGrid, clsOperator) + End Sub +End Class diff --git a/instat/UserTables/Columns/ucrColumns.Designer.vb b/instat/UserTables/Columns/ucrColumns.Designer.vb new file mode 100644 index 00000000000..c59d2dff065 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumns.Designer.vb @@ -0,0 +1,245 @@ + +Partial Class ucrColumns + 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.rdoColSpanners = New System.Windows.Forms.RadioButton() + Me.rdoColLabel = New System.Windows.Forms.RadioButton() + Me.rdoColFootNotes = New System.Windows.Forms.RadioButton() + Me.rdoColWidth = New System.Windows.Forms.RadioButton() + Me.rdoColNanoPlot = New System.Windows.Forms.RadioButton() + Me.ucrColumnSpanners = New instat.ucrColumnSpanners() + Me.ucrColumnLabels = New instat.ucrColumnLabels() + Me.ucrColumnFootNote = New instat.ucrColumnFootNote() + Me.ucrColumnWidth = New instat.ucrColumnWidth() + Me.ucrPnlCols = New instat.UcrPanel() + Me.ucrColumnNanoPlots = New instat.ucrColumnNanoPlots() + Me.rdoColStyles = New System.Windows.Forms.RadioButton() + Me.ucrColumnStyles = New instat.ucrColumnStyles() + Me.SuspendLayout() + ' + 'rdoColSpanners + ' + Me.rdoColSpanners.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoColSpanners.BackColor = System.Drawing.SystemColors.Control + Me.rdoColSpanners.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoColSpanners.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColSpanners.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColSpanners.FlatAppearance.BorderSize = 2 + Me.rdoColSpanners.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColSpanners.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoColSpanners.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColSpanners.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoColSpanners.Location = New System.Drawing.Point(419, 3) + Me.rdoColSpanners.Name = "rdoColSpanners" + Me.rdoColSpanners.Size = New System.Drawing.Size(91, 29) + Me.rdoColSpanners.TabIndex = 294 + Me.rdoColSpanners.Text = "Spanners" + Me.rdoColSpanners.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColSpanners.UseVisualStyleBackColor = True + ' + 'rdoColLabel + ' + Me.rdoColLabel.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoColLabel.BackColor = System.Drawing.SystemColors.Control + Me.rdoColLabel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoColLabel.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColLabel.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColLabel.FlatAppearance.BorderSize = 2 + Me.rdoColLabel.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoColLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoColLabel.Location = New System.Drawing.Point(65, 3) + Me.rdoColLabel.Name = "rdoColLabel" + Me.rdoColLabel.Size = New System.Drawing.Size(91, 29) + Me.rdoColLabel.TabIndex = 296 + Me.rdoColLabel.Text = "Labels" + Me.rdoColLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColLabel.UseVisualStyleBackColor = True + ' + 'rdoColFootNotes + ' + Me.rdoColFootNotes.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoColFootNotes.BackColor = System.Drawing.SystemColors.Control + Me.rdoColFootNotes.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoColFootNotes.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColFootNotes.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColFootNotes.FlatAppearance.BorderSize = 2 + Me.rdoColFootNotes.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColFootNotes.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoColFootNotes.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColFootNotes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoColFootNotes.Location = New System.Drawing.Point(330, 3) + Me.rdoColFootNotes.Name = "rdoColFootNotes" + Me.rdoColFootNotes.Size = New System.Drawing.Size(91, 29) + Me.rdoColFootNotes.TabIndex = 298 + Me.rdoColFootNotes.Text = "Foot Notes" + Me.rdoColFootNotes.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColFootNotes.UseVisualStyleBackColor = True + ' + 'rdoColWidth + ' + Me.rdoColWidth.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoColWidth.BackColor = System.Drawing.SystemColors.Control + Me.rdoColWidth.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoColWidth.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColWidth.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColWidth.FlatAppearance.BorderSize = 2 + Me.rdoColWidth.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColWidth.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoColWidth.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColWidth.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoColWidth.Location = New System.Drawing.Point(154, 3) + Me.rdoColWidth.Name = "rdoColWidth" + Me.rdoColWidth.Size = New System.Drawing.Size(91, 29) + Me.rdoColWidth.TabIndex = 300 + Me.rdoColWidth.Text = "Width" + Me.rdoColWidth.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColWidth.UseVisualStyleBackColor = True + ' + 'rdoColNanoPlot + ' + Me.rdoColNanoPlot.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoColNanoPlot.BackColor = System.Drawing.SystemColors.Control + Me.rdoColNanoPlot.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoColNanoPlot.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColNanoPlot.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColNanoPlot.FlatAppearance.BorderSize = 2 + Me.rdoColNanoPlot.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColNanoPlot.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoColNanoPlot.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColNanoPlot.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoColNanoPlot.Location = New System.Drawing.Point(508, 3) + Me.rdoColNanoPlot.Name = "rdoColNanoPlot" + Me.rdoColNanoPlot.Size = New System.Drawing.Size(91, 29) + Me.rdoColNanoPlot.TabIndex = 303 + Me.rdoColNanoPlot.Text = "Nano Plot" + Me.rdoColNanoPlot.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColNanoPlot.UseVisualStyleBackColor = True + ' + 'ucrColumnSpanners + ' + Me.ucrColumnSpanners.Location = New System.Drawing.Point(6, 40) + Me.ucrColumnSpanners.Name = "ucrColumnSpanners" + Me.ucrColumnSpanners.Size = New System.Drawing.Size(615, 266) + Me.ucrColumnSpanners.TabIndex = 295 + ' + 'ucrColumnLabels + ' + Me.ucrColumnLabels.Location = New System.Drawing.Point(13, 42) + Me.ucrColumnLabels.Name = "ucrColumnLabels" + Me.ucrColumnLabels.Size = New System.Drawing.Size(575, 262) + Me.ucrColumnLabels.TabIndex = 297 + ' + 'ucrColumnFootNote + ' + Me.ucrColumnFootNote.Location = New System.Drawing.Point(7, 37) + Me.ucrColumnFootNote.Name = "ucrColumnFootNote" + Me.ucrColumnFootNote.Size = New System.Drawing.Size(599, 292) + Me.ucrColumnFootNote.TabIndex = 299 + ' + 'ucrColumnWidth + ' + Me.ucrColumnWidth.Location = New System.Drawing.Point(5, 37) + Me.ucrColumnWidth.Name = "ucrColumnWidth" + Me.ucrColumnWidth.Size = New System.Drawing.Size(613, 267) + Me.ucrColumnWidth.TabIndex = 301 + ' + 'ucrPnlCols + ' + Me.ucrPnlCols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlCols.Location = New System.Drawing.Point(8, 3) + Me.ucrPnlCols.Name = "ucrPnlCols" + Me.ucrPnlCols.Size = New System.Drawing.Size(634, 29) + Me.ucrPnlCols.TabIndex = 289 + ' + 'ucrColumnNanoPlots + ' + Me.ucrColumnNanoPlots.Location = New System.Drawing.Point(8, 42) + Me.ucrColumnNanoPlots.Name = "ucrColumnNanoPlots" + Me.ucrColumnNanoPlots.Size = New System.Drawing.Size(623, 262) + Me.ucrColumnNanoPlots.TabIndex = 304 + ' + 'rdoColStyles + ' + Me.rdoColStyles.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoColStyles.BackColor = System.Drawing.SystemColors.Control + Me.rdoColStyles.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoColStyles.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColStyles.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColStyles.FlatAppearance.BorderSize = 2 + Me.rdoColStyles.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColStyles.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoColStyles.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColStyles.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoColStyles.Location = New System.Drawing.Point(243, 3) + Me.rdoColStyles.Name = "rdoColStyles" + Me.rdoColStyles.Size = New System.Drawing.Size(91, 29) + Me.rdoColStyles.TabIndex = 305 + Me.rdoColStyles.Text = "Styles" + Me.rdoColStyles.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoColStyles.UseVisualStyleBackColor = True + ' + 'ucrColumnStyles + ' + Me.ucrColumnStyles.Location = New System.Drawing.Point(8, 42) + Me.ucrColumnStyles.Name = "ucrColumnStyles" + Me.ucrColumnStyles.Size = New System.Drawing.Size(556, 262) + Me.ucrColumnStyles.TabIndex = 306 + ' + 'ucrColumns + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.rdoColStyles) + Me.Controls.Add(Me.rdoColNanoPlot) + Me.Controls.Add(Me.ucrColumnFootNote) + Me.Controls.Add(Me.ucrColumnWidth) + Me.Controls.Add(Me.rdoColWidth) + Me.Controls.Add(Me.rdoColFootNotes) + Me.Controls.Add(Me.rdoColLabel) + Me.Controls.Add(Me.rdoColSpanners) + Me.Controls.Add(Me.ucrPnlCols) + Me.Controls.Add(Me.ucrColumnNanoPlots) + Me.Controls.Add(Me.ucrColumnStyles) + Me.Controls.Add(Me.ucrColumnSpanners) + Me.Controls.Add(Me.ucrColumnLabels) + Me.Name = "ucrColumns" + Me.Size = New System.Drawing.Size(651, 332) + Me.ResumeLayout(False) + + End Sub + Friend WithEvents ucrPnlCols As UcrPanel + Friend WithEvents rdoColSpanners As RadioButton + Friend WithEvents ucrColumnSpanners As ucrColumnSpanners + Friend WithEvents rdoColLabel As RadioButton + Friend WithEvents ucrColumnLabels As ucrColumnLabels + Friend WithEvents rdoColFootNotes As RadioButton + Friend WithEvents ucrColumnFootNote As ucrColumnFootNote + Friend WithEvents rdoColWidth As RadioButton + Friend WithEvents ucrColumnWidth As ucrColumnWidth + Friend WithEvents rdoColNanoPlot As RadioButton + Friend WithEvents ucrColumnNanoPlots As ucrColumnNanoPlots + Friend WithEvents rdoColStyles As RadioButton + Friend WithEvents ucrColumnStyles As ucrColumnStyles +End Class diff --git a/instat/UserTables/Columns/ucrColumns.resx b/instat/UserTables/Columns/ucrColumns.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumns.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Columns/ucrColumns.vb b/instat/UserTables/Columns/ucrColumns.vb new file mode 100644 index 00000000000..b3c7824fde1 --- /dev/null +++ b/instat/UserTables/Columns/ucrColumns.vb @@ -0,0 +1,55 @@ +Public Class ucrColumns + + Private bFirstload As Boolean = True + + + + Private Sub ucrColumns_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + End Sub + + Private Sub InitialiseDialog() + ucrPnlCols.AddRadioButton(rdoColLabel) + ucrPnlCols.AddRadioButton(rdoColStyles) + ucrPnlCols.AddRadioButton(rdoColWidth) + ucrPnlCols.AddRadioButton(rdoColFootNotes) + ucrPnlCols.AddRadioButton(rdoColSpanners) + + ' TODO. Nonplots disabled until R is upgraded + 'ucrPnlCols.AddRadioButton(rdoColNanoPlot) + rdoColNanoPlot.Enabled = False + + rdoColLabel.Checked = True + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + ucrColumnLabels.Setup(strDataFrameName, clsOperator) + ucrColumnStyles.Setup(strDataFrameName, clsOperator) + ucrColumnWidth.Setup(strDataFrameName, clsOperator) + ucrColumnFootNote.Setup(strDataFrameName, clsOperator) + ucrColumnSpanners.Setup(strDataFrameName, clsOperator) + ucrColumnNanoPlots.Setup(strDataFrameName, clsOperator) + End Sub + + Private Sub ucrPnlCols_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCols.ControlValueChanged + ucrColumnLabels.Visible = rdoColLabel.Checked + ucrColumnStyles.Visible = rdoColStyles.Checked + ucrColumnWidth.Visible = rdoColWidth.Checked + ucrColumnFootNote.Visible = rdoColFootNotes.Checked + ucrColumnSpanners.Visible = rdoColSpanners.Checked + ucrColumnNanoPlots.Visible = rdoColNanoPlot.Checked + End Sub + + Public Sub SetValuesToOperator() + ucrColumnLabels.SetValuesToOperator() + ucrColumnStyles.SetValuesToOperator() + ucrColumnWidth.SetValuesToOperator() + ucrColumnFootNote.SetValuesToOperator() + ucrColumnSpanners.SetValuesToOperator() + ucrColumnNanoPlots.SetValuesToOperator() + End Sub + +End Class diff --git a/instat/UserTables/Header/ucrHeader.Designer.vb b/instat/UserTables/Header/ucrHeader.Designer.vb new file mode 100644 index 00000000000..ebd3b82dd80 --- /dev/null +++ b/instat/UserTables/Header/ucrHeader.Designer.vb @@ -0,0 +1,202 @@ + _ +Partial Class ucrHeader + 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.ucrInputSubtitleFooter = New instat.ucrInputTextBox() + Me.ucrInputTitleFooter = New instat.ucrInputTextBox() + Me.lblHeaderSubtitle = New System.Windows.Forms.Label() + Me.lblHeaderTitle = New System.Windows.Forms.Label() + Me.btnSubTitleStyle = New System.Windows.Forms.Button() + Me.btnTitleStyle = New System.Windows.Forms.Button() + Me.ucrInputSubtitle = New instat.ucrInputTextBox() + Me.ucrInputTitle = New instat.ucrInputTextBox() + Me.lblSubtitle = New System.Windows.Forms.Label() + Me.lblTitle = New System.Windows.Forms.Label() + Me.grpBoxTitle = New System.Windows.Forms.GroupBox() + Me.grpBoxSubtitle = New System.Windows.Forms.GroupBox() + Me.grpBoxTitle.SuspendLayout() + Me.grpBoxSubtitle.SuspendLayout() + Me.SuspendLayout() + ' + 'ucrInputSubtitleFooter + ' + Me.ucrInputSubtitleFooter.AddQuotesIfUnrecognised = True + Me.ucrInputSubtitleFooter.AutoSize = True + Me.ucrInputSubtitleFooter.IsMultiline = False + Me.ucrInputSubtitleFooter.IsReadOnly = False + Me.ucrInputSubtitleFooter.Location = New System.Drawing.Point(9, 88) + Me.ucrInputSubtitleFooter.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputSubtitleFooter.Name = "ucrInputSubtitleFooter" + Me.ucrInputSubtitleFooter.Size = New System.Drawing.Size(361, 21) + Me.ucrInputSubtitleFooter.TabIndex = 23 + ' + 'ucrInputTitleFooter + ' + Me.ucrInputTitleFooter.AddQuotesIfUnrecognised = True + Me.ucrInputTitleFooter.AutoSize = True + Me.ucrInputTitleFooter.IsMultiline = False + Me.ucrInputTitleFooter.IsReadOnly = False + Me.ucrInputTitleFooter.Location = New System.Drawing.Point(11, 89) + Me.ucrInputTitleFooter.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputTitleFooter.Name = "ucrInputTitleFooter" + Me.ucrInputTitleFooter.Size = New System.Drawing.Size(359, 21) + Me.ucrInputTitleFooter.TabIndex = 22 + ' + 'lblHeaderSubtitle + ' + Me.lblHeaderSubtitle.AutoSize = True + Me.lblHeaderSubtitle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblHeaderSubtitle.Location = New System.Drawing.Point(6, 72) + Me.lblHeaderSubtitle.Name = "lblHeaderSubtitle" + Me.lblHeaderSubtitle.Size = New System.Drawing.Size(78, 13) + Me.lblHeaderSubtitle.TabIndex = 21 + Me.lblHeaderSubtitle.Text = "Subtitle Footer:" + ' + 'lblHeaderTitle + ' + Me.lblHeaderTitle.AutoSize = True + Me.lblHeaderTitle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblHeaderTitle.Location = New System.Drawing.Point(8, 72) + Me.lblHeaderTitle.Name = "lblHeaderTitle" + Me.lblHeaderTitle.Size = New System.Drawing.Size(63, 13) + Me.lblHeaderTitle.TabIndex = 20 + Me.lblHeaderTitle.Text = "Title Footer:" + ' + 'btnSubTitleStyle + ' + Me.btnSubTitleStyle.Location = New System.Drawing.Point(372, 40) + Me.btnSubTitleStyle.Name = "btnSubTitleStyle" + Me.btnSubTitleStyle.Size = New System.Drawing.Size(75, 23) + Me.btnSubTitleStyle.TabIndex = 31 + Me.btnSubTitleStyle.Text = "Style" + Me.btnSubTitleStyle.UseVisualStyleBackColor = True + ' + 'btnTitleStyle + ' + Me.btnTitleStyle.Location = New System.Drawing.Point(374, 42) + Me.btnTitleStyle.Name = "btnTitleStyle" + Me.btnTitleStyle.Size = New System.Drawing.Size(79, 23) + Me.btnTitleStyle.TabIndex = 30 + Me.btnTitleStyle.Text = "Style" + Me.btnTitleStyle.UseVisualStyleBackColor = True + ' + 'ucrInputSubtitle + ' + Me.ucrInputSubtitle.AddQuotesIfUnrecognised = True + Me.ucrInputSubtitle.AutoSize = True + Me.ucrInputSubtitle.IsMultiline = False + Me.ucrInputSubtitle.IsReadOnly = False + Me.ucrInputSubtitle.Location = New System.Drawing.Point(9, 42) + Me.ucrInputSubtitle.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputSubtitle.Name = "ucrInputSubtitle" + Me.ucrInputSubtitle.Size = New System.Drawing.Size(361, 21) + Me.ucrInputSubtitle.TabIndex = 29 + ' + 'ucrInputTitle + ' + Me.ucrInputTitle.AddQuotesIfUnrecognised = True + Me.ucrInputTitle.AutoSize = True + Me.ucrInputTitle.IsMultiline = False + Me.ucrInputTitle.IsReadOnly = False + Me.ucrInputTitle.Location = New System.Drawing.Point(11, 42) + Me.ucrInputTitle.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputTitle.Name = "ucrInputTitle" + Me.ucrInputTitle.Size = New System.Drawing.Size(359, 21) + Me.ucrInputTitle.TabIndex = 28 + ' + 'lblSubtitle + ' + Me.lblSubtitle.AutoSize = True + Me.lblSubtitle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSubtitle.Location = New System.Drawing.Point(6, 25) + Me.lblSubtitle.Name = "lblSubtitle" + Me.lblSubtitle.Size = New System.Drawing.Size(74, 13) + Me.lblSubtitle.TabIndex = 27 + Me.lblSubtitle.Text = "Subtitle Label:" + ' + 'lblTitle + ' + Me.lblTitle.AutoSize = True + Me.lblTitle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblTitle.Location = New System.Drawing.Point(8, 22) + Me.lblTitle.Name = "lblTitle" + Me.lblTitle.Size = New System.Drawing.Size(59, 13) + Me.lblTitle.TabIndex = 26 + Me.lblTitle.Text = "Title Label:" + ' + 'grpBoxTitle + ' + Me.grpBoxTitle.Controls.Add(Me.lblTitle) + Me.grpBoxTitle.Controls.Add(Me.ucrInputTitle) + Me.grpBoxTitle.Controls.Add(Me.btnTitleStyle) + Me.grpBoxTitle.Controls.Add(Me.lblHeaderTitle) + Me.grpBoxTitle.Controls.Add(Me.ucrInputTitleFooter) + Me.grpBoxTitle.Location = New System.Drawing.Point(4, 5) + Me.grpBoxTitle.Name = "grpBoxTitle" + Me.grpBoxTitle.Size = New System.Drawing.Size(463, 115) + Me.grpBoxTitle.TabIndex = 32 + Me.grpBoxTitle.TabStop = False + Me.grpBoxTitle.Text = "Title" + ' + 'grpBoxSubtitle + ' + Me.grpBoxSubtitle.Controls.Add(Me.lblHeaderSubtitle) + Me.grpBoxSubtitle.Controls.Add(Me.ucrInputSubtitleFooter) + Me.grpBoxSubtitle.Controls.Add(Me.btnSubTitleStyle) + Me.grpBoxSubtitle.Controls.Add(Me.ucrInputSubtitle) + Me.grpBoxSubtitle.Controls.Add(Me.lblSubtitle) + Me.grpBoxSubtitle.Location = New System.Drawing.Point(4, 125) + Me.grpBoxSubtitle.Name = "grpBoxSubtitle" + Me.grpBoxSubtitle.Size = New System.Drawing.Size(463, 116) + Me.grpBoxSubtitle.TabIndex = 33 + Me.grpBoxSubtitle.TabStop = False + Me.grpBoxSubtitle.Text = "Subtitle" + ' + 'ucrHeader + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.grpBoxSubtitle) + Me.Controls.Add(Me.grpBoxTitle) + Me.Name = "ucrHeader" + Me.Size = New System.Drawing.Size(470, 246) + Me.grpBoxTitle.ResumeLayout(False) + Me.grpBoxTitle.PerformLayout() + Me.grpBoxSubtitle.ResumeLayout(False) + Me.grpBoxSubtitle.PerformLayout() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents ucrInputSubtitleFooter As ucrInputTextBox + Friend WithEvents ucrInputTitleFooter As ucrInputTextBox + Friend WithEvents lblHeaderSubtitle As Label + Friend WithEvents lblHeaderTitle As Label + Friend WithEvents btnSubTitleStyle As Button + Friend WithEvents btnTitleStyle As Button + Friend WithEvents ucrInputSubtitle As ucrInputTextBox + Friend WithEvents ucrInputTitle As ucrInputTextBox + Friend WithEvents lblSubtitle As Label + Friend WithEvents lblTitle As Label + Friend WithEvents grpBoxTitle As GroupBox + Friend WithEvents grpBoxSubtitle As GroupBox +End Class diff --git a/instat/UserTables/Header/ucrHeader.resx b/instat/UserTables/Header/ucrHeader.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Header/ucrHeader.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Header/ucrHeader.vb b/instat/UserTables/Header/ucrHeader.vb new file mode 100644 index 00000000000..1be15500eee --- /dev/null +++ b/instat/UserTables/Header/ucrHeader.vb @@ -0,0 +1,183 @@ + +Public Class ucrHeader + Private clsOperator As New ROperator + Private clsHeaderRFunction, clsTitleFooterRFunction, clsSubtitleFooterRFunction, clsTitleLocationRFunction, clsSubtitleLocationRFunction, clsTitleStyleRFunction, clsSubtitleStyleRFunction As New RFunction + + + Private bFirstload As Boolean = True + + Private Sub InitialiseDialog() + + ucrInputTitle.SetParameter(New RParameter("title", iNewPosition:=0)) + + ucrInputSubtitle.SetParameter(New RParameter("subtitle", iNewPosition:=1)) + + ucrInputTitleFooter.SetParameter(New RParameter("footnote", iNewPosition:=0)) + + ucrInputSubtitleFooter.SetParameter(New RParameter("footnote", iNewPosition:=0)) + + End Sub + + Public Sub Setup(clsOperator As ROperator) + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + SetRFunctions(clsOperator) + SetRCode() + + End Sub + + Private Sub SetRFunctions(clsOperator As ROperator) + + clsHeaderRFunction = Nothing + clsTitleStyleRFunction = Nothing + clsSubtitleStyleRFunction = Nothing + clsTitleLocationRFunction = Nothing + clsSubtitleLocationRFunction = Nothing + clsTitleFooterRFunction = Nothing + clsSubtitleFooterRFunction = Nothing + + '-------------- + ' Set up the header R function for title and subtitle + clsHeaderRFunction = clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_header"}, clsOperator).FirstOrDefault()?.clsArgumentCodeStructure + If clsHeaderRFunction Is Nothing Then + clsHeaderRFunction = New RFunction + clsHeaderRFunction.SetPackageName("gt") + clsHeaderRFunction.SetRCommand("tab_header") + End If + '-------------- + + '-------------- + ' Set up the title and subtitle styles R function + Dim lstTabStyleForRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_title", clsOperator) + For Each clsTabStyleRParam As RParameter In lstTabStyleForRParams + For Each clsStyleLocationParam As RParameter In clsTabStyleRParam.clsArgumentCodeStructure.clsParameters + If clsStyleLocationParam.strArgumentName = "locations" AndAlso clsStyleLocationParam.clsArgumentCodeStructure.ContainsParameter("groups") Then + If clsTablesUtils.GetStringValue(clsStyleLocationParam.clsArgumentCodeStructure.GetParameter("groups").strArgumentValue, False) = "title" Then + clsTitleStyleRFunction = clsTabStyleRParam.clsArgumentCodeStructure + clsTitleLocationRFunction = clsStyleLocationParam.clsArgumentCodeStructure + ElseIf clsTablesUtils.GetStringValue(clsStyleLocationParam.clsArgumentCodeStructure.GetParameter("groups").strArgumentValue, False) = "subtitle" Then + clsSubtitleStyleRFunction = clsTabStyleRParam.clsArgumentCodeStructure + clsSubtitleLocationRFunction = clsStyleLocationParam.clsArgumentCodeStructure + End If + End If + Next + Next + '-------------- + + '-------------- + ' Set up the title footer and subtitle footer, locations R function + Dim lstTabFootNoteRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_footnote"}, "locations", "cells_title", clsOperator) + For Each clsTabFootNoteRParam As RParameter In lstTabFootNoteRParams + For Each clsFooterParam As RParameter In clsTabFootNoteRParam.clsArgumentCodeStructure.clsParameters + If clsFooterParam.strArgumentName = "locations" AndAlso clsFooterParam.clsArgumentCodeStructure.ContainsParameter("groups") Then + If clsTablesUtils.GetStringValue(clsFooterParam.clsArgumentCodeStructure.GetParameter("groups").strArgumentValue, False) = "title" Then + clsTitleFooterRFunction = clsTabFootNoteRParam.clsArgumentCodeStructure + clsTitleLocationRFunction = clsFooterParam.clsArgumentCodeStructure + ElseIf clsTablesUtils.GetStringValue(clsFooterParam.clsArgumentCodeStructure.GetParameter("groups").strArgumentValue, False) = "subtitle" Then + clsSubtitleFooterRFunction = clsTabFootNoteRParam.clsArgumentCodeStructure + clsSubtitleLocationRFunction = clsFooterParam.clsArgumentCodeStructure + End If + End If + Next + Next + + If clsTitleFooterRFunction Is Nothing Then + clsTitleLocationRFunction = GetNewCellsTitleRFunction("title") + clsTitleFooterRFunction = New RFunction + + clsTitleFooterRFunction.SetPackageName("gt") + clsTitleFooterRFunction.SetRCommand("tab_footnote") + clsTitleFooterRFunction.AddParameter(strParameterName:="locations", clsRFunctionParameter:=clsTitleLocationRFunction, iPosition:=1) + + End If + + If clsSubtitleFooterRFunction Is Nothing Then + clsSubtitleLocationRFunction = GetNewCellsTitleRFunction("subtitle") + clsSubtitleFooterRFunction = New RFunction + + + clsSubtitleFooterRFunction.SetPackageName("gt") + clsSubtitleFooterRFunction.SetRCommand("tab_footnote") + clsSubtitleFooterRFunction.AddParameter(strParameterName:="locations", clsRFunctionParameter:=clsSubtitleLocationRFunction, iPosition:=1) + End If + '-------------- + End Sub + + Private Function GetNewCellsTitleRFunction(strGroupParamValue As String) + Dim clsCellsTitleRFunction As New RFunction + clsCellsTitleRFunction.SetPackageName("gt") + clsCellsTitleRFunction.SetRCommand("cells_title") + clsCellsTitleRFunction.AddParameter(strParameterName:="groups", strParameterValue:=Chr(34) & strGroupParamValue & Chr(34), iPosition:=0) + Return clsCellsTitleRFunction + End Function + + Private Sub SetRCode() + + ucrInputTitle.SetRCode(clsHeaderRFunction, True, bCloneIfNeeded:=True) + ucrInputSubtitle.SetRCode(clsHeaderRFunction, True, bCloneIfNeeded:=True) + + ucrInputTitleFooter.SetRCode(clsTitleFooterRFunction, True, bCloneIfNeeded:=True) + ucrInputSubtitleFooter.SetRCode(clsSubtitleFooterRFunction, True, bCloneIfNeeded:=True) + + End Sub + + Private Sub btnTitleFormat_Click(sender As Object, e As EventArgs) Handles btnTitleStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm, clsTitleStyleRFunction) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + clsTitleStyleRFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsTitleLocationRFunction) + End Sub + + + Private Sub btnSubtitleFormat_Click(sender As Object, e As EventArgs) Handles btnSubTitleStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm, clsSubtitleStyleRFunction) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + clsSubtitleStyleRFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsSubtitleLocationRFunction) + End Sub + + Private Sub ucrInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputTitle.ControlContentsChanged, ucrInputTitleFooter.ControlContentsChanged, ucrInputSubtitle.ControlContentsChanged, ucrInputSubtitleFooter.ControlContentsChanged + ucrInputTitleFooter.Enabled = Not ucrInputTitle.IsEmpty() + ucrInputSubtitle.Enabled = Not ucrInputTitle.IsEmpty() + ucrInputSubtitleFooter.Enabled = ucrInputSubtitle.Enabled AndAlso Not ucrInputSubtitle.IsEmpty() + End Sub + + Public Sub SetValuesToOperator() + ' Remove any previous header parameters + clsTablesUtils.RemoveRFunctionsParamsWithRCommand({"tab_header"}, clsOperator) + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_footnote", "tab_style"}, "locations", "cells_title", clsOperator), clsOperator) + + ' Add new changes + If Not ucrInputTitle.IsEmpty Then + clsOperator.AddParameter(strParameterName:="tab_header_param", clsRFunctionParameter:=clsHeaderRFunction) + + If ucrInputTitleFooter.Enabled AndAlso Not ucrInputTitleFooter.IsEmpty Then + clsOperator.AddParameter(strParameterName:="tab_footer_for_tile_param", clsRFunctionParameter:=clsTitleFooterRFunction) + End If + + If ucrInputSubtitleFooter.Enabled AndAlso Not ucrInputSubtitleFooter.IsEmpty Then + clsOperator.AddParameter(strParameterName:="tab_footer_for_subtitle_param", clsRFunctionParameter:=clsSubtitleFooterRFunction) + End If + + End If + + If clsTitleStyleRFunction IsNot Nothing Then + clsOperator.AddParameter(strParameterName:="tab_style_for_title_param", clsRFunctionParameter:=clsTitleStyleRFunction) + End If + + If clsSubtitleStyleRFunction IsNot Nothing Then + clsOperator.AddParameter(strParameterName:="tab_style_for_subtitle_param", clsRFunctionParameter:=clsSubtitleStyleRFunction) + End If + + End Sub + +End Class diff --git a/instat/UserTables/Others/ucrOtherStyles.Designer.vb b/instat/UserTables/Others/ucrOtherStyles.Designer.vb new file mode 100644 index 00000000000..a86909180fc --- /dev/null +++ b/instat/UserTables/Others/ucrOtherStyles.Designer.vb @@ -0,0 +1,137 @@ + _ +Partial Class ucrOtherStyles + 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.cboLocation = New System.Windows.Forms.ComboBox() + Me.lblLocation = New System.Windows.Forms.Label() + Me.lblFormats = New System.Windows.Forms.Label() + Me.btnClearStyles = New System.Windows.Forms.Button() + Me.btnEnterStyle = New System.Windows.Forms.Button() + Me.dataGridStyles = New System.Windows.Forms.DataGridView() + Me.colLocation = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colStyles = New System.Windows.Forms.DataGridViewTextBoxColumn() + CType(Me.dataGridStyles, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'cboLocation + ' + Me.cboLocation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cboLocation.FormattingEnabled = True + Me.cboLocation.Items.AddRange(New Object() {"Foot Notes", "Souce Notes"}) + Me.cboLocation.Location = New System.Drawing.Point(7, 20) + Me.cboLocation.Name = "cboLocation" + Me.cboLocation.Size = New System.Drawing.Size(127, 21) + Me.cboLocation.TabIndex = 311 + ' + 'lblLocation + ' + Me.lblLocation.AutoSize = True + Me.lblLocation.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLocation.Location = New System.Drawing.Point(5, 3) + Me.lblLocation.Name = "lblLocation" + Me.lblLocation.Size = New System.Drawing.Size(84, 13) + Me.lblLocation.TabIndex = 310 + Me.lblLocation.Text = "Select Location:" + ' + 'lblFormats + ' + Me.lblFormats.AutoSize = True + Me.lblFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFormats.Location = New System.Drawing.Point(5, 83) + Me.lblFormats.Name = "lblFormats" + Me.lblFormats.Size = New System.Drawing.Size(38, 13) + Me.lblFormats.TabIndex = 330 + Me.lblFormats.Text = "Styles:" + ' + 'btnClearStyles + ' + Me.btnClearStyles.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearStyles.Location = New System.Drawing.Point(244, 74) + Me.btnClearStyles.Name = "btnClearStyles" + Me.btnClearStyles.Size = New System.Drawing.Size(75, 23) + Me.btnClearStyles.TabIndex = 328 + Me.btnClearStyles.Tag = "" + Me.btnClearStyles.Text = "Clear" + Me.btnClearStyles.UseVisualStyleBackColor = True + ' + 'btnEnterStyle + ' + Me.btnEnterStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnEnterStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnEnterStyle.Location = New System.Drawing.Point(8, 50) + Me.btnEnterStyle.Name = "btnEnterStyle" + Me.btnEnterStyle.Size = New System.Drawing.Size(126, 23) + Me.btnEnterStyle.TabIndex = 327 + Me.btnEnterStyle.Tag = "" + Me.btnEnterStyle.Text = "Enter Style" + Me.btnEnterStyle.UseVisualStyleBackColor = True + ' + 'dataGridStyles + ' + Me.dataGridStyles.AllowUserToAddRows = False + Me.dataGridStyles.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridStyles.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colLocation, Me.colStyles}) + Me.dataGridStyles.Location = New System.Drawing.Point(8, 100) + Me.dataGridStyles.Name = "dataGridStyles" + Me.dataGridStyles.RowHeadersWidth = 62 + Me.dataGridStyles.Size = New System.Drawing.Size(315, 73) + Me.dataGridStyles.TabIndex = 329 + ' + 'colLocation + ' + Me.colLocation.HeaderText = "Location" + Me.colLocation.Name = "colLocation" + ' + 'colStyles + ' + Me.colStyles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colStyles.HeaderText = "Style Expressions" + Me.colStyles.MinimumWidth = 8 + Me.colStyles.Name = "colStyles" + ' + 'ucrOtherStyles + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.lblFormats) + Me.Controls.Add(Me.btnClearStyles) + Me.Controls.Add(Me.btnEnterStyle) + Me.Controls.Add(Me.dataGridStyles) + Me.Controls.Add(Me.cboLocation) + Me.Controls.Add(Me.lblLocation) + Me.Name = "ucrOtherStyles" + Me.Size = New System.Drawing.Size(326, 179) + CType(Me.dataGridStyles, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents cboLocation As ComboBox + Friend WithEvents lblLocation As Label + Friend WithEvents lblFormats As Label + Friend WithEvents btnClearStyles As Button + Friend WithEvents btnEnterStyle As Button + Friend WithEvents dataGridStyles As DataGridView + Friend WithEvents colLocation As DataGridViewTextBoxColumn + Friend WithEvents colStyles As DataGridViewTextBoxColumn +End Class diff --git a/instat/UserTables/Others/ucrOtherStyles.resx b/instat/UserTables/Others/ucrOtherStyles.resx new file mode 100644 index 00000000000..57eb4184f91 --- /dev/null +++ b/instat/UserTables/Others/ucrOtherStyles.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Others/ucrOtherStyles.vb b/instat/UserTables/Others/ucrOtherStyles.vb new file mode 100644 index 00000000000..1835dc7e969 --- /dev/null +++ b/instat/UserTables/Others/ucrOtherStyles.vb @@ -0,0 +1,94 @@ +Public Class ucrOtherStyles + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Private Sub ucrOtherStyles_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + End Sub + + Private Sub InitialiseControl() + cboLocation.SelectedIndex = 0 + End Sub + + Public Sub Setup(clsOperator As ROperator) + Me.clsOperator = clsOperator + + ' Clear and Set up the data grid with contents + dataGridStyles.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_footnotes", clsOperator), "Foot Notes") + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_source_notes", clsOperator), "Souce Notes") + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter), strLocation As String) + For Each clsRParam As RParameter In lstRParams + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGridStyles) + row.Cells(0).Value = strLocation + row.Cells(1).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the tab_style() parameter function contents as a row + row.Tag = clsRParam + dataGridStyles.Rows.Add(row) + Next + End Sub + + Private Sub btnEnterStyle_Click(sender As Object, e As EventArgs) Handles btnEnterStyle.Click + + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + + If cboLocation.Text = "Foot Notes" Then + clsLocationsRFunction.SetRCommand("cells_footnotes") + + ElseIf cboLocation.Text = "Souce Notes" Then + clsLocationsRFunction.SetRCommand("cells_source_notes") + Else + Exit Sub + End If + + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="tab_style_others_param" & (dataGridStyles.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + Dim row As DataGridViewRow = Nothing + + ' Update location style if it exists + For Each existingRow As DataGridViewRow In dataGridStyles.Rows + If existingRow.Cells(0).Value = cboLocation.Text Then + row = existingRow + row.Cells(1).Value = clsTabStyleRFunction.Clone.ToScript + row.Tag = clsRParam + Exit For + End If + Next + + ' If it does not exist then add new column label + If row Is Nothing Then + row = New DataGridViewRow + row.CreateCells(dataGridStyles) + row.Cells(0).Value = cboLocation.Text + row.Cells(1).Value = clsTabStyleRFunction.Clone.ToScript + row.Tag = clsRParam + dataGridStyles.Rows.Add(row) + End If + End Sub + + Private Sub btnClearStyle_Click(sender As Object, e As EventArgs) Handles btnClearStyles.Click + dataGridStyles.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_footnotes", clsOperator), clsOperator) + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_source_notes", clsOperator), clsOperator) + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGridStyles, clsOperator) + End Sub +End Class diff --git a/instat/UserTables/Rows/ucrRowExpression.Designer.vb b/instat/UserTables/Rows/ucrRowExpression.Designer.vb new file mode 100644 index 00000000000..b071abd1f57 --- /dev/null +++ b/instat/UserTables/Rows/ucrRowExpression.Designer.vb @@ -0,0 +1,52 @@ + _ +Partial Class ucrRowExpression + 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.ucrInputExpression = New instat.ucrInputTextBox() + Me.SuspendLayout() + ' + 'ucrInputExpression + ' + Me.ucrInputExpression.AddQuotesIfUnrecognised = True + Me.ucrInputExpression.AutoSize = True + Me.ucrInputExpression.Dock = System.Windows.Forms.DockStyle.Fill + Me.ucrInputExpression.IsMultiline = False + Me.ucrInputExpression.IsReadOnly = False + Me.ucrInputExpression.Location = New System.Drawing.Point(0, 0) + Me.ucrInputExpression.Name = "ucrInputExpression" + Me.ucrInputExpression.Size = New System.Drawing.Size(146, 21) + Me.ucrInputExpression.TabIndex = 340 + ' + 'ucrRowExpression + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrInputExpression) + Me.Name = "ucrRowExpression" + Me.Size = New System.Drawing.Size(146, 21) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents ucrInputExpression As ucrInputTextBox +End Class diff --git a/instat/UserTables/Rows/ucrRowExpression.resx b/instat/UserTables/Rows/ucrRowExpression.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Rows/ucrRowExpression.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Rows/ucrRowExpression.vb b/instat/UserTables/Rows/ucrRowExpression.vb new file mode 100644 index 00000000000..8965ad550fb --- /dev/null +++ b/instat/UserTables/Rows/ucrRowExpression.vb @@ -0,0 +1,61 @@ +Public Class ucrRowExpression + + Public Event ControlContentsChanged(ucrChangedControl As ucrCore) + Private strDataFrameName As String + Private bFirstload As Boolean = True + + Private Sub UcrInputRowExpression_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + End Sub + + Private Sub InitialiseControl() + Dim btnOptions As New Button + 'add the button to the comment textbox first + ucrInputExpression.txtInput.Controls.Clear() + ucrInputExpression.txtInput.Controls.Add(btnOptions) + + 'then set the button properties + btnOptions.Text = ":::" 'temp. This will be shown as centered ... An image as below commended code is preferred + 'btn.Image = Image.FromFile("C:\patowhiz\3dots.png") + btnOptions.Size = New Size(25, ucrInputExpression.txtInput.ClientSize.Height + 2) + btnOptions.TextAlign = ContentAlignment.TopCenter + btnOptions.FlatStyle = FlatStyle.Standard + btnOptions.FlatAppearance.BorderSize = 0 + btnOptions.Cursor = Cursors.Default + btnOptions.Dock = DockStyle.Right + 'btnOptions.BackColor = Parent.BackColor + btnOptions.UseVisualStyleBackColor = True + + 'set the btn event handler + AddHandler btnOptions.Click, Sub() + sdgTableRowExpression.Setup(strDataFrameName) + sdgTableRowExpression.ShowDialog(Me.ParentForm) + If sdgTableRowExpression.bUserClickedReturn Then + ucrInputExpression.SetName(sdgTableRowExpression.GetUserInputRowExpression()) + End If + End Sub + End Sub + + Public Sub Setup(strDataFrameName As String) + Me.strDataFrameName = strDataFrameName + End Sub + + Public Function IsEmpty() As Boolean + Return ucrInputExpression.IsEmpty() + End Function + + Public Function GetText() As String + Return ucrInputExpression.GetText() + End Function + + Public Sub Clear() + ucrInputExpression.SetName("") + End Sub + + Private Sub ucrInputExpression_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputExpression.ControlContentsChanged + RaiseEvent ControlContentsChanged(ucrChangedControl) + End Sub +End Class diff --git a/instat/UserTables/Rows/ucrRowGroup.Designer.vb b/instat/UserTables/Rows/ucrRowGroup.Designer.vb new file mode 100644 index 00000000000..187eb8e2181 --- /dev/null +++ b/instat/UserTables/Rows/ucrRowGroup.Designer.vb @@ -0,0 +1,212 @@ + +Partial Class ucrRowGroup + 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.dataGridGroups = New System.Windows.Forms.DataGridView() + Me.btnClearGroups = New System.Windows.Forms.Button() + Me.btnAddCondition = New System.Windows.Forms.Button() + Me.lblGroups = New System.Windows.Forms.Label() + Me.lblCondition = New System.Windows.Forms.Label() + Me.ucrInputGroupLabel = New instat.ucrInputTextBox() + Me.btnStyle = New System.Windows.Forms.Button() + Me.ucrRowExpression = New instat.ucrRowExpression() + Me.lblGroupExpression = New System.Windows.Forms.Label() + Me.colId = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colLabel = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colCodnition = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colStyleExpression = New System.Windows.Forms.DataGridViewTextBoxColumn() + CType(Me.dataGridGroups, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'dataGridGroups + ' + Me.dataGridGroups.AllowUserToAddRows = False + Me.dataGridGroups.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridGroups.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colId, Me.colLabel, Me.colCodnition, Me.colStyleExpression}) + Me.dataGridGroups.Location = New System.Drawing.Point(12, 249) + Me.dataGridGroups.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.dataGridGroups.Name = "dataGridGroups" + Me.dataGridGroups.ReadOnly = True + Me.dataGridGroups.RowHeadersWidth = 62 + Me.dataGridGroups.Size = New System.Drawing.Size(484, 146) + Me.dataGridGroups.TabIndex = 11 + ' + 'btnClearGroups + ' + Me.btnClearGroups.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearGroups.Location = New System.Drawing.Point(368, 204) + Me.btnClearGroups.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnClearGroups.Name = "btnClearGroups" + Me.btnClearGroups.Size = New System.Drawing.Size(118, 35) + Me.btnClearGroups.TabIndex = 30 + Me.btnClearGroups.Tag = "" + Me.btnClearGroups.Text = "Clear" + Me.btnClearGroups.UseVisualStyleBackColor = True + ' + 'btnAddCondition + ' + Me.btnAddCondition.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAddCondition.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAddCondition.Location = New System.Drawing.Point(13, 170) + Me.btnAddCondition.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnAddCondition.Name = "btnAddCondition" + Me.btnAddCondition.Size = New System.Drawing.Size(144, 35) + Me.btnAddCondition.TabIndex = 25 + Me.btnAddCondition.Tag = "" + Me.btnAddCondition.Text = "Add" + Me.btnAddCondition.UseVisualStyleBackColor = True + ' + 'lblGroups + ' + Me.lblGroups.AutoSize = True + Me.lblGroups.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblGroups.Location = New System.Drawing.Point(7, 220) + Me.lblGroups.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblGroups.Name = "lblGroups" + Me.lblGroups.Size = New System.Drawing.Size(66, 20) + Me.lblGroups.TabIndex = 32 + Me.lblGroups.Text = "Groups:" + ' + 'lblCondition + ' + Me.lblCondition.AutoSize = True + Me.lblCondition.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblCondition.Location = New System.Drawing.Point(9, 8) + Me.lblCondition.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblCondition.Name = "lblCondition" + Me.lblCondition.Size = New System.Drawing.Size(101, 20) + Me.lblCondition.TabIndex = 282 + Me.lblCondition.Text = "Group Label:" + ' + 'ucrInputGroupLabel + ' + Me.ucrInputGroupLabel.AddQuotesIfUnrecognised = True + Me.ucrInputGroupLabel.AutoSize = True + Me.ucrInputGroupLabel.IsMultiline = False + Me.ucrInputGroupLabel.IsReadOnly = False + Me.ucrInputGroupLabel.Location = New System.Drawing.Point(8, 34) + Me.ucrInputGroupLabel.Margin = New System.Windows.Forms.Padding(14) + Me.ucrInputGroupLabel.Name = "ucrInputGroupLabel" + Me.ucrInputGroupLabel.Size = New System.Drawing.Size(180, 32) + Me.ucrInputGroupLabel.TabIndex = 308 + ' + 'btnStyle + ' + Me.btnStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnStyle.Location = New System.Drawing.Point(210, 101) + Me.btnStyle.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnStyle.Name = "btnStyle" + Me.btnStyle.Size = New System.Drawing.Size(74, 35) + Me.btnStyle.TabIndex = 309 + Me.btnStyle.Tag = "" + Me.btnStyle.Text = "Style" + Me.btnStyle.UseVisualStyleBackColor = True + ' + 'ucrRowExpression + ' + Me.ucrRowExpression.Location = New System.Drawing.Point(13, 108) + Me.ucrRowExpression.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrRowExpression.Name = "ucrRowExpression" + Me.ucrRowExpression.Size = New System.Drawing.Size(186, 38) + Me.ucrRowExpression.TabIndex = 333 + ' + 'lblGroupExpression + ' + Me.lblGroupExpression.AutoSize = True + Me.lblGroupExpression.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblGroupExpression.Location = New System.Drawing.Point(9, 80) + Me.lblGroupExpression.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblGroupExpression.Name = "lblGroupExpression" + Me.lblGroupExpression.Size = New System.Drawing.Size(129, 20) + Me.lblGroupExpression.TabIndex = 334 + Me.lblGroupExpression.Text = "Group Condition:" + ' + 'colId + ' + Me.colId.HeaderText = "Id" + Me.colId.MinimumWidth = 8 + Me.colId.Name = "colId" + Me.colId.ReadOnly = True + Me.colId.Width = 70 + ' + 'colLabel + ' + Me.colLabel.HeaderText = "Label" + Me.colLabel.MinimumWidth = 8 + Me.colLabel.Name = "colLabel" + Me.colLabel.ReadOnly = True + Me.colLabel.Width = 70 + ' + 'colCodnition + ' + Me.colCodnition.HeaderText = "Condition" + Me.colCodnition.MinimumWidth = 8 + Me.colCodnition.Name = "colCodnition" + Me.colCodnition.ReadOnly = True + Me.colCodnition.Width = 90 + ' + 'colStyleExpression + ' + Me.colStyleExpression.HeaderText = "Style Expression" + Me.colStyleExpression.MinimumWidth = 8 + Me.colStyleExpression.Name = "colStyleExpression" + Me.colStyleExpression.ReadOnly = True + Me.colStyleExpression.Width = 90 + ' + 'ucrRowGroup + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.lblGroupExpression) + Me.Controls.Add(Me.ucrRowExpression) + Me.Controls.Add(Me.btnStyle) + Me.Controls.Add(Me.ucrInputGroupLabel) + Me.Controls.Add(Me.lblCondition) + Me.Controls.Add(Me.lblGroups) + Me.Controls.Add(Me.btnClearGroups) + Me.Controls.Add(Me.btnAddCondition) + Me.Controls.Add(Me.dataGridGroups) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "ucrRowGroup" + Me.Size = New System.Drawing.Size(507, 403) + CType(Me.dataGridGroups, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents dataGridGroups As DataGridView + Friend WithEvents btnClearGroups As Button + Friend WithEvents btnAddCondition As Button + Friend WithEvents lblGroups As Label + Friend WithEvents lblCondition As Label + Friend WithEvents ucrInputGroupLabel As ucrInputTextBox + Friend WithEvents btnStyle As Button + Friend WithEvents ucrRowExpression As ucrRowExpression + Friend WithEvents lblGroupExpression As Label + Friend WithEvents colId As DataGridViewTextBoxColumn + Friend WithEvents colLabel As DataGridViewTextBoxColumn + Friend WithEvents colCodnition As DataGridViewTextBoxColumn + Friend WithEvents colStyleExpression As DataGridViewTextBoxColumn +End Class diff --git a/instat/UserTables/Rows/ucrRowGroup.resx b/instat/UserTables/Rows/ucrRowGroup.resx new file mode 100644 index 00000000000..7703172b4e8 --- /dev/null +++ b/instat/UserTables/Rows/ucrRowGroup.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Rows/ucrRowGroup.vb b/instat/UserTables/Rows/ucrRowGroup.vb new file mode 100644 index 00000000000..9bded35fffa --- /dev/null +++ b/instat/UserTables/Rows/ucrRowGroup.vb @@ -0,0 +1,142 @@ +Public Class ucrRowGroup + + Private bFirstLoad As Boolean = True + Private clsOperator As New ROperator + + Private Sub ucrRowGroup_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseDialog() + bFirstLoad = False + End If + End Sub + + Private Sub InitialiseDialog() + btnStyle.Tag = Nothing + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + Me.clsOperator = clsOperator + + ucrRowExpression.Setup(strDataFrameName) + dataGridGroups.Rows.Clear() + + ' Note, the sequence of these 2 functions matters + SetupTabRowGroupInDataGrid(clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_row_group"}, clsOperator)) + SetupTabRowGroupStylesInDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_row_groups", clsOperator)) + End Sub + + Private Sub SetupTabRowGroupInDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + Dim clsTabRowGroupRFunction As RFunction = clsRParam.clsArgumentCodeStructure + Dim row As New DataGridViewRow + row.CreateCells(dataGridGroups) + For Each clsTabRowGroupRParam As RParameter In clsTabRowGroupRFunction.clsParameters + If clsTabRowGroupRParam.strArgumentName = "id" Then + row.Cells(0).Value = clsTablesUtils.GetStringValue(clsTabRowGroupRParam.strArgumentValue, False) + ElseIf clsTabRowGroupRParam.strArgumentName = "label" Then + row.Cells(1).Value = clsTablesUtils.GetStringValue(clsTabRowGroupRParam.strArgumentValue, False) + ElseIf clsTabRowGroupRParam.strArgumentName = "rows" Then + row.Cells(2).Value = clsTablesUtils.GetStringValue(clsTabRowGroupRParam.strArgumentValue, False) + End If + Next + Dim arrParams(2) As RParameter + arrParams(0) = clsRParam + row.Tag = arrParams + dataGridGroups.Rows.Add(row) + Next + End Sub + + Private Sub SetupTabRowGroupStylesInDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + Dim clsTabStyleRFunction As RFunction = clsRParam.clsArgumentCodeStructure + ' Get spanner Id + Dim strArgumentValueSpannerId As String = clsTabStyleRFunction.GetParameter("locations").clsArgumentCodeStructure.GetParameter("groups").strArgumentValue + For index As Integer = 0 To dataGridGroups.Rows.Count - 1 + Dim row As DataGridViewRow = dataGridGroups.Rows(index) + Dim lstParams() As RParameter = row.Tag + If strArgumentValueSpannerId = lstParams(0).clsArgumentCodeStructure.GetParameter("id").strArgumentValue Then + row.Cells(2).Value = clsTabStyleRFunction.Clone().ToScript + lstParams(1) = clsRParam + row.Tag = lstParams + Exit For + End If + Next + Next + End Sub + + Private Sub btnStyle_Click(sender As Object, e As EventArgs) Handles btnStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + btnStyle.Tag = clsListStyleRFunction + End Sub + + Private Sub btnAddCondition_Click(sender As Object, e As EventArgs) Handles btnAddCondition.Click + Dim strGroupId As String = ucrInputGroupLabel.GetText().Replace(" ", String.Empty) + Dim strGroupStyleExpression As String = "" + + Dim clsTabRowGroupRFunction As New RFunction + clsTabRowGroupRFunction.SetPackageName("gt") + clsTabRowGroupRFunction.SetRCommand("tab_row_group") + clsTabRowGroupRFunction.AddParameter(New RParameter(strParameterName:="label", strParamValue:=clsTablesUtils.GetStringValue(ucrInputGroupLabel.GetText(), True), iNewPosition:=0)) + clsTabRowGroupRFunction.AddParameter(New RParameter(strParameterName:="rows", strParamValue:=ucrRowExpression.GetText(), iNewPosition:=1)) + clsTabRowGroupRFunction.AddParameter(New RParameter(strParameterName:="id", strParamValue:=clsTablesUtils.GetStringValue(strGroupId, True), iNewPosition:=2)) + + Dim arrParams(2) As RParameter + + ' Add add the group parameter as the first element + arrParams(0) = New RParameter(strParameterName:="tab_row_group_param" & (dataGridGroups.Rows.Count + 1), strParamValue:=clsTabRowGroupRFunction, bNewIncludeArgumentName:=False) + + ' Add the group style as the second element + If btnStyle.Tag IsNot Nothing Then + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_row_groups") + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="groups", strParamValue:=clsTablesUtils.GetStringValue(strGroupId, True), iNewPosition:=0)) + + Dim clsListStyleRFunction As RFunction = btnStyle.Tag + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + strGroupStyleExpression = clsTabStyleRFunction.Clone.ToScript + + arrParams(1) = New RParameter(strParameterName:="tab_style_cells_row_groups_param" & (dataGridGroups.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + End If + + Dim row As New DataGridViewRow + row.CreateCells(dataGridGroups) + row.Cells(0).Value = strGroupId + row.Cells(1).Value = ucrInputGroupLabel.GetText() + row.Cells(2).Value = ucrRowExpression.GetText() + row.Cells(3).Value = strGroupStyleExpression + ' Tag the array of parameters + row.Tag = arrParams + dataGridGroups.Rows.Add(row) + + ucrInputGroupLabel.SetName("") + ucrRowExpression.Clear() + btnStyle.Tag = Nothing + End Sub + + Private Sub conditionValue_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrRowExpression.ControlContentsChanged, ucrInputGroupLabel.ControlContentsChanged + btnAddCondition.Enabled = Not ucrRowExpression.IsEmpty AndAlso Not ucrInputGroupLabel.IsEmpty + btnStyle.Enabled = btnAddCondition.Enabled + End Sub + + Private Sub btnClearGroups_Click(sender As Object, e As EventArgs) Handles btnClearGroups.Click + dataGridGroups.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_row_group"}, clsOperator), clsOperator) + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_row_groups", clsOperator), clsOperator) + + For index As Integer = 0 To dataGridGroups.Rows.Count - 1 + Dim lstParams() As RParameter = dataGridGroups.Rows(index).Tag + clsOperator.AddParameter(lstParams(0)) + If lstParams(1) IsNot Nothing Then + clsOperator.AddParameter(lstParams(1)) + End If + Next + End Sub +End Class diff --git a/instat/UserTables/Rows/ucrRowSummary.Designer.vb b/instat/UserTables/Rows/ucrRowSummary.Designer.vb new file mode 100644 index 00000000000..7ef44d485d4 --- /dev/null +++ b/instat/UserTables/Rows/ucrRowSummary.Designer.vb @@ -0,0 +1,344 @@ + _ +Partial Class ucrRowSummary + 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.dataGridSummaries = New System.Windows.Forms.DataGridView() + Me.btnStyle = New System.Windows.Forms.Button() + Me.lblSummaryTypes = New System.Windows.Forms.Label() + Me.lblSummaries = New System.Windows.Forms.Label() + Me.btnClearSummaries = New System.Windows.Forms.Button() + Me.btnAddSummaries = New System.Windows.Forms.Button() + Me.lblSummaryLabel = New System.Windows.Forms.Label() + Me.lblReplaceWith = New System.Windows.Forms.Label() + Me.btnFormat = New System.Windows.Forms.Button() + Me.lblColumns = New System.Windows.Forms.Label() + Me.lblGroupId = New System.Windows.Forms.Label() + Me.lblSide = New System.Windows.Forms.Label() + Me.ucrCboSide = New instat.ucrInputComboBox() + Me.ucrTxtGroupId = New instat.ucrInputTextBox() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrTxtReplaceNa = New instat.ucrInputTextBox() + Me.ucrCboSummaryType = New instat.ucrInputComboBox() + Me.ucrTxtSummaryLabel = New instat.ucrInputTextBox() + Me.colType = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colExpression = New System.Windows.Forms.DataGridViewTextBoxColumn() + CType(Me.dataGridSummaries, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'dataGridSummaries + ' + Me.dataGridSummaries.AllowUserToAddRows = False + Me.dataGridSummaries.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridSummaries.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colType, Me.colExpression}) + Me.dataGridSummaries.Location = New System.Drawing.Point(360, 451) + Me.dataGridSummaries.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.dataGridSummaries.Name = "dataGridSummaries" + Me.dataGridSummaries.ReadOnly = True + Me.dataGridSummaries.RowHeadersWidth = 62 + Me.dataGridSummaries.Size = New System.Drawing.Size(522, 120) + Me.dataGridSummaries.TabIndex = 335 + ' + 'btnStyle + ' + Me.btnStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnStyle.Location = New System.Drawing.Point(740, 303) + Me.btnStyle.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnStyle.Name = "btnStyle" + Me.btnStyle.Size = New System.Drawing.Size(126, 35) + Me.btnStyle.TabIndex = 341 + Me.btnStyle.Tag = "" + Me.btnStyle.Text = "Style" + Me.btnStyle.UseVisualStyleBackColor = True + ' + 'lblSummaryTypes + ' + Me.lblSummaryTypes.AutoSize = True + Me.lblSummaryTypes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSummaryTypes.Location = New System.Drawing.Point(356, 144) + Me.lblSummaryTypes.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSummaryTypes.Name = "lblSummaryTypes" + Me.lblSummaryTypes.Size = New System.Drawing.Size(118, 20) + Me.lblSummaryTypes.TabIndex = 339 + Me.lblSummaryTypes.Text = "Summary Type:" + ' + 'lblSummaries + ' + Me.lblSummaries.AutoSize = True + Me.lblSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSummaries.Location = New System.Drawing.Point(362, 426) + Me.lblSummaries.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSummaries.Name = "lblSummaries" + Me.lblSummaries.Size = New System.Drawing.Size(93, 20) + Me.lblSummaries.TabIndex = 338 + Me.lblSummaries.Text = "Summaries:" + ' + 'btnClearSummaries + ' + Me.btnClearSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearSummaries.Location = New System.Drawing.Point(758, 410) + Me.btnClearSummaries.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnClearSummaries.Name = "btnClearSummaries" + Me.btnClearSummaries.Size = New System.Drawing.Size(118, 35) + Me.btnClearSummaries.TabIndex = 337 + Me.btnClearSummaries.Tag = "" + Me.btnClearSummaries.Text = "Clear" + Me.btnClearSummaries.UseVisualStyleBackColor = True + ' + 'btnAddSummaries + ' + Me.btnAddSummaries.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnAddSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnAddSummaries.Location = New System.Drawing.Point(359, 373) + Me.btnAddSummaries.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnAddSummaries.Name = "btnAddSummaries" + Me.btnAddSummaries.Size = New System.Drawing.Size(144, 35) + Me.btnAddSummaries.TabIndex = 336 + Me.btnAddSummaries.Tag = "" + Me.btnAddSummaries.Text = "Add" + Me.btnAddSummaries.UseVisualStyleBackColor = True + ' + 'lblSummaryLabel + ' + Me.lblSummaryLabel.AutoSize = True + Me.lblSummaryLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSummaryLabel.Location = New System.Drawing.Point(355, 286) + Me.lblSummaryLabel.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSummaryLabel.Name = "lblSummaryLabel" + Me.lblSummaryLabel.Size = New System.Drawing.Size(196, 20) + Me.lblSummaryLabel.TabIndex = 342 + Me.lblSummaryLabel.Text = "Summary Label (Optional):" + ' + 'lblReplaceWith + ' + Me.lblReplaceWith.AutoSize = True + Me.lblReplaceWith.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblReplaceWith.Location = New System.Drawing.Point(590, 144) + Me.lblReplaceWith.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblReplaceWith.Name = "lblReplaceWith" + Me.lblReplaceWith.Size = New System.Drawing.Size(203, 20) + Me.lblReplaceWith.TabIndex = 346 + Me.lblReplaceWith.Text = "Replace NA with (Optional):" + ' + 'btnFormat + ' + Me.btnFormat.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnFormat.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnFormat.Location = New System.Drawing.Point(594, 304) + Me.btnFormat.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnFormat.Name = "btnFormat" + Me.btnFormat.Size = New System.Drawing.Size(136, 35) + Me.btnFormat.TabIndex = 348 + Me.btnFormat.Tag = "" + Me.btnFormat.Text = "Format" + Me.btnFormat.UseVisualStyleBackColor = True + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(362, 13) + Me.lblColumns.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(85, 20) + Me.lblColumns.TabIndex = 350 + Me.lblColumns.Text = "Column(s):" + ' + 'lblGroupId + ' + Me.lblGroupId.AutoSize = True + Me.lblGroupId.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblGroupId.Location = New System.Drawing.Point(590, 216) + Me.lblGroupId.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblGroupId.Name = "lblGroupId" + Me.lblGroupId.Size = New System.Drawing.Size(152, 20) + Me.lblGroupId.TabIndex = 352 + Me.lblGroupId.Text = "Group ID (Optional):" + ' + 'lblSide + ' + Me.lblSide.AutoSize = True + Me.lblSide.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSide.Location = New System.Drawing.Point(361, 216) + Me.lblSide.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblSide.Name = "lblSide" + Me.lblSide.Size = New System.Drawing.Size(45, 20) + Me.lblSide.TabIndex = 354 + Me.lblSide.Text = "Side:" + ' + 'ucrCboSide + ' + Me.ucrCboSide.AddQuotesIfUnrecognised = True + Me.ucrCboSide.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboSide.GetSetSelectedIndex = -1 + Me.ucrCboSide.IsReadOnly = False + Me.ucrCboSide.Location = New System.Drawing.Point(359, 237) + Me.ucrCboSide.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) + Me.ucrCboSide.Name = "ucrCboSide" + Me.ucrCboSide.Size = New System.Drawing.Size(176, 40) + Me.ucrCboSide.TabIndex = 355 + ' + 'ucrTxtGroupId + ' + Me.ucrTxtGroupId.AddQuotesIfUnrecognised = True + Me.ucrTxtGroupId.AutoSize = True + Me.ucrTxtGroupId.IsMultiline = False + Me.ucrTxtGroupId.IsReadOnly = False + Me.ucrTxtGroupId.Location = New System.Drawing.Point(594, 240) + Me.ucrTxtGroupId.Margin = New System.Windows.Forms.Padding(14) + Me.ucrTxtGroupId.Name = "ucrTxtGroupId" + Me.ucrTxtGroupId.Size = New System.Drawing.Size(180, 32) + Me.ucrTxtGroupId.TabIndex = 353 + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Nothing + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(359, 38) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(198, 85) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 351 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(9, 7) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(320, 282) + Me.ucrSelectorCols.TabIndex = 349 + ' + 'ucrTxtReplaceNa + ' + Me.ucrTxtReplaceNa.AddQuotesIfUnrecognised = True + Me.ucrTxtReplaceNa.AutoSize = True + Me.ucrTxtReplaceNa.IsMultiline = False + Me.ucrTxtReplaceNa.IsReadOnly = False + Me.ucrTxtReplaceNa.Location = New System.Drawing.Point(594, 166) + Me.ucrTxtReplaceNa.Margin = New System.Windows.Forms.Padding(14) + Me.ucrTxtReplaceNa.Name = "ucrTxtReplaceNa" + Me.ucrTxtReplaceNa.Size = New System.Drawing.Size(180, 32) + Me.ucrTxtReplaceNa.TabIndex = 347 + ' + 'ucrCboSummaryType + ' + Me.ucrCboSummaryType.AddQuotesIfUnrecognised = True + Me.ucrCboSummaryType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboSummaryType.GetSetSelectedIndex = -1 + Me.ucrCboSummaryType.IsReadOnly = False + Me.ucrCboSummaryType.Location = New System.Drawing.Point(359, 167) + Me.ucrCboSummaryType.Margin = New System.Windows.Forms.Padding(9, 9, 9, 9) + Me.ucrCboSummaryType.Name = "ucrCboSummaryType" + Me.ucrCboSummaryType.Size = New System.Drawing.Size(176, 40) + Me.ucrCboSummaryType.TabIndex = 345 + ' + 'ucrTxtSummaryLabel + ' + Me.ucrTxtSummaryLabel.AddQuotesIfUnrecognised = True + Me.ucrTxtSummaryLabel.AutoSize = True + Me.ucrTxtSummaryLabel.IsMultiline = False + Me.ucrTxtSummaryLabel.IsReadOnly = False + Me.ucrTxtSummaryLabel.Location = New System.Drawing.Point(360, 312) + Me.ucrTxtSummaryLabel.Margin = New System.Windows.Forms.Padding(14) + Me.ucrTxtSummaryLabel.Name = "ucrTxtSummaryLabel" + Me.ucrTxtSummaryLabel.Size = New System.Drawing.Size(180, 32) + Me.ucrTxtSummaryLabel.TabIndex = 343 + ' + 'colType + ' + Me.colType.HeaderText = "Summary Expression" + Me.colType.MinimumWidth = 8 + Me.colType.Name = "colType" + Me.colType.ReadOnly = True + Me.colType.Width = 150 + ' + 'colExpression + ' + Me.colExpression.HeaderText = "Style Expression" + Me.colExpression.MinimumWidth = 8 + Me.colExpression.Name = "colExpression" + Me.colExpression.ReadOnly = True + Me.colExpression.Width = 150 + ' + 'ucrRowSummary + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrCboSide) + Me.Controls.Add(Me.lblSide) + Me.Controls.Add(Me.ucrTxtGroupId) + Me.Controls.Add(Me.lblGroupId) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.btnFormat) + Me.Controls.Add(Me.ucrTxtReplaceNa) + Me.Controls.Add(Me.lblReplaceWith) + Me.Controls.Add(Me.ucrCboSummaryType) + Me.Controls.Add(Me.ucrTxtSummaryLabel) + Me.Controls.Add(Me.lblSummaryLabel) + Me.Controls.Add(Me.dataGridSummaries) + Me.Controls.Add(Me.btnStyle) + Me.Controls.Add(Me.lblSummaryTypes) + Me.Controls.Add(Me.lblSummaries) + Me.Controls.Add(Me.btnClearSummaries) + Me.Controls.Add(Me.btnAddSummaries) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "ucrRowSummary" + Me.Size = New System.Drawing.Size(890, 576) + CType(Me.dataGridSummaries, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents dataGridSummaries As DataGridView + Friend WithEvents btnStyle As Button + Friend WithEvents lblSummaryTypes As Label + Friend WithEvents lblSummaries As Label + Friend WithEvents btnClearSummaries As Button + Friend WithEvents btnAddSummaries As Button + Friend WithEvents ucrTxtSummaryLabel As ucrInputTextBox + Friend WithEvents lblSummaryLabel As Label + Friend WithEvents ucrCboSummaryType As ucrInputComboBox + Friend WithEvents ucrTxtReplaceNa As ucrInputTextBox + Friend WithEvents lblReplaceWith As Label + Friend WithEvents btnFormat As Button + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents lblColumns As Label + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrTxtGroupId As ucrInputTextBox + Friend WithEvents lblGroupId As Label + Friend WithEvents lblSide As Label + Friend WithEvents ucrCboSide As ucrInputComboBox + Friend WithEvents colType As DataGridViewTextBoxColumn + Friend WithEvents colExpression As DataGridViewTextBoxColumn +End Class diff --git a/instat/UserTables/Rows/ucrRowSummary.resx b/instat/UserTables/Rows/ucrRowSummary.resx new file mode 100644 index 00000000000..0f42d579fc9 --- /dev/null +++ b/instat/UserTables/Rows/ucrRowSummary.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Rows/ucrRowSummary.vb b/instat/UserTables/Rows/ucrRowSummary.vb new file mode 100644 index 00000000000..c34ec209a0d --- /dev/null +++ b/instat/UserTables/Rows/ucrRowSummary.vb @@ -0,0 +1,232 @@ +Public Class ucrRowSummary + + Private bFirstLoad As Boolean = True + Private clsOperator As New ROperator + Private dctSummaryTypes, dctSides As New Dictionary(Of String, String) + + Private Sub ucrRowSummary_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseDialog() + bFirstLoad = False + End If + End Sub + + Private Sub InitialiseDialog() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetDataType("numeric", bStrict:=True) + ucrReceiverMultipleCols.SetMeAsReceiver() + + dctSummaryTypes.Add("Minimum", "min") + dctSummaryTypes.Add("Maximum", "max") + dctSummaryTypes.Add("Mean", "mean") + dctSummaryTypes.Add("Median", "median") + dctSummaryTypes.Add("Standard Deviation", "sd") + dctSummaryTypes.Add("Sum", "sum") + dctSummaryTypes.Add("Length", "length") + ucrCboSummaryType.SetItems(dctSummaryTypes, bSetConditions:=False) + ucrCboSummaryType.SetDropDownStyleAsNonEditable() + ucrCboSummaryType.GetSetSelectedIndex = 0 + + dctSides.Add("Bottom", "bottom") + dctSides.Add("Top", "top") + ucrCboSide.SetItems(dctSides, bSetConditions:=False) + ucrCboSide.SetDropDownStyleAsNonEditable() + ucrCboSide.GetSetSelectedIndex = 0 + + btnFormat.Tag = Nothing + btnStyle.Tag = Nothing + + ' TODO. Disabled due to error thrwon when using data book. See comments inside GetFnParameters() + lblSummaryLabel.Enabled = False + ucrTxtSummaryLabel.Enabled = False + + ' TODO. Disabled until R is upgraded + lblSide.Enabled = False + ucrCboSide.Enabled = False + btnFormat.Enabled = False + btnStyle.Enabled = False + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + Me.clsOperator = clsOperator + + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + dataGridSummaries.Rows.Clear() + + ' Note, the sequence of these 2 functions matters + SetupSummaryRowInDataGrid(clsTablesUtils.FindRFunctionsParamsWithRCommand({"summary_rows"}, clsOperator)) + SetupSummaryRowStylesInDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_summary", clsOperator)) + End Sub + + Private Sub SetupSummaryRowInDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + Dim clsTabSummaryRowRFunction As RFunction = clsRParam.clsArgumentCodeStructure + Dim row As New DataGridViewRow + row.CreateCells(dataGridSummaries) + row.Cells(0).Value = clsTabSummaryRowRFunction.Clone.ToScript + + ' TODO. In future we could get the individual parameters + + 'For Each clsTabRowGroupRParam As RParameter In clsTabSummaryRowRFunction.clsParameters + ' If clsTabRowGroupRParam.strArgumentName = "fns" Then + ' row.Cells(0).Value = clsTablesUtils.GetStringValue(clsTabRowGroupRParam.strArgumentValue, False) + ' ElseIf clsTabRowGroupRParam.strArgumentName = "fms" Then + ' row.Cells(1).Value = clsTablesUtils.GetStringValue(clsTabRowGroupRParam.strArgumentValue, False) + ' End If + 'Next + Dim arrParams(2) As RParameter + arrParams(0) = clsRParam + row.Tag = arrParams + dataGridSummaries.Rows.Add(row) + Next + End Sub + + Private Sub SetupSummaryRowStylesInDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + Dim clsTabStyleRFunction As RFunction = clsRParam.clsArgumentCodeStructure + ' Get spanner Id + Dim iRowId As Integer + If Not Integer.TryParse(clsTabStyleRFunction.GetParameter("locations").clsArgumentCodeStructure.GetParameter("row").strArgumentValue, iRowId) Then + Continue For + End If + + + For index As Integer = 0 To dataGridSummaries.Rows.Count - 1 + Dim row As DataGridViewRow = dataGridSummaries.Rows(index) + Dim lstParams() As RParameter = row.Tag + + ' As of 2024/08/07 the gt summary_rows R function doesn't have a unique identifier like row groups. + ' So just use the data gridview index to show the style expressions + If index + 1 = iRowId Then + row.Cells(1).Value = clsTabStyleRFunction.Clone().ToScript + lstParams(1) = clsRParam + row.Tag = lstParams + Exit For + End If + Next + Next + End Sub + + Private Sub btnFormat_Click(sender As Object, e As EventArgs) Handles btnFormat.Click + sdgCellFormatNumberOptions.ShowDialog(Me.ParentForm) + Dim clsFormatRFunction As RFunction = sdgCellFormatNumberOptions.GetNewUserInputAsRFunction() + + If clsFormatRFunction IsNot Nothing Then + btnFormat.Tag = clsFormatRFunction + End If + + End Sub + + Private Sub btnStyle_Click(sender As Object, e As EventArgs) Handles btnStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_summary") + + If Not ucrTxtGroupId.IsEmpty Then + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="groups", strParamValue:=Chr(34) & ucrTxtGroupId.GetText & Chr(34), iNewPosition:=0)) + End If + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=ucrReceiverMultipleCols.GetVariableNames(bWithQuotes:=False), iNewPosition:=1)) + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="row", strParamValue:=dataGridSummaries.Rows.Count + 1, iNewPosition:=2)) + + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + btnStyle.Tag = clsTabStyleRFunction + End Sub + + Private Sub conditionValue_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + btnAddSummaries.Enabled = Not ucrReceiverMultipleCols.IsEmpty + End Sub + + Private Sub btnAddSummaries_Click(sender As Object, e As EventArgs) Handles btnAddSummaries.Click + Dim strSpannerLabel As String = ucrTxtGroupId.GetValue() + Dim strSpannerId As String = strSpannerLabel.Replace(" ", String.Empty) + Dim strSpannerColsRFunction As String = mdlCoreControl.GetRVector(ucrReceiverMultipleCols.GetVariableNamesList(bWithQuotes:=False), bOnlyIfMultipleElement:=False) + Dim strSpannerStyleExpression As String = "" + + Dim clsSummaryRowsRFunction As New RFunction + clsSummaryRowsRFunction.SetPackageName("gt") + clsSummaryRowsRFunction.SetRCommand("summary_rows") + + + If Not ucrTxtGroupId.IsEmpty Then + clsSummaryRowsRFunction.AddParameter(New RParameter(strParameterName:="groups", strParamValue:=Chr(34) & ucrTxtGroupId.GetText & Chr(34), iNewPosition:=0)) + End If + + clsSummaryRowsRFunction.AddParameter(New RParameter(strParameterName:="fns", strParamValue:=GetFnParameters(), iNewPosition:=1)) + clsSummaryRowsRFunction.AddParameter(New RParameter(strParameterName:="columns", strParamValue:=mdlCoreControl.GetRVector(ucrReceiverMultipleCols.GetVariableNamesList(bWithQuotes:=False), bOnlyIfMultipleElement:=False), iNewPosition:=2)) + + If btnFormat.Tag IsNot Nothing Then + Dim clsFormatRFunction As RFunction = btnFormat.Tag + clsSummaryRowsRFunction.AddParameter(New RParameter(strParameterName:="fmt", strParamValue:=clsFormatRFunction, iNewPosition:=3)) + End If + + 'TODO. Commented out until R-Instat R is upgraded + 'clsSummaryRowsRFunction.AddParameter(New RParameter(strParameterName:="side", strParamValue:=Chr(34) & dctSides.Item(ucrCboSide.GetText) & Chr(34), iNewPosition:=4)) + + If Not ucrTxtReplaceNa.IsEmpty Then + clsSummaryRowsRFunction.AddParameter(New RParameter(strParameterName:="missing_text", strParamValue:=Chr(34) & ucrTxtReplaceNa.GetText & Chr(34), iNewPosition:=0)) + End If + + Dim arrParams(2) As RParameter + + ' Add add the spanner parameter as the first element + arrParams(0) = New RParameter(strParameterName:="summary_rows_param" & (dataGridSummaries.Rows.Count + 1), strParamValue:=clsSummaryRowsRFunction, bNewIncludeArgumentName:=False) + + ' Add the spanner style as the second element + If btnStyle.Tag IsNot Nothing Then + Dim clsTabStyleRFunction As RFunction = btnStyle.Tag + strSpannerStyleExpression = clsTabStyleRFunction.Clone.ToScript + arrParams(1) = New RParameter(strParameterName:="tab_style_cells_summary_param" & (dataGridSummaries.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + End If + + Dim row As New DataGridViewRow + row.CreateCells(dataGridSummaries) + row.Cells(0).Value = clsSummaryRowsRFunction.Clone.ToScript + row.Cells(1).Value = strSpannerStyleExpression + ' Tag the array of parameters + row.Tag = arrParams + dataGridSummaries.Rows.Add(row) + + ucrReceiverMultipleCols.Clear() + ucrTxtGroupId.SetName("") + ucrTxtSummaryLabel.SetName("") + btnFormat.Tag = Nothing + btnStyle.Tag = Nothing + End Sub + + Private Function GetFnParameters() As String + ' TODO. As of 08/08/2024, GT example like list(fn = "min", label = "Minimum", id = "min") throws an error when exeuted in R-Instat + ' TODO. Investigate why the error why is thrown when using the databook + + Dim strFnType As String = dctSummaryTypes.Item(ucrCboSummaryType.GetText) + Dim strFnParams As String = "id = " & Chr(34) & strFnType & Chr(34) & ", fn = " & Chr(34) & strFnType & Chr(34) + If Not ucrTxtSummaryLabel.IsEmpty Then + strFnParams = strFnParams & ", label = " & Chr(34) & ucrCboSummaryType.GetText & Chr(34) + End If + ' TODO. Commented out due to error thrown + 'Return "list(" & strFnParams & ")" + Return Chr(34) & strFnType & Chr(34) + End Function + + Private Sub btnClearSummaries_Click(sender As Object, e As EventArgs) Handles btnClearSummaries.Click + dataGridSummaries.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRCommand({"summary_rows"}, clsOperator), clsOperator) + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_summary", clsOperator), clsOperator) + + For index As Integer = 0 To dataGridSummaries.Rows.Count - 1 + Dim lstParams() As RParameter = dataGridSummaries.Rows(index).Tag + clsOperator.AddParameter(lstParams(0)) + If lstParams(1) IsNot Nothing Then + clsOperator.AddParameter(lstParams(1)) + End If + Next + End Sub +End Class diff --git a/instat/UserTables/Rows/ucrRows.Designer.vb b/instat/UserTables/Rows/ucrRows.Designer.vb new file mode 100644 index 00000000000..443747332c0 --- /dev/null +++ b/instat/UserTables/Rows/ucrRows.Designer.vb @@ -0,0 +1,119 @@ + _ +Partial Class ucrRows + 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.rdoRowsGroups = New System.Windows.Forms.RadioButton() + Me.rdoRowsSummaries = New System.Windows.Forms.RadioButton() + Me.ucrPnlRows = New instat.UcrPanel() + Me.ucrRowSummary = New instat.ucrRowSummary() + Me.ucrRowGroups = New instat.ucrRowGroup() + Me.SuspendLayout() + ' + 'rdoRowsGroups + ' + Me.rdoRowsGroups.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoRowsGroups.BackColor = System.Drawing.SystemColors.Control + Me.rdoRowsGroups.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoRowsGroups.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoRowsGroups.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRowsGroups.FlatAppearance.BorderSize = 2 + Me.rdoRowsGroups.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRowsGroups.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoRowsGroups.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoRowsGroups.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowsGroups.Location = New System.Drawing.Point(267, 5) + Me.rdoRowsGroups.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.rdoRowsGroups.Name = "rdoRowsGroups" + Me.rdoRowsGroups.Size = New System.Drawing.Size(136, 45) + Me.rdoRowsGroups.TabIndex = 280 + Me.rdoRowsGroups.Text = "Groups" + Me.rdoRowsGroups.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoRowsGroups.UseVisualStyleBackColor = True + ' + 'rdoRowsSummaries + ' + Me.rdoRowsSummaries.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoRowsSummaries.BackColor = System.Drawing.SystemColors.Control + Me.rdoRowsSummaries.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoRowsSummaries.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoRowsSummaries.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRowsSummaries.FlatAppearance.BorderSize = 2 + Me.rdoRowsSummaries.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRowsSummaries.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoRowsSummaries.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoRowsSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowsSummaries.Location = New System.Drawing.Point(401, 5) + Me.rdoRowsSummaries.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.rdoRowsSummaries.Name = "rdoRowsSummaries" + Me.rdoRowsSummaries.Size = New System.Drawing.Size(136, 45) + Me.rdoRowsSummaries.TabIndex = 281 + Me.rdoRowsSummaries.Text = "Summaries" + Me.rdoRowsSummaries.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoRowsSummaries.UseVisualStyleBackColor = True + ' + 'ucrPnlRows + ' + Me.ucrPnlRows.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlRows.Location = New System.Drawing.Point(24, 5) + Me.ucrPnlRows.Margin = New System.Windows.Forms.Padding(9) + Me.ucrPnlRows.Name = "ucrPnlRows" + Me.ucrPnlRows.Size = New System.Drawing.Size(821, 45) + Me.ucrPnlRows.TabIndex = 279 + ' + 'ucrRowSummary + ' + Me.ucrRowSummary.Location = New System.Drawing.Point(8, 64) + Me.ucrRowSummary.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrRowSummary.Name = "ucrRowSummary" + Me.ucrRowSummary.Size = New System.Drawing.Size(900, 588) + Me.ucrRowSummary.TabIndex = 284 + ' + 'ucrRowGroups + ' + Me.ucrRowGroups.Location = New System.Drawing.Point(4, 58) + Me.ucrRowGroups.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrRowGroups.Name = "ucrRowGroups" + Me.ucrRowGroups.Size = New System.Drawing.Size(575, 411) + Me.ucrRowGroups.TabIndex = 283 + ' + 'ucrRows + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.rdoRowsGroups) + Me.Controls.Add(Me.rdoRowsSummaries) + Me.Controls.Add(Me.ucrPnlRows) + Me.Controls.Add(Me.ucrRowGroups) + Me.Controls.Add(Me.ucrRowSummary) + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "ucrRows" + Me.Size = New System.Drawing.Size(993, 667) + Me.ResumeLayout(False) + + End Sub + Friend WithEvents rdoRowsGroups As RadioButton + Friend WithEvents rdoRowsSummaries As RadioButton + Friend WithEvents ucrPnlRows As UcrPanel + Friend WithEvents ucrRowGroups As ucrRowGroup + Friend WithEvents ucrRowSummary As ucrRowSummary +End Class diff --git a/instat/UserTables/Rows/ucrRows.resx b/instat/UserTables/Rows/ucrRows.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Rows/ucrRows.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Rows/ucrRows.vb b/instat/UserTables/Rows/ucrRows.vb new file mode 100644 index 00000000000..52581f9623c --- /dev/null +++ b/instat/UserTables/Rows/ucrRows.vb @@ -0,0 +1,34 @@ +Public Class ucrRows + + Private bFirstload As Boolean = True + + Private Sub ucrRows_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + End Sub + + Private Sub InitialiseDialog() + ucrPnlRows.AddRadioButton(rdoRowsGroups) + ucrPnlRows.AddRadioButton(rdoRowsSummaries) + rdoRowsGroups.Checked = True + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + ucrRowGroups.Setup(strDataFrameName, clsOperator) + ucrRowSummary.Setup(strDataFrameName, clsOperator) + End Sub + + Private Sub ucrPnlRows_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlRows.ControlValueChanged + ucrRowGroups.Visible = rdoRowsGroups.Checked + ucrRowSummary.Visible = rdoRowsSummaries.Checked + End Sub + + Public Sub SetValuesToOperator() + ucrRowGroups.SetValuesToOperator() + ucrRowSummary.SetValuesToOperator() + End Sub + + +End Class diff --git a/instat/UserTables/SourceNotes/ucrSourceNotes.Designer.vb b/instat/UserTables/SourceNotes/ucrSourceNotes.Designer.vb new file mode 100644 index 00000000000..6519d25a573 --- /dev/null +++ b/instat/UserTables/SourceNotes/ucrSourceNotes.Designer.vb @@ -0,0 +1,92 @@ + _ +Partial Class ucrSourceNotes + 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.dataGridSourceNotes = New System.Windows.Forms.DataGridView() + Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.lblSourceNotes = New System.Windows.Forms.Label() + Me.btnClearNotes = New System.Windows.Forms.Button() + CType(Me.dataGridSourceNotes, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'dataGridSourceNotes + ' + Me.dataGridSourceNotes.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.dataGridSourceNotes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridSourceNotes.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.DataGridViewTextBoxColumn1}) + Me.dataGridSourceNotes.Location = New System.Drawing.Point(3, 23) + Me.dataGridSourceNotes.Name = "dataGridSourceNotes" + Me.dataGridSourceNotes.RowHeadersWidth = 62 + Me.dataGridSourceNotes.Size = New System.Drawing.Size(464, 197) + Me.dataGridSourceNotes.TabIndex = 9 + ' + 'DataGridViewTextBoxColumn1 + ' + Me.DataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.DataGridViewTextBoxColumn1.HeaderText = "Note Text" + Me.DataGridViewTextBoxColumn1.MinimumWidth = 8 + Me.DataGridViewTextBoxColumn1.Name = "DataGridViewTextBoxColumn1" + ' + 'lblSourceNotes + ' + Me.lblSourceNotes.AutoSize = True + Me.lblSourceNotes.Location = New System.Drawing.Point(6, 7) + Me.lblSourceNotes.Name = "lblSourceNotes" + Me.lblSourceNotes.Size = New System.Drawing.Size(73, 13) + Me.lblSourceNotes.TabIndex = 8 + Me.lblSourceNotes.Text = "Source notes:" + ' + 'btnClearNotes + ' + Me.btnClearNotes.Enabled = False + Me.btnClearNotes.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearNotes.Location = New System.Drawing.Point(392, 0) + Me.btnClearNotes.Name = "btnClearNotes" + Me.btnClearNotes.Size = New System.Drawing.Size(75, 23) + Me.btnClearNotes.TabIndex = 296 + Me.btnClearNotes.Tag = "" + Me.btnClearNotes.Text = "Clear" + Me.btnClearNotes.UseVisualStyleBackColor = True + ' + 'ucrSourceNotes + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.btnClearNotes) + Me.Controls.Add(Me.dataGridSourceNotes) + Me.Controls.Add(Me.lblSourceNotes) + Me.Name = "ucrSourceNotes" + Me.Size = New System.Drawing.Size(470, 223) + CType(Me.dataGridSourceNotes, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents dataGridSourceNotes As DataGridView + Friend WithEvents lblSourceNotes As Label + Friend WithEvents DataGridViewTextBoxColumn1 As DataGridViewTextBoxColumn + Friend WithEvents btnClearNotes As Button +End Class diff --git a/instat/UserTables/SourceNotes/ucrSourceNotes.resx b/instat/UserTables/SourceNotes/ucrSourceNotes.resx new file mode 100644 index 00000000000..228caedf30a --- /dev/null +++ b/instat/UserTables/SourceNotes/ucrSourceNotes.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/instat/UserTables/SourceNotes/ucrSourceNotes.vb b/instat/UserTables/SourceNotes/ucrSourceNotes.vb new file mode 100644 index 00000000000..afdb4018770 --- /dev/null +++ b/instat/UserTables/SourceNotes/ucrSourceNotes.vb @@ -0,0 +1,61 @@ + +Public Class ucrSourceNotes + + Private clsOperator As ROperator + + Public Sub Setup(clsOperator As ROperator) + Me.clsOperator = clsOperator + dataGridSourceNotes.Rows.Clear() + + Dim lstRParams As List(Of RParameter) = clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_source_note"}, clsOperator) + For Each clsRParam As RParameter In lstRParams + Dim clsTabSourceNotesRFunction As RFunction = clsRParam.clsArgumentCodeStructure + Dim row As New DataGridViewRow + row.CreateCells(dataGridSourceNotes) + For Each clsTabSourceNoteRParam As RParameter In clsTabSourceNotesRFunction.clsParameters + If clsTabSourceNoteRParam.strArgumentName = "source_note" Then + row.Cells(0).Value = clsTablesUtils.GetStringValue(clsTabSourceNoteRParam.strArgumentValue, False) + End If + Next + row.Tag = clsRParam + dataGridSourceNotes.Rows.Add(row) + Next + + ' Always add a place holder row for new foot note + dataGridSourceNotes.Rows.Add() + End Sub + + Private Sub btnClearNotes_Click(sender As Object, e As EventArgs) Handles btnClearNotes.Click + dataGridSourceNotes.Rows.Clear() + dataGridSourceNotes.Rows.Add() + End Sub + + Private Sub dataGridNotes_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dataGridSourceNotes.CellEndEdit + + Dim row As DataGridViewRow = dataGridSourceNotes.Rows.Item(e.RowIndex) + Dim strNoteTextValue As String = row.Cells(0).Value + + ' If no foot note typed by user then just exit the sub + If String.IsNullOrEmpty(strNoteTextValue) Then + Exit Sub + End If + + Dim clsTabSourceNoteRParam As New RFunction + clsTabSourceNoteRParam.SetPackageName("gt") + clsTabSourceNoteRParam.SetRCommand("tab_source_note") + clsTabSourceNoteRParam.AddParameter(New RParameter(strParameterName:="source_note", strParamValue:=clsTablesUtils.GetStringValue(strNoteTextValue, True), iNewPosition:=0)) + + ' Overwrite the tag with the new unique parameter + row.Tag = New RParameter(strParameterName:="tab_source_note_param" & (dataGridSourceNotes.Rows.Count + 1), strParamValue:=clsTabSourceNoteRParam, bNewIncludeArgumentName:=False) + + ' If last row then add new empty row + If e.RowIndex = dataGridSourceNotes.Rows.Count - 1 Then + dataGridSourceNotes.Rows.Add() + End If + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_source_note"}, clsOperator), clsOperator) + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGridSourceNotes, clsOperator) + End Sub +End Class diff --git a/instat/UserTables/Stub/ucrStub.Designer.vb b/instat/UserTables/Stub/ucrStub.Designer.vb new file mode 100644 index 00000000000..94e76a4240e --- /dev/null +++ b/instat/UserTables/Stub/ucrStub.Designer.vb @@ -0,0 +1,114 @@ + +Partial Class ucrStub + 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.ucrStubOptions = New instat.ucrStubOptions() + Me.rdoVariables = New System.Windows.Forms.RadioButton() + Me.rdoStyles = New System.Windows.Forms.RadioButton() + Me.ucrPnlStub = New instat.UcrPanel() + Me.ucrStubStyle = New instat.ucrStubStyle() + Me.SuspendLayout() + ' + 'ucrStubOptions + ' + Me.ucrStubOptions.Location = New System.Drawing.Point(3, 40) + Me.ucrStubOptions.Name = "ucrStubOptions" + Me.ucrStubOptions.Size = New System.Drawing.Size(405, 187) + Me.ucrStubOptions.TabIndex = 0 + ' + 'rdoVariables + ' + Me.rdoVariables.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoVariables.BackColor = System.Drawing.SystemColors.Control + Me.rdoVariables.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoVariables.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoVariables.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoVariables.FlatAppearance.BorderSize = 2 + Me.rdoVariables.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoVariables.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoVariables.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoVariables.Location = New System.Drawing.Point(106, 3) + Me.rdoVariables.Name = "rdoVariables" + Me.rdoVariables.Size = New System.Drawing.Size(91, 29) + Me.rdoVariables.TabIndex = 283 + Me.rdoVariables.Text = "Contents" + Me.rdoVariables.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoVariables.UseVisualStyleBackColor = True + ' + 'rdoStyles + ' + Me.rdoStyles.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoStyles.BackColor = System.Drawing.SystemColors.Control + Me.rdoStyles.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoStyles.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoStyles.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoStyles.FlatAppearance.BorderSize = 2 + Me.rdoStyles.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoStyles.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoStyles.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoStyles.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoStyles.Location = New System.Drawing.Point(195, 3) + Me.rdoStyles.Name = "rdoStyles" + Me.rdoStyles.Size = New System.Drawing.Size(91, 29) + Me.rdoStyles.TabIndex = 284 + Me.rdoStyles.Text = "Styles" + Me.rdoStyles.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoStyles.UseVisualStyleBackColor = True + ' + 'ucrPnlStub + ' + Me.ucrPnlStub.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlStub.Location = New System.Drawing.Point(81, 3) + Me.ucrPnlStub.Name = "ucrPnlStub" + Me.ucrPnlStub.Size = New System.Drawing.Size(232, 29) + Me.ucrPnlStub.TabIndex = 282 + ' + 'ucrStubStyle + ' + Me.ucrStubStyle.Location = New System.Drawing.Point(3, 43) + Me.ucrStubStyle.Name = "ucrStubStyle" + Me.ucrStubStyle.Size = New System.Drawing.Size(372, 186) + Me.ucrStubStyle.TabIndex = 285 + ' + 'ucrStub + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrStubStyle) + Me.Controls.Add(Me.rdoVariables) + Me.Controls.Add(Me.rdoStyles) + Me.Controls.Add(Me.ucrPnlStub) + Me.Controls.Add(Me.ucrStubOptions) + Me.Name = "ucrStub" + Me.Size = New System.Drawing.Size(420, 239) + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents ucrStubOptions As ucrStubOptions + Friend WithEvents rdoVariables As RadioButton + Friend WithEvents rdoStyles As RadioButton + Friend WithEvents ucrPnlStub As UcrPanel + Friend WithEvents ucrStubStyle As ucrStubStyle +End Class diff --git a/instat/UserTables/Stub/ucrStub.resx b/instat/UserTables/Stub/ucrStub.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Stub/ucrStub.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Stub/ucrStub.vb b/instat/UserTables/Stub/ucrStub.vb new file mode 100644 index 00000000000..b96c302de4d --- /dev/null +++ b/instat/UserTables/Stub/ucrStub.vb @@ -0,0 +1,33 @@ +Imports Antlr.Runtime + +Public Class ucrStub + + Private bFirstload As Boolean = True + + Private Sub initialiseDialog() + ucrPnlStub.AddRadioButton(rdoVariables) + ucrPnlStub.AddRadioButton(rdoStyles) + + rdoVariables.Checked = True + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + initialiseDialog() + bFirstload = False + End If + + ucrStubOptions.Setup(strDataFrameName, clsOperator) + ucrStubStyle.Setup(strDataFrameName, clsOperator) + End Sub + + Private Sub ucrPnlRows_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlStub.ControlValueChanged + ucrStubOptions.Visible = rdoVariables.Checked + ucrStubStyle.Visible = rdoStyles.Checked + End Sub + + Public Sub SetValuesToOperator() + ucrStubOptions.SetValuesToOperator() + ucrStubStyle.SetValuesToOperator() + End Sub +End Class diff --git a/instat/UserTables/Stub/ucrStubOptions.Designer.vb b/instat/UserTables/Stub/ucrStubOptions.Designer.vb new file mode 100644 index 00000000000..7f8eec498f3 --- /dev/null +++ b/instat/UserTables/Stub/ucrStubOptions.Designer.vb @@ -0,0 +1,138 @@ + _ +Partial Class ucrStubOptions + 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.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrInputStubHead = New instat.ucrInputTextBox() + Me.lblStubHeadLabel = New System.Windows.Forms.Label() + Me.lblRowName = New System.Windows.Forms.Label() + Me.ucrReceiverSingleRowName = New instat.ucrReceiverSingle() + Me.lblGroupByCol = New System.Windows.Forms.Label() + Me.ucrReceiverSingleGroupByCol = New instat.ucrReceiverSingle() + Me.SuspendLayout() + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(3, 1) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 1 + ' + 'ucrInputStubHead + ' + Me.ucrInputStubHead.AddQuotesIfUnrecognised = True + Me.ucrInputStubHead.AutoSize = True + Me.ucrInputStubHead.IsMultiline = False + Me.ucrInputStubHead.IsReadOnly = False + Me.ucrInputStubHead.Location = New System.Drawing.Point(256, 122) + Me.ucrInputStubHead.Name = "ucrInputStubHead" + Me.ucrInputStubHead.Size = New System.Drawing.Size(142, 21) + Me.ucrInputStubHead.TabIndex = 4 + ' + 'lblStubHeadLabel + ' + Me.lblStubHeadLabel.AutoSize = True + Me.lblStubHeadLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblStubHeadLabel.Location = New System.Drawing.Point(254, 106) + Me.lblStubHeadLabel.Name = "lblStubHeadLabel" + Me.lblStubHeadLabel.Size = New System.Drawing.Size(133, 13) + Me.lblStubHeadLabel.TabIndex = 296 + Me.lblStubHeadLabel.Text = "Stubhead Label (Optional):" + ' + 'lblRowName + ' + Me.lblRowName.AutoSize = True + Me.lblRowName.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblRowName.Location = New System.Drawing.Point(254, 16) + Me.lblRowName.Name = "lblRowName" + Me.lblRowName.Size = New System.Drawing.Size(63, 13) + Me.lblRowName.TabIndex = 295 + Me.lblRowName.Text = "Row Name:" + ' + 'ucrReceiverSingleRowName + ' + Me.ucrReceiverSingleRowName.AutoSize = True + Me.ucrReceiverSingleRowName.frmParent = Nothing + Me.ucrReceiverSingleRowName.Location = New System.Drawing.Point(257, 29) + Me.ucrReceiverSingleRowName.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSingleRowName.Name = "ucrReceiverSingleRowName" + Me.ucrReceiverSingleRowName.Selector = Nothing + Me.ucrReceiverSingleRowName.Size = New System.Drawing.Size(142, 20) + Me.ucrReceiverSingleRowName.strNcFilePath = "" + Me.ucrReceiverSingleRowName.TabIndex = 2 + Me.ucrReceiverSingleRowName.ucrSelector = Nothing + ' + 'lblGroupByCol + ' + Me.lblGroupByCol.AutoSize = True + Me.lblGroupByCol.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblGroupByCol.Location = New System.Drawing.Point(253, 61) + Me.lblGroupByCol.Name = "lblGroupByCol" + Me.lblGroupByCol.Size = New System.Drawing.Size(102, 13) + Me.lblGroupByCol.TabIndex = 293 + Me.lblGroupByCol.Text = "Group By (Optional):" + ' + 'ucrReceiverSingleGroupByCol + ' + Me.ucrReceiverSingleGroupByCol.AutoSize = True + Me.ucrReceiverSingleGroupByCol.frmParent = Nothing + Me.ucrReceiverSingleGroupByCol.Location = New System.Drawing.Point(255, 75) + Me.ucrReceiverSingleGroupByCol.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSingleGroupByCol.Name = "ucrReceiverSingleGroupByCol" + Me.ucrReceiverSingleGroupByCol.Selector = Nothing + Me.ucrReceiverSingleGroupByCol.Size = New System.Drawing.Size(142, 20) + Me.ucrReceiverSingleGroupByCol.strNcFilePath = "" + Me.ucrReceiverSingleGroupByCol.TabIndex = 3 + Me.ucrReceiverSingleGroupByCol.ucrSelector = Nothing + ' + 'ucrStubOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrSelectorCols) + Me.Controls.Add(Me.ucrInputStubHead) + Me.Controls.Add(Me.lblStubHeadLabel) + Me.Controls.Add(Me.lblRowName) + Me.Controls.Add(Me.ucrReceiverSingleRowName) + Me.Controls.Add(Me.lblGroupByCol) + Me.Controls.Add(Me.ucrReceiverSingleGroupByCol) + Me.Name = "ucrStubOptions" + Me.Size = New System.Drawing.Size(405, 187) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrInputStubHead As ucrInputTextBox + Friend WithEvents lblStubHeadLabel As Label + Friend WithEvents lblRowName As Label + Friend WithEvents ucrReceiverSingleRowName As ucrReceiverSingle + Friend WithEvents lblGroupByCol As Label + Friend WithEvents ucrReceiverSingleGroupByCol As ucrReceiverSingle +End Class diff --git a/instat/UserTables/Stub/ucrStubOptions.resx b/instat/UserTables/Stub/ucrStubOptions.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/Stub/ucrStubOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/Stub/ucrStubOptions.vb b/instat/UserTables/Stub/ucrStubOptions.vb new file mode 100644 index 00000000000..e78295e38fa --- /dev/null +++ b/instat/UserTables/Stub/ucrStubOptions.vb @@ -0,0 +1,69 @@ +Public Class ucrStubOptions + Private clsOperator As New ROperator + Private clsGtRFunction, clsStubHeadRFunction, clsStubStyleRFunction, clsStubLocationRFunction As New RFunction + Private bFirstload As Boolean = True + + Private Sub initialiseDialog() + ucrReceiverSingleRowName.SetParameter(New RParameter("rowname_col", 0)) + ucrReceiverSingleRowName.SetParameterIsString() + ucrReceiverSingleRowName.Selector = ucrSelectorCols + ucrReceiverSingleRowName.SetLinkedDisplayControl(lblRowName) + + ucrReceiverSingleGroupByCol.SetParameter(New RParameter("groupname_col", 1)) + ucrReceiverSingleGroupByCol.SetParameterIsString() + ucrReceiverSingleGroupByCol.Selector = ucrSelectorCols + ucrReceiverSingleGroupByCol.SetLinkedDisplayControl(lblGroupByCol) + + ucrInputStubHead.SetParameter(New RParameter("label", 0)) + End Sub + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + + If bFirstload Then + initialiseDialog() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + ucrReceiverSingleRowName.SetMeAsReceiver() + + ' The GT paramter should always be there. + clsGtRFunction = clsTablesUtils.FindRFunctionsParamsWithRCommand({"gt"}, clsOperator).FirstOrDefault()?.clsArgumentCodeStructure + + clsStubHeadRFunction = clsTablesUtils.FindRFunctionsParamsWithRCommand({"tab_stubhead"}, clsOperator).FirstOrDefault()?.clsArgumentCodeStructure + If clsStubHeadRFunction Is Nothing Then + clsStubHeadRFunction = New RFunction + clsStubHeadRFunction.SetPackageName("gt") + clsStubHeadRFunction.SetRCommand("tab_stubhead") + End If + + SetRCode() + End Sub + + Private Sub SetRCode() + ucrReceiverSingleRowName.SetRCode(clsGtRFunction, True, bCloneIfNeeded:=True) + ucrReceiverSingleGroupByCol.SetRCode(clsGtRFunction, True, bCloneIfNeeded:=True) + ucrInputStubHead.SetRCode(clsStubHeadRFunction, True, bCloneIfNeeded:=True) + End Sub + + + Private Sub btnStyle_Click(sender As Object, e As EventArgs) + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm, clsStubStyleRFunction) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + clsStubStyleRFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsStubLocationRFunction) + End Sub + + Public Sub SetValuesToOperator() + + clsTablesUtils.RemoveRFunctionsParamsWithRCommand({"tab_stubhead"}, clsOperator) + + If Not ucrInputStubHead.IsEmpty Then + clsOperator.AddParameter(New RParameter(strParameterName:="tab_stubhead_param", strParamValue:=clsStubHeadRFunction, bNewIncludeArgumentName:=False)) + End If + End Sub +End Class diff --git a/instat/UserTables/Stub/ucrStubStyle.Designer.vb b/instat/UserTables/Stub/ucrStubStyle.Designer.vb new file mode 100644 index 00000000000..7db09228c98 --- /dev/null +++ b/instat/UserTables/Stub/ucrStubStyle.Designer.vb @@ -0,0 +1,128 @@ + _ +Partial Class ucrStubStyle + 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.btnEnterStyle = New System.Windows.Forms.Button() + Me.lblFormats = New System.Windows.Forms.Label() + Me.btnClearStyle = New System.Windows.Forms.Button() + Me.dataGridFormats = New System.Windows.Forms.DataGridView() + Me.colStyles = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.Label1 = New System.Windows.Forms.Label() + Me.ucrRowExpression = New instat.ucrRowExpression() + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'btnEnterStyle + ' + Me.btnEnterStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.btnEnterStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnEnterStyle.Location = New System.Drawing.Point(8, 54) + Me.btnEnterStyle.Name = "btnEnterStyle" + Me.btnEnterStyle.Size = New System.Drawing.Size(126, 23) + Me.btnEnterStyle.TabIndex = 335 + Me.btnEnterStyle.Tag = "" + Me.btnEnterStyle.Text = "Enter Style" + Me.btnEnterStyle.UseVisualStyleBackColor = True + ' + 'lblFormats + ' + Me.lblFormats.AutoSize = True + Me.lblFormats.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFormats.Location = New System.Drawing.Point(6, 85) + Me.lblFormats.Name = "lblFormats" + Me.lblFormats.Size = New System.Drawing.Size(38, 13) + Me.lblFormats.TabIndex = 338 + Me.lblFormats.Text = "Styles:" + ' + 'btnClearStyle + ' + Me.btnClearStyle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.btnClearStyle.Location = New System.Drawing.Point(290, 76) + Me.btnClearStyle.Name = "btnClearStyle" + Me.btnClearStyle.Size = New System.Drawing.Size(75, 23) + Me.btnClearStyle.TabIndex = 337 + Me.btnClearStyle.Tag = "" + Me.btnClearStyle.Text = "Clear" + Me.btnClearStyle.UseVisualStyleBackColor = True + ' + 'dataGridFormats + ' + Me.dataGridFormats.AllowUserToAddRows = False + Me.dataGridFormats.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataGridFormats.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colStyles}) + Me.dataGridFormats.Location = New System.Drawing.Point(8, 102) + Me.dataGridFormats.Name = "dataGridFormats" + Me.dataGridFormats.RowHeadersWidth = 62 + Me.dataGridFormats.Size = New System.Drawing.Size(361, 73) + Me.dataGridFormats.TabIndex = 336 + ' + 'colStyles + ' + Me.colStyles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.colStyles.HeaderText = "Style Expressions" + Me.colStyles.MinimumWidth = 8 + Me.colStyles.Name = "colStyles" + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.Label1.Location = New System.Drawing.Point(6, 4) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(131, 13) + Me.Label1.TabIndex = 333 + Me.Label1.Text = "Row Expression(Optional):" + ' + 'ucrRowExpression + ' + Me.ucrRowExpression.Location = New System.Drawing.Point(3, 20) + Me.ucrRowExpression.Name = "ucrRowExpression" + Me.ucrRowExpression.Size = New System.Drawing.Size(134, 26) + Me.ucrRowExpression.TabIndex = 339 + ' + 'ucrStubStyle + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrRowExpression) + Me.Controls.Add(Me.lblFormats) + Me.Controls.Add(Me.btnClearStyle) + Me.Controls.Add(Me.dataGridFormats) + Me.Controls.Add(Me.btnEnterStyle) + Me.Controls.Add(Me.Label1) + Me.Name = "ucrStubStyle" + Me.Size = New System.Drawing.Size(372, 177) + CType(Me.dataGridFormats, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents btnEnterStyle As Button + Friend WithEvents lblFormats As Label + Friend WithEvents btnClearStyle As Button + Friend WithEvents dataGridFormats As DataGridView + Friend WithEvents colStyles As DataGridViewTextBoxColumn + Friend WithEvents Label1 As Label + Friend WithEvents ucrRowExpression As ucrRowExpression +End Class diff --git a/instat/UserTables/Stub/ucrStubStyle.resx b/instat/UserTables/Stub/ucrStubStyle.resx new file mode 100644 index 00000000000..d937ee32b35 --- /dev/null +++ b/instat/UserTables/Stub/ucrStubStyle.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + \ No newline at end of file diff --git a/instat/UserTables/Stub/ucrStubStyle.vb b/instat/UserTables/Stub/ucrStubStyle.vb new file mode 100644 index 00000000000..71f87724290 --- /dev/null +++ b/instat/UserTables/Stub/ucrStubStyle.vb @@ -0,0 +1,72 @@ +Public Class ucrStubStyle + Private clsOperator As New ROperator + Private bFirstload As Boolean = True + + Public Sub Setup(strDataFrameName As String, clsOperator As ROperator) + If bFirstload Then + 'InitialiseControl() + bFirstload = False + End If + + Me.clsOperator = clsOperator + + ucrRowExpression.Setup(strDataFrameName) + + ' Clear and Set up the data grid with contents + dataGridFormats.Rows.Clear() + SetupDataGrid(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_stub", clsOperator)) + End Sub + + Private Sub SetupDataGrid(lstRParams As List(Of RParameter)) + For Each clsRParam As RParameter In lstRParams + ' Create a new row that represents the tab_style() parameters + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsRParam.clsArgumentCodeStructure.Clone.ToScript + + ' Tag and add the tab_style() parameter function contents as a row + row.Tag = clsRParam + dataGridFormats.Rows.Add(row) + Next + End Sub + + Private Sub btnEnterStyle_Click(sender As Object, e As EventArgs) Handles btnEnterStyle.Click + Dim clsListStyleRFunction As RFunction = clsTablesUtils.ShowStyleSubDialog(Me.ParentForm) + If clsListStyleRFunction Is Nothing Then + Exit Sub + End If + + Dim clsLocationsRFunction As New RFunction + clsLocationsRFunction.SetPackageName("gt") + clsLocationsRFunction.SetRCommand("cells_stub") + + If Not ucrRowExpression.IsEmpty Then + clsLocationsRFunction.AddParameter(New RParameter(strParameterName:="rows", strParamValue:=ucrRowExpression.GetText(), iNewPosition:=1)) + End If + + Dim clsTabStyleRFunction As RFunction = clsTablesUtils.GetNewStyleRFunction(clsListStyleRFunction, clsLocationsRFunction) + + ' Create parameter with unique name + Dim clsRParam As New RParameter(strParameterName:="tab_style_stub_param" & (dataGridFormats.Rows.Count + 1), strParamValue:=clsTabStyleRFunction, bNewIncludeArgumentName:=False) + + ' Create row and its cells + Dim row As New DataGridViewRow + row.CreateCells(dataGridFormats) + row.Cells(0).Value = clsTabStyleRFunction.Clone.ToScript + + ' Tag the row with the parameter + row.Tag = clsRParam + + ' Add it to grid + dataGridFormats.Rows.Add(row) + End Sub + + Private Sub btnClearStyle_Click(sender As Object, e As EventArgs) Handles btnClearStyle.Click + dataGridFormats.Rows.Clear() + End Sub + + Public Sub SetValuesToOperator() + clsTablesUtils.RemoveRParams(clsTablesUtils.FindRFunctionsParamsWithRParamValue({"tab_style"}, "locations", "cells_stub", clsOperator), clsOperator) + clsTablesUtils.AddGridRowTagsRParamsToROperator(dataGridFormats, clsOperator) + End Sub +End Class diff --git a/instat/UserTables/clsTablesUtils.vb b/instat/UserTables/clsTablesUtils.vb new file mode 100644 index 00000000000..cace4963759 --- /dev/null +++ b/instat/UserTables/clsTablesUtils.vb @@ -0,0 +1,114 @@ +Imports System.Reflection + +Public Class clsTablesUtils + + Public Shared Function ShowStyleSubDialog(owner As Form, Optional clsListStyleRFunction As RFunction = Nothing) As RFunction + If clsListStyleRFunction IsNot Nothing AndAlso clsListStyleRFunction.ContainsParameter("style") Then + sdgTableStyles.Setup(clsListStyleRFunction.GetParameter("style").clsArgumentCodeStructure) + Else + sdgTableStyles.Setup() + End If + + sdgTableStyles.ShowDialog(owner) + Return sdgTableStyles.GetNewUserInputAsRFunction() + End Function + + 'TODO. Delete + Public Shared Function FindRFunctionsWithRCommand(strRCommandName As String, clsOperator As ROperator) As List(Of RFunction) + Dim lstRFunctions As New List(Of RFunction) + For Each clsRParam As RParameter In clsOperator.clsParameters + If clsRParam.bIsFunction AndAlso clsRParam.HasValue() Then + Dim rFunction As RFunction = clsRParam.clsArgumentCodeStructure + If rFunction.strRCommand = strRCommandName Then + lstRFunctions.Add(rFunction) + End If + End If + Next + Return lstRFunctions + End Function + + Public Shared Function GetNewStyleRFunction(clsListStyleRFunction As RFunction, clsLocationsRFunction As RFunction) As RFunction + Dim clsTabStyleRFunction As New RFunction + clsTabStyleRFunction.SetPackageName("gt") + clsTabStyleRFunction.SetRCommand("tab_style") + clsTabStyleRFunction.AddParameter(strParameterName:="style", clsRFunctionParameter:=clsListStyleRFunction, iPosition:=0) + clsTabStyleRFunction.AddParameter(strParameterName:="locations", clsRFunctionParameter:=clsLocationsRFunction, iPosition:=1) + Return clsTabStyleRFunction + End Function + + Public Shared Function FindRFunctionsParamsWithRCommand(strRCommandNames() As String, clsOperator As ROperator) As List(Of RParameter) + Dim lstRFunctionParams As New List(Of RParameter) + For Each clsRParam As RParameter In clsOperator.clsParameters + If clsRParam.bIsFunction AndAlso clsRParam.HasValue() Then + If strRCommandNames.Contains(DirectCast(clsRParam.clsArgumentCodeStructure, RFunction).strRCommand) Then + lstRFunctionParams.Add(clsRParam) + End If + End If + Next + Return lstRFunctionParams + End Function + + Public Shared Sub RemoveRFunctionsParamsWithRCommand(strRCommandNames() As String, clsOperator As ROperator) + ' Remove all the previous footer parameters first + Dim lstParams As New List(Of RParameter) + For Each clsRParam As RParameter In clsOperator.clsParameters + If clsRParam.bIsFunction AndAlso clsRParam.HasValue() Then + If strRCommandNames.Contains(DirectCast(clsRParam.clsArgumentCodeStructure, RFunction).strRCommand) Then + lstParams.Add(clsRParam) + End If + End If + Next + + RemoveRParams(lstParams, clsOperator) + End Sub + + Public Shared Sub RemoveRParams(lstParams As IEnumerable(Of RParameter), clsOperator As ROperator) + For Each clsRParam As RParameter In lstParams + clsOperator.RemoveParameter(clsRParam) + Next + End Sub + + Public Shared Sub AddGridRowTagsRParamsToROperator(dataGrid As DataGridView, clsOperator As ROperator) + For index As Integer = 0 To dataGrid.Rows.Count - 1 + If dataGrid.Rows.Item(index).Tag IsNot Nothing Then + Dim clsRParam As RParameter = dataGrid.Rows.Item(index).Tag + clsOperator.AddParameter(clsRParam) + End If + Next + End Sub + + ''' + ''' E.g Finding cells_body in R Function tab_style( style = cell_fill(color = "gray85"), locations = cells_body() ) + ''' + ''' e.g tab_style + ''' e.g locations + ''' e.g cells_body + ''' Operator that contains the parent strRCommandName + ''' + Public Shared Function FindRFunctionsParamsWithRParamValue(strRCommandNames() As String, strParamName As String, strParamValueRCommand As String, clsOperator As ROperator) As List(Of RParameter) + + Dim lstRFunctionParams As List(Of RParameter) = FindRFunctionsParamsWithRCommand(strRCommandNames, clsOperator) + Dim lstRFunctionsParamsFound As New List(Of RParameter) + + For Each clsRParam As RParameter In lstRFunctionParams + Dim rFunctionParent As RFunction = clsRParam.clsArgumentCodeStructure + If strRCommandNames.Contains(rFunctionParent.strRCommand) AndAlso rFunctionParent.ContainsParameter(strParamName) Then + + Dim rFunctionchild As RFunction = rFunctionParent.GetParameter(strParamName).clsArgumentCodeStructure + If rFunctionchild.strRCommand = strParamValueRCommand Then + lstRFunctionsParamsFound.Add(clsRParam) + End If + + End If + Next + Return lstRFunctionsParamsFound + End Function + + Public Shared Function GetStringValue(str As String, bwithQuotes As Boolean) As String + If String.IsNullOrEmpty(str) Then + str = "" + End If + Return If(bwithQuotes, """" & str & """", str.Replace("""", "")) + End Function + +End Class diff --git a/instat/UserTables/dlgGeneralTable.Designer.vb b/instat/UserTables/dlgGeneralTable.Designer.vb new file mode 100644 index 00000000000..481a6fbbd41 --- /dev/null +++ b/instat/UserTables/dlgGeneralTable.Designer.vb @@ -0,0 +1,150 @@ + _ +Partial Class dlgGeneralTable + 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.lblColumns = New System.Windows.Forms.Label() + Me.btnMoreOptions = New System.Windows.Forms.Button() + Me.ucrNudPreview = New instat.ucrNud() + Me.ucrChkPreview = New instat.ucrCheck() + Me.ucrSaveTable = New instat.ucrSave() + Me.ucrBase = New instat.ucrButtons() + Me.ucrReceiverMultipleCols = New instat.ucrReceiverMultiple() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.SuspendLayout() + ' + 'lblColumns + ' + Me.lblColumns.AutoSize = True + Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumns.Location = New System.Drawing.Point(247, 50) + Me.lblColumns.Name = "lblColumns" + Me.lblColumns.Size = New System.Drawing.Size(50, 13) + Me.lblColumns.TabIndex = 24 + Me.lblColumns.Text = "Columns:" + ' + 'btnMoreOptions + ' + Me.btnMoreOptions.Location = New System.Drawing.Point(9, 204) + Me.btnMoreOptions.Name = "btnMoreOptions" + Me.btnMoreOptions.Size = New System.Drawing.Size(141, 23) + Me.btnMoreOptions.TabIndex = 25 + Me.btnMoreOptions.Text = "Table Options" + Me.btnMoreOptions.UseVisualStyleBackColor = True + ' + 'ucrNudPreview + ' + Me.ucrNudPreview.AutoSize = True + Me.ucrNudPreview.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudPreview.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudPreview.Location = New System.Drawing.Point(370, 174) + Me.ucrNudPreview.Margin = New System.Windows.Forms.Padding(6) + Me.ucrNudPreview.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudPreview.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudPreview.Name = "ucrNudPreview" + Me.ucrNudPreview.Size = New System.Drawing.Size(50, 20) + Me.ucrNudPreview.TabIndex = 31 + Me.ucrNudPreview.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkPreview + ' + Me.ucrChkPreview.AutoSize = True + Me.ucrChkPreview.Checked = False + Me.ucrChkPreview.Location = New System.Drawing.Point(250, 175) + Me.ucrChkPreview.Margin = New System.Windows.Forms.Padding(6) + Me.ucrChkPreview.Name = "ucrChkPreview" + Me.ucrChkPreview.Size = New System.Drawing.Size(119, 23) + Me.ucrChkPreview.TabIndex = 30 + ' + 'ucrSaveTable + ' + Me.ucrSaveTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveTable.Location = New System.Drawing.Point(9, 242) + Me.ucrSaveTable.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveTable.Name = "ucrSaveTable" + Me.ucrSaveTable.Size = New System.Drawing.Size(319, 24) + Me.ucrSaveTable.TabIndex = 27 + ' + 'ucrBase + ' + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(9, 276) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(4) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 26 + ' + 'ucrReceiverMultipleCols + ' + Me.ucrReceiverMultipleCols.AutoSize = True + Me.ucrReceiverMultipleCols.frmParent = Me + Me.ucrReceiverMultipleCols.Location = New System.Drawing.Point(250, 63) + Me.ucrReceiverMultipleCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultipleCols.Name = "ucrReceiverMultipleCols" + Me.ucrReceiverMultipleCols.Selector = Nothing + Me.ucrReceiverMultipleCols.Size = New System.Drawing.Size(141, 100) + Me.ucrReceiverMultipleCols.strNcFilePath = "" + Me.ucrReceiverMultipleCols.TabIndex = 23 + Me.ucrReceiverMultipleCols.ucrSelector = Nothing + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(9, 9) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCols.TabIndex = 22 + ' + 'dlgGeneralTable + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(476, 338) + Me.Controls.Add(Me.ucrNudPreview) + Me.Controls.Add(Me.ucrChkPreview) + Me.Controls.Add(Me.ucrSaveTable) + Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.btnMoreOptions) + Me.Controls.Add(Me.lblColumns) + Me.Controls.Add(Me.ucrReceiverMultipleCols) + Me.Controls.Add(Me.ucrSelectorCols) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "dlgGeneralTable" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Presentation Table" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrReceiverMultipleCols As ucrReceiverMultiple + Friend WithEvents btnMoreOptions As Button + Friend WithEvents lblColumns As Label + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrSaveTable As ucrSave + Friend WithEvents ucrNudPreview As ucrNud + Friend WithEvents ucrChkPreview As ucrCheck +End Class diff --git a/instat/UserTables/dlgGeneralTable.resx b/instat/UserTables/dlgGeneralTable.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/dlgGeneralTable.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/dlgGeneralTable.vb b/instat/UserTables/dlgGeneralTable.vb new file mode 100644 index 00000000000..fefc401eee2 --- /dev/null +++ b/instat/UserTables/dlgGeneralTable.vb @@ -0,0 +1,119 @@ +Imports instat.Translations + +Public Class dlgGeneralTable + Private clsBaseOperator As New ROperator + Private clsHeadRFunction, clsGtRFunction As New RFunction + + Private bFirstload As Boolean = True + Private bReset As Boolean = True + + Private Sub dlgGeneralTable_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + initialiseDialog() + bFirstload = False + End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False + autoTranslate(Me) + TestOKEnabled() + End Sub + + Private Sub btnMoreOptions_Click(sender As Object, e As EventArgs) Handles btnMoreOptions.Click + sdgTableOptions.Setup(ucrSelectorCols.strCurrentDataFrame, clsBaseOperator) + sdgTableOptions.ShowDialog(Me) + End Sub + + Private Sub ucrControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleCols.ControlContentsChanged + TestOKEnabled() + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeForControls(True) + TestOKEnabled() + End Sub + + Private Sub initialiseDialog() + ucrBase.iHelpTopicID = 419 + + ucrReceiverMultipleCols.SetParameter(New RParameter("df_columns_to_use_param", 0, bNewIncludeArgumentName:=False)) + ucrReceiverMultipleCols.SetParameterIsRFunction() + ucrReceiverMultipleCols.Selector = ucrSelectorCols + ucrReceiverMultipleCols.SetLinkedDisplayControl(lblColumns) + + ucrChkPreview.SetText("Preview") + ucrChkPreview.AddParameterPresentCondition(True, "head", bNewIsPositive:=True) + ucrChkPreview.AddParameterPresentCondition(False, "head", bNewIsPositive:=False) + ucrChkPreview.AddToLinkedControls(ucrNudPreview, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrNudPreview.SetParameter(New RParameter("x", 0, bNewIncludeArgumentName:=False)) + ucrNudPreview.Minimum = 6 + ucrNudPreview.Maximum = Decimal.MaxValue + ucrNudPreview.SetRDefault(6) + + ucrSaveTable.SetPrefix("presentation_table") + ucrSaveTable.SetSaveType(RObjectTypeLabel.Table, strRObjectFormat:=RObjectFormat.Html) + ucrSaveTable.SetDataFrameSelector(ucrSelectorCols.ucrAvailableDataFrames) + ucrSaveTable.SetIsComboBox() + ucrSaveTable.SetCheckBoxText("Store Table") + ucrSaveTable.SetAssignToIfUncheckedValue("last_table") + + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + End Sub + + + Private Sub SetDefaults() + clsBaseOperator = New ROperator + clsHeadRFunction = New RFunction + clsGtRFunction = New RFunction + + ucrSelectorCols.Reset() + ucrReceiverMultipleCols.SetMeAsReceiver() + ucrSaveTable.Reset() + ucrChkPreview.Checked = True + + clsBaseOperator.SetOperation("%>%") + clsBaseOperator.bBrackets = False + + clsHeadRFunction.SetPackageName("utils") + clsHeadRFunction.SetRCommand("head") + clsHeadRFunction.AddParameter(strParameterName:="x", strParameterValue:=100, iPosition:=0, bIncludeArgumentName:=False) + clsBaseOperator.AddParameter(strParameterName:="head", clsRFunctionParameter:=clsHeadRFunction, iPosition:=1, bIncludeArgumentName:=False) + + clsGtRFunction.SetPackageName("gt") + clsGtRFunction.SetRCommand("gt") + clsBaseOperator.AddParameter(strParameterName:="gt", clsRFunctionParameter:=clsGtRFunction, iPosition:=2, bIncludeArgumentName:=False) + + clsBaseOperator.SetAssignToOutputObject(strRObjectToAssignTo:="last_table", + strRObjectTypeLabelToAssignTo:=RObjectTypeLabel.Table, + strRObjectFormatToAssignTo:=RObjectFormat.Html, + strRDataFrameNameToAddObjectTo:=ucrSelectorCols.strCurrentDataFrame, + strObjectName:="last_table") + + ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) + End Sub + + + Private Sub SetRCodeForControls(bReset As Boolean) + ucrReceiverMultipleCols.SetRCode(clsBaseOperator, bReset) + ucrSaveTable.SetRCode(clsBaseOperator, bReset) + + ucrChkPreview.SetRCode(clsBaseOperator, bReset) + ucrNudPreview.SetRCode(clsHeadRFunction, bReset) + End Sub + + Private Sub TestOKEnabled() + ucrBase.OKEnabled(Not ucrReceiverMultipleCols.IsEmpty AndAlso ucrSaveTable.IsComplete) + End Sub + + Private Sub ucrChkPreview_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkPreview.ControlValueChanged + If ucrChkPreview.Checked Then + clsBaseOperator.AddParameter(strParameterName:="head", clsRFunctionParameter:=clsHeadRFunction, iPosition:=1, bIncludeArgumentName:=False) + Else + clsBaseOperator.RemoveParameterByName("head") + End If + End Sub +End Class \ No newline at end of file diff --git a/instat/UserTables/sdgTableOptions.Designer.vb b/instat/UserTables/sdgTableOptions.Designer.vb new file mode 100644 index 00000000000..5f4be438d62 --- /dev/null +++ b/instat/UserTables/sdgTableOptions.Designer.vb @@ -0,0 +1,324 @@ + _ +Partial Class sdgTableOptions + 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.tbpFormatOptions = New System.Windows.Forms.TabControl() + Me.tbpHeader = New System.Windows.Forms.TabPage() + Me.ucrHeader = New instat.ucrHeader() + Me.tbpStub = New System.Windows.Forms.TabPage() + Me.ucrStub = New instat.ucrStub() + Me.tbpColumns = New System.Windows.Forms.TabPage() + Me.ucrColumns = New instat.ucrColumns() + Me.tbpRows = New System.Windows.Forms.TabPage() + Me.ucrRows = New instat.ucrRows() + Me.tbpCells = New System.Windows.Forms.TabPage() + Me.ucrCells = New instat.ucrCells() + Me.tbpSourceNotes = New System.Windows.Forms.TabPage() + Me.ucrSourceNotes = New instat.ucrSourceNotes() + Me.tbpThemes = New System.Windows.Forms.TabPage() + Me.ucrCboSelectThemes = New instat.ucrInputComboBox() + Me.btnManualTheme = New System.Windows.Forms.Button() + Me.rdoSelectTheme = New System.Windows.Forms.RadioButton() + Me.rdoManualTheme = New System.Windows.Forms.RadioButton() + Me.ucrPnlThemesPanel = New instat.UcrPanel() + Me.tbpOtherStyles = New System.Windows.Forms.TabPage() + Me.ucrOtherStyles = New instat.ucrOtherStyles() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() + Me.tbpFormatOptions.SuspendLayout() + Me.tbpHeader.SuspendLayout() + Me.tbpStub.SuspendLayout() + Me.tbpColumns.SuspendLayout() + Me.tbpRows.SuspendLayout() + Me.tbpCells.SuspendLayout() + Me.tbpSourceNotes.SuspendLayout() + Me.tbpThemes.SuspendLayout() + Me.tbpOtherStyles.SuspendLayout() + Me.SuspendLayout() + ' + 'tbpFormatOptions + ' + Me.tbpFormatOptions.Controls.Add(Me.tbpHeader) + Me.tbpFormatOptions.Controls.Add(Me.tbpStub) + Me.tbpFormatOptions.Controls.Add(Me.tbpColumns) + Me.tbpFormatOptions.Controls.Add(Me.tbpRows) + Me.tbpFormatOptions.Controls.Add(Me.tbpCells) + Me.tbpFormatOptions.Controls.Add(Me.tbpSourceNotes) + Me.tbpFormatOptions.Controls.Add(Me.tbpThemes) + Me.tbpFormatOptions.Controls.Add(Me.tbpOtherStyles) + Me.tbpFormatOptions.Location = New System.Drawing.Point(3, 5) + Me.tbpFormatOptions.Name = "tbpFormatOptions" + Me.tbpFormatOptions.SelectedIndex = 0 + Me.tbpFormatOptions.Size = New System.Drawing.Size(656, 457) + Me.tbpFormatOptions.TabIndex = 5 + ' + 'tbpHeader + ' + Me.tbpHeader.Controls.Add(Me.ucrHeader) + Me.tbpHeader.Location = New System.Drawing.Point(4, 22) + Me.tbpHeader.Name = "tbpHeader" + Me.tbpHeader.Padding = New System.Windows.Forms.Padding(3) + Me.tbpHeader.Size = New System.Drawing.Size(648, 431) + Me.tbpHeader.TabIndex = 0 + Me.tbpHeader.Text = "Header" + Me.tbpHeader.UseVisualStyleBackColor = True + ' + 'ucrHeader + ' + Me.ucrHeader.Location = New System.Drawing.Point(7, 6) + Me.ucrHeader.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrHeader.Name = "ucrHeader" + Me.ucrHeader.Size = New System.Drawing.Size(601, 300) + Me.ucrHeader.TabIndex = 16 + ' + 'tbpStub + ' + Me.tbpStub.Controls.Add(Me.ucrStub) + Me.tbpStub.Location = New System.Drawing.Point(4, 22) + Me.tbpStub.Name = "tbpStub" + Me.tbpStub.Size = New System.Drawing.Size(648, 431) + Me.tbpStub.TabIndex = 9 + Me.tbpStub.Text = "Stub" + Me.tbpStub.UseVisualStyleBackColor = True + ' + 'ucrStub + ' + Me.ucrStub.Location = New System.Drawing.Point(7, 7) + Me.ucrStub.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrStub.Name = "ucrStub" + Me.ucrStub.Size = New System.Drawing.Size(425, 258) + Me.ucrStub.TabIndex = 0 + ' + 'tbpColumns + ' + Me.tbpColumns.Controls.Add(Me.ucrColumns) + Me.tbpColumns.Location = New System.Drawing.Point(4, 22) + Me.tbpColumns.Name = "tbpColumns" + Me.tbpColumns.Size = New System.Drawing.Size(648, 431) + Me.tbpColumns.TabIndex = 8 + Me.tbpColumns.Text = "Columns" + Me.tbpColumns.UseVisualStyleBackColor = True + ' + 'ucrColumns + ' + Me.ucrColumns.Location = New System.Drawing.Point(5, 6) + Me.ucrColumns.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrColumns.Name = "ucrColumns" + Me.ucrColumns.Size = New System.Drawing.Size(632, 360) + Me.ucrColumns.TabIndex = 0 + ' + 'tbpRows + ' + Me.tbpRows.Controls.Add(Me.ucrRows) + Me.tbpRows.Location = New System.Drawing.Point(4, 22) + Me.tbpRows.Name = "tbpRows" + Me.tbpRows.Size = New System.Drawing.Size(648, 431) + Me.tbpRows.TabIndex = 7 + Me.tbpRows.Text = "Rows" + Me.tbpRows.UseVisualStyleBackColor = True + ' + 'ucrRows + ' + Me.ucrRows.Location = New System.Drawing.Point(7, 9) + Me.ucrRows.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrRows.Name = "ucrRows" + Me.ucrRows.Size = New System.Drawing.Size(600, 421) + Me.ucrRows.TabIndex = 0 + ' + 'tbpCells + ' + Me.tbpCells.Controls.Add(Me.ucrCells) + Me.tbpCells.Location = New System.Drawing.Point(4, 22) + Me.tbpCells.Name = "tbpCells" + Me.tbpCells.Size = New System.Drawing.Size(648, 431) + Me.tbpCells.TabIndex = 3 + Me.tbpCells.Text = "Cells" + Me.tbpCells.UseVisualStyleBackColor = True + ' + 'ucrCells + ' + Me.ucrCells.Location = New System.Drawing.Point(8, 8) + Me.ucrCells.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrCells.Name = "ucrCells" + Me.ucrCells.Size = New System.Drawing.Size(644, 360) + Me.ucrCells.TabIndex = 6 + ' + 'tbpSourceNotes + ' + Me.tbpSourceNotes.Controls.Add(Me.ucrSourceNotes) + Me.tbpSourceNotes.Location = New System.Drawing.Point(4, 22) + Me.tbpSourceNotes.Name = "tbpSourceNotes" + Me.tbpSourceNotes.Size = New System.Drawing.Size(648, 431) + Me.tbpSourceNotes.TabIndex = 4 + Me.tbpSourceNotes.Text = "Source Notes" + Me.tbpSourceNotes.UseVisualStyleBackColor = True + ' + 'ucrSourceNotes + ' + Me.ucrSourceNotes.Location = New System.Drawing.Point(7, 7) + Me.ucrSourceNotes.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSourceNotes.Name = "ucrSourceNotes" + Me.ucrSourceNotes.Size = New System.Drawing.Size(581, 190) + Me.ucrSourceNotes.TabIndex = 0 + ' + 'tbpThemes + ' + Me.tbpThemes.Controls.Add(Me.ucrCboSelectThemes) + Me.tbpThemes.Controls.Add(Me.btnManualTheme) + Me.tbpThemes.Controls.Add(Me.rdoSelectTheme) + Me.tbpThemes.Controls.Add(Me.rdoManualTheme) + Me.tbpThemes.Controls.Add(Me.ucrPnlThemesPanel) + Me.tbpThemes.Location = New System.Drawing.Point(4, 22) + Me.tbpThemes.Name = "tbpThemes" + Me.tbpThemes.Size = New System.Drawing.Size(648, 431) + Me.tbpThemes.TabIndex = 6 + Me.tbpThemes.Text = "Themes" + Me.tbpThemes.UseVisualStyleBackColor = True + ' + 'ucrCboSelectThemes + ' + Me.ucrCboSelectThemes.AddQuotesIfUnrecognised = True + Me.ucrCboSelectThemes.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboSelectThemes.GetSetSelectedIndex = -1 + Me.ucrCboSelectThemes.IsReadOnly = False + Me.ucrCboSelectThemes.Location = New System.Drawing.Point(157, 29) + Me.ucrCboSelectThemes.Margin = New System.Windows.Forms.Padding(9) + Me.ucrCboSelectThemes.Name = "ucrCboSelectThemes" + Me.ucrCboSelectThemes.Size = New System.Drawing.Size(168, 21) + Me.ucrCboSelectThemes.TabIndex = 3 + ' + 'btnManualTheme + ' + Me.btnManualTheme.Location = New System.Drawing.Point(157, 59) + Me.btnManualTheme.Name = "btnManualTheme" + Me.btnManualTheme.Size = New System.Drawing.Size(168, 21) + Me.btnManualTheme.TabIndex = 2 + Me.btnManualTheme.Text = "Custom Theme" + Me.btnManualTheme.UseVisualStyleBackColor = True + ' + 'rdoSelectTheme + ' + Me.rdoSelectTheme.AutoSize = True + Me.rdoSelectTheme.Checked = True + Me.rdoSelectTheme.Location = New System.Drawing.Point(22, 31) + Me.rdoSelectTheme.Name = "rdoSelectTheme" + Me.rdoSelectTheme.Size = New System.Drawing.Size(91, 17) + Me.rdoSelectTheme.TabIndex = 0 + Me.rdoSelectTheme.TabStop = True + Me.rdoSelectTheme.Text = "Select Theme" + Me.rdoSelectTheme.UseVisualStyleBackColor = True + ' + 'rdoManualTheme + ' + Me.rdoManualTheme.AutoSize = True + Me.rdoManualTheme.Location = New System.Drawing.Point(22, 61) + Me.rdoManualTheme.Name = "rdoManualTheme" + Me.rdoManualTheme.Size = New System.Drawing.Size(96, 17) + Me.rdoManualTheme.TabIndex = 1 + Me.rdoManualTheme.Text = "Manual Theme" + Me.rdoManualTheme.UseVisualStyleBackColor = True + ' + 'ucrPnlThemesPanel + ' + Me.ucrPnlThemesPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlThemesPanel.Location = New System.Drawing.Point(12, 16) + Me.ucrPnlThemesPanel.Margin = New System.Windows.Forms.Padding(6) + Me.ucrPnlThemesPanel.Name = "ucrPnlThemesPanel" + Me.ucrPnlThemesPanel.Size = New System.Drawing.Size(349, 70) + Me.ucrPnlThemesPanel.TabIndex = 4 + ' + 'tbpOtherStyles + ' + Me.tbpOtherStyles.Controls.Add(Me.ucrOtherStyles) + Me.tbpOtherStyles.Location = New System.Drawing.Point(4, 22) + Me.tbpOtherStyles.Name = "tbpOtherStyles" + Me.tbpOtherStyles.Padding = New System.Windows.Forms.Padding(3) + Me.tbpOtherStyles.Size = New System.Drawing.Size(648, 431) + Me.tbpOtherStyles.TabIndex = 10 + Me.tbpOtherStyles.Text = "Other Styles" + Me.tbpOtherStyles.UseVisualStyleBackColor = True + ' + 'ucrOtherStyles + ' + Me.ucrOtherStyles.Location = New System.Drawing.Point(8, 7) + Me.ucrOtherStyles.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrOtherStyles.Name = "ucrOtherStyles" + Me.ucrOtherStyles.Size = New System.Drawing.Size(326, 179) + Me.ucrOtherStyles.TabIndex = 0 + ' + 'ucrSdgBaseButtons + ' + Me.ucrSdgBaseButtons.AutoSize = True + Me.ucrSdgBaseButtons.Location = New System.Drawing.Point(200, 465) + Me.ucrSdgBaseButtons.Margin = New System.Windows.Forms.Padding(4) + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" + Me.ucrSdgBaseButtons.Size = New System.Drawing.Size(224, 30) + Me.ucrSdgBaseButtons.TabIndex = 343 + ' + 'sdgTableOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(661, 500) + Me.Controls.Add(Me.ucrSdgBaseButtons) + Me.Controls.Add(Me.tbpFormatOptions) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "sdgTableOptions" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Table Options" + Me.tbpFormatOptions.ResumeLayout(False) + Me.tbpHeader.ResumeLayout(False) + Me.tbpStub.ResumeLayout(False) + Me.tbpColumns.ResumeLayout(False) + Me.tbpRows.ResumeLayout(False) + Me.tbpCells.ResumeLayout(False) + Me.tbpSourceNotes.ResumeLayout(False) + Me.tbpThemes.ResumeLayout(False) + Me.tbpThemes.PerformLayout() + Me.tbpOtherStyles.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents tbpFormatOptions As TabControl + Friend WithEvents tbpHeader As TabPage + Friend WithEvents tbpCells As TabPage + Friend WithEvents tbpSourceNotes As TabPage + Friend WithEvents tbpThemes As TabPage + Friend WithEvents ucrCboSelectThemes As ucrInputComboBox + Friend WithEvents btnManualTheme As Button + Friend WithEvents rdoSelectTheme As RadioButton + Friend WithEvents rdoManualTheme As RadioButton + Friend WithEvents ucrPnlThemesPanel As UcrPanel + Friend WithEvents ucrSourceNotes As ucrSourceNotes + Friend WithEvents tbpRows As TabPage + Friend WithEvents ucrHeader As ucrHeader + Friend WithEvents tbpColumns As TabPage + Friend WithEvents ucrColumns As ucrColumns + Friend WithEvents ucrRows As ucrRows + Friend WithEvents tbpStub As TabPage + Friend WithEvents ucrStub As ucrStub + Friend WithEvents ucrCells As ucrCells + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue + Friend WithEvents tbpOtherStyles As TabPage + Friend WithEvents ucrOtherStyles As ucrOtherStyles +End Class diff --git a/instat/UserTables/sdgTableOptions.resx b/instat/UserTables/sdgTableOptions.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/sdgTableOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/sdgTableOptions.vb b/instat/UserTables/sdgTableOptions.vb new file mode 100644 index 00000000000..53386ef1e0b --- /dev/null +++ b/instat/UserTables/sdgTableOptions.vb @@ -0,0 +1,165 @@ +' 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 sdgTableOptions + + Private clsOperator As ROperator + Private clsThemeRFunction As RFunction + Private bFirstload As Boolean = True + + Private Sub sdgTableOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + ucrSdgBaseButtons.iHelpTopicID = 146 + + ucrPnlThemesPanel.AddRadioButton(rdoSelectTheme) + ucrPnlThemesPanel.AddRadioButton(rdoManualTheme) + + ucrCboSelectThemes.SetItems({"None", "Dark Theme", "538 Theme", "Dot Matrix Theme", "Espn Theme", "Excel Theme", "Guardian Theme", "NY Times Theme", "PFF Theme"}) + ucrCboSelectThemes.SetDropDownStyleAsNonEditable() + End Sub + + ''' + ''' An R operateor that has a parameter named "gt" set up. + ''' The parameter should be an R Function that generates script "gt:gt()" as part of the last script statement. + ''' + ''' + Public Sub Setup(strDataFrameName As String, clsNewOperator As ROperator) + If clsTablesUtils.FindRFunctionsParamsWithRCommand({"gt"}, clsNewOperator).Count = 0 Then + MsgBox("Developer Error: Parameter with 'gt' as name MUST be set up before using this subdialog") + Exit Sub + End If + + clsOperator = clsNewOperator + + ucrHeader.Setup(clsOperator) + ucrStub.Setup(strDataFrameName, clsOperator) + ucrRows.Setup(strDataFrameName, clsOperator) + ucrColumns.Setup(strDataFrameName, clsOperator) + ucrCells.Setup(strDataFrameName, clsOperator) + ucrSourceNotes.Setup(clsOperator) + ucrOtherStyles.Setup(clsOperator) + + SetupTheme(clsOperator) + End Sub + + Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn + ucrHeader.SetValuesToOperator() + ucrStub.SetValuesToOperator() + ucrColumns.SetValuesToOperator() + ucrRows.SetValuesToOperator() + ucrCells.SetValuesToOperator() + ucrSourceNotes.SetValuesToOperator() + ucrOtherStyles.SetValuesToOperator() + SetThemeValuesOnReturn(clsOperator) + End Sub + + + '----------------------------------------- + ' Themes + + Private Sub SetupTheme(clsOperator As ROperator) + clsThemeRFunction = New RFunction + + ' Uncheck then the check radio button to forces the panel to raise its ControlValueChanged event + rdoSelectTheme.Checked = False + rdoSelectTheme.Checked = True + + If Not clsOperator.ContainsParameter("theme_format") Then + Exit Sub + End If + + clsThemeRFunction = clsOperator.GetParameter("theme_format").clsArgumentCodeStructure + + If clsThemeRFunction.strRCommand = "tab_options" Then + rdoManualTheme.Checked = True + Else + rdoSelectTheme.Checked = True + ucrCboSelectThemes.SetName(clsThemeRFunction.strRCommand) + End If + + End Sub + + Private Sub ucrPnlThemes_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlThemesPanel.ControlValueChanged + ucrCboSelectThemes.Visible = False + btnManualTheme.Visible = False + + If rdoSelectTheme.Checked Then + ucrCboSelectThemes.Visible = True + clsThemeRFunction.SetPackageName("gtExtras") + clsThemeRFunction.ClearParameters() + ElseIf rdoManualTheme.Checked Then + btnManualTheme.Visible = True + clsThemeRFunction.SetPackageName("gt") + clsThemeRFunction.SetRCommand("tab_options") + End If + + End Sub + + Private Sub ucrCboSelectThemes_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrCboSelectThemes.ControlValueChanged + + If clsThemeRFunction Is Nothing Then + Exit Sub + End If + + Dim strCommand As String = "" + Select Case ucrCboSelectThemes.GetText + Case "Dark Theme" + strCommand = "gt_theme_dark" + Case "538 Theme" + strCommand = "gt_theme_538" + Case "Dot Matrix Theme" + strCommand = "gt_theme_dot_matrix" + Case "Espn Theme" + strCommand = "gt_theme_espn" + Case "Excel Theme" + strCommand = "gt_theme_excel" + Case "Guardian Theme" + strCommand = "gt_theme_guardian" + Case "NY Times Theme" + strCommand = "gt_theme_nytimes" + Case "PFF Theme" + strCommand = "gt_theme_pff" + End Select + + clsThemeRFunction.SetRCommand(strCommand) + End Sub + + Private Sub btnManualTheme_Click(sender As Object, e As EventArgs) Handles btnManualTheme.Click + sdgSummaryThemes.SetRCode(bReset:=True, clsNewThemesTabOption:=clsThemeRFunction) + sdgSummaryThemes.ShowDialog(Me) + End Sub + + Private Sub SetThemeValuesOnReturn(clsOperator As ROperator) + ' Set the themes parameter if there was a theme selected + If clsThemeRFunction IsNot Nothing AndAlso Not String.IsNullOrEmpty(clsThemeRFunction.strRCommand) Then + clsOperator.AddParameter("theme_format", clsRFunctionParameter:=clsThemeRFunction) + Else + clsOperator.RemoveParameterByName("theme_format") + End If + End Sub + '----------------------------------------- + + +End Class \ No newline at end of file diff --git a/instat/UserTables/sdgTableRowExpression.Designer.vb b/instat/UserTables/sdgTableRowExpression.Designer.vb new file mode 100644 index 00000000000..45e15079c89 --- /dev/null +++ b/instat/UserTables/sdgTableRowExpression.Designer.vb @@ -0,0 +1,139 @@ + +Partial Class sdgTableRowExpression + 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.cboCondition = New System.Windows.Forms.ComboBox() + Me.lblCondition = New System.Windows.Forms.Label() + Me.lblExpression = New System.Windows.Forms.Label() + Me.ucrSelectorCols = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() + Me.btnAddCondition = New System.Windows.Forms.Button() + Me.ucrReceiverExpression = New instat.ucrReceiverExpression() + Me.SuspendLayout() + ' + 'cboCondition + ' + Me.cboCondition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cboCondition.FormattingEnabled = True + Me.cboCondition.Items.AddRange(New Object() {"==", "<", "<=", ">", ">=", "!=", "Expression"}) + Me.cboCondition.Location = New System.Drawing.Point(360, 38) + Me.cboCondition.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.cboCondition.Name = "cboCondition" + Me.cboCondition.Size = New System.Drawing.Size(220, 28) + Me.cboCondition.TabIndex = 285 + ' + 'lblCondition + ' + Me.lblCondition.AutoSize = True + Me.lblCondition.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblCondition.Location = New System.Drawing.Point(356, 14) + Me.lblCondition.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblCondition.Name = "lblCondition" + Me.lblCondition.Size = New System.Drawing.Size(80, 20) + Me.lblCondition.TabIndex = 284 + Me.lblCondition.Text = "Condition:" + ' + 'lblExpression + ' + Me.lblExpression.AutoSize = True + Me.lblExpression.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblExpression.Location = New System.Drawing.Point(356, 157) + Me.lblExpression.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblExpression.Name = "lblExpression" + Me.lblExpression.Size = New System.Drawing.Size(91, 20) + Me.lblExpression.TabIndex = 283 + Me.lblExpression.Text = "Expression:" + ' + 'ucrSelectorCols + ' + Me.ucrSelectorCols.AutoSize = True + Me.ucrSelectorCols.bDropUnusedFilterLevels = False + Me.ucrSelectorCols.bShowHiddenColumns = False + Me.ucrSelectorCols.bUseCurrentFilter = True + Me.ucrSelectorCols.Location = New System.Drawing.Point(8, 6) + Me.ucrSelectorCols.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCols.Name = "ucrSelectorCols" + Me.ucrSelectorCols.Size = New System.Drawing.Size(320, 282) + Me.ucrSelectorCols.TabIndex = 281 + ' + 'ucrSdgBaseButtons + ' + Me.ucrSdgBaseButtons.AutoSize = True + Me.ucrSdgBaseButtons.Location = New System.Drawing.Point(159, 338) + Me.ucrSdgBaseButtons.Margin = New System.Windows.Forms.Padding(6) + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" + Me.ucrSdgBaseButtons.Size = New System.Drawing.Size(336, 46) + Me.ucrSdgBaseButtons.TabIndex = 344 + ' + 'btnAddCondition + ' + Me.btnAddCondition.Location = New System.Drawing.Point(580, 35) + Me.btnAddCondition.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.btnAddCondition.Name = "btnAddCondition" + Me.btnAddCondition.Size = New System.Drawing.Size(98, 35) + Me.btnAddCondition.TabIndex = 346 + Me.btnAddCondition.Text = "Add" + Me.btnAddCondition.UseVisualStyleBackColor = True + ' + 'ucrReceiverExpression + ' + Me.ucrReceiverExpression.AutoSize = True + Me.ucrReceiverExpression.frmParent = Me + Me.ucrReceiverExpression.Location = New System.Drawing.Point(360, 182) + Me.ucrReceiverExpression.Margin = New System.Windows.Forms.Padding(9) + Me.ucrReceiverExpression.Name = "ucrReceiverExpression" + Me.ucrReceiverExpression.Selector = Nothing + Me.ucrReceiverExpression.Size = New System.Drawing.Size(266, 45) + Me.ucrReceiverExpression.strNcFilePath = "" + Me.ucrReceiverExpression.TabIndex = 347 + Me.ucrReceiverExpression.ucrSelector = Nothing + ' + 'sdgTableRowExpression + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(684, 397) + Me.Controls.Add(Me.ucrReceiverExpression) + Me.Controls.Add(Me.btnAddCondition) + Me.Controls.Add(Me.ucrSdgBaseButtons) + Me.Controls.Add(Me.cboCondition) + Me.Controls.Add(Me.lblCondition) + Me.Controls.Add(Me.lblExpression) + Me.Controls.Add(Me.ucrSelectorCols) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.Name = "sdgTableRowExpression" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Set Expression" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents cboCondition As ComboBox + Friend WithEvents lblCondition As Label + Friend WithEvents lblExpression As Label + Friend WithEvents ucrSelectorCols As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue + Friend WithEvents btnAddCondition As Button + Friend WithEvents ucrReceiverExpression As ucrReceiverExpression +End Class diff --git a/instat/UserTables/sdgTableRowExpression.resx b/instat/UserTables/sdgTableRowExpression.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/sdgTableRowExpression.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/sdgTableRowExpression.vb b/instat/UserTables/sdgTableRowExpression.vb new file mode 100644 index 00000000000..b115b6333ec --- /dev/null +++ b/instat/UserTables/sdgTableRowExpression.vb @@ -0,0 +1,44 @@ +Public Class sdgTableRowExpression + Private bFirstload As Boolean = True + Public bUserClickedReturn As Boolean = False + + Private Sub sdgTableRowExpression_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + + bUserClickedReturn = False + End Sub + + Private Sub InitialiseControl() + ucrReceiverExpression.Selector = ucrSelectorCols + ucrReceiverExpression.SetMeAsReceiver() + End Sub + + Public Sub Setup(strDataFrameName As String) + If bFirstload Then + InitialiseControl() + bFirstload = False + End If + + + ' Set up the selector + ucrSelectorCols.SetDataframe(strDataFrameName, bEnableDataframe:=False) + ucrReceiverExpression.Clear() + + End Sub + + ' TODO. In future this can be refactored to return an RFunction + Public Function GetUserInputRowExpression() As String + Return ucrReceiverExpression.GetText() + End Function + + Private Sub btnAddCondition_Click(sender As Object, e As EventArgs) Handles btnAddCondition.Click + ucrReceiverExpression.AddToReceiverAtCursorPosition(cboCondition.Text) + End Sub + + Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn + bUserClickedReturn = True + End Sub +End Class \ No newline at end of file diff --git a/instat/UserTables/sdgTableStyles.Designer.vb b/instat/UserTables/sdgTableStyles.Designer.vb new file mode 100644 index 00000000000..75bdb4b6f3f --- /dev/null +++ b/instat/UserTables/sdgTableStyles.Designer.vb @@ -0,0 +1,611 @@ + _ +Partial Class sdgTableStyles + 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.Label2 = New System.Windows.Forms.Label() + Me.grpBoxColor = New System.Windows.Forms.GroupBox() + Me.ucrCboColorBackground = New instat.ucrColors() + Me.ucrCboColorText = New instat.ucrColors() + Me.lblFill = New System.Windows.Forms.Label() + Me.grpBoxAlignment = New System.Windows.Forms.GroupBox() + Me.lblAlignVertical = New System.Windows.Forms.Label() + Me.ucrCboAlignVertical = New instat.ucrInputComboBox() + Me.lblAlignHorizontal = New System.Windows.Forms.Label() + Me.ucrCboAlignHorizontal = New instat.ucrInputComboBox() + Me.lblUnderlineType = New System.Windows.Forms.Label() + Me.ucrCboUnderlineType = New instat.ucrInputComboBox() + Me.lblFontWeight = New System.Windows.Forms.Label() + Me.grpBoxFont = New System.Windows.Forms.GroupBox() + Me.ucrTxtFontSize = New instat.ucrInputTextBox() + Me.ucrCboFontWeight = New instat.ucrInputComboBox() + Me.lblFontFamily = New System.Windows.Forms.Label() + Me.ucrCboFontStyle = New instat.ucrInputComboBox() + Me.ucrCboFontFamily = New instat.ucrInputComboBox() + Me.lblFontStyle = New System.Windows.Forms.Label() + Me.lblFontSize = New System.Windows.Forms.Label() + Me.grpBoxOthers = New System.Windows.Forms.GroupBox() + Me.ucrNudIndent = New instat.ucrNud() + Me.lblStretch = New System.Windows.Forms.Label() + Me.ucrCboStretch = New instat.ucrInputComboBox() + Me.lblWhiteSpace = New System.Windows.Forms.Label() + Me.ucrCboWhiteSpace = New instat.ucrInputComboBox() + Me.lblIndent = New System.Windows.Forms.Label() + Me.lblTransform = New System.Windows.Forms.Label() + Me.ucrCboTransform = New instat.ucrInputComboBox() + Me.grpBoxBorders = New System.Windows.Forms.GroupBox() + Me.ucrNudBorderWeight = New instat.ucrNud() + Me.grpBoxSides = New System.Windows.Forms.GroupBox() + Me.ucrChkBorderLeft = New instat.ucrCheck() + Me.ucrChkBorderBottom = New instat.ucrCheck() + Me.ucrChkBorderTop = New instat.ucrCheck() + Me.ucrChkBorderRight = New instat.ucrCheck() + Me.lblBorderStyle = New System.Windows.Forms.Label() + Me.ucrCboBorderStyle = New instat.ucrInputComboBox() + Me.ucrCboBorderColor = New instat.ucrColors() + Me.lblBorderWeight = New System.Windows.Forms.Label() + Me.lblBorderColor = New System.Windows.Forms.Label() + Me.ucrBaseSubdialog = New instat.ucrButtonsSubdialogue() + Me.grpBoxColor.SuspendLayout() + Me.grpBoxAlignment.SuspendLayout() + Me.grpBoxFont.SuspendLayout() + Me.grpBoxOthers.SuspendLayout() + Me.grpBoxBorders.SuspendLayout() + Me.grpBoxSides.SuspendLayout() + Me.SuspendLayout() + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(155, 21) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(68, 13) + Me.Label2.TabIndex = 16 + Me.Label2.Text = "Background:" + ' + 'grpBoxColor + ' + Me.grpBoxColor.Controls.Add(Me.ucrCboColorBackground) + Me.grpBoxColor.Controls.Add(Me.ucrCboColorText) + Me.grpBoxColor.Controls.Add(Me.lblFill) + Me.grpBoxColor.Controls.Add(Me.Label2) + Me.grpBoxColor.Location = New System.Drawing.Point(7, 78) + Me.grpBoxColor.Name = "grpBoxColor" + Me.grpBoxColor.Size = New System.Drawing.Size(594, 68) + Me.grpBoxColor.TabIndex = 29 + Me.grpBoxColor.TabStop = False + Me.grpBoxColor.Text = "Color" + ' + 'ucrCboColorBackground + ' + Me.ucrCboColorBackground.AddQuotesIfUnrecognised = True + Me.ucrCboColorBackground.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboColorBackground.GetSetSelectedIndex = -1 + Me.ucrCboColorBackground.IsReadOnly = False + Me.ucrCboColorBackground.Location = New System.Drawing.Point(157, 37) + Me.ucrCboColorBackground.Name = "ucrCboColorBackground" + Me.ucrCboColorBackground.Size = New System.Drawing.Size(137, 21) + Me.ucrCboColorBackground.TabIndex = 18 + ' + 'ucrCboColorText + ' + Me.ucrCboColorText.AddQuotesIfUnrecognised = True + Me.ucrCboColorText.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboColorText.GetSetSelectedIndex = -1 + Me.ucrCboColorText.IsReadOnly = False + Me.ucrCboColorText.Location = New System.Drawing.Point(9, 37) + Me.ucrCboColorText.Name = "ucrCboColorText" + Me.ucrCboColorText.Size = New System.Drawing.Size(137, 21) + Me.ucrCboColorText.TabIndex = 17 + ' + 'lblFill + ' + Me.lblFill.AutoSize = True + Me.lblFill.Location = New System.Drawing.Point(6, 21) + Me.lblFill.Name = "lblFill" + Me.lblFill.Size = New System.Drawing.Size(31, 13) + Me.lblFill.TabIndex = 14 + Me.lblFill.Text = "Text:" + ' + 'grpBoxAlignment + ' + Me.grpBoxAlignment.Controls.Add(Me.lblAlignVertical) + Me.grpBoxAlignment.Controls.Add(Me.ucrCboAlignVertical) + Me.grpBoxAlignment.Controls.Add(Me.lblAlignHorizontal) + Me.grpBoxAlignment.Controls.Add(Me.ucrCboAlignHorizontal) + Me.grpBoxAlignment.Location = New System.Drawing.Point(7, 149) + Me.grpBoxAlignment.Name = "grpBoxAlignment" + Me.grpBoxAlignment.Size = New System.Drawing.Size(594, 65) + Me.grpBoxAlignment.TabIndex = 28 + Me.grpBoxAlignment.TabStop = False + Me.grpBoxAlignment.Text = "Alignment" + ' + 'lblAlignVertical + ' + Me.lblAlignVertical.AutoSize = True + Me.lblAlignVertical.Location = New System.Drawing.Point(155, 20) + Me.lblAlignVertical.Name = "lblAlignVertical" + Me.lblAlignVertical.Size = New System.Drawing.Size(45, 13) + Me.lblAlignVertical.TabIndex = 20 + Me.lblAlignVertical.Text = "Vertical:" + ' + 'ucrCboAlignVertical + ' + Me.ucrCboAlignVertical.AddQuotesIfUnrecognised = True + Me.ucrCboAlignVertical.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboAlignVertical.GetSetSelectedIndex = -1 + Me.ucrCboAlignVertical.IsReadOnly = False + Me.ucrCboAlignVertical.Location = New System.Drawing.Point(158, 36) + Me.ucrCboAlignVertical.Name = "ucrCboAlignVertical" + Me.ucrCboAlignVertical.Size = New System.Drawing.Size(137, 21) + Me.ucrCboAlignVertical.TabIndex = 19 + ' + 'lblAlignHorizontal + ' + Me.lblAlignHorizontal.AutoSize = True + Me.lblAlignHorizontal.Location = New System.Drawing.Point(6, 20) + Me.lblAlignHorizontal.Name = "lblAlignHorizontal" + Me.lblAlignHorizontal.Size = New System.Drawing.Size(57, 13) + Me.lblAlignHorizontal.TabIndex = 18 + Me.lblAlignHorizontal.Text = "Horizontal:" + ' + 'ucrCboAlignHorizontal + ' + Me.ucrCboAlignHorizontal.AddQuotesIfUnrecognised = True + Me.ucrCboAlignHorizontal.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboAlignHorizontal.GetSetSelectedIndex = -1 + Me.ucrCboAlignHorizontal.IsReadOnly = False + Me.ucrCboAlignHorizontal.Location = New System.Drawing.Point(9, 36) + Me.ucrCboAlignHorizontal.Name = "ucrCboAlignHorizontal" + Me.ucrCboAlignHorizontal.Size = New System.Drawing.Size(137, 21) + Me.ucrCboAlignHorizontal.TabIndex = 17 + ' + 'lblUnderlineType + ' + Me.lblUnderlineType.AutoSize = True + Me.lblUnderlineType.Location = New System.Drawing.Point(6, 67) + Me.lblUnderlineType.Name = "lblUnderlineType" + Me.lblUnderlineType.Size = New System.Drawing.Size(82, 13) + Me.lblUnderlineType.TabIndex = 21 + Me.lblUnderlineType.Text = "Underline Type:" + ' + 'ucrCboUnderlineType + ' + Me.ucrCboUnderlineType.AddQuotesIfUnrecognised = True + Me.ucrCboUnderlineType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboUnderlineType.GetSetSelectedIndex = -1 + Me.ucrCboUnderlineType.IsReadOnly = False + Me.ucrCboUnderlineType.Location = New System.Drawing.Point(9, 83) + Me.ucrCboUnderlineType.Name = "ucrCboUnderlineType" + Me.ucrCboUnderlineType.Size = New System.Drawing.Size(137, 21) + Me.ucrCboUnderlineType.TabIndex = 20 + ' + 'lblFontWeight + ' + Me.lblFontWeight.AutoSize = True + Me.lblFontWeight.Location = New System.Drawing.Point(297, 19) + Me.lblFontWeight.Name = "lblFontWeight" + Me.lblFontWeight.Size = New System.Drawing.Size(44, 13) + Me.lblFontWeight.TabIndex = 14 + Me.lblFontWeight.Text = "Weight:" + ' + 'grpBoxFont + ' + Me.grpBoxFont.Controls.Add(Me.ucrTxtFontSize) + Me.grpBoxFont.Controls.Add(Me.ucrCboFontWeight) + Me.grpBoxFont.Controls.Add(Me.lblFontWeight) + Me.grpBoxFont.Controls.Add(Me.lblFontFamily) + Me.grpBoxFont.Controls.Add(Me.ucrCboFontStyle) + Me.grpBoxFont.Controls.Add(Me.ucrCboFontFamily) + Me.grpBoxFont.Controls.Add(Me.lblFontStyle) + Me.grpBoxFont.Controls.Add(Me.lblFontSize) + Me.grpBoxFont.Location = New System.Drawing.Point(7, 6) + Me.grpBoxFont.Name = "grpBoxFont" + Me.grpBoxFont.Size = New System.Drawing.Size(594, 68) + Me.grpBoxFont.TabIndex = 26 + Me.grpBoxFont.TabStop = False + Me.grpBoxFont.Text = "Font" + ' + 'ucrTxtFontSize + ' + Me.ucrTxtFontSize.AddQuotesIfUnrecognised = True + Me.ucrTxtFontSize.AutoSize = True + Me.ucrTxtFontSize.IsMultiline = False + Me.ucrTxtFontSize.IsReadOnly = False + Me.ucrTxtFontSize.Location = New System.Drawing.Point(447, 35) + Me.ucrTxtFontSize.Name = "ucrTxtFontSize" + Me.ucrTxtFontSize.Size = New System.Drawing.Size(137, 21) + Me.ucrTxtFontSize.TabIndex = 15 + ' + 'ucrCboFontWeight + ' + Me.ucrCboFontWeight.AddQuotesIfUnrecognised = True + Me.ucrCboFontWeight.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboFontWeight.GetSetSelectedIndex = -1 + Me.ucrCboFontWeight.IsReadOnly = False + Me.ucrCboFontWeight.Location = New System.Drawing.Point(300, 35) + Me.ucrCboFontWeight.Name = "ucrCboFontWeight" + Me.ucrCboFontWeight.Size = New System.Drawing.Size(137, 21) + Me.ucrCboFontWeight.TabIndex = 13 + ' + 'lblFontFamily + ' + Me.lblFontFamily.AutoSize = True + Me.lblFontFamily.Location = New System.Drawing.Point(6, 19) + Me.lblFontFamily.Name = "lblFontFamily" + Me.lblFontFamily.Size = New System.Drawing.Size(69, 13) + Me.lblFontFamily.TabIndex = 6 + Me.lblFontFamily.Text = "Type (family):" + ' + 'ucrCboFontStyle + ' + Me.ucrCboFontStyle.AddQuotesIfUnrecognised = True + Me.ucrCboFontStyle.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboFontStyle.GetSetSelectedIndex = -1 + Me.ucrCboFontStyle.IsReadOnly = False + Me.ucrCboFontStyle.Location = New System.Drawing.Point(154, 35) + Me.ucrCboFontStyle.Name = "ucrCboFontStyle" + Me.ucrCboFontStyle.Size = New System.Drawing.Size(137, 21) + Me.ucrCboFontStyle.TabIndex = 7 + ' + 'ucrCboFontFamily + ' + Me.ucrCboFontFamily.AddQuotesIfUnrecognised = True + Me.ucrCboFontFamily.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboFontFamily.GetSetSelectedIndex = -1 + Me.ucrCboFontFamily.IsReadOnly = False + Me.ucrCboFontFamily.Location = New System.Drawing.Point(9, 35) + Me.ucrCboFontFamily.Name = "ucrCboFontFamily" + Me.ucrCboFontFamily.Size = New System.Drawing.Size(137, 21) + Me.ucrCboFontFamily.TabIndex = 5 + ' + 'lblFontStyle + ' + Me.lblFontStyle.AutoSize = True + Me.lblFontStyle.Location = New System.Drawing.Point(151, 19) + Me.lblFontStyle.Name = "lblFontStyle" + Me.lblFontStyle.Size = New System.Drawing.Size(33, 13) + Me.lblFontStyle.TabIndex = 8 + Me.lblFontStyle.Text = "Style:" + ' + 'lblFontSize + ' + Me.lblFontSize.AutoSize = True + Me.lblFontSize.Location = New System.Drawing.Point(444, 19) + Me.lblFontSize.Name = "lblFontSize" + Me.lblFontSize.Size = New System.Drawing.Size(30, 13) + Me.lblFontSize.TabIndex = 10 + Me.lblFontSize.Text = "Size:" + ' + 'grpBoxOthers + ' + Me.grpBoxOthers.Controls.Add(Me.lblUnderlineType) + Me.grpBoxOthers.Controls.Add(Me.ucrCboUnderlineType) + Me.grpBoxOthers.Controls.Add(Me.ucrNudIndent) + Me.grpBoxOthers.Controls.Add(Me.lblStretch) + Me.grpBoxOthers.Controls.Add(Me.ucrCboStretch) + Me.grpBoxOthers.Controls.Add(Me.lblWhiteSpace) + Me.grpBoxOthers.Controls.Add(Me.ucrCboWhiteSpace) + Me.grpBoxOthers.Controls.Add(Me.lblIndent) + Me.grpBoxOthers.Controls.Add(Me.lblTransform) + Me.grpBoxOthers.Controls.Add(Me.ucrCboTransform) + Me.grpBoxOthers.Location = New System.Drawing.Point(7, 330) + Me.grpBoxOthers.Name = "grpBoxOthers" + Me.grpBoxOthers.Size = New System.Drawing.Size(594, 132) + Me.grpBoxOthers.TabIndex = 30 + Me.grpBoxOthers.TabStop = False + Me.grpBoxOthers.Text = "Others" + ' + 'ucrNudIndent + ' + Me.ucrNudIndent.AutoSize = True + Me.ucrNudIndent.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudIndent.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudIndent.Location = New System.Drawing.Point(469, 35) + Me.ucrNudIndent.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudIndent.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudIndent.Name = "ucrNudIndent" + Me.ucrNudIndent.Size = New System.Drawing.Size(50, 20) + Me.ucrNudIndent.TabIndex = 27 + Me.ucrNudIndent.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblStretch + ' + Me.lblStretch.AutoSize = True + Me.lblStretch.Location = New System.Drawing.Point(302, 20) + Me.lblStretch.Name = "lblStretch" + Me.lblStretch.Size = New System.Drawing.Size(44, 13) + Me.lblStretch.TabIndex = 24 + Me.lblStretch.Text = "Stretch:" + ' + 'ucrCboStretch + ' + Me.ucrCboStretch.AddQuotesIfUnrecognised = True + Me.ucrCboStretch.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboStretch.GetSetSelectedIndex = -1 + Me.ucrCboStretch.IsReadOnly = False + Me.ucrCboStretch.Location = New System.Drawing.Point(303, 36) + Me.ucrCboStretch.Name = "ucrCboStretch" + Me.ucrCboStretch.Size = New System.Drawing.Size(137, 21) + Me.ucrCboStretch.TabIndex = 23 + ' + 'lblWhiteSpace + ' + Me.lblWhiteSpace.AutoSize = True + Me.lblWhiteSpace.Location = New System.Drawing.Point(155, 20) + Me.lblWhiteSpace.Name = "lblWhiteSpace" + Me.lblWhiteSpace.Size = New System.Drawing.Size(72, 13) + Me.lblWhiteSpace.TabIndex = 22 + Me.lblWhiteSpace.Text = "White Space:" + ' + 'ucrCboWhiteSpace + ' + Me.ucrCboWhiteSpace.AddQuotesIfUnrecognised = True + Me.ucrCboWhiteSpace.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboWhiteSpace.GetSetSelectedIndex = -1 + Me.ucrCboWhiteSpace.IsReadOnly = False + Me.ucrCboWhiteSpace.Location = New System.Drawing.Point(158, 36) + Me.ucrCboWhiteSpace.Name = "ucrCboWhiteSpace" + Me.ucrCboWhiteSpace.Size = New System.Drawing.Size(137, 21) + Me.ucrCboWhiteSpace.TabIndex = 21 + ' + 'lblIndent + ' + Me.lblIndent.AutoSize = True + Me.lblIndent.Location = New System.Drawing.Point(466, 16) + Me.lblIndent.Name = "lblIndent" + Me.lblIndent.Size = New System.Drawing.Size(40, 13) + Me.lblIndent.TabIndex = 19 + Me.lblIndent.Text = "Indent:" + ' + 'lblTransform + ' + Me.lblTransform.AutoSize = True + Me.lblTransform.Location = New System.Drawing.Point(6, 20) + Me.lblTransform.Name = "lblTransform" + Me.lblTransform.Size = New System.Drawing.Size(57, 13) + Me.lblTransform.TabIndex = 18 + Me.lblTransform.Text = "Transform:" + ' + 'ucrCboTransform + ' + Me.ucrCboTransform.AddQuotesIfUnrecognised = True + Me.ucrCboTransform.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboTransform.GetSetSelectedIndex = -1 + Me.ucrCboTransform.IsReadOnly = False + Me.ucrCboTransform.Location = New System.Drawing.Point(9, 36) + Me.ucrCboTransform.Name = "ucrCboTransform" + Me.ucrCboTransform.Size = New System.Drawing.Size(137, 21) + Me.ucrCboTransform.TabIndex = 17 + ' + 'grpBoxBorders + ' + Me.grpBoxBorders.Controls.Add(Me.ucrNudBorderWeight) + Me.grpBoxBorders.Controls.Add(Me.grpBoxSides) + Me.grpBoxBorders.Controls.Add(Me.lblBorderStyle) + Me.grpBoxBorders.Controls.Add(Me.ucrCboBorderStyle) + Me.grpBoxBorders.Controls.Add(Me.ucrCboBorderColor) + Me.grpBoxBorders.Controls.Add(Me.lblBorderWeight) + Me.grpBoxBorders.Controls.Add(Me.lblBorderColor) + Me.grpBoxBorders.Location = New System.Drawing.Point(7, 218) + Me.grpBoxBorders.Name = "grpBoxBorders" + Me.grpBoxBorders.Size = New System.Drawing.Size(594, 109) + Me.grpBoxBorders.TabIndex = 31 + Me.grpBoxBorders.TabStop = False + Me.grpBoxBorders.Text = "Borders" + ' + 'ucrNudBorderWeight + ' + Me.ucrNudBorderWeight.AutoSize = True + Me.ucrNudBorderWeight.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBorderWeight.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudBorderWeight.Location = New System.Drawing.Point(469, 36) + Me.ucrNudBorderWeight.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudBorderWeight.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBorderWeight.Name = "ucrNudBorderWeight" + Me.ucrNudBorderWeight.Size = New System.Drawing.Size(50, 20) + Me.ucrNudBorderWeight.TabIndex = 26 + Me.ucrNudBorderWeight.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'grpBoxSides + ' + Me.grpBoxSides.Controls.Add(Me.ucrChkBorderLeft) + Me.grpBoxSides.Controls.Add(Me.ucrChkBorderBottom) + Me.grpBoxSides.Controls.Add(Me.ucrChkBorderTop) + Me.grpBoxSides.Controls.Add(Me.ucrChkBorderRight) + Me.grpBoxSides.Location = New System.Drawing.Point(9, 19) + Me.grpBoxSides.Name = "grpBoxSides" + Me.grpBoxSides.Size = New System.Drawing.Size(259, 83) + Me.grpBoxSides.TabIndex = 21 + Me.grpBoxSides.TabStop = False + Me.grpBoxSides.Text = "Sides" + ' + 'ucrChkBorderLeft + ' + Me.ucrChkBorderLeft.AutoSize = True + Me.ucrChkBorderLeft.Checked = False + Me.ucrChkBorderLeft.Location = New System.Drawing.Point(6, 21) + Me.ucrChkBorderLeft.Name = "ucrChkBorderLeft" + Me.ucrChkBorderLeft.Size = New System.Drawing.Size(100, 23) + Me.ucrChkBorderLeft.TabIndex = 26 + ' + 'ucrChkBorderBottom + ' + Me.ucrChkBorderBottom.AutoSize = True + Me.ucrChkBorderBottom.Checked = False + Me.ucrChkBorderBottom.Location = New System.Drawing.Point(137, 54) + Me.ucrChkBorderBottom.Name = "ucrChkBorderBottom" + Me.ucrChkBorderBottom.Size = New System.Drawing.Size(100, 23) + Me.ucrChkBorderBottom.TabIndex = 28 + ' + 'ucrChkBorderTop + ' + Me.ucrChkBorderTop.AutoSize = True + Me.ucrChkBorderTop.Checked = False + Me.ucrChkBorderTop.Location = New System.Drawing.Point(137, 21) + Me.ucrChkBorderTop.Name = "ucrChkBorderTop" + Me.ucrChkBorderTop.Size = New System.Drawing.Size(100, 23) + Me.ucrChkBorderTop.TabIndex = 29 + ' + 'ucrChkBorderRight + ' + Me.ucrChkBorderRight.AutoSize = True + Me.ucrChkBorderRight.Checked = False + Me.ucrChkBorderRight.Location = New System.Drawing.Point(6, 54) + Me.ucrChkBorderRight.Name = "ucrChkBorderRight" + Me.ucrChkBorderRight.Size = New System.Drawing.Size(100, 23) + Me.ucrChkBorderRight.TabIndex = 27 + ' + 'lblBorderStyle + ' + Me.lblBorderStyle.AutoSize = True + Me.lblBorderStyle.Location = New System.Drawing.Point(300, 65) + Me.lblBorderStyle.Name = "lblBorderStyle" + Me.lblBorderStyle.Size = New System.Drawing.Size(33, 13) + Me.lblBorderStyle.TabIndex = 25 + Me.lblBorderStyle.Text = "Style:" + ' + 'ucrCboBorderStyle + ' + Me.ucrCboBorderStyle.AddQuotesIfUnrecognised = True + Me.ucrCboBorderStyle.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboBorderStyle.GetSetSelectedIndex = -1 + Me.ucrCboBorderStyle.IsReadOnly = False + Me.ucrCboBorderStyle.Location = New System.Drawing.Point(300, 81) + Me.ucrCboBorderStyle.Name = "ucrCboBorderStyle" + Me.ucrCboBorderStyle.Size = New System.Drawing.Size(137, 21) + Me.ucrCboBorderStyle.TabIndex = 24 + ' + 'ucrCboBorderColor + ' + Me.ucrCboBorderColor.AddQuotesIfUnrecognised = True + Me.ucrCboBorderColor.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrCboBorderColor.GetSetSelectedIndex = -1 + Me.ucrCboBorderColor.IsReadOnly = False + Me.ucrCboBorderColor.Location = New System.Drawing.Point(300, 35) + Me.ucrCboBorderColor.Name = "ucrCboBorderColor" + Me.ucrCboBorderColor.Size = New System.Drawing.Size(137, 21) + Me.ucrCboBorderColor.TabIndex = 23 + ' + 'lblBorderWeight + ' + Me.lblBorderWeight.AutoSize = True + Me.lblBorderWeight.Location = New System.Drawing.Point(466, 20) + Me.lblBorderWeight.Name = "lblBorderWeight" + Me.lblBorderWeight.Size = New System.Drawing.Size(44, 13) + Me.lblBorderWeight.TabIndex = 21 + Me.lblBorderWeight.Text = "Weight:" + ' + 'lblBorderColor + ' + Me.lblBorderColor.AutoSize = True + Me.lblBorderColor.Location = New System.Drawing.Point(300, 20) + Me.lblBorderColor.Name = "lblBorderColor" + Me.lblBorderColor.Size = New System.Drawing.Size(34, 13) + Me.lblBorderColor.TabIndex = 22 + Me.lblBorderColor.Text = "Color:" + ' + 'ucrBaseSubdialog + ' + Me.ucrBaseSubdialog.AutoSize = True + Me.ucrBaseSubdialog.Location = New System.Drawing.Point(185, 467) + Me.ucrBaseSubdialog.Margin = New System.Windows.Forms.Padding(4) + Me.ucrBaseSubdialog.Name = "ucrBaseSubdialog" + Me.ucrBaseSubdialog.Size = New System.Drawing.Size(224, 29) + Me.ucrBaseSubdialog.TabIndex = 25 + ' + 'sdgTableStyles + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(607, 504) + Me.Controls.Add(Me.grpBoxBorders) + Me.Controls.Add(Me.grpBoxOthers) + Me.Controls.Add(Me.grpBoxColor) + Me.Controls.Add(Me.grpBoxAlignment) + Me.Controls.Add(Me.grpBoxFont) + Me.Controls.Add(Me.ucrBaseSubdialog) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Name = "sdgTableStyles" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Styles" + Me.grpBoxColor.ResumeLayout(False) + Me.grpBoxColor.PerformLayout() + Me.grpBoxAlignment.ResumeLayout(False) + Me.grpBoxAlignment.PerformLayout() + Me.grpBoxFont.ResumeLayout(False) + Me.grpBoxFont.PerformLayout() + Me.grpBoxOthers.ResumeLayout(False) + Me.grpBoxOthers.PerformLayout() + Me.grpBoxBorders.ResumeLayout(False) + Me.grpBoxBorders.PerformLayout() + Me.grpBoxSides.ResumeLayout(False) + Me.grpBoxSides.PerformLayout() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents ucrCboColorBackground As ucrColors + Friend WithEvents ucrCboColorText As ucrColors + Friend WithEvents Label2 As Label + Friend WithEvents grpBoxColor As GroupBox + Friend WithEvents lblFill As Label + Friend WithEvents ucrCboAlignHorizontal As ucrInputComboBox + Friend WithEvents grpBoxAlignment As GroupBox + Friend WithEvents lblAlignHorizontal As Label + Friend WithEvents lblUnderlineType As Label + Friend WithEvents ucrCboUnderlineType As ucrInputComboBox + Friend WithEvents ucrTxtFontSize As ucrInputTextBox + Friend WithEvents ucrCboFontWeight As ucrInputComboBox + Friend WithEvents lblFontWeight As Label + Friend WithEvents ucrCboFontStyle As ucrInputComboBox + Friend WithEvents grpBoxFont As GroupBox + Friend WithEvents lblFontFamily As Label + Friend WithEvents ucrCboFontFamily As ucrInputComboBox + Friend WithEvents lblFontStyle As Label + Friend WithEvents lblFontSize As Label + Friend WithEvents ucrBaseSubdialog As ucrButtonsSubdialogue + Friend WithEvents lblAlignVertical As Label + Friend WithEvents ucrCboAlignVertical As ucrInputComboBox + Friend WithEvents grpBoxOthers As GroupBox + Friend WithEvents lblTransform As Label + Friend WithEvents ucrCboTransform As ucrInputComboBox + Friend WithEvents lblIndent As Label + Friend WithEvents lblWhiteSpace As Label + Friend WithEvents ucrCboWhiteSpace As ucrInputComboBox + Friend WithEvents lblStretch As Label + Friend WithEvents ucrCboStretch As ucrInputComboBox + Friend WithEvents grpBoxBorders As GroupBox + Friend WithEvents lblBorderStyle As Label + Friend WithEvents ucrCboBorderStyle As ucrInputComboBox + Friend WithEvents ucrCboBorderColor As ucrColors + Friend WithEvents lblBorderWeight As Label + Friend WithEvents lblBorderColor As Label + Friend WithEvents ucrChkBorderTop As ucrCheck + Friend WithEvents ucrChkBorderBottom As ucrCheck + Friend WithEvents ucrChkBorderRight As ucrCheck + Friend WithEvents ucrChkBorderLeft As ucrCheck + Friend WithEvents grpBoxSides As GroupBox + Friend WithEvents ucrNudBorderWeight As ucrNud + Friend WithEvents ucrNudIndent As ucrNud +End Class diff --git a/instat/UserTables/sdgTableStyles.resx b/instat/UserTables/sdgTableStyles.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/UserTables/sdgTableStyles.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/UserTables/sdgTableStyles.vb b/instat/UserTables/sdgTableStyles.vb new file mode 100644 index 00000000000..d6c1c720bdc --- /dev/null +++ b/instat/UserTables/sdgTableStyles.vb @@ -0,0 +1,373 @@ +Imports instat.Translations + +Public Class sdgTableStyles + Private clsStyleListRFunction, clsCellTextRFunction, clsCellFillRFunction, clsCellBordersRFunction, clsCellBorderSidesRFunction As New RFunction + Private bFirstload As Boolean = True + Private bUserClickedReturn As Boolean = False + + Private Sub sdgTableTextFormatOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstload Then + InitialiseDialog() + bFirstload = False + End If + + SetRCode() + + bUserClickedReturn = False + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + ucrBaseSubdialog.iHelpTopicID = 150 + + '----------------- + ucrCboColorText.SetDropDownStyleAsNonEditable() + ucrCboColorText.SetParameter(New RParameter("color", iNewPosition:=0)) + ucrCboColorText.SetColours() + ucrCboColorText.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctFontFamily As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Arial (sans-serif)", Chr(34) & "Arial, sans-serif" & Chr(34)}, + {"Verdana (sans-serif)", Chr(34) & "Verdana, sans-serif" & Chr(34)}, + {"Tahoma", Chr(34) & "Tahoma, sans-serif" & Chr(34)}, + {"Trebuchet MS", Chr(34) & "'Trebuchet MS', sans-serif" & Chr(34)}, + {"Times New Roman (serif)", Chr(34) & "'Times New Roman', serif" & Chr(34)}, + {"Georgia (serif)", Chr(34) & "Georgia, serif" & Chr(34)}, + {"Garamond (serif)", Chr(34) & "Garamond, serif" & Chr(34)} + } + ucrCboFontFamily.SetDropDownStyleAsNonEditable() + ucrCboFontFamily.SetParameter(New RParameter("font", iNewPosition:=1)) + ucrCboFontFamily.SetItems(dctFontFamily) + ucrCboFontFamily.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctAlignHorizontal As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Center", Chr(34) & "center" & Chr(34)}, + {"Left", Chr(34) & "left" & Chr(34)}, + {"Right", Chr(34) & "right" & Chr(34)}, + {"Justify", Chr(34) & "justify" & Chr(34)} + } + ucrCboAlignHorizontal.SetDropDownStyleAsNonEditable() + ucrCboAlignHorizontal.SetParameter(New RParameter("align", iNewPosition:=3)) + ucrCboAlignHorizontal.SetItems(dctAlignHorizontal) + ucrCboAlignHorizontal.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctAlignVertical As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Middle", Chr(34) & "middle" & Chr(34)}, + {"Top", Chr(34) & "top" & Chr(34)}, + {"Bottom", Chr(34) & "bottom" & Chr(34)} + } + ucrCboAlignVertical.SetDropDownStyleAsNonEditable() + ucrCboAlignVertical.SetParameter(New RParameter("v_align", iNewPosition:=4)) + ucrCboAlignVertical.SetItems(dctAlignVertical) + ucrCboAlignVertical.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctFontStyle As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Normal", Chr(34) & "normal" & Chr(34)}, + {"Italic", Chr(34) & "italic" & Chr(34)}, + {"Oblique", Chr(34) & "oblique" & Chr(34)} + } + + ucrCboFontStyle.SetDropDownStyleAsNonEditable() + ucrCboFontStyle.SetParameter(New RParameter("style", iNewPosition:=5)) + ucrCboFontStyle.SetItems(dctFontStyle) + ucrCboFontStyle.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctFontWeight As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Normal", Chr(34) & "normal" & Chr(34)}, + {"Bold", Chr(34) & "bold" & Chr(34)}, + {"Lighter", Chr(34) & "lighter" & Chr(34)}, + {"Bolder", Chr(34) & "bold" & Chr(34)} + } + + ucrCboFontWeight.SetDropDownStyleAsNonEditable() + ucrCboFontWeight.SetParameter(New RParameter("weight", iNewPosition:=7)) + ucrCboFontWeight.SetItems(dctFontWeight) + ucrCboFontWeight.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctUnderlineType As New Dictionary(Of String, String) From { + {"None", "NULL"}, + {"Underline", Chr(34) & "underline" & Chr(34)}, + {"Overline", Chr(34) & "overline" & Chr(34)}, + {"Line-through", Chr(34) & "line-through" & Chr(34)} + } + ucrCboUnderlineType.SetDropDownStyleAsNonEditable() + ucrCboUnderlineType.SetParameter(New RParameter("decorate", iNewPosition:=8)) + ucrCboUnderlineType.SetItems(dctUnderlineType) + ucrCboUnderlineType.SetRDefault("NULL") + + + 'Dim dctUnderlineStyle As New Dictionary(Of String, String) From { + ' {"Default", "NULL"}, + ' {"Solid", Chr(34) & "solid" & Chr(34)}, + ' {"Double", Chr(34) & "double" & Chr(34)}, + ' {"Dotted", Chr(34) & "dotted" & Chr(34)}, + ' {"Dashed", Chr(34) & "dashed" & Chr(34)}, + ' {"Wavy", Chr(34) & "wavy" & Chr(34)} + '} + 'ucrCboUnderlineStyle.SetDropDownStyleAsNonEditable() + 'ucrCboUnderlineStyle.SetParameter(New RParameter("text.decoration.style")) + 'ucrCboUnderlineStyle.SetItems(dctUnderlineStyle) + 'ucrCboUnderlineStyle.SetRDefault("NULL") + + 'ucrCboUnderLineColor.SetDropDownStyleAsNonEditable() + 'ucrCboUnderLineColor.SetParameter(New RParameter("text.decoration.color")) + 'ucrCboUnderLineColor.SetColours() + 'ucrCboUnderLineColor.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctTransform As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Uppercase", Chr(34) & "uppercase" & Chr(34)}, + {"Lowercase", Chr(34) & "lowercase" & Chr(34)}, + {"Capitalize", Chr(34) & "capitalize" & Chr(34)} + } + ucrCboTransform.SetDropDownStyleAsNonEditable() + ucrCboTransform.SetParameter(New RParameter("transform", iNewPosition:=9)) + ucrCboTransform.SetItems(dctTransform) + ucrCboTransform.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctStretch As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Ultra-condensed", Chr(34) & "ultra-condensed" & Chr(34)}, + {"Extra-condensed", Chr(34) & "extra-condensed" & Chr(34)}, + {"Condensed", Chr(34) & "condensed" & Chr(34)}, + {"Semi-condensed", Chr(34) & "semi-condensed" & Chr(34)}, + {"normal", Chr(34) & "normal" & Chr(34)}, + {"Semi-expanded", Chr(34) & "semi-expanded" & Chr(34)}, + {"Expanded", Chr(34) & "expanded" & Chr(34)}, + {"Extra-expanded", Chr(34) & "extra-expanded" & Chr(34)}, + {"Ultra-expanded", Chr(34) & "ultra-expanded" & Chr(34)} + } + ucrCboStretch.SetDropDownStyleAsNonEditable() + ucrCboStretch.SetParameter(New RParameter("stretch", iNewPosition:=10)) + ucrCboStretch.SetItems(dctStretch) + ucrCboStretch.SetRDefault("NULL") + '----------------- + + '----------------- + ucrNudIndent.SetParameter(New RParameter("indent", iNewPosition:=11)) + ucrNudIndent.SetRDefault(0) + '----------------- + + '----------------- + Dim dctWhiteSpace As New Dictionary(Of String, String) From { + {"Default", "NULL"}, + {"Normal", Chr(34) & "normal" & Chr(34)}, + {"No wrap", Chr(34) & "nowrap" & Chr(34)}, + {"Pre", Chr(34) & "pre" & Chr(34)}, + {"Pre-wrap", Chr(34) & "pre-wrap" & Chr(34)}, + {"Pre-line", Chr(34) & "pre-line" & Chr(34)}, + {"Break-spaces", Chr(34) & "break-spaces" & Chr(34)} + } + ucrCboWhiteSpace.SetDropDownStyleAsNonEditable() + ucrCboWhiteSpace.SetParameter(New RParameter("transform", iNewPosition:=11)) + ucrCboWhiteSpace.SetItems(dctWhiteSpace) + ucrCboWhiteSpace.SetRDefault("NULL") + '----------------- + + '--------------------------------------------------- + ' Cell fill controls + ucrCboColorBackground.SetDropDownStyleAsNonEditable() + ucrCboColorBackground.SetParameter(New RParameter("color", iNewPosition:=0)) + ucrCboColorBackground.SetColours() + ucrCboColorBackground.SetRDefault("NULL") + '----------------- + + '--------------------------------------------------- + ' Cell Border + '----------------- + ucrChkBorderLeft.SetText("Left") + ucrChkBorderLeft.SetParameter(New RParameter("left", iNewPosition:=0, bNewIncludeArgumentName:=False)) + ucrChkBorderLeft.SetValuesCheckedAndUnchecked(Chr(34) & "left" & Chr(34), "NULL") + ucrChkBorderLeft.SetRDefault("NULL") + + ucrChkBorderRight.SetText("Right") + ucrChkBorderRight.SetParameter(New RParameter("right", iNewPosition:=1, bNewIncludeArgumentName:=False)) + ucrChkBorderRight.SetValuesCheckedAndUnchecked(Chr(34) & "right" & Chr(34), "NULL") + ucrChkBorderRight.SetRDefault("NULL") + + ucrChkBorderTop.SetText("Top") + ucrChkBorderTop.SetParameter(New RParameter("top", iNewPosition:=2, bNewIncludeArgumentName:=False)) + ucrChkBorderTop.SetValuesCheckedAndUnchecked(Chr(34) & "top" & Chr(34), "NULL") + ucrChkBorderTop.SetRDefault("NULL") + + ucrChkBorderBottom.SetText("Bottom") + ucrChkBorderBottom.SetParameter(New RParameter("bottom", iNewPosition:=3, bNewIncludeArgumentName:=False)) + ucrChkBorderBottom.SetValuesCheckedAndUnchecked(Chr(34) & "bottom" & Chr(34), "NULL") + ucrChkBorderBottom.SetRDefault("NULL") + + '----------------- + ucrCboBorderColor.SetDropDownStyleAsNonEditable() + ucrCboBorderColor.SetParameter(New RParameter("color", iNewPosition:=1)) + ucrCboBorderColor.SetColours() + ucrCboBorderColor.SetRDefault("NULL") + '----------------- + + '----------------- + Dim dctBorderStyle As New Dictionary(Of String, String) From { + {"Default", "solid"}, + {"Solid", Chr(34) & "solid" & Chr(34)}, + {"Dashed", Chr(34) & "dashed" & Chr(34)}, + {"Dotted", Chr(34) & "dotted" & Chr(34)} + } + ucrCboBorderStyle.SetDropDownStyleAsNonEditable() + ucrCboBorderStyle.SetParameter(New RParameter("style", iNewPosition:=2)) + ucrCboBorderStyle.SetItems(dctBorderStyle) + ucrCboBorderStyle.SetRDefault("solid") + '----------------- + + '----------------- + ucrNudBorderWeight.SetParameter(New RParameter("weight", iNewPosition:=3)) + ucrNudBorderWeight.SetRDefault(1) + '----------------- + + '--------------------------------------------------- + + End Sub + + Public Sub Setup(Optional clsNewStyleListRFunction As RFunction = Nothing) + clsStyleListRFunction = New RFunction + clsCellTextRFunction = New RFunction + clsCellFillRFunction = New RFunction + clsCellBordersRFunction = New RFunction + clsCellBorderSidesRFunction = New RFunction + + clsStyleListRFunction.SetRCommand("list") + + clsCellTextRFunction.SetPackageName("gt") + clsCellTextRFunction.SetRCommand("cell_text") + + clsCellFillRFunction.SetPackageName("gt") + clsCellFillRFunction.SetRCommand("cell_fill") + + clsCellBordersRFunction.SetPackageName("gt") + clsCellBordersRFunction.SetRCommand("cell_borders") + + clsCellBorderSidesRFunction.SetRCommand("c") + + ucrTxtFontSize.SetName("") + + If clsNewStyleListRFunction IsNot Nothing Then + clsStyleListRFunction = clsNewStyleListRFunction + + If clsStyleListRFunction.ContainsParameter("cell_text_param") Then + clsCellTextRFunction = clsStyleListRFunction.GetParameter("cell_text_param").clsArgumentCodeStructure + Dim sizeValue As String = clsCellTextRFunction.GetParameter("size")?.clsArgumentCodeStructure.GetParameter("x")?.strArgumentValue + ucrTxtFontSize.SetName(If(sizeValue IsNot Nothing, sizeValue, "")) + End If + + If clsStyleListRFunction.ContainsParameter("cell_fill_param") Then + clsCellFillRFunction = clsStyleListRFunction.GetParameter("cell_fill_param").clsArgumentCodeStructure + End If + + If clsStyleListRFunction.ContainsParameter("cell_borders_param") Then + clsCellBordersRFunction = clsStyleListRFunction.GetParameter("cell_borders_param").clsArgumentCodeStructure + If clsCellBordersRFunction.ContainsParameter("sides") Then + clsCellBordersRFunction = clsCellBordersRFunction.GetParameter("sides").clsArgumentCodeStructure + End If + End If + + End If + End Sub + + Public Function GetNewUserInputAsRFunction() As RFunction + If Not bUserClickedReturn Then + Return Nothing + End If + + If clsCellTextRFunction.clsParameters.Count > 0 Then + clsStyleListRFunction.AddParameter(strParameterName:="cell_text_param", clsRFunctionParameter:=clsCellTextRFunction, bIncludeArgumentName:=False, iPosition:=0) + End If + + If clsCellFillRFunction.clsParameters.Count > 0 Then + clsStyleListRFunction.AddParameter(strParameterName:="cell_fill_param", clsRFunctionParameter:=clsCellFillRFunction, bIncludeArgumentName:=False, iPosition:=1) + End If + + If clsCellBordersRFunction.clsParameters.Count > 0 OrElse clsCellBorderSidesRFunction.clsParameters.Count > 0 Then + If clsCellBorderSidesRFunction.clsParameters.Count > 0 Then + clsCellBordersRFunction.AddParameter(strParameterName:="sides", clsRFunctionParameter:=clsCellBorderSidesRFunction, iPosition:=0) + End If + clsStyleListRFunction.AddParameter(strParameterName:="cell_borders_param", clsRFunctionParameter:=clsCellBordersRFunction, bIncludeArgumentName:=False, iPosition:=1) + End If + + Return If(clsStyleListRFunction.clsParameters.Count > 0, clsStyleListRFunction, Nothing) + End Function + + + Private Sub SetRCode() + '----------------- + ' Cell text controls + ucrCboFontFamily.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboFontStyle.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboFontWeight.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboColorText.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboUnderlineType.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + 'ucrCboUnderlineStyle.SetRCode(clsNewStyleRFunction, bReset:=False, bCloneIfNeeded:=True) + 'ucrCboUnderLineColor.SetRCode(clsNewStyleRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboAlignHorizontal.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboAlignVertical.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboTransform.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboWhiteSpace.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboStretch.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + 'ucrTxtIndent.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrNudIndent.SetRCode(clsCellTextRFunction, bReset:=False, bCloneIfNeeded:=True) + '----------------- + + '----------------- + 'Cell fill controls + ucrCboColorBackground.SetRCode(clsCellFillRFunction, bReset:=False, bCloneIfNeeded:=True) + '----------------- + + '----------------- + 'Cell border controls + ucrChkBorderLeft.SetRCode(clsCellBorderSidesRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrChkBorderRight.SetRCode(clsCellBorderSidesRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrChkBorderTop.SetRCode(clsCellBorderSidesRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrChkBorderBottom.SetRCode(clsCellBorderSidesRFunction, bReset:=False, bCloneIfNeeded:=True) + + ucrCboBorderColor.SetRCode(clsCellBordersRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrCboBorderStyle.SetRCode(clsCellBordersRFunction, bReset:=False, bCloneIfNeeded:=True) + ucrNudBorderWeight.SetRCode(clsCellBordersRFunction, bReset:=False, bCloneIfNeeded:=True) + '----------------- + End Sub + + + Private Sub ucrBaseSubdialog_ClickReturn(sender As Object, e As EventArgs) Handles ucrBaseSubdialog.ClickReturn + bUserClickedReturn = True + End Sub + + Private Sub ucrTxtFontSize_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrTxtFontSize.ControlValueChanged + If ucrTxtFontSize.IsEmpty Then + clsCellTextRFunction.RemoveParameterByName("size") + Else + Dim pxRFunction As New RFunction + pxRFunction.SetPackageName("gt") + pxRFunction.SetRCommand("px") + pxRFunction.AddParameter(strParameterName:="x", strParameterValue:=ucrTxtFontSize.GetText(), bIncludeArgumentName:=False, iPosition:=2) + clsCellTextRFunction.AddParameter(strParameterName:="size", clsRFunctionParameter:=pxRFunction) + End If + End Sub + + + +End Class \ No newline at end of file diff --git a/instat/dlgDistances.Designer.vb b/instat/dlgDistances.Designer.vb new file mode 100644 index 00000000000..dc4a112b081 --- /dev/null +++ b/instat/dlgDistances.Designer.vb @@ -0,0 +1,54 @@ + _ +Partial Class dlgDistances + 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.SuspendLayout() + ' + 'ucrBase + ' + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(6, 242) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 51) + Me.ucrBase.TabIndex = 0 + ' + 'dlgDistances + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(423, 305) + Me.Controls.Add(Me.ucrBase) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2) + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "dlgDistances" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Distances" + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents ucrBase As ucrButtons +End Class diff --git a/instat/dlgDistances.resx b/instat/dlgDistances.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/dlgDistances.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/dlgDistances.vb b/instat/dlgDistances.vb new file mode 100644 index 00000000000..80cf80dc157 --- /dev/null +++ b/instat/dlgDistances.vb @@ -0,0 +1,3 @@ +Public Class dlgDistances + +End Class \ No newline at end of file diff --git a/instat/dlgEndOfRainsSeason.vb b/instat/dlgEndOfRainsSeason.vb index 2067cedc683..8bf2b645f9b 100644 --- a/instat/dlgEndOfRainsSeason.vb +++ b/instat/dlgEndOfRainsSeason.vb @@ -29,7 +29,7 @@ Public Class dlgEndOfRainsSeason #Region "general_code_structures" ' General - Private clsRunCalculation As New RFunction + Private clsRunCalculation, clsListCalFunction, clsDummyFunction As New RFunction Private clsFirstOrLastFunction As New RFunction ' Group by @@ -243,8 +243,8 @@ Public Class dlgEndOfRainsSeason ucrInputEndRainDoy.SetValidationTypeAsRVariable() ucrInputEndRainDoy.SetDataFrameSelector(ucrSelectorForWaterBalance.ucrAvailableDataFrames) - ucrChkEndofRainsDate.AddParameterPresentCondition(True, "sub2") - ucrChkEndofRainsDate.AddParameterPresentCondition(False, "sub2", False) + ucrChkEndofRainsDate.AddParameterValuesCondition(True, "sub2", "True") + ucrChkEndofRainsDate.AddParameterValuesCondition(False, "sub2", "False") ucrChkEndofRainsDate.SetText("Date") ucrInputEndofRainsDate.SetParameter(New RParameter("result_name", 2)) @@ -252,8 +252,8 @@ Public Class dlgEndOfRainsSeason ucrInputEndofRainsDate.SetDataFrameSelector(ucrSelectorForWaterBalance.ucrAvailableDataFrames) ucrChkEndofRainsOccurence.SetText("Occurrence") - ucrChkEndofRainsOccurence.AddParameterPresentCondition(True, "sub3") - ucrChkEndofRainsOccurence.AddParameterPresentCondition(False, "sub3", False) + ucrChkEndofRainsOccurence.AddParameterValuesCondition(True, "sub3", "True") + ucrChkEndofRainsOccurence.AddParameterValuesCondition(False, "sub3", "False") ucrInputEndofRainsOccurence.SetParameter(New RParameter("result_name", 2)) ucrInputEndofRainsOccurence.SetValidationTypeAsRVariable() @@ -289,15 +289,15 @@ Public Class dlgEndOfRainsSeason ucrInputSeasonDoy.SetDataFrameSelector(ucrSelectorForWaterBalance.ucrAvailableDataFrames) ucrChkEndofSeasonDate.SetText("Date") - ucrChkEndofSeasonDate.AddParameterPresentCondition(True, "sub2") - ucrChkEndofSeasonDate.AddParameterPresentCondition(False, "sub2", False) + ucrChkEndofSeasonDate.AddParameterValuesCondition(True, "sub2", "True") + ucrChkEndofSeasonDate.AddParameterValuesCondition(False, "sub2", "False") ucrInputEndofSeasonDate.SetParameter(New RParameter("result_name", 3)) ucrInputEndofSeasonDate.SetValidationTypeAsRVariable() ucrInputEndofSeasonDate.SetDataFrameSelector(ucrSelectorForWaterBalance.ucrAvailableDataFrames) - ucrChkEndofSeasonOccurence.AddParameterPresentCondition(True, "sub3") - ucrChkEndofSeasonOccurence.AddParameterPresentCondition(False, "sub3", False) + ucrChkEndofSeasonOccurence.AddParameterValuesCondition(True, "sub3", "True") + ucrChkEndofSeasonOccurence.AddParameterValuesCondition(False, "sub3", "False") ucrChkEndofSeasonOccurence.SetText("Occurrence") ucrInputEndofSeasonOccurence.SetParameter(New RParameter("result_name", 2)) @@ -363,6 +363,7 @@ Public Class dlgEndOfRainsSeason #Region "clear_code_structures" ' General clsRunCalculation.Clear() + clsListCalFunction.Clear() clsFirstOrLastFunction.Clear() ' Group by @@ -498,6 +499,10 @@ Public Class dlgEndOfRainsSeason ucrNudCapacity.SetText("100") ucrNudWBLessThan.SetText("0.5") + clsDummyFunction = New RFunction + clsDummyFunction.AddParameter("sub2", "True", iPosition:=0) + clsDummyFunction.AddParameter("sub3", "True", iPosition:=1) + ' Group by clsGroupByStationYearCalc.SetRCommand("instat_calculation$new") clsGroupByStationYearCalc.AddParameter("type", Chr(34) & "by" & Chr(34), iPosition:=0) @@ -644,9 +649,13 @@ Public Class dlgEndOfRainsSeason clsEndRainsCombinationSubCalcList.SetRCommand("list") clsEndRainsCombinationSubCalcList.AddParameter("sub1", clsRFunctionParameter:=clsEndRainsLastDoySummaryCalc, bIncludeArgumentName:=False, iPosition:=0) + clsListCalFunction.SetRCommand("list") + clsListCalFunction.AddParameter("drop", "FALSE", iPosition:=0) + clsRunCalculation.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$run_instat_calculation") clsRunCalculation.AddParameter("display", "FALSE") clsRunCalculation.AddParameter("calc", clsRFunctionParameter:=clsEndRainsCombinationCalc) + clsRunCalculation.AddParameter("param_list", clsRFunctionParameter:=clsListCalFunction, iPosition:=2) ucrBase.clsRsyntax.SetBaseRFunction(clsRunCalculation) #End Region @@ -952,14 +961,14 @@ Public Class dlgEndOfRainsSeason End If ucrChkEndofSeasonDoy.SetRCode(clsEndSeasonCombinationSubCalcList, bReset) - ucrChkEndofSeasonDate.SetRCode(clsEndSeasonCombinationSubCalcList, bReset) - ucrChkEndofSeasonOccurence.SetRCode(clsEndSeasonCombinationSubCalcList, bReset) + ucrChkEndofSeasonDate.SetRCode(clsDummyFunction, bReset) + ucrChkEndofSeasonOccurence.SetRCode(clsDummyFunction, bReset) ucrNudAmount.SetRCode(clsEndRainsRollSumRainConditionOperator, bReset) ucrNudTotalOverDays.SetRCode(clsRollSumRainFunction, bReset) ucrChkEndofRainsDoy.SetRCode(clsEndRainsCombinationSubCalcList, bReset) - ucrChkEndofRainsDate.SetRCode(clsEndRainsCombinationSubCalcList, bReset) - ucrChkEndofRainsOccurence.SetRCode(clsEndRainsCombinationSubCalcList, bReset) + ucrChkEndofRainsDate.SetRCode(clsDummyFunction, bReset) + ucrChkEndofRainsOccurence.SetRCode(clsDummyFunction, bReset) ucrPnlEndOfRainsAndSeasons.SetRCode(clsFirstOrLastFunction, bReset) End Sub diff --git a/instat/dlgPICSACrops.Designer.vb b/instat/dlgPICSACrops.Designer.vb index dee8add1de3..e787f1db1b8 100644 --- a/instat/dlgPICSACrops.Designer.vb +++ b/instat/dlgPICSACrops.Designer.vb @@ -19,7 +19,7 @@ Partial Class dlgPICSACrops 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 @@ -36,7 +36,7 @@ Partial Class dlgPICSACrops '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.lblSelectedSet = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() @@ -49,13 +49,16 @@ Partial Class dlgPICSACrops Me.ucrReceiverStart = New instat.ucrReceiverSingle() Me.ucrReceiverEnd = New instat.ucrReceiverSingle() Me.grpCropDefinitions = New System.Windows.Forms.GroupBox() - Me.lblPlantingDays = New System.Windows.Forms.Label() - Me.lblCropLengthDays = New System.Windows.Forms.Label() - Me.lblWaterAmounts = New System.Windows.Forms.Label() - Me.ucrChkRequirePlantingDays = New instat.ucrCheck() Me.ucrInputCropLengths = New instat.ucrInputComboBox() Me.ucrInputWaterAmounts = New instat.ucrInputComboBox() Me.ucrInputPlantingDates = New instat.ucrInputComboBox() + Me.rdoBoth = New System.Windows.Forms.RadioButton() + Me.rdoNo = New System.Windows.Forms.RadioButton() + Me.rdoYes = New System.Windows.Forms.RadioButton() + Me.lblPlantingDays = New System.Windows.Forms.Label() + Me.lblCropLengthDays = New System.Windows.Forms.Label() + Me.lblWaterAmounts = New System.Windows.Forms.Label() + Me.ucrPnlStartCheck = New instat.UcrPanel() Me.ucrChkDataProp = New instat.ucrCheck() Me.ucrChkPrintDataProp = New instat.ucrCheck() Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() @@ -64,6 +67,7 @@ Partial Class dlgPICSACrops Me.ucrReceiverStation = New instat.ucrReceiverSingle() Me.ucrSelectorForCrops = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.lblStarts = New System.Windows.Forms.Label() Me.grpSeasonReceivers.SuspendLayout() Me.grpCropDefinitions.SuspendLayout() Me.SuspendLayout() @@ -180,24 +184,100 @@ Partial Class dlgPICSACrops ' 'grpCropDefinitions ' - Me.grpCropDefinitions.Controls.Add(Me.lblPlantingDays) - Me.grpCropDefinitions.Controls.Add(Me.lblCropLengthDays) - Me.grpCropDefinitions.Controls.Add(Me.lblWaterAmounts) - Me.grpCropDefinitions.Controls.Add(Me.ucrChkRequirePlantingDays) + Me.grpCropDefinitions.Controls.Add(Me.lblStarts) Me.grpCropDefinitions.Controls.Add(Me.ucrInputCropLengths) Me.grpCropDefinitions.Controls.Add(Me.ucrInputWaterAmounts) Me.grpCropDefinitions.Controls.Add(Me.ucrInputPlantingDates) + Me.grpCropDefinitions.Controls.Add(Me.rdoBoth) + Me.grpCropDefinitions.Controls.Add(Me.rdoNo) + Me.grpCropDefinitions.Controls.Add(Me.rdoYes) + Me.grpCropDefinitions.Controls.Add(Me.lblPlantingDays) + Me.grpCropDefinitions.Controls.Add(Me.lblCropLengthDays) + Me.grpCropDefinitions.Controls.Add(Me.lblWaterAmounts) + Me.grpCropDefinitions.Controls.Add(Me.ucrPnlStartCheck) Me.grpCropDefinitions.Location = New System.Drawing.Point(6, 194) Me.grpCropDefinitions.Name = "grpCropDefinitions" - Me.grpCropDefinitions.Size = New System.Drawing.Size(323, 158) + Me.grpCropDefinitions.Size = New System.Drawing.Size(292, 158) Me.grpCropDefinitions.TabIndex = 39 Me.grpCropDefinitions.TabStop = False Me.grpCropDefinitions.Text = "Crop Definitions" ' + 'ucrInputCropLengths + ' + Me.ucrInputCropLengths.AddQuotesIfUnrecognised = True + Me.ucrInputCropLengths.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputCropLengths.GetSetSelectedIndex = -1 + Me.ucrInputCropLengths.IsReadOnly = False + Me.ucrInputCropLengths.Location = New System.Drawing.Point(106, 129) + Me.ucrInputCropLengths.Margin = New System.Windows.Forms.Padding(6) + Me.ucrInputCropLengths.Name = "ucrInputCropLengths" + Me.ucrInputCropLengths.Size = New System.Drawing.Size(170, 21) + Me.ucrInputCropLengths.TabIndex = 55 + ' + 'ucrInputWaterAmounts + ' + Me.ucrInputWaterAmounts.AddQuotesIfUnrecognised = True + Me.ucrInputWaterAmounts.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputWaterAmounts.GetSetSelectedIndex = -1 + Me.ucrInputWaterAmounts.IsReadOnly = False + Me.ucrInputWaterAmounts.Location = New System.Drawing.Point(107, 92) + Me.ucrInputWaterAmounts.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputWaterAmounts.Name = "ucrInputWaterAmounts" + Me.ucrInputWaterAmounts.Size = New System.Drawing.Size(169, 21) + Me.ucrInputWaterAmounts.TabIndex = 40 + ' + 'ucrInputPlantingDates + ' + Me.ucrInputPlantingDates.AddQuotesIfUnrecognised = True + Me.ucrInputPlantingDates.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputPlantingDates.GetSetSelectedIndex = -1 + Me.ucrInputPlantingDates.IsReadOnly = False + Me.ucrInputPlantingDates.Location = New System.Drawing.Point(107, 58) + Me.ucrInputPlantingDates.Margin = New System.Windows.Forms.Padding(9) + Me.ucrInputPlantingDates.Name = "ucrInputPlantingDates" + Me.ucrInputPlantingDates.Size = New System.Drawing.Size(169, 21) + Me.ucrInputPlantingDates.TabIndex = 53 + ' + 'rdoBoth + ' + Me.rdoBoth.AutoSize = True + Me.rdoBoth.Location = New System.Drawing.Point(225, 25) + Me.rdoBoth.Margin = New System.Windows.Forms.Padding(2) + Me.rdoBoth.Name = "rdoBoth" + Me.rdoBoth.Size = New System.Drawing.Size(47, 17) + Me.rdoBoth.TabIndex = 44 + Me.rdoBoth.TabStop = True + Me.rdoBoth.Text = "Both" + Me.rdoBoth.UseVisualStyleBackColor = True + ' + 'rdoNo + ' + Me.rdoNo.AutoSize = True + Me.rdoNo.Location = New System.Drawing.Point(153, 25) + Me.rdoNo.Margin = New System.Windows.Forms.Padding(2) + Me.rdoNo.Name = "rdoNo" + Me.rdoNo.Size = New System.Drawing.Size(39, 17) + Me.rdoNo.TabIndex = 45 + Me.rdoNo.TabStop = True + Me.rdoNo.Text = "No" + Me.rdoNo.UseVisualStyleBackColor = True + ' + 'rdoYes + ' + Me.rdoYes.AutoSize = True + Me.rdoYes.Location = New System.Drawing.Point(81, 25) + Me.rdoYes.Margin = New System.Windows.Forms.Padding(2) + Me.rdoYes.Name = "rdoYes" + Me.rdoYes.Size = New System.Drawing.Size(43, 17) + Me.rdoYes.TabIndex = 43 + Me.rdoYes.TabStop = True + Me.rdoYes.Text = "Yes" + Me.rdoYes.UseVisualStyleBackColor = True + ' 'lblPlantingDays ' Me.lblPlantingDays.AutoSize = True - Me.lblPlantingDays.Location = New System.Drawing.Point(6, 51) + Me.lblPlantingDays.Location = New System.Drawing.Point(3, 60) Me.lblPlantingDays.Name = "lblPlantingDays" Me.lblPlantingDays.Size = New System.Drawing.Size(81, 13) Me.lblPlantingDays.TabIndex = 42 @@ -206,7 +286,7 @@ Partial Class dlgPICSACrops 'lblCropLengthDays ' Me.lblCropLengthDays.AutoSize = True - Me.lblCropLengthDays.Location = New System.Drawing.Point(6, 129) + Me.lblCropLengthDays.Location = New System.Drawing.Point(5, 133) Me.lblCropLengthDays.Name = "lblCropLengthDays" Me.lblCropLengthDays.Size = New System.Drawing.Size(101, 13) Me.lblCropLengthDays.TabIndex = 41 @@ -215,59 +295,27 @@ Partial Class dlgPICSACrops 'lblWaterAmounts ' Me.lblWaterAmounts.AutoSize = True - Me.lblWaterAmounts.Location = New System.Drawing.Point(6, 92) + Me.lblWaterAmounts.Location = New System.Drawing.Point(5, 95) Me.lblWaterAmounts.Name = "lblWaterAmounts" Me.lblWaterAmounts.Size = New System.Drawing.Size(89, 13) Me.lblWaterAmounts.TabIndex = 40 Me.lblWaterAmounts.Text = "Water Amount(s):" ' - 'ucrChkRequirePlantingDays - ' - Me.ucrChkRequirePlantingDays.AutoSize = True - Me.ucrChkRequirePlantingDays.Checked = False - Me.ucrChkRequirePlantingDays.Location = New System.Drawing.Point(6, 18) - Me.ucrChkRequirePlantingDays.Name = "ucrChkRequirePlantingDays" - Me.ucrChkRequirePlantingDays.Size = New System.Drawing.Size(286, 23) - Me.ucrChkRequirePlantingDays.TabIndex = 39 - ' - 'ucrInputCropLengths - ' - Me.ucrInputCropLengths.AddQuotesIfUnrecognised = True - Me.ucrInputCropLengths.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputCropLengths.GetSetSelectedIndex = -1 - Me.ucrInputCropLengths.IsReadOnly = False - Me.ucrInputCropLengths.Location = New System.Drawing.Point(172, 126) - Me.ucrInputCropLengths.Name = "ucrInputCropLengths" - Me.ucrInputCropLengths.Size = New System.Drawing.Size(137, 21) - Me.ucrInputCropLengths.TabIndex = 38 - ' - 'ucrInputWaterAmounts - ' - Me.ucrInputWaterAmounts.AddQuotesIfUnrecognised = True - Me.ucrInputWaterAmounts.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputWaterAmounts.GetSetSelectedIndex = -1 - Me.ucrInputWaterAmounts.IsReadOnly = False - Me.ucrInputWaterAmounts.Location = New System.Drawing.Point(172, 89) - Me.ucrInputWaterAmounts.Name = "ucrInputWaterAmounts" - Me.ucrInputWaterAmounts.Size = New System.Drawing.Size(137, 21) - Me.ucrInputWaterAmounts.TabIndex = 38 - ' - 'ucrInputPlantingDates + 'ucrPnlStartCheck ' - Me.ucrInputPlantingDates.AddQuotesIfUnrecognised = True - Me.ucrInputPlantingDates.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputPlantingDates.GetSetSelectedIndex = -1 - Me.ucrInputPlantingDates.IsReadOnly = False - Me.ucrInputPlantingDates.Location = New System.Drawing.Point(172, 51) - Me.ucrInputPlantingDates.Name = "ucrInputPlantingDates" - Me.ucrInputPlantingDates.Size = New System.Drawing.Size(137, 21) - Me.ucrInputPlantingDates.TabIndex = 38 + Me.ucrPnlStartCheck.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlStartCheck.Location = New System.Drawing.Point(75, 14) + Me.ucrPnlStartCheck.Margin = New System.Windows.Forms.Padding(6) + Me.ucrPnlStartCheck.Name = "ucrPnlStartCheck" + Me.ucrPnlStartCheck.Size = New System.Drawing.Size(201, 37) + Me.ucrPnlStartCheck.TabIndex = 46 ' 'ucrChkDataProp ' Me.ucrChkDataProp.AutoSize = True Me.ucrChkDataProp.Checked = False Me.ucrChkDataProp.Location = New System.Drawing.Point(10, 358) + Me.ucrChkDataProp.Margin = New System.Windows.Forms.Padding(6) Me.ucrChkDataProp.Name = "ucrChkDataProp" Me.ucrChkDataProp.Size = New System.Drawing.Size(172, 23) Me.ucrChkDataProp.TabIndex = 37 @@ -277,6 +325,7 @@ Partial Class dlgPICSACrops Me.ucrChkPrintDataProp.AutoSize = True Me.ucrChkPrintDataProp.Checked = False Me.ucrChkPrintDataProp.Location = New System.Drawing.Point(188, 358) + Me.ucrChkPrintDataProp.Margin = New System.Windows.Forms.Padding(6) Me.ucrChkPrintDataProp.Name = "ucrChkPrintDataProp" Me.ucrChkPrintDataProp.Size = New System.Drawing.Size(255, 23) Me.ucrChkPrintDataProp.TabIndex = 36 @@ -350,10 +399,20 @@ Partial Class dlgPICSACrops Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrBase.Location = New System.Drawing.Point(10, 392) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(4) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 0 ' + 'lblStarts + ' + Me.lblStarts.AutoSize = True + Me.lblStarts.Location = New System.Drawing.Point(6, 27) + Me.lblStarts.Name = "lblStarts" + Me.lblStarts.Size = New System.Drawing.Size(70, 13) + Me.lblStarts.TabIndex = 56 + Me.lblStarts.Text = "Include Start:" + ' 'dlgPICSACrops ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -407,13 +466,17 @@ Partial Class dlgPICSACrops Friend WithEvents cmdOptions As Button Friend WithEvents ucrChkPrintDataProp As ucrCheck Friend WithEvents ucrChkDataProp As ucrCheck - Friend WithEvents ucrInputPlantingDates As ucrInputComboBox - Friend WithEvents ucrInputWaterAmounts As ucrInputComboBox - Friend WithEvents ucrInputCropLengths As ucrInputComboBox Friend WithEvents grpSeasonReceivers As GroupBox Friend WithEvents grpCropDefinitions As GroupBox - Friend WithEvents ucrChkRequirePlantingDays As ucrCheck Friend WithEvents lblCropLengthDays As Label Friend WithEvents lblWaterAmounts As Label Friend WithEvents lblPlantingDays As Label + Friend WithEvents rdoNo As RadioButton + Friend WithEvents rdoBoth As RadioButton + Friend WithEvents rdoYes As RadioButton + Friend WithEvents ucrPnlStartCheck As UcrPanel + Friend WithEvents ucrInputWaterAmounts As ucrInputComboBox + Friend WithEvents ucrInputPlantingDates As ucrInputComboBox + Friend WithEvents ucrInputCropLengths As ucrInputComboBox + Friend WithEvents lblStarts As Label End Class diff --git a/instat/dlgPICSACrops.vb b/instat/dlgPICSACrops.vb index b0c55f14f33..a340b3716cc 100644 --- a/instat/dlgPICSACrops.vb +++ b/instat/dlgPICSACrops.vb @@ -18,6 +18,8 @@ Imports instat.Translations Public Class dlgPICSACrops Private clsCropsFunction As New RFunction + Private clsDummyFunction As New RFunction + Private clsSequenceFunction, clsSequencewaterFunction, clsSequencePlantingFunction As New RFunction Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private strCurrDataName As String = "" @@ -38,7 +40,6 @@ Public Class dlgPICSACrops Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 480 - ' Sub dialog not yet created. cmdOptions.Visible = False @@ -87,28 +88,30 @@ Public Class dlgPICSACrops ucrReceiverEnd.SetDataType("numeric") ucrReceiverEnd.bAttachedToPrimaryDataFrame = False - 'Planting date - ucrChkRequirePlantingDays.SetText("Require start day before planting day") - ucrChkRequirePlantingDays.SetParameter(New RParameter("start_check", 10), bNewChangeParameterValue:=True, strNewValueIfChecked:="TRUE", strNewValueIfUnchecked:="FALSE") - ucrChkRequirePlantingDays.SetRDefault("TRUE") + ucrPnlStartCheck.AddRadioButton(rdoYes) + ucrPnlStartCheck.AddRadioButton(rdoNo) + ucrPnlStartCheck.AddRadioButton(rdoBoth) + ucrPnlStartCheck.AddParameterValuesCondition(rdoYes, "check", "yes") + ucrPnlStartCheck.AddParameterValuesCondition(rdoNo, "check", "no") + ucrPnlStartCheck.AddParameterValuesCondition(rdoBoth, "check", "both") ucrInputPlantingDates.SetParameter(New RParameter("plant_days", 5)) ucrInputPlantingDates.SetValidationTypeAsNumericList() - ucrInputPlantingDates.SetItems({"120", "80, 90, 100, 110, 120", "92, 122, 153"}) + ucrInputPlantingDates.SetItems({"160", "80, 90, 100, 110, 120", "92, 122, 153", "124, 184, 10", "92, 152, 15"}) ucrInputPlantingDates.AddQuotesIfUnrecognised = False ucrInputPlantingDates.bAllowNonConditionValues = True 'Planting Length ucrInputCropLengths.SetParameter(New RParameter("plant_lengths", 6)) ucrInputCropLengths.SetValidationTypeAsNumericList() - ucrInputCropLengths.SetItems({"120", "100, 110, 120, 130, 140", "80, 90, 100, 110", "120, 150, 180"}) + ucrInputCropLengths.SetItems({"120", "100, 110, 120, 130, 140", "80, 90, 100, 110", "120, 150, 180", "60, 120, 10"}) ucrInputCropLengths.AddQuotesIfUnrecognised = False ucrInputCropLengths.bAllowNonConditionValues = True 'Water amount ucrInputWaterAmounts.SetParameter(New RParameter("rain_totals", 7)) ucrInputWaterAmounts.SetValidationTypeAsNumericList() - ucrInputWaterAmounts.SetItems({"600", "300, 400, 500, 600, 700", "300, 500, 700"}) + ucrInputWaterAmounts.SetItems({"600", "300, 400, 500, 600, 700", "300, 500, 700", "200, 600, 50", "500, 700, 25"}) ucrInputWaterAmounts.AddQuotesIfUnrecognised = False ucrInputWaterAmounts.bAllowNonConditionValues = True @@ -180,19 +183,27 @@ Public Class dlgPICSACrops Private Sub SetDefaults() clsCropsFunction = New RFunction - + clsDummyFunction = New RFunction + clsSequenceFunction = New RFunction + clsSequencePlantingFunction = New RFunction + clsSequencewaterFunction = New RFunction 'Currently this must come before reset to ensure autofilling is done correctly 'Once autofilling is being triggered correctly this can go after Reset. ucrSelectorForCrops.Reset() ucrReceiverRainfall.SetMeAsReceiver() + clsDummyFunction.AddParameter("check", "both", iPosition:=0) + 'Crops Function clsCropsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$crops_definitions") + + clsSequenceFunction.SetRCommand("seq") + clsSequencePlantingFunction.SetRCommand("seq") + clsSequencewaterFunction.SetRCommand("seq") + ' Temp disabled until list working correctly - 'clsCropsFunction.AddParameter("plant_days", "120") - 'clsCropsFunction.AddParameter("plant_lengths", "120") - 'clsCropsFunction.AddParameter("rain_totals", "600") - ucrInputPlantingDates.SetName("120") + + ucrInputPlantingDates.SetName("160") ucrInputCropLengths.SetName("120") ucrInputWaterAmounts.SetName("600") clsCropsFunction.AddParameter("definition_props", "TRUE", iPosition:=11) @@ -200,6 +211,7 @@ Public Class dlgPICSACrops ucrBase.clsRsyntax.SetBaseRFunction(clsCropsFunction) ucrBase.clsRsyntax.iCallType = 2 TestOkEnabled() + AddingStartCheckParm() End Sub Public Sub SetRCodeForControls(bReset As Boolean) @@ -219,13 +231,12 @@ Public Class dlgPICSACrops ucrReceiverEnd.SetRCode(clsCropsFunction, bReset) ' Disabled as list validation not working correctly with reading/writing controls - 'ucrInputPlantingDates.SetRCode(clsCropsFunction, bReset) - 'ucrInputPlantingLengths.SetRCode(clsCropsFunction, bReset) - 'ucrInputWaterAmounts.SetRCode(clsCropsFunction, bReset) - - ucrChkRequirePlantingDays.SetRCode(clsCropsFunction, bReset) ucrChkDataProp.SetRCode(clsCropsFunction, bReset) ucrChkPrintDataProp.SetRCode(clsCropsFunction, bReset) + If bReset Then + ucrPnlStartCheck.SetRCode(clsDummyFunction, bReset) + End If + AddingStartCheckParm() End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -242,14 +253,11 @@ Public Class dlgPICSACrops End If End Sub - Private Sub ucrReceiverYear_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlContentsChanged, ucrReceiverRainfall.ControlContentsChanged, ucrReceiverStart.ControlContentsChanged, ucrReceiverEnd.ControlContentsChanged, ucrReceiverDay.ControlContentsChanged, ucrInputPlantingDates.ControlContentsChanged, ucrInputCropLengths.ControlContentsChanged, ucrInputWaterAmounts.ControlContentsChanged + Private Sub ucrReceiverYear_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlContentsChanged, ucrReceiverRainfall.ControlContentsChanged, ucrReceiverStart.ControlContentsChanged, ucrReceiverEnd.ControlContentsChanged, ucrReceiverDay.ControlContentsChanged, + ucrInputCropLengths.ControlContentsChanged, ucrInputPlantingDates.ControlContentsChanged, ucrInputWaterAmounts.ControlContentsChanged TestOkEnabled() End Sub - Private Sub ucrInputPlantingDates_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputPlantingDates.ControlValueChanged - PlantingDaysParam() - End Sub - Private Sub ucrSelectorForCrops_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForCrops.ControlValueChanged If ucrSelectorForCrops.CurrentReceiver Is Nothing OrElse ucrSelectorForCrops.CurrentReceiver.bAttachedToPrimaryDataFrame Then clsCropsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForCrops.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) @@ -259,26 +267,108 @@ Public Class dlgPICSACrops End Sub Private Sub PlantingDaysParam() + Dim strPlantingDates As String = ucrInputPlantingDates.GetText + If ucrInputPlantingDates.IsEmpty Then + clsSequencePlantingFunction.RemoveParameterByName("plant") clsCropsFunction.RemoveParameterByName("plant_days") Else - clsCropsFunction.AddParameter("plant_days", "c(" & ucrInputPlantingDates.GetText() & ")", iPosition:=5) + Dim plantingDates As String() = ucrInputPlantingDates.GetText().Split(","c) + + If plantingDates.Length = 3 Then + Dim first As Integer = Integer.Parse(plantingDates(0).Trim()) + Dim second As Integer = Integer.Parse(plantingDates(1).Trim()) + Dim third As Integer = Integer.Parse(plantingDates(2).Trim()) + + If third < second Then + ' Assume a sequence and run the sequence function + clsSequencePlantingFunction.AddParameter("plant", strPlantingDates, iPosition:=5, bIncludeArgumentName:=False) + clsCropsFunction.AddParameter("plant_days", clsRFunctionParameter:=clsSequencePlantingFunction) + Else + ' List the values as provided + clsCropsFunction.AddParameter("plant_days", "c(" & strPlantingDates & ")", iPosition:=5) + End If + Else + ' List the values as provided + clsCropsFunction.AddParameter("plant_days", "c(" & strPlantingDates & ")", iPosition:=5) + End If + End If + End Sub + + Private Sub ucrPnlStartCheck_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlStartCheck.ControlValueChanged + AddingStartCheckParm() + End Sub + + Private Sub AddingStartCheckParm() + If rdoYes.Checked Then + clsCropsFunction.AddParameter("start_check", Chr(34) & "yes" & Chr(34), iPosition:=10) + ElseIf rdoNo.Checked Then + clsCropsFunction.AddParameter("start_check", Chr(34) & "no" & Chr(34), iPosition:=10) + Else + clsCropsFunction.AddParameter("start_check", Chr(34) & "both" & Chr(34), iPosition:=10) End If End Sub Private Sub ucrInputCropLengths_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputCropLengths.ControlValueChanged + Dim strCropLengths As String = ucrInputCropLengths.GetText + If ucrInputCropLengths.IsEmpty Then + clsSequenceFunction.RemoveParameterByName("plant") clsCropsFunction.RemoveParameterByName("plant_lengths") Else - clsCropsFunction.AddParameter("plant_lengths", "c(" & ucrInputCropLengths.GetText() & ")", iPosition:=6) + Dim plantingDates As String() = ucrInputCropLengths.GetText().Split(","c) + + If plantingDates.Length = 3 Then + Dim first As Integer = Integer.Parse(plantingDates(0).Trim()) + Dim second As Integer = Integer.Parse(plantingDates(1).Trim()) + Dim third As Integer = Integer.Parse(plantingDates(2).Trim()) + + If third < second Then + ' Assume a sequence and run the sequence function + clsSequenceFunction.AddParameter("plant", strCropLengths, iPosition:=5, bIncludeArgumentName:=False) + clsCropsFunction.AddParameter("plant_lengths", clsRFunctionParameter:=clsSequenceFunction) + Else + ' List the values as provided + clsCropsFunction.AddParameter("plant_lengths", "c(" & strCropLengths & ")", iPosition:=6) + End If + Else + ' List the values as provided + clsCropsFunction.AddParameter("plant_lengths", "c(" & strCropLengths & ")", iPosition:=6) + End If End If End Sub + Private Sub ucrInputPlantingDates_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputPlantingDates.ControlValueChanged + PlantingDaysParam() + End Sub + Private Sub ucrInputWaterAmounts_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputWaterAmounts.ControlValueChanged + Dim strWaterAmounts As String = ucrInputWaterAmounts.GetText + If ucrInputWaterAmounts.IsEmpty Then clsCropsFunction.RemoveParameterByName("rain_totals") + clsSequencewaterFunction.RemoveParameterByName("totals") Else - clsCropsFunction.AddParameter("rain_totals", "c(" & ucrInputWaterAmounts.GetText() & ")", iPosition:=7) + Dim plantingDates As String() = ucrInputWaterAmounts.GetText().Split(","c) + + If plantingDates.Length = 3 Then + Dim first As Integer = Integer.Parse(plantingDates(0).Trim()) + Dim second As Integer = Integer.Parse(plantingDates(1).Trim()) + Dim third As Integer = Integer.Parse(plantingDates(2).Trim()) + + If third < second Then + ' Assume a sequence and run the sequence function + clsSequencewaterFunction.AddParameter("totals", strWaterAmounts, iPosition:=5, bIncludeArgumentName:=False) + clsCropsFunction.AddParameter("rain_totals", clsRFunctionParameter:=clsSequencewaterFunction) + Else + ' List the values as provided + clsCropsFunction.AddParameter("rain_totals", "c(" & strWaterAmounts & ")", iPosition:=7) + End If + Else + ' List the values as provided + clsCropsFunction.AddParameter("rain_totals", "c(" & strWaterAmounts & ")", iPosition:=7) + End If End If End Sub + End Class \ No newline at end of file diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 8717e3e6506..b5df24820c2 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -17,7 +17,7 @@ Imports instat.Translations Public Class dlgStartofRains - Private clsCalcRainDay, clsCalcStartDOY, clsCalcStartDate, clsCombinationCalc, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction + Private clsCalcRainDay, clsCalcStartDOY, clsConvertColumnType1Function, clsConvertColumnType2Function, clsConvertColumnTypeFunction, clsGetColumnDataTypeFunction, clsDummyFunction, clsIfelseStatusFunction, clsIfelseStatus1Function, clsFirstStatusFunction, clsIsNAStatusFunction, clsCalcStartDate, clsCombinationCalc, clsListCalFunction, clsCombinationManipList, clsCombinationSubCalcList, clsListSubCalc, clsManipulationFirstDOYPerYear, clsConditionsFilter, clsCombinedList As New RFunction Private clsDayFromAndTo, clsGroupByStation, clsGroupByYear, clsListToTalRain, clsApplyInstatFunction, clsFirstDOY, clsFirstDate As New RFunction Private clsDayFromAndToOperator, clsDayFromOperator, clsDayToOperator, clsRainDayOperator, clsRainDayConditionOperator, clsConditionsAndOperator, clsTRCombineOperator, clsRollingSumRainDayOperator, clsDSCombineOperator, clsDPCombineOperator As New ROperator Private clsDayFilterCalcFromConvert, clsDayFilterCalcFromList As New RFunction @@ -244,12 +244,12 @@ Public Class dlgStartofRains ucrChkAsDoy.AddParameterPresentCondition(False, "sub1", False) ucrChkAsDoy.SetText("Day of Year") - ucrChkAsDate.AddParameterPresentCondition(True, "sub2", True) - ucrChkAsDate.AddParameterPresentCondition(False, "sub2", False) + ucrChkAsDate.AddParameterValuesCondition(True, "sub2", "True") + ucrChkAsDate.AddParameterValuesCondition(False, "sub2", "False") ucrChkAsDate.SetText("Date") - ucrChkStatus.AddParameterPresentCondition(True, "sub3", True) - ucrChkStatus.AddParameterPresentCondition(False, "sub3", False) + ucrChkStatus.AddParameterValuesCondition(True, "sub3", "True") + ucrChkStatus.AddParameterValuesCondition(False, "sub3", "False") ucrChkStatus.SetText("Occurrence") End Sub @@ -265,6 +265,7 @@ Public Class dlgStartofRains Dim strStartStatus As String = "start_rain_status" Dim strStartDoy As String = "start_rain" Dim strRollSumRainDryPeriod As String = "roll_sum_rain_dry_period" + Dim strYearType As String = "year_type" clsDayFromAndTo.Clear() clsDayFromAndToOperator.Clear() @@ -279,7 +280,16 @@ Public Class dlgStartofRains clsCombinedList.Clear() clsCombinationCalc.Clear() clsListSubCalc.Clear() + clsListCalFunction.Clear() clsCombinationSubCalcList.Clear() + clsIfelseStatus1Function.Clear() + clsIfelseStatusFunction.Clear() + clsFirstStatusFunction.Clear() + clsIsNAStatusFunction.Clear() + clsGetColumnDataTypeFunction.Clear() + clsConvertColumnTypeFunction.Clear() + clsConvertColumnType2Function.Clear() + clsConvertColumnType1Function.Clear() clsSpellsFunction.Clear() clsRainDaySpellsOperator.Clear() @@ -354,6 +364,10 @@ Public Class dlgStartofRains clsDayFilterCalcFromList.SetRCommand("list") clsDayFilterCalcFromConvert.AddParameter("x", clsRFunctionParameter:=clsDayFilterCalcFromList, iPosition:=0) + clsDummyFunction = New RFunction + clsDummyFunction.AddParameter("sub2", "True", iPosition:=0) + clsDummyFunction.AddParameter("sub3", "True", iPosition:=1) + 'Day From and To clsDayFromAndTo.SetRCommand("instat_calculation$new") clsDayFromAndTo.AddParameter("type", Chr(34) & "filter" & Chr(34), iPosition:=0) @@ -383,6 +397,21 @@ Public Class dlgStartofRains clsGroupByYear.AddParameter("type", Chr(34) & "by" & Chr(34), iPosition:=0) clsGroupByYear.SetAssignTo("grouping_by_year") + clsGetColumnDataTypeFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_data_types") + clsGetColumnDataTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsGetColumnDataTypeFunction.SetAssignTo(strYearType) + + clsConvertColumnTypeFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") + clsConvertColumnTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsConvertColumnTypeFunction.AddParameter("to_type", Chr(34) & "factor" & Chr(34), iPosition:=2) + + clsConvertColumnType1Function.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") + clsConvertColumnType1Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsConvertColumnType1Function.AddParameter("to_type", "year_type", iPosition:=2) + + clsConvertColumnType2Function.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") + clsConvertColumnType2Function.AddParameter("to_type", "year_type", iPosition:=2) + 'TOTAL RAIN: associated with ucrChkTotalRainfall clsCalcRainRollingSum.SetRCommand("instat_calculation$new") clsCalcRainRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) @@ -683,11 +712,29 @@ Public Class dlgStartofRains ' Status clsCalcStatus.SetRCommand("instat_calculation$new") clsCalcStatus.AddParameter("type", Chr(34) & "summary" & Chr(34), iPosition:=0) - clsCalcStatus.AddParameter("function_exp", Chr(34) & "n() > 0" & Chr(34), iPosition:=1) + clsCalcStatus.AddParameter("function_exp", clsRFunctionParameter:=clsIfelseStatusFunction, iPosition:=1) clsCalcStatus.AddParameter("result_name", Chr(34) & strStartStatus & Chr(34), iPosition:=3) clsCalcStatus.AddParameter("save", 2, iPosition:=4) clsCalcStatus.SetAssignTo("start_of_rains_status") + clsIfelseStatusFunction.SetRCommand("ifelse") + clsIfelseStatusFunction.bToScriptAsRString = True + clsIfelseStatusFunction.AddParameter("x", "n() > 0", iPosition:=0, bIncludeArgumentName:=False) + clsIfelseStatusFunction.AddParameter("y", clsRFunctionParameter:=clsIfelseStatus1Function, iPosition:=1, bIncludeArgumentName:=False) + clsIfelseStatusFunction.AddParameter("z", "FALSE", iPosition:=2, bIncludeArgumentName:=False) + + clsIfelseStatus1Function.SetRCommand("ifelse") + clsIfelseStatus1Function.AddParameter("yes", clsRFunctionParameter:=clsFirstStatusFunction, iPosition:=0, bIncludeArgumentName:=False) + clsIfelseStatus1Function.AddParameter("test", "NA", iPosition:=1, bIncludeArgumentName:=False) + clsIfelseStatus1Function.AddParameter("no", "TRUE", iPosition:=2, bIncludeArgumentName:=False) + + clsFirstStatusFunction.SetPackageName("dplyr") + clsFirstStatusFunction.SetRCommand("first") + clsFirstStatusFunction.AddParameter("x", clsRFunctionParameter:=clsIsNAStatusFunction, iPosition:=0, bIncludeArgumentName:=False) + + clsIsNAStatusFunction.SetRCommand("is.na") + clsIsNAStatusFunction.AddParameter("x", strRollSumRain, iPosition:=0, bIncludeArgumentName:=False) + 'Combination clsCombinationCalc.SetRCommand("instat_calculation$new") clsCombinationCalc.AddParameter("type", Chr(34) & "combination" & Chr(34), iPosition:=0) @@ -702,18 +749,26 @@ Public Class dlgStartofRains clsCombinationSubCalcList.SetRCommand("list") clsCombinationSubCalcList.AddParameter("sub1", clsRFunctionParameter:=clsCalcStartDOY, bIncludeArgumentName:=False, iPosition:=0) + clsCombinationSubCalcList.AddParameter("sub2", clsRFunctionParameter:=clsCalcStartDate, bIncludeArgumentName:=False, iPosition:=1) + clsCombinationSubCalcList.AddParameter("sub3", clsRFunctionParameter:=clsCalcStatus, bIncludeArgumentName:=False, iPosition:=2) 'Sub_Calculations List clsListSubCalc.SetRCommand("list") - clsListSubCalc.AddParameter("sub1", iPosition:=0, clsRFunctionParameter:=clsCalcStartDOY, bIncludeArgumentName:=False) 'Run Calculations + clsListCalFunction.SetRCommand("list") + clsListCalFunction.AddParameter("drop", "FALSE", iPosition:=0) + clsApplyInstatFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$run_instat_calculation") clsApplyInstatFunction.AddParameter("display", "FALSE", iPosition:=1) clsApplyInstatFunction.AddParameter("calc", clsRFunctionParameter:=clsCombinationCalc, iPosition:=0) + clsApplyInstatFunction.AddParameter("param_list", clsRFunctionParameter:=clsListCalFunction, iPosition:=2) - 'Base Function ucrBase.clsRsyntax.SetBaseRFunction(clsApplyInstatFunction) + ucrBase.clsRsyntax.AddToBeforeCodes(clsGetColumnDataTypeFunction, iPosition:=0) + ucrBase.clsRsyntax.AddToBeforeCodes(clsConvertColumnTypeFunction, iPosition:=1) + ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType1Function, iPosition:=0) + ucrBase.clsRsyntax.AddToAfterCodes(clsConvertColumnType2Function, iPosition:=1) End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -735,8 +790,8 @@ Public Class dlgStartofRains ucrReceiverDOY.SetRCode(clsDayToOperator, bReset) ucrChkAsDoy.SetRCode(clsCombinationSubCalcList, bReset) - ucrChkStatus.SetRCode(clsCombinationSubCalcList, bReset) - ucrChkAsDate.SetRCode(clsCombinationSubCalcList, bReset) + ucrChkStatus.SetRCode(clsDummyFunction, bReset) + ucrChkAsDate.SetRCode(clsDummyFunction, bReset) ucrInputThreshold.SetRCode(clsRainDayOperator, bReset) ucrReceiverDate.SetRCode(clsFirstDate, bReset) @@ -865,9 +920,17 @@ Public Class dlgStartofRains Private Sub GroupByYearOptions() If Not ucrReceiverYear.IsEmpty Then + clsGetColumnDataTypeFunction.AddParameter("columns", ucrReceiverYear.GetVariableNames(), iPosition:=1) + clsConvertColumnTypeFunction.AddParameter("col_names", ucrReceiverYear.GetVariableNames(), iPosition:=1) + clsConvertColumnType1Function.AddParameter("col_names", ucrReceiverYear.GetVariableNames(), iPosition:=1) + clsConvertColumnType2Function.AddParameter("col_names", ucrReceiverYear.GetVariableNames(), iPosition:=1) clsGroupByYear.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverYear.GetVariableNames & ")", iPosition:=3) Else clsGroupByYear.RemoveParameterByName("calculated_from") + clsGetColumnDataTypeFunction.RemoveParameterByName("columns") + clsConvertColumnTypeFunction.RemoveParameterByName("col_names") + clsConvertColumnType1Function.RemoveParameterByName("col_names") + clsConvertColumnType2Function.RemoveParameterByName("col_names") End If End Sub @@ -925,6 +988,7 @@ Public Class dlgStartofRains Private Sub ucrReceiverStation_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged GroupByStationOptions() + ConvertYearType() End Sub Private Sub ucrReceiverYear_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverYear.ControlValueChanged @@ -939,7 +1003,19 @@ Public Class dlgStartofRains TestOKEnabled() End Sub + Private Sub ConvertYearType() + If Not ucrReceiverStation.IsEmpty Then + clsConvertColumnType2Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_by_station_year" & Chr(34), iPosition:=0) + Else + clsConvertColumnType2Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_by_year" & Chr(34), iPosition:=0) + End If + End Sub + Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged + clsGetColumnDataTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsConvertColumnTypeFunction.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsConvertColumnType1Function.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + ConvertYearType() clsDayFilterCalcFromList.ClearParameters() End Sub @@ -960,7 +1036,7 @@ Public Class dlgStartofRains Private Sub ucrChkAsDoy_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAsDoy.ControlValueChanged If ucrChkAsDoy.Checked Then clsCombinationSubCalcList.AddParameter("sub1", clsRFunctionParameter:=clsCalcStartDOY, bIncludeArgumentName:=False, iPosition:=0) - clsListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsCalcStartDOY, bIncludeArgumentName:=False, iPosition:=1) + clsListSubCalc.AddParameter("sub1", clsRFunctionParameter:=clsCalcStartDOY, bIncludeArgumentName:=False, iPosition:=0) Else clsCombinationSubCalcList.RemoveParameterByName("sub1") clsListSubCalc.RemoveParameterByName("sub1") @@ -975,8 +1051,10 @@ Public Class dlgStartofRains Private Sub ucrChkStatus_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkStatus.ControlValueChanged If ucrChkStatus.Checked Then clsCombinationSubCalcList.AddParameter("sub3", clsRFunctionParameter:=clsCalcStatus, bIncludeArgumentName:=False, iPosition:=2) + clsListSubCalc.AddParameter("sub3", clsRFunctionParameter:=clsCalcStatus, bIncludeArgumentName:=False, iPosition:=2) Else clsCombinationSubCalcList.RemoveParameterByName("sub3") + clsListSubCalc.RemoveParameterByName("sub3") End If End Sub diff --git a/instat/dlgSummaryTables.Designer.vb b/instat/dlgSummaryTables.Designer.vb index 2fc3646bcd2..cc8ebfa2823 100644 --- a/instat/dlgSummaryTables.Designer.vb +++ b/instat/dlgSummaryTables.Designer.vb @@ -278,6 +278,7 @@ Partial Class dlgSummaryTables Me.cmdFormatTable.TabIndex = 19 Me.cmdFormatTable.Text = "Format Table..." Me.cmdFormatTable.UseVisualStyleBackColor = True + Me.cmdFormatTable.Visible = False ' 'rdoFrequencyTable ' diff --git a/instat/dlgSummaryTables.resx b/instat/dlgSummaryTables.resx index c776d802beb..c838926ad7f 100644 --- a/instat/dlgSummaryTables.resx +++ b/instat/dlgSummaryTables.resx @@ -123,7 +123,4 @@ 17, 17 - - 17, 17 - \ No newline at end of file diff --git a/instat/dlgSummaryTables.vb b/instat/dlgSummaryTables.vb index bd7aba23fa4..f69bfc8f878 100644 --- a/instat/dlgSummaryTables.vb +++ b/instat/dlgSummaryTables.vb @@ -22,18 +22,14 @@ Public Class dlgSummaryTables Private clsSummariesList As New RFunction Private bResetSubdialog As Boolean = False Private bResetFormatSubdialog As Boolean = False - Private clsSummaryDefaultFunction, clsFrequencyDefaultFunction, clsConcFunction As New RFunction + Private clsSummaryDefaultFunction, clsFrequencyDefaultFunction As New RFunction Private bRCodeSet As Boolean = True - Private clsStubHeadFunction, clsPivotWiderFunction As New RFunction + Private clsPivotWiderFunction As New RFunction Private iUcrBaseXLocation, iDialogueXsize As Integer - Private clsTableTitleFunction, clsTabFootnoteTitleFunction, clsTableSourcenoteFunction, clsFootnoteTitleLocationFunction, clsFootnoteSubtitleLocationFunction, - clsTabFootnoteSubtitleFunction, clsFootnoteCellFunction, clsFootnoteCellBodyFunction, - clsSecondFootnoteCellFunction, clsSecondFootnoteCellBodyFunction, clsTabStyleFunction, clsDummyFunction, - clsTabStyleCellTextFunction, clsTabStylePxFunction, clsTabStyleCellTitleFunction, clsThemesTabOptionsFunction, - clsgtExtraThemesFunction, clsGtFunction As New RFunction + Private clsDummyFunction As New RFunction - Private clsSummaryOperator, clsFrequencyOperator, clsPipeOperator, clsJoiningPipeOperator As New ROperator + Private clsSummaryOperator, clsFrequencyOperator, clsJoiningPipeOperator As New ROperator Private Sub dlgNewSummaryTables_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -192,31 +188,13 @@ Public Class dlgSummaryTables clsSummaryDefaultFunction = New RFunction clsFrequencyDefaultFunction = New RFunction clsSummariesList = New RFunction - clsConcFunction = New RFunction - clsTableTitleFunction = New RFunction - clsTabFootnoteTitleFunction = New RFunction - clsTableSourcenoteFunction = New RFunction - clsFootnoteTitleLocationFunction = New RFunction - clsFootnoteSubtitleLocationFunction = New RFunction - clsSummaryOperator = New ROperator - clsPipeOperator = New ROperator - clsTabFootnoteSubtitleFunction = New RFunction - clsFootnoteCellBodyFunction = New RFunction - clsSecondFootnoteCellBodyFunction = New RFunction - clsFootnoteCellFunction = New RFunction - clsSecondFootnoteCellFunction = New RFunction - clsTabStyleFunction = New RFunction - clsTabStyleCellTextFunction = New RFunction - clsTabStylePxFunction = New RFunction - clsTabStyleCellTitleFunction = New RFunction - clsJoiningPipeOperator = New ROperator - clsFrequencyOperator = New ROperator clsDummyFunction = New RFunction - clsThemesTabOptionsFunction = New RFunction - clsgtExtraThemesFunction = New RFunction - clsGtFunction = New RFunction clsPivotWiderFunction = New RFunction + clsJoiningPipeOperator = New ROperator + clsSummaryOperator = New ROperator + clsFrequencyOperator = New ROperator + ucrReceiverFactors.SetMeAsReceiver() ucrSelectorSummaryTables.Reset() ucrSaveTable.Reset() @@ -227,55 +205,9 @@ Public Class dlgSummaryTables clsDummyFunction.AddParameter("rdo_checked", "rdoFrequency", iPosition:=1) clsDummyFunction.AddParameter("factor_cols", "FactorVar", iPosition:=2) - clsSummaryOperator.SetOperation("%>%") - clsSummaryOperator.bBrackets = False - - clsConcFunction.SetRCommand("c") - - clsPipeOperator.SetOperation("%>%") - clsPipeOperator.bBrackets = False - - clsJoiningPipeOperator.SetOperation("%>%") - clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0) - - clsThemesTabOptionsFunction.SetPackageName("gt") - clsThemesTabOptionsFunction.SetRCommand("tab_options") - - clsgtExtraThemesFunction.SetPackageName("gtExtras") - clsGtFunction.SetPackageName("gt") - clsGtFunction.SetRCommand("gt") - - clsStubHeadFunction.SetPackageName("gt") - clsStubHeadFunction.SetRCommand("tab_stubhead") - - clsTabStyleFunction.SetRCommand("tab_style") - clsTabStyleFunction.SetPackageName("gt") - clsTabStyleFunction.AddParameter("style", clsRFunctionParameter:=clsTabStyleCellTextFunction, iPosition:=0) - clsTabStyleFunction.AddParameter("location", clsRFunctionParameter:=clsTabStyleCellTitleFunction, iPosition:=1) - - clsTabStyleCellTitleFunction.SetPackageName("gt") - clsTabStyleCellTitleFunction.SetRCommand("cells_title") - clsTabStyleCellTitleFunction.AddParameter("groups", Chr(34) & "title" & Chr(34), iPosition:=0) - - clsTabStyleCellTextFunction.SetPackageName("gt") - clsTabStyleCellTextFunction.SetRCommand("cell_text") - clsTabStyleCellTextFunction.AddParameter("size", clsRFunctionParameter:=clsTabStylePxFunction, iPosition:=0) - - clsTabStylePxFunction.SetPackageName("gt") - clsTabStylePxFunction.SetRCommand("px") - clsTabStylePxFunction.AddParameter("size", "18", bIncludeArgumentName:=False, iPosition:=0) - clsPivotWiderFunction.SetRCommand("pivot_wider") clsPivotWiderFunction.AddParameter("values_from", "value", iPosition:=1) - clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryDefaultFunction, iPosition:=0) - clsSummaryOperator.AddParameter("gttbl", clsRFunctionParameter:=clsGtFunction, iPosition:=2) - - clsFrequencyOperator.SetOperation("%>%") - clsFrequencyOperator.bBrackets = False - clsFrequencyOperator.AddParameter("tableFun", clsRFunctionParameter:=clsFrequencyDefaultFunction, iPosition:=0) - clsFrequencyOperator.AddParameter("gttbl", clsRFunctionParameter:=clsGtFunction, iPosition:=2) - clsSummariesList.SetRCommand("c") clsSummariesList.AddParameter("summary_mean", Chr(34) & "summary_mean" & Chr(34), bIncludeArgumentName:=False) ' TODO decide which default(s) to use? @@ -290,35 +222,24 @@ Public Class dlgSummaryTables clsFrequencyDefaultFunction.AddParameter("summaries", "count_label", iPosition:=11) clsFrequencyDefaultFunction.SetAssignToObject("frequency_table") - clsTableTitleFunction.SetPackageName("gt") - clsTableTitleFunction.SetRCommand("tab_header") - - clsTabFootnoteTitleFunction.SetPackageName("gt") - clsTabFootnoteTitleFunction.SetRCommand("tab_footnote") - - clsTabFootnoteSubtitleFunction.SetPackageName("gt") - clsTabFootnoteSubtitleFunction.SetRCommand("tab_footnote") - clsFootnoteCellFunction.SetPackageName("gt") - clsFootnoteCellFunction.SetRCommand("tab_footnote") - - clsSecondFootnoteCellFunction.SetPackageName("gt") - clsSecondFootnoteCellFunction.SetRCommand("tab_footnote") - - clsFootnoteTitleLocationFunction.SetPackageName("gt") - clsFootnoteTitleLocationFunction.SetRCommand("cells_title") - - clsFootnoteSubtitleLocationFunction.SetPackageName("gt") - clsFootnoteSubtitleLocationFunction.SetRCommand("cells_title") + ' Gt function + Dim clsGtFunction As New RFunction + clsGtFunction.SetPackageName("gt") + clsGtFunction.SetRCommand("gt") - clsTableSourcenoteFunction.SetPackageName("gt") - clsTableSourcenoteFunction.SetRCommand("tab_source_note") + clsSummaryOperator.SetOperation("%>%") + clsSummaryOperator.bBrackets = False + clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryDefaultFunction, iPosition:=0) + clsSummaryOperator.AddParameter("gt", clsRFunctionParameter:=clsGtFunction.Clone, iPosition:=2) - clsFootnoteCellBodyFunction.SetPackageName("gt") - clsFootnoteCellBodyFunction.SetRCommand("cells_body") + clsFrequencyOperator.SetOperation("%>%") + clsFrequencyOperator.bBrackets = False + clsFrequencyOperator.AddParameter("tableFun", clsRFunctionParameter:=clsFrequencyDefaultFunction, iPosition:=0) + clsFrequencyOperator.AddParameter("gt", clsRFunctionParameter:=clsGtFunction.Clone, iPosition:=2) - clsSecondFootnoteCellBodyFunction.SetPackageName("gt") - clsSecondFootnoteCellBodyFunction.SetRCommand("cells_body") + clsJoiningPipeOperator.SetOperation("%>%") + clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0) ucrBase.clsRsyntax.SetBaseROperator(clsJoiningPipeOperator) clsJoiningPipeOperator.SetAssignToOutputObject(strRObjectToAssignTo:="last_table", @@ -386,6 +307,8 @@ Public Class dlgSummaryTables End Sub Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click + Dim clsConcFunction As New RFunction + clsConcFunction.SetRCommand("c") sdgSummaries.SetRFunction(clsSummariesList, clsSummaryDefaultFunction, clsConcFunction, ucrSelectorSummaryTables, bResetSubdialog) bResetSubdialog = False sdgSummaries.bEnable2VariableTab = False @@ -396,26 +319,19 @@ Public Class dlgSummaryTables End Sub Private Sub cmdFormatTable_Click(sender As Object, e As EventArgs) Handles cmdFormatTable.Click - If rdoSummaryTable.Checked Then - sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction, - clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction, - clsNewPipeOperator:=clsPipeOperator, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction, - clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator, - clsNewMutableOperator:=clsSummaryOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction, - clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, clsNewThemesTabOptionFunction:=clsThemesTabOptionsFunction, - clsNewgtExtraThemesFunction:=clsgtExtraThemesFunction, bReset:=bResetFormatSubdialog) + + Dim clsROperator As ROperator + If rdoFrequencyTable.Checked Then + clsROperator = clsFrequencyOperator + ElseIf rdoSummaryTable.Checked Then + clsROperator = clsSummaryOperator Else - sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction, - clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction, - clsNewPipeOperator:=clsPipeOperator, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction, - clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator, - clsNewMutableOperator:=clsFrequencyOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction, - clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, clsNewThemesTabOptionFunction:=clsThemesTabOptionsFunction, - clsNewgtExtraThemesFunction:=clsgtExtraThemesFunction, bReset:=bResetFormatSubdialog) + Exit Sub End If - sdgFormatSummaryTables.ShowDialog() - bResetFormatSubdialog = False + 'sdgTableOptions.Setup(clsROperator) + sdgTableOptions.ShowDialog(Me) + End Sub Private Sub ucrChkWeights_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkWeight.ControlValueChanged diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index e7e4ee0766b..b6e4800811e 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -72,6 +72,8 @@ Partial Class frmMain Me.mnuDescribeSpecificCummulativeDistribution = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeSpecificParallelCoordinatePlot = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeSpecificTables = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribeSummaries = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribePresentation = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator9 = New System.Windows.Forms.ToolStripSeparator() Me.mnuDescribeMultivariate = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeMultivariateCorrelations = New System.Windows.Forms.ToolStripMenuItem() @@ -199,6 +201,7 @@ Partial Class frmMain Me.mnuClimaticFileImportandTidyShapefile = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimateFileImportfromClimSoft = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticFileImportfromCliData = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator15 = New System.Windows.Forms.ToolStripSeparator() Me.mnuClimaticFileExportToClimsoft = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticFileExportToCPT = New System.Windows.Forms.ToolStripMenuItem() Me.mnuExportToWWRToolStrip = New System.Windows.Forms.ToolStripMenuItem() @@ -251,6 +254,7 @@ Partial Class frmMain Me.ToolStripSeparator70 = New System.Windows.Forms.ToolStripSeparator() Me.mnuClimaticCheckDataHomogenization = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticCheckDataCheckStationLocations = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuClimaticCheckDataDistances = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticPrepare = New System.Windows.Forms.ToolStripMenuItem() Me.mnuCimaticPrepareTransform = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticPrepareConversions = New System.Windows.Forms.ToolStripMenuItem() @@ -699,7 +703,6 @@ Partial Class frmMain Me.mnuDataFrameMetadata = New System.Windows.Forms.ToolStripMenuItem() Me.mnuScriptFile = New System.Windows.Forms.ToolStripMenuItem() Me.mnuLogFile = New System.Windows.Forms.ToolStripMenuItem() - Me.ToolStripSeparator15 = New System.Windows.Forms.ToolStripSeparator() Me.stsStrip.SuspendLayout() Me.Tool_strip.SuspendLayout() Me.mnuBar.SuspendLayout() @@ -733,7 +736,7 @@ Partial Class frmMain ' Me.mnuDescribeOneVariable.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeOneVariableVisualiseData, Me.ToolStripSeparator72, Me.mnuDescribeOneVariableSummarise, Me.mnuDescribeOneVariableGraph, Me.ToolStripSeparator33, Me.mnuDescribeOneVariableFrequencies, Me.mnuDescribeOneVariableRatingData}) Me.mnuDescribeOneVariable.Name = "mnuDescribeOneVariable" - Me.mnuDescribeOneVariable.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeOneVariable.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeOneVariable.Tag = "One_Variable" Me.mnuDescribeOneVariable.Text = "One Variable" ' @@ -786,7 +789,7 @@ Partial Class frmMain ' Me.mnuDescribeTwoThreeVariables.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeTwoThreeVariablesPivotTable, Me.ToolStripSeparator36, Me.mnuDescribeTwoVariablesSummarise, Me.mnuDescribeTwoVariablesGraph, Me.ToolStripSeparator34, Me.mnuDescribeTwoThreeVariablesCorrelations, Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies, Me.mnuDescribeTwoThreeVariablesThreeWayFrequencies}) Me.mnuDescribeTwoThreeVariables.Name = "mnuDescribeTwoThreeVariables" - Me.mnuDescribeTwoThreeVariables.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeTwoThreeVariables.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeTwoThreeVariables.Tag = "Two_Variables" Me.mnuDescribeTwoThreeVariables.Text = "Two/Three Variables" ' @@ -848,7 +851,7 @@ Partial Class frmMain ' Me.mnuDescribeSpecificTablesGraphs.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeGeneral, Me.ToolStripSeparator38, Me.mnuDescribeSpecificBarPieChart, Me.mnuDescribeSpecificBoxplotJitterViolinPlot, Me.mnuDescribeSpecificHistogramDensityFrequencyPlot, Me.mnuDescribeSpecificPointPlot, Me.mnuDescribeSpecificLineSmoothPlot, Me.ToolStripSeparator26, Me.mnuDescribeSpecificMapPlot, Me.mnuDescribeSpecificDotPlot, Me.mnuDescribeSpecificMosaic, Me.mnuDescribeSpecificCummulativeDistribution, Me.mnuDescribeSpecificParallelCoordinatePlot}) Me.mnuDescribeSpecificTablesGraphs.Name = "mnuDescribeSpecificTablesGraphs" - Me.mnuDescribeSpecificTablesGraphs.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeSpecificTablesGraphs.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeSpecificTablesGraphs.Tag = "Graph_Dialogs" Me.mnuDescribeSpecificTablesGraphs.Text = "Graphs" ' @@ -946,22 +949,35 @@ Partial Class frmMain ' 'mnuDescribeSpecificTables ' + Me.mnuDescribeSpecificTables.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeSummaries, Me.mnuDescribePresentation}) Me.mnuDescribeSpecificTables.Name = "mnuDescribeSpecificTables" - Me.mnuDescribeSpecificTables.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeSpecificTables.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeSpecificTables.Tag = "Table_Dialogs" Me.mnuDescribeSpecificTables.Text = "Tables..." Me.mnuDescribeSpecificTables.ToolTipText = "Frequency tables and Summary tables" ' + 'mnuDescribeSummaries + ' + Me.mnuDescribeSummaries.Name = "mnuDescribeSummaries" + Me.mnuDescribeSummaries.Size = New System.Drawing.Size(180, 22) + Me.mnuDescribeSummaries.Text = "Summaries..." + ' + 'mnuDescribePresentation + ' + Me.mnuDescribePresentation.Name = "mnuDescribePresentation" + Me.mnuDescribePresentation.Size = New System.Drawing.Size(180, 22) + Me.mnuDescribePresentation.Text = "Presentation..." + ' 'ToolStripSeparator9 ' Me.ToolStripSeparator9.Name = "ToolStripSeparator9" - Me.ToolStripSeparator9.Size = New System.Drawing.Size(175, 6) + Me.ToolStripSeparator9.Size = New System.Drawing.Size(177, 6) ' 'mnuDescribeMultivariate ' Me.mnuDescribeMultivariate.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeMultivariateCorrelations, Me.mnuDescribeMultivariateprincipalComponents, Me.mnuDescribeMultivariateCanonicalCorrelations, Me.mnuDescribeMultivariateClusterAnalysis}) Me.mnuDescribeMultivariate.Name = "mnuDescribeMultivariate" - Me.mnuDescribeMultivariate.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeMultivariate.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeMultivariate.Text = "Multivariate" ' 'mnuDescribeMultivariateCorrelations @@ -993,38 +1009,38 @@ Partial Class frmMain 'ToolStripSeparator13 ' Me.ToolStripSeparator13.Name = "ToolStripSeparator13" - Me.ToolStripSeparator13.Size = New System.Drawing.Size(175, 6) + Me.ToolStripSeparator13.Size = New System.Drawing.Size(177, 6) ' 'mnuDescribeUseTable ' Me.mnuDescribeUseTable.Name = "mnuDescribeUseTable" - Me.mnuDescribeUseTable.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeUseTable.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeUseTable.Text = "Use Table..." ' 'mnuDescribeUseGraph ' Me.mnuDescribeUseGraph.Name = "mnuDescribeUseGraph" - Me.mnuDescribeUseGraph.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeUseGraph.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeUseGraph.Text = "Use Graph..." ' 'mnuDescribeCombineGraph ' Me.mnuDescribeCombineGraph.Name = "mnuDescribeCombineGraph" - Me.mnuDescribeCombineGraph.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeCombineGraph.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeCombineGraph.Text = "Combine Graphs..." ' 'mnuDescribeThemes ' Me.mnuDescribeThemes.Enabled = False Me.mnuDescribeThemes.Name = "mnuDescribeThemes" - Me.mnuDescribeThemes.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeThemes.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeThemes.Text = "Themes..." Me.mnuDescribeThemes.Visible = False ' 'mnuDescribeViewGraph ' Me.mnuDescribeViewGraph.Name = "mnuDescribeViewGraph" - Me.mnuDescribeViewGraph.Size = New System.Drawing.Size(178, 22) + Me.mnuDescribeViewGraph.Size = New System.Drawing.Size(180, 22) Me.mnuDescribeViewGraph.Text = "View Graph..." ' 'mnuModel @@ -1798,6 +1814,11 @@ Partial Class frmMain Me.mnuClimaticFileImportfromCliData.Text = "Import from CLIDATA..." Me.mnuClimaticFileImportfromCliData.Visible = False ' + 'ToolStripSeparator15 + ' + Me.ToolStripSeparator15.Name = "ToolStripSeparator15" + Me.ToolStripSeparator15.Size = New System.Drawing.Size(279, 6) + ' 'mnuClimaticFileExportToClimsoft ' Me.mnuClimaticFileExportToClimsoft.Name = "mnuClimaticFileExportToClimsoft" @@ -2047,7 +2068,7 @@ Partial Class frmMain ' 'mnuClimaticCheckData ' - Me.mnuClimaticCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticCheckDataInventory, Me.mnuClimaticCheckDataDisplayDaily, Me.ToolStripSeparator65, Me.mnuClimaticCheckDataFillMissingValues, Me.mnuClimaticCheckDataBoxplot, Me.mnuClimaticCheckDataQCTemperatures, Me.mnuClimaticCheckDataQCRainfall, Me.ToolStripSeparator70, Me.mnuClimaticCheckDataHomogenization, Me.mnuClimaticCheckDataCheckStationLocations}) + Me.mnuClimaticCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticCheckDataInventory, Me.mnuClimaticCheckDataDisplayDaily, Me.ToolStripSeparator65, Me.mnuClimaticCheckDataFillMissingValues, Me.mnuClimaticCheckDataBoxplot, Me.mnuClimaticCheckDataQCTemperatures, Me.mnuClimaticCheckDataQCRainfall, Me.ToolStripSeparator70, Me.mnuClimaticCheckDataHomogenization, Me.mnuClimaticCheckDataCheckStationLocations, Me.mnuClimaticCheckDataDistances}) Me.mnuClimaticCheckData.Name = "mnuClimaticCheckData" Me.mnuClimaticCheckData.Size = New System.Drawing.Size(212, 22) Me.mnuClimaticCheckData.Text = "Check Data" @@ -2110,6 +2131,13 @@ Partial Class frmMain Me.mnuClimaticCheckDataCheckStationLocations.Size = New System.Drawing.Size(210, 22) Me.mnuClimaticCheckDataCheckStationLocations.Text = "Check Station Locations..." ' + 'mnuClimaticCheckDataDistances + ' + Me.mnuClimaticCheckDataDistances.Enabled = False + Me.mnuClimaticCheckDataDistances.Name = "mnuClimaticCheckDataDistances" + Me.mnuClimaticCheckDataDistances.Size = New System.Drawing.Size(210, 22) + Me.mnuClimaticCheckDataDistances.Text = "Distances..." + ' 'mnuClimaticPrepare ' Me.mnuClimaticPrepare.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuCimaticPrepareTransform, Me.mnuClimaticPrepareConversions, Me.ToolStripSeparator37, Me.mnuClimaticPrepareClimaticSummaries, Me.mnuClimaticPrepareStartoftheRains, Me.mnuClimaticPrepareEndOfRains, Me.mnuClimaticPrepareLengthOfSeason, Me.mnuClimaticPrepareSpells, Me.mnuClimaticPrepareExtremes, Me.ToolStripSeparator64, Me.mnuClimaticPrepareClimdex, Me.ToolStripSeparator51, Me.mnuClimaticPrepareEvapotranspiration, Me.mnuClimaticPrepareSummary, Me.mnuClimaticPrepareNewWorksheet, Me.mnuClimaticPrepareImportDailyData, Me.mnuClimaticPrepareMakeFactor, Me.mnuClimaticPrepareShiftDailyData, Me.mnuClimaticPrepareUnstackDailyData, Me.mnuClimaticPrepareStackDailyData}) @@ -5221,11 +5249,6 @@ Partial Class frmMain Me.mnuLogFile.Text = "Log Window..." Me.mnuLogFile.ToolTipText = "Log Window" ' - 'ToolStripSeparator15 - ' - Me.ToolStripSeparator15.Name = "ToolStripSeparator15" - Me.ToolStripSeparator15.Size = New System.Drawing.Size(279, 6) - ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -5239,7 +5262,7 @@ Partial Class frmMain Me.IsMdiContainer = True Me.MainMenuStrip = Me.mnuBar Me.Name = "frmMain" - Me.Text = "R-Instat " + My.Application.Info.Version.Major.ToString + "." + My.Application.Info.Version.Minor.ToString + "." + My.Application.Info.Version.Build.ToString + Me.Text = "R-Instat .." Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.stsStrip.ResumeLayout(False) Me.stsStrip.PerformLayout() @@ -5925,6 +5948,10 @@ Partial Class frmMain Friend WithEvents mnuClimaticFileExportToGoogleBucketsToolStrip As ToolStripMenuItem Friend WithEvents ToolStripSeparator79 As ToolStripSeparator + + Friend WithEvents mnuDescribeSummaries As ToolStripMenuItem + Friend WithEvents mnuDescribePresentation As ToolStripMenuItem + Friend WithEvents MenusAndDialogsToolStripMenuItem As ToolStripMenuItem Friend WithEvents FileToolStripMenuItem As ToolStripMenuItem Friend WithEvents EditToolStripMenuItem As ToolStripMenuItem @@ -5945,4 +5972,5 @@ Partial Class frmMain Friend WithEvents RInstatResourcesSiteToolStripMenuItem As ToolStripMenuItem Friend WithEvents mnuImportFromOpenAppBuilder As ToolStripMenuItem Friend WithEvents ToolStripSeparator15 As ToolStripSeparator + Friend WithEvents mnuClimaticCheckDataDistances As ToolStripMenuItem End Class diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 74fa9309f21..aab37fc42f3 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -222,6 +222,10 @@ Public Class frmMain AddHandler System.Windows.Forms.Application.Idle, AddressOf Application_Idle '--------------------------------------- + '-------------------------------------- + CreateAdditionalLibraryDirectory() + '------------------------------------- + isMaximised = True 'Need to get the windowstate when the application is loaded End Sub @@ -393,6 +397,35 @@ Public Class frmMain End If End Function + Private Sub CreateAdditionalLibraryDirectory() + ' Define the custom library path in the ApplicationData folder + Dim strLibraryPath As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "R-Instat", "library") + + Try + ' Check if the directory exists, if not, create it + If Not Directory.Exists(strLibraryPath) Then + Directory.CreateDirectory(strLibraryPath) + End If + + 'To ensure this part of the code only runs when the application Is Not in the Debug mode (i.e., in Release mode) +#If Not DEBUG Then + ' Add the custom library path to R's .libPaths for user-level package installation + Dim strScript As String = $".libPaths(c('{strLibraryPath.Replace("\", "/")}', .libPaths()))" & Environment.NewLine & + "if (length(.libPaths()) > 2) { + current_paths <- .libPaths() + valid_indices <- c(1, 3)[c(1, 3) <= length(current_paths)] + .libPaths(current_paths[valid_indices]) + }" + + ' Execute the R script to update the library paths + clsRLink.RunScript(strScript:=strScript, bSeparateThread:=False, bSilent:=False) +#End If + Catch ex As Exception + ' Handle potential errors (e.g., directory creation failure) + MessageBox.Show($"Failed to create or update library directory: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + Private Sub ExecuteSetupRScriptsAndSetupRLinkAndDatabook() Dim strRScripts As String = "" Dim strDataFilePath As String = "" @@ -651,10 +684,6 @@ Public Class frmMain dlgRegularSequence.ShowDialog() End Sub - Private Sub mnuDescribeSpecificTables_Click(sender As Object, e As EventArgs) Handles mnuDescribeSpecificTables.Click - dlgSummaryTables.ShowDialog() - End Sub - Private Sub mnuPrepareReshapeStack_Click(sender As Object, e As EventArgs) Handles mnuPrepareColumnReshapeStack.Click dlgStack.enumStackMode = dlgStack.StackMode.Prepare dlgStack.ShowDialog() @@ -2776,6 +2805,13 @@ Public Class frmMain dlgExportClimaticDefinitions.ShowDialog() End Sub + Private Sub mnuDescribeSummaries_Click(sender As Object, e As EventArgs) Handles mnuDescribeSummaries.Click + dlgSummaryTables.ShowDialog() + End Sub + + Private Sub mnuDescribePresentation_Click(sender As Object, e As EventArgs) Handles mnuDescribePresentation.Click + dlgGeneralTable.ShowDialog() + End Sub Private Sub FileToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FileToolStripMenuItem.Click Help.ShowHelp(Me, strStaticPath & "\" & strHelpFilePath, HelpNavigator.TopicId, "13") End Sub @@ -2845,4 +2881,8 @@ Public Class frmMain Private Sub mnuImportFromOpenAppBuilder_Click(sender As Object, e As EventArgs) Handles mnuImportFromOpenAppBuilder.Click dlgImportOpenAppBuilder.ShowDialog() End Sub + + Private Sub mnuClimaticCheckDataDistances_Click(sender As Object, e As EventArgs) Handles mnuClimaticCheckDataDistances.Click + dlgDistances.ShowDialog() + End Sub End Class diff --git a/instat/instat.vbproj b/instat/instat.vbproj index 1b2d4bf4295..02ca60eef9b 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -239,6 +239,12 @@ Form + + dlgDistances.vb + + + Form + dlgEdit.vb @@ -379,6 +385,97 @@ Form + + ucrCellsFootNotes.vb + + + UserControl + + + sdgCellFormatDateOptions.vb + + + Form + + + sdgCellFormatNumberOptions.vb + + + Form + + + sdgCellFormatTextOptions.vb + + + Form + + + ucrCellFormatEmail.vb + + + UserControl + + + ucrCellFormats.vb + + + UserControl + + + ucrCellStyles.vb + + + UserControl + + + + ucrColumnFootNote.vb + + + UserControl + + + ucrColumnNanoPlots.vb + + + UserControl + + + ucrColumnStyles.vb + + + UserControl + + + ucrColumnWidth.vb + + + UserControl + + + dlgGeneralTable.vb + + + Form + + + ucrOtherStyles.vb + + + UserControl + + + ucrRowExpression.vb + + + UserControl + + + sdgTableOptions.vb + + + Form + frmMaximiseOutput.vb @@ -3049,6 +3146,90 @@ UserControl + + ucrCells.vb + + + UserControl + + + ucrColumnLabels.vb + + + UserControl + + + ucrColumns.vb + + + UserControl + + + ucrColumnSpanners.vb + + + UserControl + + + ucrHeader.vb + + + UserControl + + + ucrRowGroup.vb + + + UserControl + + + ucrRows.vb + + + UserControl + + + ucrRowSummary.vb + + + UserControl + + + sdgTableRowExpression.vb + + + Form + + + sdgTableStyles.vb + + + Form + + + ucrSourceNotes.vb + + + UserControl + + + ucrStub.vb + + + UserControl + + + ucrStubOptions.vb + + + UserControl + + + ucrStubStyle.vb + + + UserControl + @@ -3116,6 +3297,9 @@ dlgDisplayTopN.vb Designer + + dlgDistances.vb + dlgEdit.vb @@ -3251,6 +3435,51 @@ sdgSummaryThemes.vb + + ucrCellsFootNotes.vb + + + sdgCellFormatDateOptions.vb + + + sdgCellFormatNumberOptions.vb + + + sdgCellFormatTextOptions.vb + + + ucrCellFormatEmail.vb + + + ucrCellFormats.vb + + + ucrCellStyles.vb + + + ucrColumnFootNote.vb + + + ucrColumnNanoPlots.vb + + + ucrColumnStyles.vb + + + ucrColumnWidth.vb + + + dlgGeneralTable.vb + + + ucrOtherStyles.vb + + + ucrRowExpression.vb + + + sdgTableOptions.vb + frmMaximiseOutput.vb Designer @@ -5352,6 +5581,48 @@ ucrOutputPages.vb + + ucrCells.vb + + + ucrColumnLabels.vb + + + ucrColumns.vb + + + ucrColumnSpanners.vb + + + ucrHeader.vb + + + ucrRowGroup.vb + + + ucrRows.vb + + + ucrRowSummary.vb + + + sdgTableRowExpression.vb + + + sdgTableStyles.vb + + + ucrSourceNotes.vb + + + ucrStub.vb + + + ucrStubOptions.vb + + + ucrStubStyle.vb + diff --git a/instat/static/InstatObject/R/Backend_Components/summary_functions.R b/instat/static/InstatObject/R/Backend_Components/summary_functions.R index 4e647613ff9..92e81c7bdc4 100644 --- a/instat/static/InstatObject/R/Backend_Components/summary_functions.R +++ b/instat/static/InstatObject/R/Backend_Components/summary_functions.R @@ -4,43 +4,63 @@ DataSheet$set("public", "merge_data", function(new_data, by = NULL, type = "left old_metadata <- attributes(private$data) curr_data <- self$get_data_frame(use_current_filter = FALSE) by_col_attributes <- list() + if(!is.null(by)) { for(i in seq_along(by)) { - # TODO also check that !is.null(names(by)) ? - by_col_attributes[[names(by)[[i]]]] <- get_column_attributes(curr_data[[names(by)[[i]]]]) + # Collect column attributes + by_col_attributes[[by[[i]]]] <- get_column_attributes(curr_data[[by[[i]]]]) + + # Check and align the data types for each "by" column + if (class(curr_data[[by[[i]]]]) != class(new_data[[by[[i]]]])) { + warning(paste0("Type is different for ", by[[i]], " in the two data frames. Setting as numeric in both data frames.")) + + # Convert factors to numeric if necessary + if (class(curr_data[[by[[i]]]]) == "factor") { + curr_data[[by[[i]]]] <- as.numeric(as.character(curr_data[[by[[i]]]])) + } else if (class(new_data[[by[[i]]]]) == "factor") { + new_data[[by[[i]]]] <- as.numeric(as.character(new_data[[by[[i]]]])) + } else { + stop(paste0("Type is different for ", by[[i]], " in the two data frames and cannot be coerced.")) + } + } } } - if(type == "left") { - new_data <- dplyr::left_join(curr_data, new_data, by) - } - else if(type == "right") { - new_data <- dplyr::right_join(curr_data, new_data, by) - } - else if(type == "full") { - new_data <- dplyr::full_join(curr_data, new_data, by) - } - else if(type == "inner") { - new_data <- dplyr::inner_join(curr_data, new_data, by) + + # Perform the appropriate join based on the "type" argument + if (type == "left") { + new_data <- dplyr::left_join(curr_data, new_data, by = by) + } else if (type == "right") { + new_data <- dplyr::right_join(curr_data, new_data, by = by) + } else if (type == "full") { + new_data <- dplyr::full_join(curr_data, new_data, by = by) + } else if (type == "inner") { + new_data <- dplyr::inner_join(curr_data, new_data, by = by) + } else { + stop("type must be one of left, right, inner, or full") } - else stop("type must be one of left, right, inner or full") + + # Update the data in the object self$set_data(new_data) - self$append_to_changes(Merged_data) - #TODO will column/row count be correct here? - for(name in names(old_metadata)) { - if(!name %in% c("names", "class", "row.names")) { + self$append_to_changes("Merged_data") + + # Restore the old metadata + for (name in names(old_metadata)) { + if (!name %in% c("names", "class", "row.names")) { self$append_to_metadata(name, old_metadata[[name]]) } } - self$append_to_metadata(is_calculated_label, TRUE) + + self$append_to_metadata("is_calculated_label", TRUE) self$add_defaults_meta() self$add_defaults_variables_metadata(setdiff(names(new_data), names(curr_data))) - if(!is.null(by)) { - for(i in seq_along(by_col_attributes)) { - self$append_column_attributes(col_name = names(by_col_attributes)[i], new_attr = by_col_attributes[[i]]) + + # Add back column attributes for the "by" columns + if (!is.null(by)) { + for (i in seq_along(by_col_attributes)) { + self$append_column_attributes(col_name = by[[i]], new_attr = by_col_attributes[[i]]) } } -} -) +}) DataBook$set("public", "append_summaries_to_data_object", function(out, data_name, columns_to_summarise, summaries, factors = c(), summary_name, calc, calc_name = "") { if(!is.character(data_name)) stop("data_name must be of type character") diff --git a/instat/static/InstatObject/R/InstallPackages.R b/instat/static/InstatObject/R/InstallPackages.R index 8a88a8bd9f3..6b8ccf7f91c 100644 --- a/instat/static/InstatObject/R/InstallPackages.R +++ b/instat/static/InstatObject/R/InstallPackages.R @@ -156,13 +156,6 @@ packs <- c("abind", "agricolae", "agridat", install.packages(packs, dependencies = FALSE, repos='https://cloud.r-project.org', type="win.binary") -# Define the custom package library path (in AppData, no admin rights needed) -app_data_lib <- file.path(Sys.getenv("APPDATA"), "R-Instat", "library") -dir.create(app_data_lib, recursive = TRUE, showWarnings = FALSE) - -# Add the custom library path to .libPaths() for installing user-level packages -.libPaths(c(app_data_lib, .libPaths())) - # Only use internal library if (length(.libPaths()) >= 2){ current_paths <- .libPaths() diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index c3d38d9ee99..0634d1aabb4 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -2200,20 +2200,8 @@ DataBook$set("public", "crops_definitions", function(data_name, year, station, r year_col <- self$get_columns_from_data(data_name, year) unique_year <- na.omit(unique(year_col)) - expand_list <- list() - names_list <- c() - - expand_list[[length(expand_list) + 1]] <- rain_totals - names_list[length(names_list) + 1] <- rain_total_name - - expand_list[[length(expand_list) + 1]] <- plant_lengths - names_list[length(names_list) + 1] <- plant_length_name - - expand_list[[length(expand_list) + 1]] <- plant_days - names_list[length(names_list) + 1] <- plant_day_name - - expand_list[[length(expand_list) + 1]] <- unique_year - names_list[length(names_list) + 1] <- year + expand_list <- list(rain_totals, plant_lengths, plant_days, unique_year) + names_list <- c(rain_total_name, plant_length_name, plant_day_name, year) if(is_station) { station_col <- self$get_columns_from_data(data_name, station) @@ -2221,8 +2209,10 @@ DataBook$set("public", "crops_definitions", function(data_name, year, station, r expand_list[[length(expand_list) + 1]] <- unique_station names_list[length(names_list) + 1] <- station } + df <- setNames(expand.grid(expand_list), names_list) daily_data <- self$get_data_frame(data_name) + if(season_data_name != data_name) { join_by <- by names(join_by) <- season_by @@ -2242,7 +2232,7 @@ DataBook$set("public", "crops_definitions", function(data_name, year, station, r } # Plant day condition - if(start_check) { + if(start_check %in% c("yes", "both")) { df$plant_day_cond <- (df[[start_day]] <= df[[plant_day_name]]) } @@ -2250,34 +2240,57 @@ DataBook$set("public", "crops_definitions", function(data_name, year, station, r df$length_cond <- (df[[plant_day_name]] + df[[plant_length_name]] <= df[[end_day]]) # Rain total condition - df[["rain_total_actual"]] <- sapply(1:nrow(df), - function(x) { - ind <- daily_data[[year]] == df[[year]][x] & daily_data[[day]] >= df[[plant_day_name]][x] & - daily_data[[day]] < (df[[plant_day_name]][x] + df[[plant_length_name]][x]) - if(is_station) ind <- ind & (daily_data[[station]] == df[[station]][x]) - rain_values <- daily_data[[rain]][ind] - sum_rain <- sum(rain_values, na.rm = TRUE) - # TODO + 1 is needed because of non leap years - # if period include 29 Feb then period is 1 less than required length - if(length(rain_values) + 1 < df[[plant_length_name]][x] || (anyNA(rain_values) && sum_rain < df[[rain_total_name]][x])) sum_rain <- NA - sum_rain - } - ) + # Create a column for the rain total actuals initialised with NA + df[["rain_total_actual"]] <- NA + + # Vectorise the conditions for each + for (i in 1:nrow(df)) { + # Create a condition to filter the daily data based on the year, day, and plant day/length + ind <- daily_data[[year]] == df[[year]][i] & + daily_data[[day]] >= df[[plant_day_name]][i] & + daily_data[[day]] < (df[[plant_day_name]][i] + df[[plant_length_name]][i]) + + if (is_station) { + ind <- ind & (daily_data[[station]] == df[[station]][i]) + } + + # Filter the daily data based on the condition + rain_values <- daily_data[[rain]][ind] + + # Calculate the sum of rain values and check conditions + sum_rain <- sum(rain_values, na.rm = TRUE) + + if (length(rain_values) + 1 < df[[plant_length_name]][i] || (anyNA(rain_values) && sum_rain < df[[rain_total_name]][i])) { + sum_rain <- NA + } + + # Assign the calculated sum to the respective row in the result dataframe + df[["rain_total_actual"]][i] <- sum_rain + } df$rain_cond <- df[[rain_total_name]] <= df[["rain_total_actual"]] # All three conditions met - df$overall_cond <- ((if(start_check) df$plant_day_cond else TRUE) & df$length_cond & df$rain_cond) + if (start_check == "yes"){ + df$overall_cond <- df$plant_day_cond & df$length_cond & df$rain_cond + } else if (start_check == "no"){ + df$overall_cond <- TRUE & df$length_cond & df$rain_cond + } else { + df$overall_cond_with_start <- df$plant_day_cond & df$length_cond & df$rain_cond + df$overall_cond_no_start <- TRUE & df$length_cond & df$rain_cond + } crops_name <- "crop_def" crops_name <- next_default_item(prefix = crops_name, existing_names = self$get_data_names(), include_index = FALSE) data_tables <- list(df) names(data_tables) <- crops_name self$import_data(data_tables = data_tables) + if(season_data_name != data_name) { crops_by <- season_by names(crops_by) <- by self$add_link(crops_name, season_data_name, crops_by, keyed_link_label) } + if(definition_props) { calc_from <- list() if(!missing(station)) calc_from[[length(calc_from) + 1]] <- station @@ -2286,24 +2299,65 @@ DataBook$set("public", "crops_definitions", function(data_name, year, station, r calc_from[[length(calc_from) + 1]] <- rain_total_name names(calc_from) <- rep(crops_name, length(calc_from)) grouping <- instat_calculation$new(type = "by", calculated_from = calc_from) - prop_calc_from <- list("overall_cond") - names(prop_calc_from) <- crops_name - propor_table <- instat_calculation$new(function_exp="sum(overall_cond, na.rm = TRUE)/length(na.omit(overall_cond))", - save = 2, calculated_from = prop_calc_from, - manipulations = list(grouping), - type="summary", result_name = "prop_success", result_data_frame = "crop_prop") - prop_data_frame <- self$run_instat_calculation(propor_table, display = TRUE) - if(print_table) { - prop_data_frame$prop_success <- round(prop_data_frame$prop_success, 2) - prop_table_unstacked <- reshape2::dcast(formula = as.formula(paste(if(!missing(station)) paste(station, "+"), plant_length_name, "+", rain_total_name, "~", plant_day_name)), data = prop_data_frame, value.var = "prop_success") - if(!missing(station)) f <- interaction(prop_table_unstacked[[station]], prop_table_unstacked[[plant_length_name]], lex.order = TRUE) - else f <- prop_table_unstacked[[plant_length_name]] - prop_table_split <- split(prop_table_unstacked, f) - return(prop_table_split) + + if (start_check %in% c("yes", "no")){ + prop_calc_from <- list("overall_cond") + names(prop_calc_from) <- crops_name + propor_table <- instat_calculation$new(function_exp="sum(overall_cond, na.rm = TRUE)/length(na.omit(overall_cond))", + save = 2, calculated_from = prop_calc_from, + manipulations = list(grouping), + type="summary", result_name = "prop_success", result_data_frame = "crop_prop") + prop_data_frame <- self$run_instat_calculation(propor_table, display = TRUE) + if(print_table) { + prop_data_frame$prop_success <- round(prop_data_frame$prop_success, 2) + prop_table_unstacked <- reshape2::dcast(formula = as.formula(paste(if(!missing(station)) paste(station, "+"), plant_length_name, "+", rain_total_name, "~", plant_day_name)), data = prop_data_frame, value.var = "prop_success") + if(!missing(station)) f <- interaction(prop_table_unstacked[[station]], prop_table_unstacked[[plant_length_name]], lex.order = TRUE) + else f <- prop_table_unstacked[[plant_length_name]] + prop_table_split <- split(prop_table_unstacked, f) + return(prop_table_split) + } + } else { + prop_calc_from_with_start <- list("overall_cond_with_start") + names(prop_calc_from_with_start) <- crops_name + propor_table_with_start <- instat_calculation$new(function_exp="sum(overall_cond_with_start, na.rm = TRUE)/length(na.omit(overall_cond_with_start))", + save = 2, calculated_from = prop_calc_from_with_start, + manipulations = list(grouping), + type="summary", result_name = "prop_success", result_data_frame = "crop_prop_with_start") + prop_data_frame_with_start <- self$run_instat_calculation(propor_table_with_start, display = TRUE) + + prop_calc_from_no_start <- list("overall_cond_no_start") + names(prop_calc_from_no_start) <- crops_name + propor_table_no_start <- instat_calculation$new(function_exp="sum(overall_cond_no_start, na.rm = TRUE)/length(na.omit(overall_cond_no_start))", + save = 2, calculated_from = prop_calc_from_no_start, + manipulations = list(grouping), + type="summary", result_name = "prop_success", result_data_frame = "crop_prop_no_start") + prop_data_frame_no_start <- self$run_instat_calculation(propor_table_no_start, display = TRUE) + + if(print_table) { + prop_data_frame_with_start$prop_success <- round(prop_data_frame_with_start$prop_success, 2) + prop_table_unstacked_with_start <- reshape2::dcast(formula = as.formula(paste(if(!missing(station)) paste(station, "+"), plant_length_name, "+", rain_total_name, "~", plant_day_name)), data = prop_data_frame_with_start, value.var = "prop_success") + if(!missing(station)) f <- interaction(prop_table_unstacked_with_start[[station]], prop_table_unstacked_with_start[[plant_length_name]], lex.order = TRUE) + else f <- prop_table_unstacked_with_start[[plant_length_name]] + prop_table_split_with_start <- split(prop_table_unstacked_with_start, f) + + prop_data_frame_no_start$prop_success <- round(prop_data_frame_no_start$prop_success, 2) + prop_table_unstacked_no_start <- reshape2::dcast(formula = as.formula(paste(if(!missing(station)) paste(station, "+"), plant_length_name, "+", rain_total_name, "~", plant_day_name)), data = prop_data_frame_no_start, value.var = "prop_success") + if(!missing(station)) f <- interaction(prop_table_unstacked_no_start[[station]], prop_table_unstacked_no_start[[plant_length_name]], lex.order = TRUE) + else f <- prop_table_unstacked_no_start[[plant_length_name]] + prop_table_split_no_start <- split(prop_table_unstacked_no_start, f) + + # Create an empty list to store the merged data + merged_list <- list() + + # Vectorize the addition of source indicators and merging of data frames + prop_table_split_with_start <- lapply(prop_table_split_with_start, function(df) { + df$source <- 'with start' + return(df) + }) + } } } -} -) +}) #' Converting grid (wide) format daily climatic data into tidy (long format) data #' @param x Input data frame diff --git a/instat/ucrColors.vb b/instat/ucrColors.vb index faa479b290f..fe3ddac174d 100644 --- a/instat/ucrColors.vb +++ b/instat/ucrColors.vb @@ -27,7 +27,7 @@ Public Class ucrColors ' Add any initialization after the InitializeComponent() call. If dctColours.Count = 0 Then - dctColours.Add("NULL", "NULL") + dctColours.Add("None", "NULL") dctColours.Add(strPickColour, strPickColour) dctColours.Add("Black", Chr(34) & "black" & Chr(34)) dctColours.Add("White", Chr(34) & "white" & Chr(34))