Skip to content

Commit

Permalink
Merge pull request #23 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
AlexSananka authored Apr 1, 2017
2 parents dea3535 + 5be9aa3 commit ceda5a1
Show file tree
Hide file tree
Showing 31 changed files with 3,558 additions and 299 deletions.
13 changes: 6 additions & 7 deletions instat/clsGridLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Imports RDotNet
Imports unvell.ReoGrid

Public Class clsGridLink
Public ucrDataViewer As ucrDataView
Public grdData As ReoGridControl
Public grdMetadata As ReoGridControl
Public grdVariablesMetadata As ReoGridControl
Expand Down Expand Up @@ -104,7 +105,7 @@ Public Class clsGridLink
Else
FillSheet(dfTemp, strDataName, grdData, bInstatObjectDataFrame:=True, bIncludeDataTypes:=True, iNewPosition:=i, bFilterApplied:=False, bCheckFreezeColumns:=True)
End If
frmEditor.SetColumnNames(strDataName, dfTemp.ColumnNames())
ucrDataViewer.SetColumnNames(strDataName, dfTemp.ColumnNames())
clsSetDataFramesChanged.AddParameter("data_name", Chr(34) & strDataName & Chr(34))
clsSetDataFramesChanged.AddParameter("new_val", "FALSE")
frmMain.clsRLink.RunInternalScript(clsSetDataFramesChanged.ToScript())
Expand Down Expand Up @@ -181,10 +182,7 @@ Public Class clsGridLink
grdVariablesMetadata.Visible = True
grdMetadata.Visible = True
End If
'TODO TEMPORARY THIS MUST BE REMOVED
'Cannot refer to frmEditor directly
'Could fix by having user control for grid and here raising event handled in frmEditor
frmEditor.UpdateCurrentWorksheet()
ucrDataViewer.UpdateCurrentWorksheet()
End Sub

Public Sub SetMetadata(tmpStrMetadata As String)
Expand All @@ -209,8 +207,9 @@ Public Class clsGridLink
End If
End Sub

Public Sub SetData(grdTemp As ReoGridControl)
grdData = grdTemp
Public Sub SetDataViewer(ucrNewDataViewer As ucrDataView)
ucrDataViewer = ucrNewDataViewer
grdData = ucrNewDataViewer.grdData
bGrdDataExists = True
bGrdDataChanged = True
UpdateGrids()
Expand Down
19 changes: 13 additions & 6 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
' along with this program. If not, see <http://www.gnu.org/licenses/>.

Imports RDotNet
Imports unvell.ReoGrid

Public Class RLink
' R interface class. Each instance of the class has its own REngine instance
Expand Down Expand Up @@ -44,6 +45,8 @@ Public Class RLink

Public strGraphDisplayOption As String = "view_output_window"

Private grdDataView As ReoGridControl

Public Sub New(Optional bWithInstatObj As Boolean = False, Optional bWithClimsoft As Boolean = False)

End Sub
Expand All @@ -64,6 +67,10 @@ Public Class RLink
clsEngine.Initialize()
End Sub

Public Sub SetDataViewGrid(grdNewDataGrid As ReoGridControl)
grdDataView = grdNewDataGrid
End Sub

Public Sub setFormatOutput(tempFont As Font, tempColor As Color)
fOutput = tempFont
clrOutput = tempColor
Expand Down Expand Up @@ -127,8 +134,8 @@ Public Class RLink
cboDataFrames.Items.AddRange(GetDataFrameNames().ToArray)
AdjustComboBoxWidth(cboDataFrames)
'Task/Question: From what I understood, if bSetDefault is true or if the strCurrentDataFrame (given as an argument) is actually not in cboDataFrames (is this case generic or should it never happen ?), then the selected Index should be the current worksheet.
If (bSetDefault OrElse cboDataFrames.Items.IndexOf(strCurrentDataFrame) = -1) AndAlso (frmEditor.grdData IsNot Nothing) AndAlso (frmEditor.grdData.CurrentWorksheet IsNot Nothing) Then
cboDataFrames.SelectedIndex = cboDataFrames.Items.IndexOf(frmEditor.grdData.CurrentWorksheet.Name)
If (bSetDefault OrElse cboDataFrames.Items.IndexOf(strCurrentDataFrame) = -1) AndAlso (grdDataView IsNot Nothing) AndAlso (grdDataView.CurrentWorksheet IsNot Nothing) Then
cboDataFrames.SelectedIndex = cboDataFrames.Items.IndexOf(grdDataView.CurrentWorksheet.Name)
ElseIf cboDataFrames.Items.IndexOf(strCurrentDataFrame) <> -1 Then
cboDataFrames.SelectedIndex = cboDataFrames.Items.IndexOf(strCurrentDataFrame)
End If
Expand All @@ -139,7 +146,7 @@ Public Class RLink
' Then this can be removed
Public Shared Sub AdjustComboBoxWidth(cboCurrent As ComboBox)
Dim iWidth As Integer = cboCurrent.DropDownWidth
Dim graTemp As Graphics = cboCurrent.CreateGraphics()
Dim graTemp As System.Drawing.Graphics = cboCurrent.CreateGraphics()
Dim font As Font = cboCurrent.Font
Dim iScrollBarWidth As Integer
Dim iNewWidth As Integer
Expand Down Expand Up @@ -233,7 +240,7 @@ Public Class RLink
Dim strTempGraphsDirectory As String
Dim clsPNGFunction As New RFunction

strTempGraphsDirectory = IO.Path.Combine(IO.Path.GetTempPath() & "R_Instat_Temp_Graphs")
strTempGraphsDirectory = System.IO.Path.Combine(System.IO.Path.GetTempPath() & "R_Instat_Temp_Graphs")
strOutput = ""

If strComment <> "" Then
Expand Down Expand Up @@ -265,7 +272,7 @@ Public Class RLink
If iCallType = 3 Then
If strGraphDisplayOption = "view_output_window" OrElse strGraphDisplayOption = "view_separate_window" Then
clsPNGFunction.SetRCommand("png")
clsPNGFunction.AddParameter("filename", Chr(34) & IO.Path.Combine(strTempGraphsDirectory & "/Graph.png").Replace("\", "/") & Chr(34))
clsPNGFunction.AddParameter("filename", Chr(34) & System.IO.Path.Combine(strTempGraphsDirectory & "/Graph.png").Replace("\", "/") & Chr(34))
clsPNGFunction.AddParameter("width", 4000)
clsPNGFunction.AddParameter("height", 4000)
clsPNGFunction.AddParameter("res", 500)
Expand All @@ -284,7 +291,7 @@ Public Class RLink
'It is called from RLink at the end of RunScript.
Dim lstTempGraphFiles As ObjectModel.ReadOnlyCollection(Of String)
Dim iNumberOfFiles As Integer = -1
strTempGraphsDirectory = IO.Path.Combine(IO.Path.GetTempPath(), "R_Instat_Temp_Graphs")
strTempGraphsDirectory = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "R_Instat_Temp_Graphs")
Try
lstTempGraphFiles = FileIO.FileSystem.GetFiles(strTempGraphsDirectory)
Catch e As Exception
Expand Down
93 changes: 48 additions & 45 deletions instat/dlgExportToCPT.Designer.vb

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

Loading

0 comments on commit ceda5a1

Please sign in to comment.