Skip to content

Commit

Permalink
Merge pull request #456 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
merge from main
  • Loading branch information
dannyparsons authored Jan 10, 2017
2 parents 4a4c445 + 5326a27 commit e1eef70
Show file tree
Hide file tree
Showing 10 changed files with 867 additions and 70 deletions.
6 changes: 3 additions & 3 deletions instat/dlgName.vb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Public Class dlgName
End Sub

Private Sub TestOKEnabled()
If ((Not ucrReceiverName.IsEmpty()) And (Not ucrInputNewName.IsEmpty())) Then
If ((Not ucrReceiverName.IsEmpty()) AndAlso (Not ucrInputNewName.IsEmpty()) AndAlso Not (ucrReceiverName.GetVariableNames(False) = ucrInputNewName.GetText)) Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
Expand Down Expand Up @@ -89,8 +89,8 @@ Public Class dlgName
TestOKEnabled()
End Sub

Private Sub UcrInputNewName_NameChanged() Handles ucrInputNewName.NameChanged
If Not ucrInputNewName.IsEmpty Then
Private Sub UcrInputNewName_NameChanged() Handles ucrInputNewName.NameChanged, ucrInputNewName.ContentsChanged
If Not ucrInputNewName.IsEmpty AndAlso Not ucrReceiverName.GetVariableNames(False) = ucrInputNewName.GetText Then
ucrBase.clsRsyntax.AddParameter("new_val", Chr(34) & ucrInputNewName.GetText & Chr(34))
Else
ucrBase.clsRsyntax.RemoveParameter("new_val")
Expand Down
69 changes: 31 additions & 38 deletions instat/dlgShowModel.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@ Public Class dlgShowModel
InitialiseDialog()
SetDefaults()
bFirstLoad = False
Else
ReopenDialog()
End If
TestOKEnabled()
End Sub

Private Sub TestOKEnabled()
If ((Not ucrReceiverExpressionForTablePlus.IsEmpty) OrElse (Not ucrInputProbabilities.IsEmpty)) Then
If (Not ucrReceiverExpressionForTablePlus.IsEmpty) OrElse (Not ucrInputProbabilities.IsEmpty) Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
End If

End Sub

Private Sub InitialiseDialog()
Expand All @@ -54,21 +51,17 @@ Public Class dlgShowModel
ucrInputProbabilities.Reset()
ucrInputNewColNameforTablePlus.Reset()
rdoQuantiles.Checked = True
SetName()
chkSingleValues.Checked = True
chkGraphResults.Checked = True
DisplayGraphResults()
results()
ReceiverLabels()
Results()
SaveResults()
setItems()
setname()
End Sub

Private Sub ReopenDialog()

SetItems()
TestOKEnabled()
End Sub

Private Sub setItems()
Private Sub SetItems()
If rdoProbabilities.Checked Then
ucrInputProbabilities.SetItems({"1", "0.1, 1, 3, 5, 10 ", "-2, -1, 0, 1, 2"})
Else
Expand All @@ -78,55 +71,52 @@ Public Class dlgShowModel

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

Private Sub setname()
Private Sub SetName()
If rdoProbabilities.Checked Then
ucrInputProbabilities.SetName("1")
Else
ucrInputProbabilities.SetName("0.5")
End If
End Sub
Private Sub chkGraphResults_CheckedChanged(sender As Object, e As EventArgs) Handles chkGraphResults.CheckedChanged, chkSaveResults.CheckedChanged

Private Sub chkSaveResults_CheckedChanged(sender As Object, e As EventArgs) Handles chkGraphResults.CheckedChanged, chkSaveResults.CheckedChanged
ucrInputProbabilities.Reset()
DisplayGraphResults()
ReceiverLabels()
SaveResults()
TestOKEnabled()
End Sub

Private Sub pqParameters()
Private Sub PqParameters()
If rdoProbabilities.Checked Then
If chkSingleValues.Checked Then
If ucrInputProbabilities.IsEmpty = False Then
If Not ucrInputProbabilities.IsEmpty Then
ucrBase.clsRsyntax.AddParameter("q", "c(" & ucrInputProbabilities.GetText & ")")
Else
ucrBase.clsRsyntax.RemoveParameter("q")
End If
ElseIf chkSingleValues.Checked = False Then
If ucrReceiverExpressionForTablePlus.IsEmpty = False Then
ElseIf Not chkSingleValues.Checked Then
If Not ucrReceiverExpressionForTablePlus.IsEmpty Then
ucrBase.clsRsyntax.AddParameter("q", clsRFunctionParameter:=ucrReceiverExpressionForTablePlus.GetVariables)
Else
ucrBase.clsRsyntax.RemoveParameter("q")
End If
End If
Else

If chkSingleValues.Checked Then
If ucrInputProbabilities.IsEmpty = False Then
ucrBase.clsRsyntax.AddParameter("p", "c(" & ucrInputProbabilities.GetText & ")")
Else
ucrBase.clsRsyntax.RemoveParameter("p")
End If
ElseIf chkSingleValues.Checked = False Then
If ucrReceiverExpressionForTablePlus.IsEmpty = False Then
ElseIf Not chkSingleValues.Checked Then
If Not ucrReceiverExpressionForTablePlus.IsEmpty Then
ucrBase.clsRsyntax.AddParameter("p", clsRFunctionParameter:=ucrReceiverExpressionForTablePlus.GetVariables)
Else
ucrBase.clsRsyntax.RemoveParameter("p")
End If
End If
End If

End Sub

Private Sub SaveResults()
Expand All @@ -149,38 +139,39 @@ Public Class dlgShowModel
End If
End Sub
Private Sub rdoProbabilitiesandQuantiles_CheckedChanged(sender As Object, e As EventArgs) Handles rdoProbabilities.CheckedChanged, rdoQuantiles.CheckedChanged
setname()
setItems()
SetName()
SetItems()
ReceiverLabels()
End Sub

Private Sub ReceiverLabels()
ucrBase.clsRsyntax.ClearParameters()
ucrBase.clsRsyntax.AddParameter("dist", Chr(34) & ucrDistributionsFOrTablePlus.clsCurrDistribution.strRName & Chr(34))
pqParameters()
PqParameters()
DisplayGraphResults()
If rdoProbabilities.Checked Then
If Not ucrInputNewColNameforTablePlus.bUserTyped Then
ucrInputNewColNameforTablePlus.SetPrefix("Prob")
End If
lblQuantValues.Visible = True
lblProbValues.Visible = False
ucrBase.clsRsyntax.SetFunction("mosaic:: pdist")
Else
lblProbValues.Visible = False
ucrBase.clsRsyntax.SetFunction("mosaic:: pdist")
Else
If Not ucrInputNewColNameforTablePlus.bUserTyped Then
ucrInputNewColNameforTablePlus.SetPrefix("Quant")
End If
lblQuantValues.Visible = False
lblProbValues.Visible = True
ucrBase.clsRsyntax.SetFunction("mosaic::qdist")
End If

For Each clstempparam In ucrDistributionsFOrTablePlus.clsCurrRFunction.clsParameters
ucrBase.clsRsyntax.AddParameter(clstempparam.Clone())
Next
End Sub

Private Sub ucrReceiverExpressionForTablePlus_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverExpressionForTablePlus.SelectionChanged
ReceiverLabels()
DisplayGraphResults()
TestOKEnabled()
End Sub

Expand All @@ -194,20 +185,22 @@ Public Class dlgShowModel
End Sub

Private Sub chkSIngleValues_CheckedChanged(sender As Object, e As EventArgs) Handles chkSingleValues.CheckedChanged
results()
pqParameters()
Results()
ReceiverLabels()
End Sub

Private Sub results()
Private Sub Results()
If chkSingleValues.Checked Then
chkSaveResults.Visible = False
ucrInputNewColNameforTablePlus.Visible = False
ucrReceiverExpressionForTablePlus.Visible = False
ucrSelectorForDataFrame.Reset()
ucrInputProbabilities.Visible = True
Else
chkSaveResults.Visible = True
ucrReceiverExpressionForTablePlus.Visible = False
ucrInputNewColNameforTablePlus.Visible = True
ucrInputProbabilities.Reset()
ucrReceiverExpressionForTablePlus.Visible = True
ucrInputNewColNameforTablePlus.Visible = False
ucrInputProbabilities.Visible = False
ucrReceiverExpressionForTablePlus.Visible = True
End If
Expand Down
37 changes: 30 additions & 7 deletions instat/frmEditor.Designer.vb

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

8 changes: 8 additions & 0 deletions instat/frmEditor.vb
Original file line number Diff line number Diff line change
Expand Up @@ -670,4 +670,12 @@ Public Class frmEditor
dlgDuplicateColumns.SetCurrentColumn(SelectedColumnsAsArray()(0), grdCurrSheet.Name)
dlgDuplicateColumns.ShowDialog()
End Sub

Private Sub mnuAddComment_Click(sender As Object, e As EventArgs) Handles mnuAddComment.Click
dlgAddComment.ShowDialog()
End Sub

Private Sub AddCommentToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AddComment.Click
dlgAddComment.ShowDialog()
End Sub
End Class
Loading

0 comments on commit e1eef70

Please sign in to comment.