Skip to content

Commit

Permalink
Merge pull request #293 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Vitalis95 authored Oct 29, 2024
2 parents 2e510b6 + bb6ec7a commit 42ac1aa
Show file tree
Hide file tree
Showing 28 changed files with 2,965 additions and 1,783 deletions.
4 changes: 4 additions & 0 deletions instat/Interface/IDataViewGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Public Interface IDataViewGrid

Event WorksheetChanged()

Event WorksheetInserted()

Event WorksheetRemoved(worksheet As clsWorksheetAdapter)

Event FindRow()
Expand All @@ -44,6 +46,8 @@ Public Interface IDataViewGrid

Sub AdjustColumnWidthAfterWrapping(strColumn As String, Optional bApplyWrap As Boolean = False)

Sub Focus()

Function GetSelectedColumns() As List(Of clsColumnHeaderDisplay)

Function GetFirstRowHeader() As String
Expand Down
52 changes: 52 additions & 0 deletions instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,58 @@ Public Class clsDataFramePage
Return Math.Ceiling(_iTotalColumnCount / iColumnIncrements)
End Function

Public Sub Undo()
Dim clsUndoRFunction As New RFunction
clsUndoRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$undo_last_action")
clsUndoRFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34))
_clsRLink.RunScript(clsUndoRFunction.ToScript)

End Sub

Public Function IsUndo(strCurrentDataFrame As String)
Dim clsIsUndoFunction As New RFunction
Dim expTemp As SymbolicExpression
clsIsUndoFunction.SetRCommand(_clsRLink.strInstatDataObject & "$is_undo")
clsIsUndoFunction.AddParameter("data_name", Chr(34) & strCurrentDataFrame & Chr(34))

If clsIsUndoFunction IsNot Nothing Then
expTemp = frmMain.clsRLink.RunInternalScriptGetValue(clsIsUndoFunction.ToScript(), bSilent:=True)
If expTemp IsNot Nothing AndAlso expTemp.AsCharacter(0) = "TRUE" Then
Return True
End If
End If

Return False
End Function

Public Sub DisableEnableUndo(bDisable As Boolean, strCurrentDataFrame As String)
Dim clsEnableDisableUndoRFunction As New RFunction
clsEnableDisableUndoRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$set_enable_disable_undo")
clsEnableDisableUndoRFunction.AddParameter("data_name", Chr(34) & strCurrentDataFrame & Chr(34))

Dim strDisable As String = If(bDisable, "TRUE", "FALSE")
clsEnableDisableUndoRFunction.AddParameter("disable_undo", strDisable)
_clsRLink.RunScript(clsEnableDisableUndoRFunction.ToScript)

End Sub

Public Function HasUndoHistory()
Dim expTemp As SymbolicExpression
Dim bHasHistory As Boolean = False
Dim clsHasHistoryFunction As New RFunction

clsHasHistoryFunction.SetRCommand(_clsRLink.strInstatDataObject & "$has_undo_history")
clsHasHistoryFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34))
If clsHasHistoryFunction IsNot Nothing Then
expTemp = frmMain.clsRLink.RunInternalScriptGetValue(clsHasHistoryFunction.ToScript(), bSilent:=True)
If expTemp IsNot Nothing AndAlso expTemp.AsCharacter(0) = "TRUE" Then
bHasHistory = True
End If
End If

Return bHasHistory
End Function

Private Function GetDataFrameFromRCommand() As DataFrame
Dim clsGetDataFrameRFunction As New RFunction
Dim expTemp As SymbolicExpression
Expand Down
6 changes: 6 additions & 0 deletions instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Public Class ucrDataViewLinuxGrid

Public Event WorksheetChanged() Implements IDataViewGrid.WorksheetChanged

Public Event WorksheetInserted() Implements IDataViewGrid.WorksheetInserted

Public Event WorksheetRemoved(worksheet As clsWorksheetAdapter) Implements IDataViewGrid.WorksheetRemoved

Public Sub AddColumns(visiblePage As clsDataFramePage) Implements IDataViewGrid.AddColumns
Expand Down Expand Up @@ -69,6 +71,10 @@ Public Class ucrDataViewLinuxGrid
Next
End Sub

Public Sub FocusGrid() Implements IDataViewGrid.Focus
Me.Focus()
End Sub

Public Function SelectedTab() As String
If tcTabs.SelectedTab Is Nothing Then
Return ""
Expand Down
12 changes: 12 additions & 0 deletions instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Public Class ucrDataViewReoGrid

Public Event WorksheetChanged() Implements IDataViewGrid.WorksheetChanged

Public Event WorksheetInserted() Implements IDataViewGrid.WorksheetInserted

Public Event WorksheetRemoved(worksheet As clsWorksheetAdapter) Implements IDataViewGrid.WorksheetRemoved

Public Sub AddColumns(visiblePage As clsDataFramePage) Implements IDataViewGrid.AddColumns
Expand All @@ -57,6 +59,11 @@ Public Class ucrDataViewReoGrid
Next
End Sub

Public Sub FocusGrid() Implements IDataViewGrid.Focus
grdData.Focus()
grdData.CurrentWorksheet.FocusPos = grdData.CurrentWorksheet.FocusPos
End Sub

Public Sub AddRowData(dataFrame As clsDataFrame) Implements IDataViewGrid.AddRowData
Dim textColour As Color
Dim strRowNames As String()
Expand Down Expand Up @@ -217,6 +224,11 @@ Public Class ucrDataViewReoGrid
RaiseEvent WorksheetChanged()
End Sub

Private Sub grdData_WorksheetInserted(sender As Object, e As EventArgs) Handles grdData.WorksheetInserted
RaiseEvent WorksheetInserted()
End Sub


Private Sub grdData_WorksheetRemoved(sender As Object, e As WorksheetRemovedEventArgs) Handles grdData.WorksheetRemoved
RaiseEvent WorksheetRemoved(New clsWorksheetAdapter(e.Worksheet))
End Sub
Expand Down
37 changes: 37 additions & 0 deletions instat/clsInstatOptions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Imports RDotNet
Public iPreviewRows As Nullable(Of Integer)
Public iMaxRows As Nullable(Of Integer)
Public iMaxCols As Nullable(Of Integer)
Public iUndoColLimit As Nullable(Of Integer)
Public iUndoRowLimit As Nullable(Of Integer)
Public lstColourPalette As List(Of Color)
Public strGraphDisplayOption As String
Public bCommandsinOutput As Nullable(Of Boolean)
Expand All @@ -43,6 +45,8 @@ Imports RDotNet
Public bShowSignifStars As Nullable(Of Boolean)
Public bChangeDataFrame As Nullable(Of Boolean)
Public bAutoSaveData As Nullable(Of Boolean)
Public bSwitchOffUndo As Nullable(Of Boolean)
Public bUndoSwitchAction As Nullable(Of Boolean)
Public iAutoSaveDataMinutes As Nullable(Of Integer)
Public bShowWaitDialog As Nullable(Of Boolean)
Public iWaitTimeDelaySeconds As Nullable(Of Integer)
Expand Down Expand Up @@ -75,6 +79,8 @@ Imports RDotNet
iPreviewRows = clsInstatOptionsDefaults.DEFAULTiPreviewRows
iMaxRows = clsInstatOptionsDefaults.DEFAULTiMaxRows
iMaxCols = clsInstatOptionsDefaults.DEFAULTiMaxCols
iUndoColLimit = clsInstatOptionsDefaults.DEFAULTiUndoColLimit
iUndoRowLimit = clsInstatOptionsDefaults.DEFAULTiUndoRowLimit
strComment = Translations.GetTranslation(clsInstatOptionsDefaults.DEFAULTstrComment)
strGraphDisplayOption = clsInstatOptionsDefaults.DEFAULTstrGraphDisplayOption
strLanguageCultureCode = clsInstatOptionsDefaults.DEFAULTstrLanguageCultureCode
Expand All @@ -84,6 +90,7 @@ Imports RDotNet
bShowSignifStars = clsInstatOptionsDefaults.DEFAULTbShowSignifStars
bChangeDataFrame = clsInstatOptionsDefaults.DEFAULTbChangeDataFrame
bAutoSaveData = clsInstatOptionsDefaults.DEFAULTbAutoSaveData
bSwitchOffUndo = clsInstatOptionsDefaults.DEFAULTbSwitchOffUndo
iAutoSaveDataMinutes = clsInstatOptionsDefaults.DEFAULTiAutoSaveDataMinutes
bShowWaitDialog = clsInstatOptionsDefaults.DEFAULTbShowWaitDialog
iWaitTimeDelaySeconds = clsInstatOptionsDefaults.DEFAULTiWaitTimeDelaySeconds
Expand Down Expand Up @@ -144,6 +151,18 @@ Imports RDotNet
SetMaxCols(clsInstatOptionsDefaults.DEFAULTiMaxCols)
End If

If iUndoColLimit.HasValue Then
SetUndoColLimit(iUndoColLimit)
Else
SetUndoColLimit(clsInstatOptionsDefaults.DEFAULTiUndoColLimit)
End If

If iUndoRowLimit.HasValue Then
SetUndoRowLimit(iUndoRowLimit)
Else
SetUndoRowLimit(clsInstatOptionsDefaults.DEFAULTiUndoRowLimit)
End If

If bCommandsinOutput.HasValue Then
SetCommandInOutpt(bCommandsinOutput)
Else
Expand Down Expand Up @@ -244,6 +263,12 @@ Imports RDotNet
SetAutoSaveData(clsInstatOptionsDefaults.DEFAULTbAutoSaveData)
End If

If bSwitchOffUndo.HasValue Then
SetOffUndo(bSwitchOffUndo)
Else
SetOffUndo(clsInstatOptionsDefaults.DEFAULTbSwitchOffUndo)
End If

If iAutoSaveDataMinutes.HasValue Then
SetAutoSaveDataMinutes(iAutoSaveDataMinutes)
Else
Expand Down Expand Up @@ -356,6 +381,14 @@ Imports RDotNet
Return If(expression Is Nothing OrElse expression.Type = Internals.SymbolicExpressionType.Null, Nothing, expression.AsCharacter(0))
End Function

Public Sub SetUndoColLimit(iNewUndoColLimit As Integer)
iUndoColLimit = iNewUndoColLimit
End Sub

Public Sub SetUndoRowLimit(iNewUndoRowLimit As Integer)
iUndoRowLimit = iNewUndoRowLimit
End Sub

Public Sub SetMaxRows(iRows As Integer)
iMaxRows = iRows
frmMain.UpdateAllGrids()
Expand Down Expand Up @@ -530,6 +563,10 @@ Imports RDotNet
bAutoSaveData = bNewAutoSave
End Sub

Public Sub SetOffUndo(bNewSwitchOffUndo As Boolean)
bSwitchOffUndo = bNewSwitchOffUndo
End Sub

Public Sub SetAutoSaveDataMinutes(iNewMinutes As Integer)
iAutoSaveDataMinutes = iNewMinutes
frmMain.ResetTimer()
Expand Down
3 changes: 3 additions & 0 deletions instat/clsInstatOptionsDefaults.vb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Public Class clsInstatOptionsDefaults
Public Shared ReadOnly DEFAULTiPreviewRows As Integer = 10
Public Shared ReadOnly DEFAULTiMaxRows As Integer = 1000
Public Shared ReadOnly DEFAULTiMaxCols As Integer = 50
Public Shared ReadOnly DEFAULTiUndoColLimit As Integer = 200
Public Shared ReadOnly DEFAULTiUndoRowLimit As Integer = 200000
Public Shared ReadOnly DEFAULTstrComment As String = "Dialog:"
Public Shared ReadOnly DEFAULTstrGraphDisplayOption As String = "view_output_window"
Public Shared ReadOnly DEFAULTbChangeDataFrame As Boolean = False
Expand All @@ -45,6 +47,7 @@ Public Class clsInstatOptionsDefaults
Public Shared ReadOnly DEFAULTiDigits As Integer = 4
Public Shared ReadOnly DEFAULTbShowSignifStars As Boolean = False
Public Shared ReadOnly DEFAULTbAutoSaveData As Boolean = True
Public Shared ReadOnly DEFAULTbSwitchOffUndo As Boolean = False
Public Shared ReadOnly DEFAULTiAutoSaveDataMinutes As Integer = 10
Public Shared ReadOnly DEFAULTbShowWaitDialog As Boolean = True
Public Shared ReadOnly DEFAULTiWaitTimeDelaySeconds As Integer = 2
Expand Down
7 changes: 7 additions & 0 deletions instat/dlgCalculator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ Public Class dlgCalculator
Private strDefaultKeyboard As String
' Note: This list needs to be updated when a new keyboard is added.
Private strKeyboards() As String = {"Basic", "Maths", "Logical and Symbols", "Transform", "Summary", "Probability", "Factor", "Text/Strings (Character Columns)", "Dates/Times", "Circular", "Wakefield", "Goodness of Fit", "List", "Complex", "Integer", "Functions"}
Private Shared ReadOnly Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger()


Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim start = DateTime.Now
If bFirstLoad Then
InitialiseDialog()
iBasicWidth = Me.Width
Expand All @@ -48,6 +51,10 @@ Public Class dlgCalculator
ReopenDialog()
TestOKEnabled()
autoTranslate(Me)

Logger.Debug("This is in the load")
Logger.Debug(Process.GetCurrentProcess().WorkingSet64)
Logger.Debug("Time", DateTime.Now - start)
End Sub

Private Sub TestOKEnabled()
Expand Down
6 changes: 3 additions & 3 deletions instat/dlgClimaticLengthOfSeason.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 42ac1aa

Please sign in to comment.