Skip to content

Commit

Permalink
Merge pull request #486 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
Updated master
  • Loading branch information
conlooptechnologies authored May 21, 2024
2 parents 9ad3532 + 36408d1 commit 360e93e
Show file tree
Hide file tree
Showing 21 changed files with 3,778 additions and 143 deletions.
2 changes: 1 addition & 1 deletion instat/Model/Output/clsOutputLogger.vb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Public Class clsOutputLogger

'add the output with it's R script as another output element
outputElement.SetContent("", outputType, strOutput)
'_outputElements.Add(outputElement)
_outputElements.Add(outputElement)
'raise event for output pages
RaiseEvent NewOutputAdded(outputElement, bDisplayOutputInExternalViewer)

Expand Down
54 changes: 49 additions & 5 deletions instat/UserControl/ucrOutputPage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Imports RInsightF461
''' </summary>
Public Class ucrOutputPage
Private _checkBoxes As List(Of CheckBox)

''' <summary> lastCheckedBox used to store a reference to a CheckBox control. </summary>
Private lastCheckedBox As CheckBox = Nothing

Private _bCanReOrder As Boolean
Private _bCanRename As Boolean
Private _bCanDelete As Boolean
Expand Down Expand Up @@ -115,6 +119,15 @@ Public Class ucrOutputPage
Next
End Sub

''' <summary>
''' Selects all check boxes on the page
''' </summary>
Public Sub SelectAllCheckBoxes()
For Each checkbox In _checkBoxes
checkbox.Checked = True
Next
End Sub

''' <summary>
''' Clears all outputs on the page
''' </summary>
Expand Down Expand Up @@ -215,8 +228,6 @@ Public Class ucrOutputPage
End If
End Sub



Private Sub AddNewTextOutput(outputElement As clsOutputElement)
Dim panel As Panel = AddElementPanel(outputElement)

Expand Down Expand Up @@ -377,12 +388,11 @@ Public Class ucrOutputPage
}
panel.Controls.Add(checkBox)
_checkBoxes.Add(checkBox)
AddHandler checkBox.CheckedChanged, AddressOf CheckBox_CheckedChanged
AddHandler checkBox.Click, AddressOf checkButton_Click
AddHandler checkBox.MouseLeave, AddressOf panelContents_MouseLeave
End Sub



''' <summary>
''' Copies selected elements to clipboard
''' </summary>
Expand Down Expand Up @@ -478,7 +488,6 @@ Public Class ucrOutputPage
Next
End Sub


Private Sub SetRichTextBoxHeight(richTextBox As RichTextBox)
richTextBox.Height = (richTextBox.GetLineFromCharIndex(richTextBox.Text.Length) + 1) * (richTextBox.Font.Height + richTextBox.Margin.Vertical) + 5
End Sub
Expand All @@ -487,6 +496,41 @@ Public Class ucrOutputPage
pictureBox.Height = pictureBox.Width / (pictureBox.Image.Width / pictureBox.Image.Height)
End Sub

Private Sub CheckBox_CheckedChanged(sender As Object, e As EventArgs)
Dim currentBox As CheckBox = DirectCast(sender, CheckBox)

If lastCheckedBox IsNot Nothing AndAlso Control.ModifierKeys = Keys.Shift Then
Dim startIndex As Integer = _checkBoxes.IndexOf(lastCheckedBox)
Dim endIndex As Integer = _checkBoxes.IndexOf(currentBox)

' Toggle check state for checkboxes between startIndex and endIndex
For i As Integer = Math.Min(startIndex, endIndex) To Math.Max(startIndex, endIndex)
_checkBoxes(i).Checked = currentBox.Checked
Next
End If

lastCheckedBox = currentBox
End Sub

Private Sub CheckBox_MouseDown(sender As Object, e As MouseEventArgs)
Dim currentBox As CheckBox = DirectCast(sender, CheckBox)

If e.Button = MouseButtons.Left AndAlso Control.ModifierKeys = Keys.Shift Then
' Deselect all checkboxes between lastCheckedBox and currentBox
Dim startIndex As Integer = _checkBoxes.IndexOf(lastCheckedBox)
Dim endIndex As Integer = _checkBoxes.IndexOf(currentBox)

For i As Integer = Math.Min(startIndex, endIndex) + 1 To Math.Max(startIndex, endIndex) - 1
_checkBoxes(i).Checked = False
Next
ElseIf currentBox.Checked AndAlso Not Control.ModifierKeys = Keys.Shift Then
' Deselect the current checkbox if already checked without Shift key
currentBox.Checked = False
End If

lastCheckedBox = currentBox
End Sub

Private Sub checkButton_Click(sender As Object, e As EventArgs)
RaiseEvent RefreshContextButtons()
End Sub
Expand Down
18 changes: 9 additions & 9 deletions instat/UserControl/ucrOutputPages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<data name="tdbAddToExisting.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -139,7 +139,7 @@
<data name="tbAddToNew.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -154,7 +154,7 @@
<data name="tbCopy.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -169,7 +169,7 @@
<data name="tbMoveUp.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -184,7 +184,7 @@
<data name="tbMoveDown.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -199,7 +199,7 @@
<data name="tbDelete.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -214,7 +214,7 @@
<data name="tbRename.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -229,7 +229,7 @@
<data name="tbSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand All @@ -244,7 +244,7 @@
<data name="tbHelp.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
Expand Down
79 changes: 79 additions & 0 deletions instat/UserControl/ucrOutputPages.vb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Public Class ucrOutputPages
Private _outputLogger As clsOutputLogger
Private _selectedOutputPage As ucrOutputPage
Private _strSaveDirectory As String
Private checkBoxSelectAll As New CheckBox()
Public Sub New()

' This call is required by the designer.
Expand All @@ -38,6 +39,10 @@ Public Class ucrOutputPages
EnableDisableTopButtons()
End Sub

Private Sub ucrOutputPages_Load(sender As Object, e As EventArgs) Handles Me.Load
AddSelectAllCheckBoxToToolStripControl()
End Sub

''' <summary>
''' Holds options.
''' ToDo InstatOptions should be able to be accessed from anywhere
Expand Down Expand Up @@ -84,6 +89,7 @@ Public Class ucrOutputPages

Private Sub AddNewOutput(outputElement As clsOutputElement, bDisplayOutputInExternalViewer As Boolean)
ucrMainOutputPage.AddNewOutput(outputElement, bDisplayOutputInExternalViewer)
UpdateSelectAllCheckBoxText()
End Sub

Private Sub AddNewOutputToTab(outputElement As clsOutputElement, tabName As String)
Expand Down Expand Up @@ -153,6 +159,7 @@ Public Class ucrOutputPages
tbMoveUp.Enabled = False
End If
tbRename.Enabled = _selectedOutputPage.BCanRename
UpdateSelectAllCheckBoxText()
End Sub

Private Sub RefreshPage()
Expand Down Expand Up @@ -213,6 +220,7 @@ Public Class ucrOutputPages
_outputLogger.AddOutputToFilteredList(element.Clone, strTabName)
Next
_selectedOutputPage.ClearAllCheckBoxes()
UpdateSelectAllCheckBoxText()
End Sub

Private Sub tbCopy_Click(sender As Object, e As EventArgs) Handles tbCopy.Click
Expand All @@ -239,6 +247,7 @@ Public Class ucrOutputPages
Else
RefreshPage()
End If
UpdateSelectAllCheckBoxText()
End Sub

''' <summary>
Expand Down Expand Up @@ -303,4 +312,74 @@ Public Class ucrOutputPages
End If
Next
End Sub

Private Sub AddSelectAllCheckBoxToToolStripControl()
' Create a ToolStripControlHost to host the CheckBox
Dim checkBoxHost As ToolStripControlHost = New ToolStripControlHost(checkBoxSelectAll)

' Insert the CheckBox host at the beginning of tsButtons items
tsButtons.Items.Insert(0, checkBoxHost)

' Create a ToolTip for the checkBoxSelectAll CheckBox
Dim ttcheckBoxSelectAll As New ToolTip
ttcheckBoxSelectAll.SetToolTip(checkBoxSelectAll, "Toggle selection for all elements")

' Add a Click event handler to the checkBoxSelectAll CheckBox
AddHandler checkBoxSelectAll.Click, AddressOf checkBoxSelectAll_Click
End Sub

''' <summary>
''' Updates the text and state of checkBoxSelectAll based on selected elements and output count.
''' </summary>
Private Sub UpdateSelectAllCheckBoxText()
' Check if _outputLogger is initialized
If _outputLogger Is Nothing Then
Exit Sub ' Exit the sub if logger is not initialized
End If

' Variable to hold the count of output elements
Dim iCountOutputElements As Integer = 0

' Determine the count of output elements based on the selected tab
If SelectedTab() = "Main" Then
iCountOutputElements = _outputLogger.OutputElements.Count
Else
iCountOutputElements = _outputLogger.GetFilteredList(SelectedTab).Output.Count
End If

' Enable or disable checkBoxSelectAll based on the count of output elements
checkBoxSelectAll.Enabled = iCountOutputElements > 0

' Get the count of selected elements
Dim iSelectedElements = _selectedOutputPage.SelectedElements.Count

' Determine the text and check state of checkBoxSelectAll based on selected and total elements
Select Case True
Case iSelectedElements > 0 AndAlso iCountOutputElements > iSelectedElements
' Indeterminate state when some but not all elements are selected
checkBoxSelectAll.Text = $"{iSelectedElements} item(s)"
checkBoxSelectAll.CheckState = CheckState.Indeterminate
Case iSelectedElements > 0 AndAlso iCountOutputElements = iSelectedElements
' All elements selected
checkBoxSelectAll.Text = "Deselect All"
checkBoxSelectAll.CheckState = CheckState.Checked
Case Else
' No elements selected
checkBoxSelectAll.Text = "Select All"
checkBoxSelectAll.CheckState = CheckState.Unchecked
End Select
End Sub

Private Sub checkBoxSelectAll_Click(sender As Object, e As EventArgs)
' Handle CheckBox checked changed event here
Dim checkBoxSelectAll As CheckBox = TryCast(sender, CheckBox)

If checkBoxSelectAll.Checked Then
_selectedOutputPage.SelectAllCheckBoxes()
Else
_selectedOutputPage.ClearAllCheckBoxes()
End If
EnableDisableTopButtons()
End Sub

End Class
2 changes: 1 addition & 1 deletion instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ Public Class RLink
'''
''' <param name="strScript"> The text to add to the save log file. </param>
'''--------------------------------------------------------------------------------------------
Private Sub AppendToAutoSaveLog(strScript As String)
Public Sub AppendToAutoSaveLog(strScript As String)
Dim strTempFile As String
Dim i As Integer = 1
Try
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgCluster.vb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Public Class dlgCluster
ucrPnlPrepareData.AddToLinkedControls({ucrChkMatrix, ucrSaveDistance}, {rdoDistanceData}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlPrepareData.AddToLinkedControls(ucrInputMethod, {rdoDistanceData}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)

ucrSaveNewDataFrame.SetSaveTypeAsModel()
ucrSaveNewDataFrame.SetSaveTypeAsDataFrame()
ucrSaveNewDataFrame.SetDataFrameSelector(ucrSelectorPrepareData.ucrAvailableDataFrames)
ucrSaveNewDataFrame.SetLabelText("New Data Frame Name:")
ucrSaveNewDataFrame.SetPrefix("scale")
Expand Down
Loading

0 comments on commit 360e93e

Please sign in to comment.