Lazstats: Refactor main form by beginning to rename menu items and to bring their methods in systematic order

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7620 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-08-18 21:16:19 +00:00
parent e4c6c0c1c2
commit a8307a5798
5 changed files with 843 additions and 767 deletions

View File

@ -92,7 +92,7 @@ begin
begin begin
res := MessageDlg('You must first close the current file. Close it now?', mtConfirmation, [mbYes, mbNo], 0); res := MessageDlg('You must first close the current file. Close it now?', mtConfirmation, [mbYes, mbNo], 0);
case res of case res of
mrYes: OS3MainFrm.CloseFileBtnClick(nil); mrYes: OS3MainFrm.mnuFileCloseClick(nil);
mrNo: exit; mrNo: exit;
end; end;
end; end;

View File

@ -474,7 +474,7 @@ begin
// save frequency data file if elected // save frequency data file if elected
if SaveFChk.Checked then if SaveFChk.Checked then
begin begin
OS3MainFrm.CloseFileBtnClick(self); OS3MainFrm.mnuFileCloseClick(self);
OS3MainFrm.FileNameEdit.Text := ''; OS3MainFrm.FileNameEdit.Text := '';
for i := 1 to DictionaryFrm.DictGrid.RowCount - 1 do for i := 1 to DictionaryFrm.DictGrid.RowCount - 1 do
for j := 0 to 7 do DictionaryFrm.DictGrid.Cells[j,i] := ''; for j := 0 to 7 do DictionaryFrm.DictGrid.Cells[j,i] := '';

View File

@ -15,7 +15,9 @@ object OS3MainFrm: TOS3MainFrm
Font.Pitch = fpFixed Font.Pitch = fpFixed
Font.Quality = fqDraft Font.Quality = fqDraft
Menu = MainMenu1 Menu = MainMenu1
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow OnShow = FormShow
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object Panel1: TPanel object Panel1: TPanel
@ -240,204 +242,204 @@ object OS3MainFrm: TOS3MainFrm
Top = 200 Top = 200
object MenuItem1: TMenuItem object MenuItem1: TMenuItem
Caption = 'File' Caption = 'File'
object NewFileBtn: TMenuItem object mnuFileNew: TMenuItem
Caption = 'New File' Caption = 'New File'
OnClick = NewFileBtnClick OnClick = mnuFileNewClick
end end
object OpenFileBtn: TMenuItem object mnuFileOpen: TMenuItem
Caption = 'Open File (*.laz)' Caption = 'Open File (*.laz)'
OnClick = OpenFileBtnClick OnClick = mnuFileOpenClick
end end
object SaveFileBtn: TMenuItem object mnuFileSave: TMenuItem
Caption = 'Save File (*.laz)' Caption = 'Save File (*.laz)'
OnClick = SaveFileBtnClick OnClick = mnuFileSaveClick
end end
object CloseFileBtn: TMenuItem object mnuFileClose: TMenuItem
Caption = 'Close File' Caption = 'Close File'
OnClick = CloseFileBtnClick OnClick = mnuFileCloseClick
end end
object MenuItem42: TMenuItem object MenuItem42: TMenuItem
Caption = '-' Caption = '-'
end end
object MenuItem13: TMenuItem object mnuFileImport: TMenuItem
Caption = 'Import File of Type' Caption = 'Import File of Type'
object TabFileInBtn: TMenuItem object mnuFileImportTAB: TMenuItem
Caption = 'TAB Separated' Caption = 'TAB Separated'
OnClick = TabFileInBtnClick OnClick = mnuFileImportTABClick
end end
object CSVFileIn: TMenuItem object mnuFileImportCSV: TMenuItem
Caption = 'Comma Separated' Caption = 'Comma Separated'
OnClick = CSVFileInClick OnClick = mnuFileImportCSVClick
end end
object SSVFileIn: TMenuItem object mnuFileImportSSV: TMenuItem
Caption = 'Space Separated' Caption = 'Space Separated'
OnClick = SSVFileInClick OnClick = mnuFileImportSSVClick
end end
end end
object TabFileOut: TMenuItem object mnuFileExport: TMenuItem
Caption = 'Export File of Type' Caption = 'Export File of Type'
object MenuItem20: TMenuItem object mnuFileExportTab: TMenuItem
Caption = 'Tab Separated' Caption = 'Tab Separated'
OnClick = MenuItem20Click OnClick = mnuFileExportTabClick
end end
object CSVFileOut: TMenuItem object mnuFileExportCSV: TMenuItem
Caption = 'Comma Separated' Caption = 'Comma Separated'
OnClick = CSVFileOutClick OnClick = mnuFileExportCSVClick
end end
object SSVFileOut: TMenuItem object mnuFileExportSSV: TMenuItem
Caption = 'Space Separated' Caption = 'Space Separated'
OnClick = SSVFileOutClick OnClick = mnuFileExportSSVClick
end end
end end
object MenuItem12: TMenuItem object MenuItem12: TMenuItem
Caption = '-' Caption = '-'
end end
object MenuItem16: TMenuItem object mnuFileExit: TMenuItem
Caption = 'Exit' Caption = 'Exit'
OnClick = MenuItem16Click OnClick = mnuFileExitClick
end end
end end
object MenuItem2: TMenuItem object mnuVariables: TMenuItem
Caption = 'Variables' Caption = 'Variables'
object DefineVar: TMenuItem object mnuVariablesDefine: TMenuItem
Caption = 'Define...' Caption = 'Define...'
OnClick = DefineVarClick OnClick = mnuVariablesDefineClick
end end
object PrintDefs: TMenuItem object mnuVariablesPrintDefs: TMenuItem
Caption = 'Print Definitions' Caption = 'Print Definitions'
OnClick = PrintDefsClick OnClick = mnuVariablesPrintDefsClick
end end
object Transform: TMenuItem object mnuVariablesTransform: TMenuItem
Caption = 'Transform Variables' Caption = 'Transform Variables'
OnClick = TransformClick OnClick = mnuVariablesTransformClick
end end
object Recode: TMenuItem object mnuVariablesRecode: TMenuItem
Caption = 'Recode Variables' Caption = 'Recode Variables'
OnClick = RecodeClick OnClick = mnuVariablesRecodeClick
end end
object Equation: TMenuItem object mnuVariablesEquationEditor: TMenuItem
Caption = 'Equation Editor' Caption = 'Equation Editor'
OnClick = EquationClick OnClick = mnuVariablesEquationEditorClick
end end
end end
object MenuItem3: TMenuItem object mnuTools: TMenuItem
Caption = 'Tools' Caption = 'Tools'
object FormatGrid: TMenuItem object mnuToolsFormatGrid: TMenuItem
Caption = 'Format Grid Cells' Caption = 'Format Grid Cells'
HelpContext = 15 HelpContext = 15
OnClick = FormatGridClick OnClick = mnuToolsFormatGridClick
end end
object SortCases: TMenuItem object mnuToolsSortCases: TMenuItem
Caption = 'Sort Cases' Caption = 'Sort Cases'
HelpContext = 16 HelpContext = 16
OnClick = SortCasesClick OnClick = mnuToolsSortCasesClick
end end
object PrintGrid: TMenuItem object mnuToolsPrintGrid: TMenuItem
Caption = 'Print Grid File' Caption = 'Print Grid File'
HelpContext = 17 HelpContext = 17
OnClick = PrintGridClick OnClick = mnuToolsPrintGridClick
end end
object MenuItem28: TMenuItem object mnuToolsOutputForm: TMenuItem
Caption = 'Show Output Form' Caption = 'Show Output Form'
OnClick = MenuItem28Click OnClick = mnuToolsOutputFormClick
end end
object SelectCases: TMenuItem object mnuToolsSelectCases: TMenuItem
Caption = 'Select Cases' Caption = 'Select Cases'
HelpContext = 18 HelpContext = 18
OnClick = SelectCasesClick OnClick = mnuToolsSelectCasesClick
end end
object LoadSubFile: TMenuItem object mnuToolsLoadSubFile: TMenuItem
Caption = 'Load a Sub File' Caption = 'Load a Sub File'
end end
object MenuItem30: TMenuItem object mnuToolsSwapRowsCols: TMenuItem
Caption = 'Swap Rows and Columns of Grid' Caption = 'Swap Rows and Columns of Grid'
OnClick = MenuItem30Click OnClick = mnuToolsSwapRowsColsClick
end end
object SwapDecType: TMenuItem object mnuToolsSwapDecType: TMenuItem
Caption = 'Change English to European or Vice Versa' Caption = 'Change English to European or Vice Versa'
OnClick = SwapDecTypeClick OnClick = mnuToolsSwapDecTypeClick
end end
object StrToIntegers: TMenuItem object mnuToolsStrToInt: TMenuItem
Caption = 'Convert strings to integer codes' Caption = 'Convert strings to integer codes'
OnClick = StrToIntegersClick OnClick = mnuToolsStrToIntClick
end end
object smooth: TMenuItem object mnuToolsSmooth: TMenuItem
Caption = 'Smooth Data in a Variable' Caption = 'Smooth Data in a Variable'
OnClick = smoothClick OnClick = mnuToolsSmoothClick
end end
object MenuItem15: TMenuItem object MenuItem15: TMenuItem
Caption = '-' Caption = '-'
end end
object Calculater: TMenuItem object mnuToolsCalculator: TMenuItem
Caption = 'Calculator' Caption = 'Calculator'
OnClick = CalculaterClick OnClick = mnuToolsCalculatorClick
end end
object JPEGView: TMenuItem object mnuToolsJPEGViewer: TMenuItem
Caption = 'JPEG Image Viewer' Caption = 'JPEG Image Viewer'
OnClick = JPEGViewClick OnClick = mnuToolsJPEGViewerClick
end end
end end
object MenuItem4: TMenuItem object mnuEdit: TMenuItem
Caption = 'Edit' Caption = 'Edit'
object blockcopy: TMenuItem object mnuEditCopyCells: TMenuItem
Caption = 'Copy a Block of Cells' Caption = 'Copy a Block of Cells'
HelpContext = 20 HelpContext = 20
OnClick = blockcopyClick OnClick = mnuEditCopyCellsClick
end end
object BlockPaste: TMenuItem object mnuEditPasteCells: TMenuItem
Caption = 'Paste a Block of Cells' Caption = 'Paste a Block of Cells'
HelpContext = 21 HelpContext = 21
OnClick = BlockPasteClick OnClick = mnuEditPasteCellsClick
end end
object BlockCut: TMenuItem object mnuEditCutCells: TMenuItem
Caption = 'Cut a Block of Cells' Caption = 'Cut a Block of Cells'
Visible = False Visible = False
end end
object MenuItem49: TMenuItem object mnuEditDIVIDER1: TMenuItem
Caption = '-' Caption = '-'
end end
object InsNewCol: TMenuItem object mnuEditNewCol: TMenuItem
Caption = 'Insert New Column' Caption = 'Insert New Column'
HelpContext = 22 HelpContext = 22
OnClick = InsNewColClick OnClick = mnuEditNewColClick
end end
object CopyCol: TMenuItem object mnuEditCopyCol: TMenuItem
Caption = 'Copy Column' Caption = 'Copy Column'
HelpContext = 23 HelpContext = 23
OnClick = CopyColClick OnClick = mnuEditCopyColClick
end end
object CutCol: TMenuItem object mnuEditCutCol: TMenuItem
Caption = 'Cut Column' Caption = 'Cut Column'
HelpContext = 24 HelpContext = 24
OnClick = CutColClick OnClick = mnuEditCutColClick
end end
object PasteCol: TMenuItem object mnuEditPasteCol: TMenuItem
Caption = 'Paste Column' Caption = 'Paste Column'
HelpContext = 25 HelpContext = 25
OnClick = PasteColClick OnClick = mnuEditPasteColClick
end end
object MenuItem48: TMenuItem object mnuEditDIVIDER2: TMenuItem
Caption = '-' Caption = '-'
end end
object NewRow: TMenuItem object mnuEditNewRow: TMenuItem
Caption = 'Insert New Row' Caption = 'Insert New Row'
HelpContext = 26 HelpContext = 26
OnClick = NewRowClick OnClick = mnuEditNewRowClick
end end
object CopyRowMenu: TMenuItem object mnuEditCopyRow: TMenuItem
Caption = 'Copy Row' Caption = 'Copy Row'
HelpContext = 27 HelpContext = 27
OnClick = CopyRowMenuClick OnClick = mnuEditCopyRowClick
end end
object CutRowMenu: TMenuItem object mnuEditCutRow: TMenuItem
Caption = 'Cut Row' Caption = 'Cut Row'
HelpContext = 28 HelpContext = 28
OnClick = CutRowMenuClick OnClick = mnuEditCutRowClick
end end
object PasteRowMenu: TMenuItem object mnuEditPasteRow: TMenuItem
Caption = 'Paste Row' Caption = 'Paste Row'
HelpContext = 29 HelpContext = 29
OnClick = PasteRowMenuClick OnClick = mnuEditPasteRowClick
end end
end end
object MenuItem5: TMenuItem object MenuItem5: TMenuItem
@ -950,116 +952,116 @@ object OS3MainFrm: TOS3MainFrm
OnClick = MatManMnuClick OnClick = MatManMnuClick
end end
end end
object Option: TMenuItem object mnuIOptions: TMenuItem
Caption = 'Options' Caption = 'Options'
object ShowOpts: TMenuItem object mnuShowOptions: TMenuItem
Caption = 'Show Options' Caption = 'Show Options'
OnClick = OptionClick OnClick = mnuShowOptionsClick
end end
object PicView: TMenuItem object PicView: TMenuItem
Caption = 'View Pictures' Caption = 'View Pictures'
Visible = False Visible = False
end end
end end
object MenuItem7: TMenuItem object mnuSimulations: TMenuItem
Caption = 'Simulations' Caption = 'Simulations'
object ScatPlot: TMenuItem object mnuSimBivarScatterPlot: TMenuItem
Caption = 'Bivariate Scatter Plot' Caption = 'Bivariate Scatter Plot'
OnClick = ScatPlotClick OnClick = mnuSimBivarScatterPlotClick
end end
object MultDists: TMenuItem object mnuSimMultiVarDists: TMenuItem
Caption = 'Multivariate Distribution' Caption = 'Multivariate Distribution'
OnClick = MultDistsClick OnClick = mnuSimMultiVarDistsClick
end end
object TypeErrors: TMenuItem object mnuSimTypeErrorCurves: TMenuItem
Caption = 'Type 1 and Type 2 Error Curves' Caption = 'Type 1 and Type 2 Error Curves'
OnClick = TypeErrorsClick OnClick = mnuSimTypeErrorCurvesClick
end end
object Power: TMenuItem object mnuSimPowerCurves: TMenuItem
Caption = 'Power Curves for a z test' Caption = 'Power Curves for a z test'
OnClick = PowerClick OnClick = mnuSimPowerCurvesClick
end end
object DistPlots: TMenuItem object mnuSimDistPlots: TMenuItem
Caption = 'Distribution Plots and Critical Values' Caption = 'Distribution Plots and Critical Values'
OnClick = DistPlotsClick OnClick = mnuSimDistPlotsClick
end end
object MenuItem52: TMenuItem object MenuItem52: TMenuItem
Caption = '-' Caption = '-'
end end
object SeqValues: TMenuItem object mnuSimGenerateSeqValues: TMenuItem
Caption = 'Generate Sequential Values' Caption = 'Generate Sequential Values'
OnClick = SeqValuesClick OnClick = mnuSimGenerateSeqValuesClick
end end
object RandomVals: TMenuItem object mnuSimGenerateRandomValues: TMenuItem
Caption = 'Random Theoretical Values' Caption = 'Random Theoretical Values'
OnClick = RandomValsClick OnClick = mnuSimGenerateRandomValuesClick
end end
object MenuItem51: TMenuItem object MenuItem51: TMenuItem
Caption = '-' Caption = '-'
end end
object Probabilities: TMenuItem object mnuSimProbabilities: TMenuItem
Caption = 'Probabilities' Caption = 'Probabilities'
object probgtz: TMenuItem object mnuSimProbGreaterZ: TMenuItem
Caption = 'Probability > z' Caption = 'Probability > z'
OnClick = probgtzClick OnClick = mnuSimProbGreaterZClick
end end
object Probltz: TMenuItem object mnuSimProbLessZ: TMenuItem
Caption = 'Probability < z' Caption = 'Probability < z'
OnClick = ProbltzClick OnClick = mnuSimProbLessZClick
end end
object probzbetween: TMenuItem object mnuSimProbBetween: TMenuItem
Caption = 'Probability between two z Values' Caption = 'Probability between two z Values'
OnClick = probzbetweenClick OnClick = mnuSimProbBetweenClick
end end
object MenuItem45: TMenuItem object MenuItem45: TMenuItem
Caption = '-' Caption = '-'
end end
object inversez: TMenuItem object mnuSimInverseZ: TMenuItem
Caption = 'z for a given Cumulative Probability' Caption = 'z for a given Cumulative Probability'
OnClick = inversezClick OnClick = mnuSimInverseZClick
end end
object MenuItem44: TMenuItem object mnuSimProbDIVIDER: TMenuItem
Caption = '-' Caption = '-'
end end
object Chiprob: TMenuItem object mnuSimChiSqProb: TMenuItem
Caption = 'Chi-Square Probability' Caption = 'Chi-Square Probability'
OnClick = ChiprobClick OnClick = mnuSimChiSqProbClick
end end
object tprob: TMenuItem object mnuSimStudentTProb: TMenuItem
Caption = 'Student t Probability' Caption = 'Student t Probability'
OnClick = tprobClick OnClick = mnuSimStudentTProbClick
end end
object Fprob: TMenuItem object mnuSimFProb: TMenuItem
Caption = 'F Probability' Caption = 'F Probability'
OnClick = FprobClick OnClick = mnuSimFProbClick
end end
object HypergeoProb: TMenuItem object mnuSimHyperGeomProb: TMenuItem
Caption = 'Hypergeometric Probability' Caption = 'Hypergeometric Probability'
OnClick = HypergeoProbClick OnClick = mnuSimHyperGeomProbClick
end end
end end
end end
object MenuItem8: TMenuItem object MenuItem8: TMenuItem
Caption = 'Help' Caption = 'Help'
object About: TMenuItem object mnuHelpAbout: TMenuItem
Caption = 'About...' Caption = 'About...'
OnClick = AboutClick OnClick = mnuHelpAboutClick
end end
object LicenseMenu: TMenuItem object mnuHelpLicense: TMenuItem
Caption = 'License...' Caption = 'License...'
OnClick = LicenseMenuClick OnClick = mnuHelpLicenseClick
end end
object MenuItem46: TMenuItem object MenuItem46: TMenuItem
Caption = '-' Caption = '-'
end end
object mnuShowTOC: TMenuItem object mnuHelpShowTOC: TMenuItem
Caption = 'Table of Contents' Caption = 'Table of Contents'
HelpContext = 152 HelpContext = 152
OnClick = mnuShowTOCClick OnClick = mnuHelpShowTOCClick
end end
object GridUse: TMenuItem object mnuHelpUsingGrid: TMenuItem
Caption = 'Using the Grid' Caption = 'Using the Grid'
OnClick = GridUseClick OnClick = mnuHelpUsingGridClick
end end
end end
end end

File diff suppressed because it is too large Load Diff

View File

@ -27,13 +27,13 @@ procedure CopyRow;
procedure PasteRow; procedure PasteRow;
procedure PrintDict(AReport: TStrings); procedure PrintDict(AReport: TStrings);
procedure PrintData(AReport: TStrings); procedure PrintData(AReport: TStrings);
function ValidValue(row, col : integer) : boolean; function ValidValue(row, col: integer): boolean;
function IsFiltered(GridRow : integer) : boolean; function IsFiltered(GridRow: integer): boolean;
procedure MatRead(const a: DblDyneMat; out NoRows, NoCols: integer; procedure MatRead(const a: DblDyneMat; out NoRows, NoCols: integer;
const Means, StdDevs: DblDyneVec; out NCases: integer; const Means, StdDevs: DblDyneVec; out NCases: integer;
const RowLabels, ColLabels: StrDyneVec; const AFilename: string); const RowLabels, ColLabels: StrDyneVec; const AFilename: string);
procedure MATSAVE(const a: DblDyneMat; NoRows, NoCols: Integer; procedure MatSave(const a: DblDyneMat; NoRows, NoCols: Integer;
const Means, StdDevs: DblDyneVec; NCases: integer; const Means, StdDevs: DblDyneVec; NCases: integer;
const RowLabels, ColLabels: StrDyneVec; AFileName: String); const RowLabels, ColLabels: StrDyneVec; AFileName: String);
@ -49,8 +49,8 @@ procedure SaveCommaFile;
procedure SaveSpaceFile; procedure SaveSpaceFile;
procedure ClearGrid; procedure ClearGrid;
procedure CopyIt; procedure CopyCellBlock;
procedure PasteIt; procedure PasteCellBlock;
procedure RowColSwap; procedure RowColSwap;
procedure MatToGrid(const mat: DblDyneMat; nsize: integer); procedure MatToGrid(const mat: DblDyneMat; nsize: integer);
procedure GetTypes; procedure GetTypes;
@ -1473,7 +1473,7 @@ begin
OS3MainFrm.DataGrid.Cells[0,0] := 'CASE/VAR.'; OS3MainFrm.DataGrid.Cells[0,0] := 'CASE/VAR.';
end; end;
procedure CopyIt; procedure CopyCellBlock;
var var
rowstart, rowend,colstart, colend, i, j: integer; rowstart, rowend,colstart, colend, i, j: integer;
buf: string; buf: string;
@ -1502,7 +1502,7 @@ begin
Clipboard.SetTextBuf(bf); Clipboard.SetTextBuf(bf);
end; end;
procedure PasteIt; procedure PasteCellBlock;
var var
astring, cellstr : string; astring, cellstr : string;
col, howlong, startcol : integer; col, howlong, startcol : integer;