Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds some GT table formatting functionalities #8662

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 34 additions & 118 deletions instat/dlgSummaryTables.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ Public Class dlgSummaryTables
Private clsSummariesList As New RFunction
Private bResetSubdialog As Boolean = False
Private bResetFormatSubdialog As Boolean = False
Private clsSummaryDefaultFunction, clsFrequencyDefaultFunction, clsConcFunction As New RFunction
Private clsSummaryDefaultFunction, clsFrequencyDefaultFunction As New RFunction
Private bRCodeSet As Boolean = True
Private clsStubHeadFunction, clsPivotWiderFunction As New RFunction
Private clsPivotWiderFunction As New RFunction
Private iUcrBaseXLocation, iDialogueXsize As Integer

Private clsTableTitleFunction, clsTabFootnoteTitleFunction, clsTableSourcenoteFunction, clsFootnoteTitleLocationFunction, clsFootnoteSubtitleLocationFunction,
clsTabFootnoteSubtitleFunction, clsFootnoteCellFunction, clsFootnoteCellBodyFunction,
clsSecondFootnoteCellFunction, clsSecondFootnoteCellBodyFunction, clsTabStyleFunction, clsDummyFunction,
clsTabStyleCellTextFunction, clsTabStylePxFunction, clsTabStyleCellTitleFunction, clsThemesTabOptionsFunction,
clsgtExtraThemesFunction, clsGtFunction As New RFunction
Private clsDummyFunction As New RFunction

Private clsSummaryOperator, clsFrequencyOperator, clsPipeOperator, clsJoiningPipeOperator As New ROperator
Private clsSummaryOperator, clsFrequencyOperator, clsJoiningPipeOperator As New ROperator

Private Sub dlgNewSummaryTables_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstload Then
Expand Down Expand Up @@ -192,31 +188,13 @@ Public Class dlgSummaryTables
clsSummaryDefaultFunction = New RFunction
clsFrequencyDefaultFunction = New RFunction
clsSummariesList = New RFunction
clsConcFunction = New RFunction
clsTableTitleFunction = New RFunction
clsTabFootnoteTitleFunction = New RFunction
clsTableSourcenoteFunction = New RFunction
clsFootnoteTitleLocationFunction = New RFunction
clsFootnoteSubtitleLocationFunction = New RFunction
clsSummaryOperator = New ROperator
clsPipeOperator = New ROperator
clsTabFootnoteSubtitleFunction = New RFunction
clsFootnoteCellBodyFunction = New RFunction
clsSecondFootnoteCellBodyFunction = New RFunction
clsFootnoteCellFunction = New RFunction
clsSecondFootnoteCellFunction = New RFunction
clsTabStyleFunction = New RFunction
clsTabStyleCellTextFunction = New RFunction
clsTabStylePxFunction = New RFunction
clsTabStyleCellTitleFunction = New RFunction
clsJoiningPipeOperator = New ROperator
clsFrequencyOperator = New ROperator
clsDummyFunction = New RFunction
clsThemesTabOptionsFunction = New RFunction
clsgtExtraThemesFunction = New RFunction
clsGtFunction = New RFunction
clsPivotWiderFunction = New RFunction

clsJoiningPipeOperator = New ROperator
clsSummaryOperator = New ROperator
clsFrequencyOperator = New ROperator

ucrReceiverFactors.SetMeAsReceiver()
ucrSelectorSummaryTables.Reset()
ucrSaveTable.Reset()
Expand All @@ -227,55 +205,9 @@ Public Class dlgSummaryTables
clsDummyFunction.AddParameter("rdo_checked", "rdoFrequency", iPosition:=1)
clsDummyFunction.AddParameter("factor_cols", "FactorVar", iPosition:=2)

clsSummaryOperator.SetOperation("%>%")
clsSummaryOperator.bBrackets = False

clsConcFunction.SetRCommand("c")

clsPipeOperator.SetOperation("%>%")
clsPipeOperator.bBrackets = False

clsJoiningPipeOperator.SetOperation("%>%")
clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0)

clsThemesTabOptionsFunction.SetPackageName("gt")
clsThemesTabOptionsFunction.SetRCommand("tab_options")

clsgtExtraThemesFunction.SetPackageName("gtExtras")
clsGtFunction.SetPackageName("gt")
clsGtFunction.SetRCommand("gt")

clsStubHeadFunction.SetPackageName("gt")
clsStubHeadFunction.SetRCommand("tab_stubhead")

clsTabStyleFunction.SetRCommand("tab_style")
clsTabStyleFunction.SetPackageName("gt")
clsTabStyleFunction.AddParameter("style", clsRFunctionParameter:=clsTabStyleCellTextFunction, iPosition:=0)
clsTabStyleFunction.AddParameter("location", clsRFunctionParameter:=clsTabStyleCellTitleFunction, iPosition:=1)

clsTabStyleCellTitleFunction.SetPackageName("gt")
clsTabStyleCellTitleFunction.SetRCommand("cells_title")
clsTabStyleCellTitleFunction.AddParameter("groups", Chr(34) & "title" & Chr(34), iPosition:=0)

clsTabStyleCellTextFunction.SetPackageName("gt")
clsTabStyleCellTextFunction.SetRCommand("cell_text")
clsTabStyleCellTextFunction.AddParameter("size", clsRFunctionParameter:=clsTabStylePxFunction, iPosition:=0)

clsTabStylePxFunction.SetPackageName("gt")
clsTabStylePxFunction.SetRCommand("px")
clsTabStylePxFunction.AddParameter("size", "18", bIncludeArgumentName:=False, iPosition:=0)

clsPivotWiderFunction.SetRCommand("pivot_wider")
clsPivotWiderFunction.AddParameter("values_from", "value", iPosition:=1)

clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryDefaultFunction, iPosition:=0)
clsSummaryOperator.AddParameter("gttbl", clsRFunctionParameter:=clsGtFunction, iPosition:=2)

clsFrequencyOperator.SetOperation("%>%")
clsFrequencyOperator.bBrackets = False
clsFrequencyOperator.AddParameter("tableFun", clsRFunctionParameter:=clsFrequencyDefaultFunction, iPosition:=0)
clsFrequencyOperator.AddParameter("gttbl", clsRFunctionParameter:=clsGtFunction, iPosition:=2)

clsSummariesList.SetRCommand("c")
clsSummariesList.AddParameter("summary_mean", Chr(34) & "summary_mean" & Chr(34), bIncludeArgumentName:=False) ' TODO decide which default(s) to use?

Expand All @@ -290,35 +222,24 @@ Public Class dlgSummaryTables
clsFrequencyDefaultFunction.AddParameter("summaries", "count_label", iPosition:=11)
clsFrequencyDefaultFunction.SetAssignToObject("frequency_table")

clsTableTitleFunction.SetPackageName("gt")
clsTableTitleFunction.SetRCommand("tab_header")

clsTabFootnoteTitleFunction.SetPackageName("gt")
clsTabFootnoteTitleFunction.SetRCommand("tab_footnote")

clsTabFootnoteSubtitleFunction.SetPackageName("gt")
clsTabFootnoteSubtitleFunction.SetRCommand("tab_footnote")

clsFootnoteCellFunction.SetPackageName("gt")
clsFootnoteCellFunction.SetRCommand("tab_footnote")

clsSecondFootnoteCellFunction.SetPackageName("gt")
clsSecondFootnoteCellFunction.SetRCommand("tab_footnote")

clsFootnoteTitleLocationFunction.SetPackageName("gt")
clsFootnoteTitleLocationFunction.SetRCommand("cells_title")

clsFootnoteSubtitleLocationFunction.SetPackageName("gt")
clsFootnoteSubtitleLocationFunction.SetRCommand("cells_title")
' Gt function
Dim clsGtFunction As New RFunction
clsGtFunction.SetPackageName("gt")
clsGtFunction.SetRCommand("gt")

clsTableSourcenoteFunction.SetPackageName("gt")
clsTableSourcenoteFunction.SetRCommand("tab_source_note")
clsSummaryOperator.SetOperation("%>%")
clsSummaryOperator.bBrackets = False
clsSummaryOperator.AddParameter("tableFun", clsRFunctionParameter:=clsSummaryDefaultFunction, iPosition:=0)
clsSummaryOperator.AddParameter("gt", clsRFunctionParameter:=clsGtFunction.Clone, iPosition:=2)

clsFootnoteCellBodyFunction.SetPackageName("gt")
clsFootnoteCellBodyFunction.SetRCommand("cells_body")
clsFrequencyOperator.SetOperation("%>%")
clsFrequencyOperator.bBrackets = False
clsFrequencyOperator.AddParameter("tableFun", clsRFunctionParameter:=clsFrequencyDefaultFunction, iPosition:=0)
clsFrequencyOperator.AddParameter("gt", clsRFunctionParameter:=clsGtFunction.Clone, iPosition:=2)

clsSecondFootnoteCellBodyFunction.SetPackageName("gt")
clsSecondFootnoteCellBodyFunction.SetRCommand("cells_body")
clsJoiningPipeOperator.SetOperation("%>%")
clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0)

ucrBase.clsRsyntax.SetBaseROperator(clsJoiningPipeOperator)
clsJoiningPipeOperator.SetAssignToOutputObject(strRObjectToAssignTo:="last_table",
Expand Down Expand Up @@ -386,6 +307,8 @@ Public Class dlgSummaryTables
End Sub

Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click
Dim clsConcFunction As New RFunction
clsConcFunction.SetRCommand("c")
sdgSummaries.SetRFunction(clsSummariesList, clsSummaryDefaultFunction, clsConcFunction, ucrSelectorSummaryTables, bResetSubdialog)
bResetSubdialog = False
sdgSummaries.bEnable2VariableTab = False
Expand All @@ -396,26 +319,19 @@ Public Class dlgSummaryTables
End Sub

Private Sub cmdFormatTable_Click(sender As Object, e As EventArgs) Handles cmdFormatTable.Click
If rdoSummaryTable.Checked Then
sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction,
clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction,
clsNewPipeOperator:=clsPipeOperator, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction,
clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator,
clsNewMutableOperator:=clsSummaryOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction,
clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, clsNewThemesTabOptionFunction:=clsThemesTabOptionsFunction,
clsNewgtExtraThemesFunction:=clsgtExtraThemesFunction, bReset:=bResetFormatSubdialog)

Dim clsROperator As ROperator
If rdoFrequencyTable.Checked Then
clsROperator = clsFrequencyOperator
ElseIf rdoSummaryTable.Checked Then
clsROperator = clsSummaryOperator
Else
sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction,
clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction,
clsNewPipeOperator:=clsPipeOperator, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction,
clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator,
clsNewMutableOperator:=clsFrequencyOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction,
clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, clsNewThemesTabOptionFunction:=clsThemesTabOptionsFunction,
clsNewgtExtraThemesFunction:=clsgtExtraThemesFunction, bReset:=bResetFormatSubdialog)
Exit Sub
End If

sdgFormatSummaryTables.ShowDialog()
bResetFormatSubdialog = False
sdgTableOptions.Setup(clsROperator)
sdgTableOptions.ShowDialog(Me)

End Sub

Private Sub ucrChkWeights_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkWeight.ControlValueChanged
Expand Down
18 changes: 18 additions & 0 deletions instat/instat.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,18 @@
<Compile Include="sdgSummaryThemes.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="sdgTableOptionsTextFormat.Designer.vb">
<DependentUpon>sdgTableOptionsTextFormat.vb</DependentUpon>
</Compile>
<Compile Include="sdgTableOptionsTextFormat.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="sdgTableOptions.Designer.vb">
<DependentUpon>sdgTableOptions.vb</DependentUpon>
</Compile>
<Compile Include="sdgTableOptions.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserControls\frmMaximiseOutput.Designer.vb">
<DependentUpon>frmMaximiseOutput.vb</DependentUpon>
</Compile>
Expand Down Expand Up @@ -3188,6 +3200,12 @@
<EmbeddedResource Include="sdgSummaryThemes.resx">
<DependentUpon>sdgSummaryThemes.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="sdgTableOptionsTextFormat.resx">
<DependentUpon>sdgTableOptionsTextFormat.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="sdgTableOptions.resx">
<DependentUpon>sdgTableOptions.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserControls\frmMaximiseOutput.resx">
<DependentUpon>frmMaximiseOutput.vb</DependentUpon>
<SubType>Designer</SubType>
Expand Down
Loading
Loading