From 49b5956884599ceb20223fcf3d011342581c11df Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Tue, 9 Jul 2024 12:35:37 +0300 Subject: [PATCH 1/9] changes to the code --- instat/dlgInventoryPlot.vb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index a750178ff13..ae185319dcd 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -317,7 +317,6 @@ Public Class dlgInventoryPlot SetDefaults() SetRCodeForControls(True) TestOkEnabled() - End Sub Private Sub ucrPnlOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOptions.ControlValueChanged @@ -335,6 +334,7 @@ Public Class dlgInventoryPlot clsInventoryPlot.iCallType = 3 clsInventoryPlot.bExcludeAssignedFunctionOutput = False End If + AddClimateMissingFunction() End Sub Private Sub AddOrRemoveKeyFunctions() @@ -347,13 +347,21 @@ Public Class dlgInventoryPlot End If End Sub - Private Sub ucrChkSummary_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSummary.ControlValueChanged - If ucrChkSummary.Checked Then - ucrBase.clsRsyntax.AddToAfterCodes(clsClimaticMissing, iPosition:=1) - clsClimaticMissing.iCallType = 2 + Private Sub AddClimateMissingFunction() + If rdoMissing.Checked Then + If ucrChkSummary.Checked Then + ucrBase.clsRsyntax.AddToAfterCodes(clsClimaticMissing, iPosition:=1) + clsClimaticMissing.iCallType = 2 + Else + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsClimaticMissing) + End If Else ucrBase.clsRsyntax.RemoveFromAfterCodes(clsClimaticMissing) - End If + End If + End Sub + + Private Sub ucrChkSummary_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSummary.ControlValueChanged, ucrChkOmitEnd.ControlValueChanged, ucrChkOmitStart.ControlValueChanged + AddClimateMissingFunction() AddOrRemoveKeyFunctions() End Sub From e47119c3da7cabd83d033cbd5b89c623dc6c8c63 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Tue, 9 Jul 2024 15:24:38 +0300 Subject: [PATCH 2/9] changes --- instat/dlgInventoryPlot.vb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index ae185319dcd..a9505fc0dc9 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -348,13 +348,9 @@ Public Class dlgInventoryPlot End Sub Private Sub AddClimateMissingFunction() - If rdoMissing.Checked Then - If ucrChkSummary.Checked Then - ucrBase.clsRsyntax.AddToAfterCodes(clsClimaticMissing, iPosition:=1) - clsClimaticMissing.iCallType = 2 - Else - ucrBase.clsRsyntax.RemoveFromAfterCodes(clsClimaticMissing) - End If + If rdoMissing.Checked AndAlso ucrChkSummary.Checked Then + ucrBase.clsRsyntax.AddToAfterCodes(clsClimaticMissing, iPosition:=1) + clsClimaticMissing.iCallType = 2 Else ucrBase.clsRsyntax.RemoveFromAfterCodes(clsClimaticMissing) End If From 0b775335613a80645f193b752dd5fb0ecad653be Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Mon, 15 Jul 2024 19:55:33 +0200 Subject: [PATCH 3/9] Additional feature in the Find dialog --- instat/dlgFindInVariableOrFilter.Designer.vb | 33 +++++++++++++------ instat/dlgFindInVariableOrFilter.vb | 8 ++++- .../InstatObject/R/stand_alone_functions.R | 19 ++++++++--- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/instat/dlgFindInVariableOrFilter.Designer.vb b/instat/dlgFindInVariableOrFilter.Designer.vb index 5417a14424f..ccb4f07ef7f 100644 --- a/instat/dlgFindInVariableOrFilter.Designer.vb +++ b/instat/dlgFindInVariableOrFilter.Designer.vb @@ -28,7 +28,6 @@ Partial Class dlgFindInVariableOrFilter Me.grpSelect = New System.Windows.Forms.GroupBox() Me.rdoRow = New System.Windows.Forms.RadioButton() Me.rdoCell = New System.Windows.Forms.RadioButton() - Me.ucrPnlSelect = New instat.UcrPanel() Me.lblLabel = New System.Windows.Forms.Label() Me.rdoVariable = New System.Windows.Forms.RadioButton() Me.rdoInFilter = New System.Windows.Forms.RadioButton() @@ -44,10 +43,12 @@ Partial Class dlgFindInVariableOrFilter Me.ucrBase = New instat.ucrButtons() Me.ucrChkIncludeRegularExpressions = New instat.ucrCheck() Me.ucrChkIgnoreCase = New instat.ucrCheck() + Me.ucrPnlSelect = New instat.UcrPanel() Me.ucrPnlOptions = New instat.UcrPanel() Me.ucrSelectorFind = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverVariable = New instat.ucrReceiverSingle() Me.ucrInputPattern = New instat.ucrInputComboBox() + Me.ucrWholeValue = New instat.ucrCheck() Me.grpSelect.SuspendLayout() Me.SuspendLayout() ' @@ -108,15 +109,6 @@ Partial Class dlgFindInVariableOrFilter Me.rdoCell.Text = "Cell" Me.rdoCell.UseVisualStyleBackColor = True ' - 'ucrPnlSelect - ' - Me.ucrPnlSelect.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlSelect.Location = New System.Drawing.Point(6, 13) - Me.ucrPnlSelect.Margin = New System.Windows.Forms.Padding(4) - Me.ucrPnlSelect.Name = "ucrPnlSelect" - Me.ucrPnlSelect.Size = New System.Drawing.Size(121, 31) - Me.ucrPnlSelect.TabIndex = 0 - ' 'lblLabel ' Me.lblLabel.AutoSize = True @@ -276,6 +268,15 @@ Partial Class dlgFindInVariableOrFilter Me.ucrChkIgnoreCase.Size = New System.Drawing.Size(131, 23) Me.ucrChkIgnoreCase.TabIndex = 66 ' + 'ucrPnlSelect + ' + Me.ucrPnlSelect.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlSelect.Location = New System.Drawing.Point(6, 13) + Me.ucrPnlSelect.Margin = New System.Windows.Forms.Padding(4) + Me.ucrPnlSelect.Name = "ucrPnlSelect" + Me.ucrPnlSelect.Size = New System.Drawing.Size(121, 31) + Me.ucrPnlSelect.TabIndex = 0 + ' 'ucrPnlOptions ' Me.ucrPnlOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink @@ -322,12 +323,23 @@ Partial Class dlgFindInVariableOrFilter Me.ucrInputPattern.Size = New System.Drawing.Size(127, 21) Me.ucrInputPattern.TabIndex = 65 ' + 'ucrWholeValue + ' + Me.ucrWholeValue.AutoSize = True + Me.ucrWholeValue.Checked = False + Me.ucrWholeValue.Location = New System.Drawing.Point(139, 230) + Me.ucrWholeValue.Margin = New System.Windows.Forms.Padding(4) + Me.ucrWholeValue.Name = "ucrWholeValue" + Me.ucrWholeValue.Size = New System.Drawing.Size(131, 23) + Me.ucrWholeValue.TabIndex = 76 + ' 'dlgFindInVariableOrFilter ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(417, 350) + Me.Controls.Add(Me.ucrWholeValue) Me.Controls.Add(Me.lblLabel) Me.Controls.Add(Me.lblName) Me.Controls.Add(Me.lblVariableFound) @@ -387,4 +399,5 @@ Partial Class dlgFindInVariableOrFilter Friend WithEvents lblVariableFound As Label Friend WithEvents cmdFindNext As Button Friend WithEvents ttLabels As ToolTip + Friend WithEvents ucrWholeValue As ucrCheck End Class diff --git a/instat/dlgFindInVariableOrFilter.vb b/instat/dlgFindInVariableOrFilter.vb index b4964cbbc12..badec084dfe 100644 --- a/instat/dlgFindInVariableOrFilter.vb +++ b/instat/dlgFindInVariableOrFilter.vb @@ -77,7 +77,11 @@ Public Class dlgFindInVariableOrFilter ucrChkIncludeRegularExpressions.SetParameter(New RParameter("use_regex", 4)) ucrChkIncludeRegularExpressions.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrPnlOptions.AddToLinkedControls({ucrInputPattern, ucrPnlSelect, ucrChkIgnoreCase, ucrChkIncludeRegularExpressions}, {rdoVariable}, bNewLinkedHideIfParameterMissing:=True) + ucrWholeValue.SetText("Whole Value") + ucrWholeValue.SetParameter(New RParameter("match_entire_cell", 5)) + ucrWholeValue.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + + ucrPnlOptions.AddToLinkedControls({ucrInputPattern, ucrPnlSelect, ucrChkIgnoreCase, ucrChkIncludeRegularExpressions, ucrWholeValue}, {rdoVariable}, bNewLinkedHideIfParameterMissing:=True) ucrInputPattern.SetLinkedDisplayControl(lblPattern) ucrPnlSelect.SetLinkedDisplayControl(grpSelect) @@ -113,6 +117,7 @@ Public Class dlgFindInVariableOrFilter clsGetRowHeadersFunction.AddParameter("data", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0) clsGetRowHeadersFunction.AddParameter("ignore_case", "TRUE", iPosition:=3) clsGetRowHeadersFunction.AddParameter("use_regex", "FALSE", iPosition:=4) + clsGetRowHeadersFunction.AddParameter("match_entire_cell", "TRUE", iPosition:=5) ucrReceiverVariable.SetMeAsReceiver() cmdFindNext.Enabled = False @@ -126,6 +131,7 @@ Public Class dlgFindInVariableOrFilter ucrSelectorFind.SetRCode(clsGetDataFrameFunction, bReset) ucrReceiverVariable.SetRCode(clsGetRowHeadersFunction, bReset) ucrChkIgnoreCase.SetRCode(clsGetRowHeadersFunction, bReset) + ucrWholeValue.SetRCode(clsGetRowHeadersFunction, bReset) ucrChkIncludeRegularExpressions.SetRCode(clsGetRowHeadersFunction, bReset) ucrPnlOptions.SetRCode(clsDummyFunction, bReset) ucrPnlSelect.SetRCode(clsDummyFunction, bReset) diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index 83c7eaa8091..79b7472c29f 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2977,14 +2977,23 @@ cumulative_inventory <- function(data, station = NULL, from, to){ return(data) } -getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_regex) { - if(use_regex){ +getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_regex, match_entire_cell) { + if (use_regex) { + # Adjust the search text to match the entire cell if required + if (match_entire_cell) { + searchText <- paste0("^", searchText, "$") + } # Find the rows that match the search text using regex matchingRows <- stringr::str_detect(data[[column]], stringr::regex(searchText, ignore_case = ignore_case)) - }else if (is.na(searchText)){ + } else if (is.na(searchText)) { matchingRows <- apply(data[, column, drop = FALSE], 1, function(row) any(is.na(row))) - }else{ - matchingRows <- grepl(searchText, data[[column]], ignore.case = ignore_case) + } else { + # Adjust the search text to match the entire cell if required + if (match_entire_cell) { + searchText <- paste0("^", searchText, "$") + } + # Find the rows that match the search text + matchingRows <- grepl(searchText, data[[column]], ignore.case = ignore_case, perl = TRUE) } # Get the row headers where the search text is found rowHeaders <- rownames(data)[matchingRows] From a234fee68778f670735d04863df91e4d08ecdf7b Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:32:11 +0200 Subject: [PATCH 4/9] making sure ucrWhole is uncheck when the dialog is opened --- instat/dlgFindInVariableOrFilter.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgFindInVariableOrFilter.vb b/instat/dlgFindInVariableOrFilter.vb index badec084dfe..cc128859ad8 100644 --- a/instat/dlgFindInVariableOrFilter.vb +++ b/instat/dlgFindInVariableOrFilter.vb @@ -117,7 +117,7 @@ Public Class dlgFindInVariableOrFilter clsGetRowHeadersFunction.AddParameter("data", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0) clsGetRowHeadersFunction.AddParameter("ignore_case", "TRUE", iPosition:=3) clsGetRowHeadersFunction.AddParameter("use_regex", "FALSE", iPosition:=4) - clsGetRowHeadersFunction.AddParameter("match_entire_cell", "TRUE", iPosition:=5) + clsGetRowHeadersFunction.AddParameter("match_entire_cell", "FALSE", iPosition:=5) ucrReceiverVariable.SetMeAsReceiver() cmdFindNext.Enabled = False From 03ff97726cc81ac0d02028fcbf5d7f99f9c6c644 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:09:58 +0200 Subject: [PATCH 5/9] Implemented the reset buttom for the find dialogue --- instat/dlgFindInVariableOrFilter.vb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/instat/dlgFindInVariableOrFilter.vb b/instat/dlgFindInVariableOrFilter.vb index cc128859ad8..0a33c2fe132 100644 --- a/instat/dlgFindInVariableOrFilter.vb +++ b/instat/dlgFindInVariableOrFilter.vb @@ -86,7 +86,7 @@ Public Class dlgFindInVariableOrFilter ucrPnlSelect.SetLinkedDisplayControl(grpSelect) ucrBase.OKEnabled(False) - ucrBase.cmdReset.Enabled = False + ucrBase.cmdReset.Enabled = True End Sub Private Sub SetDefaults() @@ -161,6 +161,14 @@ Public Class dlgFindInVariableOrFilter End If End Function + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + ucrSelectorFind.Reset() + rdoVariable.Checked = True + rdoCell.Checked = True + ucrReceiverVariable.Clear() + ucrInputPattern.cboInput.ResetText() + End Sub + Private Sub cmdFind_Click(sender As Object, e As EventArgs) Handles cmdFind.Click Try If rdoVariable.Checked OrElse rdoInFilter.Checked Then From 0607077c83ecb34cb4525af787a2e0156e18ae7b Mon Sep 17 00:00:00 2001 From: Fidel365 <107605960+Fidel365@users.noreply.github.com> Date: Wed, 24 Jul 2024 04:22:45 +0300 Subject: [PATCH 6/9] small change to "start" items in the front menu --- instat/ucrDataView.Designer.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index 98725d1c360..7f13c91d1a8 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -842,7 +842,7 @@ Partial Class ucrDataView Me.linkStartNewDataFrame.AutoSize = True Me.linkStartNewDataFrame.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.linkStartNewDataFrame.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline - Me.linkStartNewDataFrame.Location = New System.Drawing.Point(5, 47) + Me.linkStartNewDataFrame.Location = New System.Drawing.Point(5, 30) Me.linkStartNewDataFrame.Name = "linkStartNewDataFrame" Me.linkStartNewDataFrame.Size = New System.Drawing.Size(96, 13) Me.linkStartNewDataFrame.TabIndex = 3 @@ -855,7 +855,7 @@ Partial Class ucrDataView Me.linkStartOpenFile.AutoSize = True Me.linkStartOpenFile.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.linkStartOpenFile.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline - Me.linkStartOpenFile.Location = New System.Drawing.Point(5, 30) + Me.linkStartOpenFile.Location = New System.Drawing.Point(5, 47) Me.linkStartOpenFile.Name = "linkStartOpenFile" Me.linkStartOpenFile.Size = New System.Drawing.Size(90, 13) Me.linkStartOpenFile.TabIndex = 4 From c4cc36ff1e18bed91120a14a04e613cd21d36bb8 Mon Sep 17 00:00:00 2001 From: Fidel365 <107605960+Fidel365@users.noreply.github.com> Date: Wed, 24 Jul 2024 04:45:26 +0300 Subject: [PATCH 7/9] location --- instat/ucrDataView.Designer.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index 7f13c91d1a8..9a5cc52b872 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -684,7 +684,7 @@ Partial Class ucrDataView Me.panelSectionAdvanced.Controls.Add(Me.lblAdvanced) Me.panelSectionAdvanced.Controls.Add(Me.linkStartRestoreBackup) Me.panelSectionAdvanced.Controls.Add(Me.linkStartPasteScriptfromClipboard) - Me.panelSectionAdvanced.Location = New System.Drawing.Point(27, 410) + Me.panelSectionAdvanced.Location = New System.Drawing.Point(27, 412) Me.panelSectionAdvanced.Name = "panelSectionAdvanced" Me.panelSectionAdvanced.Size = New System.Drawing.Size(374, 83) Me.panelSectionAdvanced.TabIndex = 12 From 9ff22567690f7cbb69b326459f0d0c6504354ecc Mon Sep 17 00:00:00 2001 From: Fidel365 <107605960+Fidel365@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:47:32 +0300 Subject: [PATCH 8/9] consistency --- instat/ucrDataView.Designer.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index 9a5cc52b872..f56dc22d4ec 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -758,10 +758,10 @@ Partial Class ucrDataView Me.linkHelpData.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline Me.linkHelpData.Location = New System.Drawing.Point(5, 47) Me.linkHelpData.Name = "linkHelpData" - Me.linkHelpData.Size = New System.Drawing.Size(30, 13) + Me.linkHelpData.Size = New System.Drawing.Size(39, 13) Me.linkHelpData.TabIndex = 12 Me.linkHelpData.TabStop = True - Me.linkHelpData.Text = "Data" + Me.linkHelpData.Text = "Data..." ' 'linkHelpGettingStarted ' @@ -771,10 +771,10 @@ Partial Class ucrDataView Me.linkHelpGettingStarted.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline Me.linkHelpGettingStarted.Location = New System.Drawing.Point(5, 30) Me.linkHelpGettingStarted.Name = "linkHelpGettingStarted" - Me.linkHelpGettingStarted.Size = New System.Drawing.Size(78, 13) + Me.linkHelpGettingStarted.Size = New System.Drawing.Size(87, 13) Me.linkHelpGettingStarted.TabIndex = 11 Me.linkHelpGettingStarted.TabStop = True - Me.linkHelpGettingStarted.Text = "Getting Started" + Me.linkHelpGettingStarted.Text = "Getting Started..." ' 'lblHelp ' From d10e1cfc3f13f9fdb34e86dca3899a47d043ec92 Mon Sep 17 00:00:00 2001 From: Derrick Agorhom <76208189+derekagorhom@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:07:40 +0200 Subject: [PATCH 9/9] Added the version number --- instat/frmMain.Designer.vb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 949f21f824a..6e7045ef1ea 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -5238,7 +5238,9 @@ Partial Class frmMain Me.IsMdiContainer = True Me.MainMenuStrip = Me.mnuBar Me.Name = "frmMain" - Me.Text = "R-Instat .." + Me.Text = "R-Instat " + My.Application.Info.Version.Major.ToString + "." + + My.Application.Info.Version.Minor.ToString + "." + + My.Application.Info.Version.Build.ToString Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.stsStrip.ResumeLayout(False) Me.stsStrip.PerformLayout()