diff --git a/applications/lazstats/source/LazStats.lpi b/applications/lazstats/source/LazStats.lpi index 91cd4eea2..4ecc7a7ab 100644 --- a/applications/lazstats/source/LazStats.lpi +++ b/applications/lazstats/source/LazStats.lpi @@ -49,7 +49,7 @@ - + @@ -1429,6 +1429,13 @@ + + + + + + + diff --git a/applications/lazstats/source/LazStats.lpr b/applications/lazstats/source/LazStats.lpr index a151c287b..ea6dfea7e 100644 --- a/applications/lazstats/source/LazStats.lpr +++ b/applications/lazstats/source/LazStats.lpr @@ -8,7 +8,8 @@ uses {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, - Globals, LicenseUnit, OptionsUnit, MainDM, MainUnit, ReportFrameUnit; + Globals, LicenseUnit, OptionsUnit, MainDM, MainUnit, ReportFrameUnit, +BasicStatsFormUnit; {$R LazStats.res} @@ -28,6 +29,7 @@ begin end; Application.CreateForm(TMainDataModule, MainDataModule); Application.CreateForm(TOS3MainFrm, OS3MainFrm); + Application.CreateForm(TBasicStatsForm, BasicStatsForm); Application.Run; end. diff --git a/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.lfm index 2ee365917..1411600ec 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.lfm @@ -1,4 +1,4 @@ -object BoxPlotFrm: TBoxPlotFrm +inherited BoxPlotFrm: TBoxPlotFrm Left = 449 Height = 500 Top = 211 diff --git a/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas b/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas index 44e158e32..f945d638b 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/boxplotunit.pas @@ -9,14 +9,15 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Printers, ComCtrls, Buttons, - MainUnit, Globals, DataProcs, ContextHelpUnit, ReportFrameUnit, ChartFrameUnit; + MainUnit, Globals, DataProcs, ContextHelpUnit, + BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit; type { TBoxPlotFrm } - TBoxPlotFrm = class(TForm) + TBoxPlotFrm = class(TBasicStatsForm) Bevel2: TBevel; HelpBtn: TButton; PageControl1: TPageControl; @@ -62,7 +63,7 @@ type public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas b/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas index 6e9816e8f..e36735840 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/bubbleplotunit.pas @@ -9,14 +9,15 @@ interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Clipbrd, Buttons, ExtCtrls, ComCtrls, Math, - MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit, ChartFrameUnit, ReportFrameUnit; + MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit, + BasicStatsFormUnit, ChartFrameUnit, ReportFrameUnit; type { TBubbleForm } - TBubbleForm = class(TForm) + TBubbleForm = class(TBasicStatsForm) Bevel1: TBevel; HelpBtn: TButton; PageControl: TPageControl; @@ -79,7 +80,7 @@ type procedure UpdateBtnStates; public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.lfm index 8b02408e8..69b624ea1 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.lfm @@ -1,4 +1,4 @@ -object DescriptiveFrm: TDescriptiveFrm +inherited DescriptiveFrm: TDescriptiveFrm Left = 526 Height = 384 Top = 202 diff --git a/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.pas b/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.pas index 8a3cf9a94..69b087ee0 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/descriptiveunit.pas @@ -7,14 +7,15 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Buttons, - MainUnit, Globals, FunctionsLib, ReportFrameUnit, DataProcs, DictionaryUnit, ContextHelpUnit; + MainUnit, Globals, FunctionsLib, BasicStatsFormUnit, + ReportFrameUnit, DataProcs, DictionaryUnit, ContextHelpUnit; type { TDescriptiveFrm } - TDescriptiveFrm = class(TForm) + TDescriptiveFrm = class(TBasicStatsForm) Bevel1: TBevel; ComputeBtn: TButton; CaseChk: TCheckBox; @@ -60,7 +61,7 @@ type public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/freqspecsunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/freqspecsunit.lfm deleted file mode 100644 index 1252c0c57..000000000 --- a/applications/lazstats/source/forms/analysis/descriptive/freqspecsunit.lfm +++ /dev/null @@ -1,266 +0,0 @@ -object FreqSpecsFrm: TFreqSpecsFrm - Left = 310 - Height = 331 - Top = 137 - Width = 325 - AutoSize = True - BorderStyle = bsSingle - Caption = 'Frequency Specifications' - ClientHeight = 331 - ClientWidth = 325 - OnActivate = FormActivate - Position = poMainFormCenter - LCLVersion = '2.1.0.0' - object Label1: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = VarName - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 84 - Width = 44 - BorderSpacing.Left = 8 - Caption = 'Variable:' - ParentColor = False - end - object Label2: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Minimum - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 115 - Width = 53 - BorderSpacing.Left = 8 - Caption = 'Minimum' - ParentColor = False - end - object Label3: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Maximum - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 146 - Width = 55 - BorderSpacing.Left = 8 - Caption = 'Maximum' - ParentColor = False - end - object Label4: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Range - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 177 - Width = 33 - BorderSpacing.Left = 8 - Caption = 'Range' - ParentColor = False - end - object Label5: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = IntSize - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 208 - Width = 62 - BorderSpacing.Left = 8 - Caption = 'Interval Size' - ParentColor = False - end - object Label6: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = NoInts - AnchorSideTop.Side = asrCenter - Left = 8 - Height = 15 - Top = 239 - Width = 105 - BorderSpacing.Left = 8 - Caption = 'Number of Intervals' - ParentColor = False - end - object VarName: TEdit - AnchorSideLeft.Control = NoInts - AnchorSideTop.Control = Memo1 - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 137 - Height = 23 - Top = 80 - Width = 180 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 12 - BorderSpacing.Right = 8 - ReadOnly = True - TabOrder = 0 - end - object Minimum: TEdit - AnchorSideLeft.Control = NoInts - AnchorSideTop.Control = VarName - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 137 - Height = 23 - Top = 111 - Width = 180 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - ReadOnly = True - TabOrder = 1 - end - object Maximum: TEdit - AnchorSideLeft.Control = NoInts - AnchorSideTop.Control = Minimum - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 137 - Height = 23 - Top = 142 - Width = 180 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - ReadOnly = True - TabOrder = 2 - end - object Range: TEdit - AnchorSideLeft.Control = NoInts - AnchorSideTop.Control = Maximum - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 137 - Height = 23 - Top = 173 - Width = 180 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - ReadOnly = True - TabOrder = 3 - end - object IntSize: TEdit - AnchorSideLeft.Control = NoInts - AnchorSideTop.Control = Range - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 137 - Height = 23 - Top = 204 - Width = 180 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - OnKeyPress = IntSizeKeyPress - TabOrder = 4 - end - object NoInts: TEdit - AnchorSideLeft.Control = Label6 - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = IntSize - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 137 - Height = 23 - Top = 235 - Width = 180 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 24 - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - TabOrder = 5 - end - object CancelBtn: TButton - AnchorSideTop.Control = Bevel1 - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = OKBtn - Left = 201 - Height = 25 - Top = 274 - Width = 62 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Cancel' - ModalResult = 2 - TabOrder = 7 - end - object OKBtn: TButton - AnchorSideTop.Control = Bevel1 - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 275 - Height = 25 - Top = 274 - Width = 42 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Top = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'OK' - ModalResult = 1 - OnClick = OKBtnClick - TabOrder = 8 - end - object HelpBtn: TButton - Tag = 123 - AnchorSideTop.Control = Bevel1 - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = CancelBtn - Left = 138 - Height = 25 - Top = 274 - Width = 51 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Left = 36 - BorderSpacing.Top = 8 - BorderSpacing.Right = 12 - BorderSpacing.Bottom = 8 - Caption = 'Help' - OnClick = HelpBtnClick - TabOrder = 6 - end - object Bevel1: TBevel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = NoInts - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 0 - Height = 8 - Top = 258 - Width = 325 - Anchors = [akTop, akLeft, akRight] - Shape = bsBottomLine - end - object Memo1: TLabel - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Owner - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 8 - Height = 60 - Top = 8 - Width = 309 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Around = 8 - Caption = 'The number of intervals must be less than or equal to the number of cases. To change the number of intervals, change the interval size to a larger value. Press the Enter key to make the number of intervals smaller.' - ParentColor = False - WordWrap = True - end -end diff --git a/applications/lazstats/source/forms/analysis/descriptive/freqspecsunit.pas b/applications/lazstats/source/forms/analysis/descriptive/freqspecsunit.pas deleted file mode 100644 index 5161b4cf6..000000000 --- a/applications/lazstats/source/forms/analysis/descriptive/freqspecsunit.pas +++ /dev/null @@ -1,149 +0,0 @@ -unit FreqSpecsUnit; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, ExtCtrls, - ContextHelpUnit; - -type - - { TFreqSpecsFrm } - - TFreqSpecsFrm = class(TForm) - Bevel1: TBevel; - CancelBtn: TButton; - HelpBtn: TButton; - Memo1: TLabel; - OKBtn: TButton; - VarName: TEdit; - Minimum: TEdit; - Maximum: TEdit; - Range: TEdit; - IntSize: TEdit; - NoInts: TEdit; - Label1: TLabel; - Label2: TLabel; - Label3: TLabel; - Label4: TLabel; - Label5: TLabel; - Label6: TLabel; - procedure FormActivate(Sender: TObject); - procedure HelpBtnClick(Sender: TObject); - procedure IntSizeKeyPress(Sender: TObject; var Key: char); - procedure OKBtnClick(Sender: TObject); - private - { private declarations } - FAutoSized: Boolean; - FNoCases: Integer; - function Validate(out AMsg: String; out AControl: TWinControl): Boolean; - public - { public declarations } - property NoCases: Integer read FNoCases write FNoCases; - end; - -var - FreqSpecsFrm: TFreqSpecsFrm; - -implementation - -uses - Math; - -{ TFreqSpecsFrm } - -procedure TFreqSpecsFrm.IntSizeKeyPress(Sender: TObject; var Key: char); -var - rangeval : double; - increment : double; -begin - if ord(Key) <> 13 then exit; - rangeval := StrToFloat(Range.Text); - increment := StrToFloat(IntSize.Text); - NoInts.Text := FloatToStr(rangeval / increment); -end; - -procedure TFreqSpecsFrm.OKBtnClick(Sender: TObject); -var - msg: String; - C: TWinControl; -begin - if not Validate(msg, C) then begin - C.SetFocus; - MessageDlg(msg, mtError, [mbOK], 0); - ModalResult := mrNone; - end; -end; - -function TFreqSpecsFrm.Validate(out AMsg: String; - out AControl: TWinControl): Boolean; -var - NoIntervals: Integer; - f: Double; -begin - Result := False; - if IntSize.Text = '' then - begin - AControl := IntSize; - AMsg := 'Interval size is not specified.'; - exit; - end; - if not TryStrToFloat(IntSize.Text, f) then - begin - AControl := IntSize; - AMsg := 'No valid number given for interval size.'; - exit; - end; - if NoInts.Text = '' then - begin - AControl := NoInts; - AMsg := 'Number of intervals not specified.'; - exit; - end; - if not TryStrToInt(NoInts.Text, NoIntervals) then - begin - AControl := NoInts; - AMsg := 'No valid number given for number of intervals.'; - exit; - end; - if NoIntervals + 1 > NoCases then begin - AControl := NoInts; - AMsg := Format('Number of intervals cannot be greater than the number of cases (%d).', [NoCases]); - exit; - end; - Result := true; -end; - -procedure TFreqSpecsFrm.FormActivate(Sender: TObject); -var - w: Integer; -begin - if FAutoSized then - exit; - - w := MaxValue([OKBtn.Width, CancelBtn.Width, HelpBtn.Width]); - OKBtn.Constraints.MinWidth := w; - CancelBtn.Constraints.MinWidth := w; - HelpBtn.Constraints.MinWidth := w; - Constraints.MinHeight := Height; - Constraints.MaxHeight := Height; - HelpBtn.BorderSpacing.Left := NoInts.Left; - - FAutoSized := true; -end; - -procedure TFreqSpecsFrm.HelpBtnClick(Sender: TObject); -begin - if ContextHelpForm = nil then - Application.CreateForm(TContextHelpForm, ContextHelpForm); - ContextHelpForm.HelpMessage((Sender as TButton).tag); -end; - -initialization - {$I freqspecsunit.lrs} - -end. - diff --git a/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm b/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm index 28f5dc866..8c1b9362a 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/frequnit.lfm @@ -1,4 +1,4 @@ -object FreqFrm: TFreqFrm +inherited FreqFrm: TFreqFrm Left = 490 Height = 376 Top = 228 diff --git a/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas b/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas index db9ec836b..9d2a15ebd 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas @@ -9,13 +9,13 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin, - Globals, MainUnit, GraphLib, DataProcs, ReportFrameUnit, ChartFrameUnit; + Globals, MainUnit, GraphLib, DataProcs, BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit; type { TFreqFrm } - TFreqFrm = class(TForm) + TFreqFrm = class(TBasicStatsForm) Bevel1: TBevel; BinSelectionGroup: TGroupBox; ThreeDChk: TCheckBox; @@ -70,7 +70,7 @@ type procedure UpdateBtnStates; public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.lfm index 70dcfb631..0dfe649b0 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.lfm @@ -1,4 +1,4 @@ -object MultXvsYFrm: TMultXvsYFrm +inherited MultXvsYFrm: TMultXvsYFrm Left = 814 Height = 416 Top = 216 diff --git a/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.pas b/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.pas index 45cabcbda..e21b83faf 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/multxvsyunit.pas @@ -10,13 +10,14 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Buttons, Clipbrd, - MainUnit, Globals, OutputUnit, DataProcs, DictionaryUnit, ContextHelpUnit; + MainUnit, Globals, OutputUnit, DataProcs, DictionaryUnit, ContextHelpUnit, + BasicStatsFormUnit; type { TMultXvsYFrm } - TMultXvsYFrm = class(TForm) + TMultXvsYFrm = class(TBasicStatsForm) Bevel1: TBevel; HelpBtn: TButton; Panel1: TPanel; @@ -71,7 +72,7 @@ type public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/normalityunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/normalityunit.lfm index 20e0ed072..a060a45fe 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/normalityunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/normalityunit.lfm @@ -1,4 +1,4 @@ -object NormalityFrm: TNormalityFrm +inherited NormalityFrm: TNormalityFrm Left = 628 Height = 516 Top = 275 diff --git a/applications/lazstats/source/forms/analysis/descriptive/normalityunit.pas b/applications/lazstats/source/forms/analysis/descriptive/normalityunit.pas index bca6f8767..48176c099 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/normalityunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/normalityunit.pas @@ -9,14 +9,15 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, - MainUnit, Globals, FunctionsLib, DataProcs, ReportFrameUnit, ChartFrameUnit; + MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsFormUnit, + ReportFrameUnit, ChartFrameUnit; type { TNormalityFrm } - TNormalityFrm = class(TForm) + TNormalityFrm = class(TBasicStatsForm) Bevel1: TBevel; PageControl: TPageControl; ParamsPanel: TPanel; @@ -56,7 +57,7 @@ type public { public declarations } - procedure Reset; + procedure Reset; override; end; var @@ -467,6 +468,8 @@ begin VarList.Items.Clear; for i := 1 to NoVariables do VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + FReportFrame.Clear; + FChartFrame.Clear; UpdateBtnStates; end; diff --git a/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.lfm index 91f7a6376..c2fd48db6 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.lfm @@ -1,4 +1,4 @@ -object PlotXYFrm: TPlotXYFrm +inherited PlotXYFrm: TPlotXYFrm Left = 427 Height = 500 Top = 175 diff --git a/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas b/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas index 206c97284..050e37582 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/plotxyunit.pas @@ -9,13 +9,14 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Buttons, ComCtrls, - MainUnit, Globals, FunctionsLib, DataProcs, ReportFrameUnit, ChartFrameUnit; + MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsFormUnit, + ReportFrameUnit, ChartFrameUnit; type { TPlotXYFrm } - TPlotXYFrm = class(TForm) + TPlotXYFrm = class(TBasicStatsForm) Bevel1: TBevel; ConfEdit: TEdit; Label4: TLabel; @@ -64,7 +65,7 @@ type Xcol,Ycol: Integer): Boolean; public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.lfm b/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.lfm index 5918194dc..df1c97178 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.lfm +++ b/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.lfm @@ -1,4 +1,4 @@ -object XvsMultYForm: TXvsMultYForm +inherited XvsMultYForm: TXvsMultYForm Left = 288 Height = 500 Top = 117 diff --git a/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas b/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas index e4d086665..20f35eb6f 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas @@ -9,14 +9,14 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls, - MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, + MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit; type { TXvsMultYForm } - TXvsMultYForm = class(TForm) + TXvsMultYForm = class(TBasicStatsForm) Bevel2: TBevel; LinesBox: TCheckBox; GroupBox1: TGroupBox; @@ -64,7 +64,7 @@ type procedure UpdateBtnStates; public { public declarations } - procedure Reset; + procedure Reset; override; end; var diff --git a/applications/lazstats/source/forms/mainunit.lfm b/applications/lazstats/source/forms/mainunit.lfm index 544705628..d286a6cfd 100644 --- a/applications/lazstats/source/forms/mainunit.lfm +++ b/applications/lazstats/source/forms/mainunit.lfm @@ -232,7 +232,9 @@ object OS3MainFrm: TOS3MainFrm TitleFont.Name = 'Courier New' TitleFont.Pitch = fpFixed TitleFont.Quality = fqDraft + OnCellProcess = DataGridCellProcess OnClick = DataGridClick + OnEditingDone = DataGridEditingDone OnKeyDown = DataGridKeyDown OnKeyPress = DataGridKeyPress OnPrepareCanvas = DataGridPrepareCanvas diff --git a/applications/lazstats/source/forms/mainunit.pas b/applications/lazstats/source/forms/mainunit.pas index 54bdc557f..550d68b05 100644 --- a/applications/lazstats/source/forms/mainunit.pas +++ b/applications/lazstats/source/forms/mainunit.pas @@ -21,7 +21,7 @@ unit MainUnit; interface uses - LCLType, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, + LCLType, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, ExtCtrls, StdCtrls, Grids, {$IFDEF USE_EXTERNAL_HELP_VIEWER} {$IFDEF MSWINDOWS} @@ -285,6 +285,9 @@ type DataGrid: TStringGrid; // Form event handlers + procedure DataGridCellProcess(Sender: TObject; aCol, aRow: Integer; + processType: TCellProcessType; var aValue: string); + procedure DataGridEditingDone(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -492,6 +495,7 @@ type LHelpConnector: TLHelpConnector; {$ENDIF} procedure Init; + procedure ResetForms; public { public declarations } end; @@ -503,8 +507,11 @@ var implementation +{$R *.lfm} + uses - Utils, OptionsUnit, OutputUnit, LicenseUnit, TransFrmUnit, DescriptiveUnit, + Utils, BasicStatsFormUnit, + OptionsUnit, OutputUnit, LicenseUnit, TransFrmUnit, DescriptiveUnit, FreqUnit, CrossTabUnit, BreakDownUnit, BoxPlotUnit, NormalityUnit, Rot3DUnit, PlotXYUnit, BubblePlotUnit, StemLeafUnit, MultXvsYUnit, OneSampUnit, TwoCorrsUnit, TwoPropUnit, TtestUnit, BlkAnovaUnit, WithinANOVAUnit, @@ -548,6 +555,18 @@ begin CanClose := (res = mrYes); end; +procedure TOS3MainFrm.DataGridEditingDone(Sender: TObject); +begin + ResetForms; +end; + +procedure TOS3MainFrm.DataGridCellProcess(Sender: TObject; aCol, aRow: Integer; + processType: TCellProcessType; var aValue: string); +begin + if ProcessType = cpPaste then + ResetForms; +end; + procedure TOS3MainFrm.FormCreate(Sender: TObject); var helpfn: String; @@ -1243,6 +1262,8 @@ begin NoVarsEdit.Text := IntToStr(DataGrid.ColCount-1); NoCasesEdit.Text := IntToStr(DataGrid.RowCount-1); + + ResetForms; end; // Menu "Edit" > "Copy Block of Cells" @@ -1342,76 +1363,45 @@ end; procedure TOS3MainFrm.mnuFileImportCSVClick(Sender: TObject); begin OpenCommaFile; + ResetForms; end; // Menu "File" > "Import" > "SPACE File" procedure TOS3MainFrm.mnuFileImportSSVClick(Sender: TObject); begin OpenSpaceFile; + ResetForms; end; // Menu "File" > "Import" > "TAB File" procedure TOS3MainFrm.mnuFileImportTABClick(Sender: TObject); begin OpenTabFile; + ResetForms; end; // Menu "File" > "New" procedure TOS3MainFrm.mnuFileNewClick(Sender: TObject); begin ClearGrid; + ResetForms; end; // Menu "File" > "Open" procedure TOS3MainFrm.mnuFileOpenClick(Sender: TObject); -{ -var - i : integer; - filename : string; - } begin - OpenOS2File; - SaveOptions; - (* - filename := FileNameEdit.Text; - // move all down 1 and add new one at the top -{ for i := 8 downto 1 do - begin - MainMenu.Items[0].Items[11].Items[i].Caption := - MainMenu.Items[0].Items[11].Items[i-1].Caption; - MainMenu.Items[0].Items[11].Items[i-1].Caption := ' '; - end; - MainMenu.Items[0].Items[11].Items[0].Caption := filename;} - if OptionsFrm = nil then - Application.CreateForm(TOptionsFrm, OptionsFrm); - OptionsFrm.SaveBtnClick(Self); - *) + if OpenOS2File then + begin + SaveOptions; + ResetForms; + end; end; // Menu "File" > "Save" procedure TOS3MainFrm.mnuFileSaveClick(Sender: TObject); -(* -var - i : integer; - filename : string; - *) begin SaveOS2File; SaveOptions; - (* - filename := FileNameEdit.Text; - // move all down 1 and add new one at the top -{ for i := 8 downto 1 do - begin - MainMenu.Items[0].Items[11].Items[i].Caption := - MainMenu.Items[0].Items[11].Items[i-1].Caption; - MainMenu.Items[0].Items[11].Items[i-1].Caption := ' '; - end; - MainMenu.Items[0].Items[11].Items[0].Caption := filename;} - if OptionsFrm = nil then - Application.CreateForm(TOptionsFrm, OptionsFrm); - OptionsFrm.SaveBtnClick(Self); - *) end; // Menu "Help" > "About" @@ -2209,10 +2199,15 @@ begin end; +procedure TOS3MainFrm.ResetForms; +var + i: Integer; +begin + for i := 0 to Screen.FormCount-1 do + if Screen.Forms[i] is TBasicStatsForm then + TBasicStatsForm(Screen.Forms[i]).Reset; +end; -initialization - {$I mainunit.lrs} - end. diff --git a/applications/lazstats/source/forms/misc/basicstatsformunit.lfm b/applications/lazstats/source/forms/misc/basicstatsformunit.lfm new file mode 100644 index 000000000..1390d9336 --- /dev/null +++ b/applications/lazstats/source/forms/misc/basicstatsformunit.lfm @@ -0,0 +1,8 @@ +object BasicStatsForm: TBasicStatsForm + Left = 519 + Height = 459 + Top = 260 + Width = 717 + Caption = 'BasicStatsForm' + LCLVersion = '2.1.0.0' +end diff --git a/applications/lazstats/source/forms/misc/basicstatsformunit.pas b/applications/lazstats/source/forms/misc/basicstatsformunit.pas new file mode 100644 index 000000000..db99fc810 --- /dev/null +++ b/applications/lazstats/source/forms/misc/basicstatsformunit.pas @@ -0,0 +1,32 @@ +unit BasicStatsFormUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs; + +type + TBasicStatsForm = class(TForm) + private + + public + procedure Reset; virtual; + + end; + +var + BasicStatsForm: TBasicStatsForm; + +implementation + +{$R *.lfm} + +procedure TBasicStatsForm.Reset; +begin + // to be overridden +end; + +end. + diff --git a/applications/lazstats/source/units/dataprocs.pas b/applications/lazstats/source/units/dataprocs.pas index 0d7a60348..9804fea4c 100644 --- a/applications/lazstats/source/units/dataprocs.pas +++ b/applications/lazstats/source/units/dataprocs.pas @@ -15,8 +15,8 @@ procedure FormatGrid; function IsNumeric(s : string) : boolean; procedure VecPrint(vector: IntDyneVec; Size: integer; Heading: string; AReport: TStrings); procedure SaveOS2File; -procedure OpenOS2File; -procedure OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean); +function OpenOS2File: Boolean; +function OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean): Boolean; procedure DeleteCol; procedure CopyColumn; procedure PasteColumn; @@ -276,8 +276,9 @@ begin end; //------------------------------------------------------------------- -procedure OpenOS2File; +function OpenOS2File: Boolean; begin + Result := false; with OS3MainFrm.OpenDialog do begin DefaultExt := '.laz'; @@ -286,19 +287,20 @@ begin InitialDir := Globals.Options.DefaultDataPath; FilterIndex := 1; if Execute then begin - OpenOS2File(FileName, true); + Result := OpenOS2File(FileName, true); InitialDir := ExtractFilePath(FileName); end; end; end; -procedure OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean); +function OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean): Boolean; var F: TextFile; s: string; i, j: integer; NRows, NCols: integer; begin + Result := false; if Lowercase(ExtractFileExt(AFileName)) <> '.laz' then begin MessageDlg(Format('"%s" is not a .laz file.', [AFileName]), mtError, [mbOK], 0); @@ -374,6 +376,7 @@ begin if ShowDictionaryForm then DictionaryFrm.ShowModal; FormatGrid; + Result := true; end; //-------------------------------------------------------------------