Skip to content

Commit

Permalink
Merge pull request #23 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating branch
  • Loading branch information
maxwellfundi authored Mar 16, 2017
2 parents df79fd7 + 71560d6 commit 8a3aaed
Show file tree
Hide file tree
Showing 8 changed files with 666 additions and 683 deletions.
144 changes: 73 additions & 71 deletions instat/dlgCombineforGraphics.Designer.vb

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

159 changes: 84 additions & 75 deletions instat/dlgCombineforGraphics.vb
Original file line number Diff line number Diff line change
@@ -1,89 +1,98 @@
' Instat-R
' Copyright (C) 2015
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License k
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Imports instat.Translations
Public Class dlgCombineforGraphics
Private bFirstLoad As Boolean = True
Private Sub dlgCombineforGraphics_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
InitialiseDialog()
SetDefaults()
bFirstLoad = False
Else
ReopenDialog()

End If
autoTranslate(Me)
TestOkEnabled()
End Sub

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 431
ucrCombineGraphReceiver.Selector = ucrCombineGraphSelector
' Instat-R
' Copyright (C) 2015
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License k
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Imports instat.Translations
Public Class dlgCombineforGraphics
Private bFirstLoad As Boolean = True
Private bReset As Boolean = True
Private bResetSubDialog As Boolean = False
Private clsDefaultRFunction As New RFunction
Private Sub dlgCombineforGraphics_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
InitialiseDialog()
bFirstLoad = False

End If

If bReset Then
SetDefaults()
End If
SetRCodeForControls(bReset)
bReset = False
autoTranslate(Me)
TestOkEnabled()
End Sub

Private Sub SetRCodeForControls(bReset As Boolean)
SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset)
End Sub

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 431
ucrBase.clsRsyntax.iCallType = 3
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False


ucrCombineGraphReceiver.Selector = ucrCombineGraphSelector
ucrCombineGraphSelector.SetItemType("graph")
ucrSaveCombinedGraph.SetDataFrameSelector(ucrCombineGraphSelector.ucrAvailableDataFrames)
sdgCombineGraphOptions.SetRSyntax(ucrBase.clsRsyntax)
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBase.clsRsyntax.SetFunction("gridExtra::grid.arrange")
ucrCombineGraphReceiver.strSelectorHeading = "Graphs"
ucrBase.clsRsyntax.iCallType = 3
End Sub

Private Sub SetDefaults()
ucrCombineGraphReceiver.SetMeAsReceiver()
ucrCombineGraphSelector.Reset()
ucrSaveCombinedGraph.chkSaveGraph.Checked = False
sdgCombineGraphOptions.SetDefaults()
ucrSaveCombinedGraph.strPrefix = "CombineGraph"
TestOkEnabled()
End Sub

Private Sub ReopenDialog()

End Sub
Private Sub TestOkEnabled()
If ucrCombineGraphReceiver.lstSelectedVariables.Items.Count > 1 Then

ucrCombineGraphReceiver.SetParameter(New RParameter("grobs", 0))
ucrCombineGraphReceiver.SetParameterIsRFunction()

ucrSave.SetPrefix("Combined_Graph")
ucrSave.SetDataFrameSelector(ucrCombineGraphSelector.ucrAvailableDataFrames)
ucrSave.SetSaveTypeAsGraph()
ucrSave.SetCheckBoxText("Save Graph")
ucrSave.SetIsComboBox()
ucrSave.SetAssignToIfUncheckedValue("last_graph")

End Sub

Private Sub SetDefaults()
ucrCombineGraphReceiver.SetMeAsReceiver()
ucrCombineGraphSelector.Reset()
ucrSave.Reset()

clsDefaultRFunction = New RFunction
clsDefaultRFunction.SetRCommand("grid.arrange")
clsDefaultRFunction.SetAssignTo("last_graph", strTempDataframe:=ucrCombineGraphSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction)
bResetSubDialog = True
End Sub

Private Sub TestOkEnabled()
If ucrCombineGraphReceiver.lstSelectedVariables.Items.Count > 1 AndAlso ucrSave.IsComplete Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
End If
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
End Sub
Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
SetRCodeForControls(True)
TestOkEnabled()
End Sub

Private Sub ucrCombineGraphReceiver_SelectionChanged() Handles ucrCombineGraphReceiver.SelectionChanged
If Not ucrCombineGraphReceiver.IsEmpty Then
ucrBase.clsRsyntax.AddParameter("grobs", clsRFunctionParameter:=ucrCombineGraphReceiver.GetVariables())
sdgCombineGraphOptions.SetDefaultRowAndColumns()
Else
ucrBase.clsRsyntax.RemoveParameter("grobs")
End If
Private Sub AllControls_ControlContentsChanged() Handles ucrCombineGraphReceiver.ControlContentsChanged, ucrSave.ControlContentsChanged
TestOkEnabled()
End Sub
Private Sub cmdLayout_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click
'this SetRFunction is still empty in subdialog but will be fixed soon.
sdgCombineGraphOptions.SetRFunction(ucrBase.clsRsyntax.clsBaseFunction, bResetSubDialog)
bResetSubDialog = False
sdgCombineGraphOptions.ShowDialog()
End Sub

Private Sub ucrSaveCombinedGraph_Load() Handles ucrSaveCombinedGraph.GraphNameChanged, ucrSaveCombinedGraph.SaveGraphCheckedChanged
If ucrSaveCombinedGraph.bSaveGraph Then
ucrBase.clsRsyntax.SetAssignTo(ucrSaveCombinedGraph.strGraphName, strTempDataframe:=ucrCombineGraphSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSaveCombinedGraph.strGraphName)
Else
ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrCombineGraphSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
End If
TestOkEnabled()
End Sub
End Class
Loading

0 comments on commit 8a3aaed

Please sign in to comment.