Skip to content

Commit

Permalink
Merge pull request #224 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
MeSophie authored Jun 11, 2024
2 parents 644069c + 9736c01 commit fc1f0a5
Show file tree
Hide file tree
Showing 33 changed files with 6,780 additions and 2,153 deletions.
2 changes: 1 addition & 1 deletion instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Public Class clsDataFramePage
columnHeader.strTypeShortCode = "(L)"
' Structured columns e.g. "circular or bigz or bigq " are coded with "(S)"
ElseIf strHeaderType.Contains("circular") OrElse strHeaderType.Contains("bigz") OrElse
strHeaderType.Contains("bigq") Then
strHeaderType.Contains("bigq") OrElse strHeaderType.Contains("polynomial") Then
columnHeader.strTypeShortCode = "(S)"
ElseIf strHeaderType.Contains("list") Then
columnHeader.strTypeShortCode = "(LT)"
Expand Down
69 changes: 34 additions & 35 deletions instat/Model/Output/clsOutputLogger.vb
Original file line number Diff line number Diff line change
Expand Up @@ -71,52 +71,51 @@ Public Class clsOutputLogger
End Property

Public Sub AddOutput(strScript As String, strOutput As String, bAsFile As Boolean, bDisplayOutputInExternalViewer As Boolean)
'Note this always takes the last script added as corresponding script
' Note this always takes the last script added as corresponding script
If String.IsNullOrWhiteSpace(strScript) Then
Throw New Exception("Cannot find script to attach output to.")
Exit Sub
End If

'add the R script as an output element
' Add the R script as an output element
Dim rScriptElement As New clsOutputElement
rScriptElement.SetContent(strScript, OutputType.Script, "")
_outputElements.Add(rScriptElement)
'raise event for output pages
' Raise event for output pages
RaiseEvent NewOutputAdded(rScriptElement, False)


If Not String.IsNullOrEmpty(strOutput) Then
Dim outputElement As New clsOutputElement
Dim outputType As OutputType
If bAsFile Then
Dim strFileExtension As String = Path.GetExtension(strOutput).ToLower
Select Case strFileExtension
Case ".png"
outputType = OutputType.ImageOutput
Case ".html"
outputType = OutputType.HtmlOutput
Case ".txt"
outputType = OutputType.TextOutput
Case Else
MessageBox.Show("The file type to be added is currently not suported",
"Developer Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error)
Exit Sub
End Select
Else
outputType = OutputType.TextOutput
' Split the strOutput into an array of lines, removing empty entries
Dim arrFilesPaths() As String = strOutput.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

For Each output In arrFilesPaths
If Not String.IsNullOrEmpty(output) Then
Dim outputElement As New clsOutputElement
Dim outputType As OutputType

If bAsFile Then
Dim strFileExtension As String = Path.GetExtension(output).ToLower
Select Case strFileExtension
Case ".png"
outputType = OutputType.ImageOutput
Case ".html"
outputType = OutputType.HtmlOutput
Case ".txt"
outputType = OutputType.TextOutput
Case Else
MessageBox.Show("The file type to be added is currently not supported", "Developer Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Select
Else
outputType = OutputType.TextOutput
End If

' Add the output with its R script as another output element
outputElement.SetContent("", outputType, output)
_outputElements.Add(outputElement)
' Raise event for output pages
RaiseEvent NewOutputAdded(outputElement, bDisplayOutputInExternalViewer)
End If

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

End If


Next

End Sub

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
Loading

0 comments on commit fc1f0a5

Please sign in to comment.