Skip to content

Commit

Permalink
Merge pull request #208 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating repo
  • Loading branch information
maxwellfundi authored Jan 5, 2017
2 parents 17d3f32 + 3f76db1 commit b4f3654
Show file tree
Hide file tree
Showing 35 changed files with 1,532 additions and 546 deletions.
1 change: 1 addition & 0 deletions instat/dlgBarAndPieChart.vb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Public Class dlgBarAndPieChart
ucrSaveBar.SetDataFrameSelector(ucrBarChartSelector.ucrAvailableDataFrames)
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrSaveBar.strPrefix = "Bar"
ucrBase.clsRsyntax.iCallType = 3
End Sub

Private Sub ReopenDialog()
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgBoxPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Public Class dlgBoxplot


ucrSaveBoxplot.SetDataFrameSelector(ucrSelectorBoxPlot.ucrAvailableDataFrames)

ucrBase.clsRsyntax.iCallType = 3
End Sub

Private Sub TestOkEnabled()
Expand Down
79 changes: 76 additions & 3 deletions instat/dlgCalculationsSummary.Designer.vb

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

69 changes: 66 additions & 3 deletions instat/dlgCalculationsSummary.vb
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,94 @@
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Public Class dlgCalculationsSummary
Public bFirstLoad As Boolean = True
Private lstCalculations As New List(Of KeyValuePair(Of String, RFunction))
Private clsApplyCalculation As New RFunction

Private Sub dlgCalculationsSummary_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
SetDefaults()
InitialiseDialog()
SetDefaults()
bFirstLoad = False
Else
ReopenDialog()
End If
'Checks if Ok can be enabled.
TestOKEnabled()
SetEnabledStatusButtons()
End Sub

Private Sub ReopenDialog()

End Sub

Private Sub TestOKEnabled()

If lstLayers.Items.Count > 0 Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
End If
End Sub

Private Sub SetDefaults()

End Sub

Private Sub InitialiseDialog()
cmdEdit.Enabled = False
cmdDuplicate.Enabled = False
clsApplyCalculation.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$run_instat_calculation")
'TODO Shoudl be option on the dialog/sub dialog
clsApplyCalculation.AddParameter("display", "TRUE")
End Sub

Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click
Dim clsCalcFunction As New RFunction

clsCalcFunction.SetRCommand("instat_calculation$new")
sdgCalculationsSummmary.SetCalculationFunction(clsCalcFunction)
sdgCalculationsSummmary.ShowDialog()
If clsCalcFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "name") <> -1 Then
lstLayers.Items.Add(clsCalcFunction.clsParameters.Find(Function(x) x.strArgumentName = "name").strArgumentValue)
Else
lstLayers.Items.Add("calc" & lstLayers.Items.Count + 1)
End If
lstCalculations.Add(New KeyValuePair(Of String, RFunction)(lstLayers.Items(lstLayers.Items.Count - 1).Text, clsCalcFunction.Clone()))
TestOKEnabled()
End Sub

Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk
Dim strScript As String
Dim strComment As String = ""
Dim strTemp As String = ""

For i = 0 To lstCalculations.Count - 1
strScript = ""
If i = 0 Then
strComment = ucrBase.strComment
Else
strComment = ""
End If
clsApplyCalculation.AddParameter("calc", clsRFunctionParameter:=lstCalculations(i).Value.Clone())
strTemp = clsApplyCalculation.ToScript(strScript)
frmMain.clsRLink.RunScript(strScript & strTemp, iCallType:=2)
Next
End Sub

Private Sub cmdDelete_Click(sender As Object, e As EventArgs) Handles cmdDelete.Click
For Each iTemp As Integer In lstLayers.SelectedIndices
lstLayers.Items.RemoveAt(iTemp)
lstCalculations.RemoveAt(iTemp)
Next
End Sub

Private Sub lstLayers_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstLayers.SelectedIndexChanged
SetEnabledStatusButtons()
End Sub

Private Sub SetEnabledStatusButtons()
If lstLayers.SelectedItems.Count > 0 Then
cmdDelete.Enabled = True
Else
cmdDelete.Enabled = False
End If
End Sub
End Class
5 changes: 1 addition & 4 deletions instat/dlgCalculator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Public Class dlgCalculator
ucrCalc.ucrSaveResultInto.SetPrefix("Calc")
ucrCalc.ucrSaveResultInto.Reset()
ucrCalc.ucrInputCalOptions.Reset()
ucrCalc.ucrReceiverForCalculation.Clear()
ucrCalc.ucrSelectorForCalculations.Reset()
ucrCalc.ucrInputCalOptions.SetName("Basic")
ucrCalc.chkShowArguments.Checked = False
ucrCalc.chkSaveResultInto.Checked = True
Expand All @@ -69,7 +69,6 @@ Public Class dlgCalculator

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 14
ucrCalc.ucrReceiverForCalculation.Selector = ucrCalc.ucrSelectorForCalculations
ucrCalc.ucrReceiverForCalculation.SetMeAsReceiver()
clsAttach.SetRCommand("attach")
clsDetach.SetRCommand("detach")
Expand All @@ -81,9 +80,7 @@ Public Class dlgCalculator
ucrCalc.ucrSaveResultInto.SetDefaultTypeAsColumn()
ucrCalc.ucrSaveResultInto.SetDataFrameSelector(ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames)
ucrCalc.ucrSelectorForCalculations.Reset()
ucrCalc.ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Statistics", "Strings (Character Columns)", "Probability", "Dates", "Rows"}) ' "Rows" is a temp. name
ucrCalc.ucrSaveResultInto.SetValidationTypeAsRVariable()

End Sub

Private Sub ucrCalc_SaveNameChanged() Handles ucrCalc.SaveNameChanged
Expand Down
1 change: 1 addition & 0 deletions instat/dlgCombineforGraphics.vb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Public Class dlgCombineforGraphics
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBase.clsRsyntax.SetFunction("gridExtra::grid.arrange")
ucrCombineGraphReceiver.strSelectorHeading = "Graphs"
ucrBase.clsRsyntax.iCallType = 3
End Sub

Private Sub SetDefaults()
Expand Down
1 change: 1 addition & 0 deletions instat/dlgCumulativeDistribution.vb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Public Class dlgCumulativeDistribution

ucrSaveCumDist.SetDataFrameSelector(ucrCumDistSelector.ucrAvailableDataFrames)
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBase.clsRsyntax.iCallType = 3
End Sub

Private Sub SetDefaults()
Expand Down
1 change: 1 addition & 0 deletions instat/dlgDotPlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Public Class dlgDotPlot

ucrSaveDotPlot.SetDataFrameSelector(ucrDotPlotSelector.ucrAvailableDataFrames)
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBase.clsRsyntax.iCallType = 3

End Sub

Expand Down
Loading

0 comments on commit b4f3654

Please sign in to comment.