You've already forked lazarus-ccr
LazStats: Fix crash in MatManUnit. Some simplification with file filters.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8014 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -288,31 +288,40 @@ implementation
|
|||||||
uses
|
uses
|
||||||
MainUnit;
|
MainUnit;
|
||||||
|
|
||||||
{ TMatManFrm }
|
const
|
||||||
|
FILE_FILTERS =
|
||||||
|
'Matrix (*.mat)|*.mat;*.MAT|' +
|
||||||
|
'Column Vector (*.cve)|*.cve;*.CVE|'+
|
||||||
|
'Row Vector (*.rve)|*.rve;*.RVE|'+
|
||||||
|
'Scalar (*.scl)|*.sca;*.SCA|'+
|
||||||
|
'All (*.*)|*.*';
|
||||||
|
|
||||||
|
|
||||||
|
{ TMatManFrm }
|
||||||
|
|
||||||
procedure TMatManFrm.FormCreate(Sender: TObject);
|
procedure TMatManFrm.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if ScriptEditorFrm <> nil then
|
if ScriptEditorFrm = nil then
|
||||||
Application.CreateForm(TScriptEditorFrm, ScriptEditorFrm);
|
Application.CreateForm(TScriptEditorFrm, ScriptEditorFrm);
|
||||||
if ScriptOptsFrm <> nil then
|
if ScriptOptsFrm = nil then
|
||||||
Application.CreateForm(TScriptOptsFrm, ScriptOptsFrm);
|
Application.CreateForm(TScriptOptsFrm, ScriptOptsFrm);
|
||||||
if OutputFrm <> nil then
|
if OutputFrm = nil then
|
||||||
Application.CreateForm(TOutputFrm, OutputFrm);
|
Application.CreateForm(TOutputFrm, OutputFrm);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMatManFrm.FormShow(Sender: TObject);
|
procedure TMatManFrm.FormShow(Sender: TObject);
|
||||||
|
const
|
||||||
|
matExt = '.mat';
|
||||||
|
cvecExt = '.cve';
|
||||||
|
rvecExt = '.rve';
|
||||||
|
scaExt = '.sca';
|
||||||
var
|
var
|
||||||
count, index : integer;
|
count, index : integer;
|
||||||
filename, matext, cvecext, rvecext, scaext, extstr : string;
|
filename, extstr : string;
|
||||||
scriptopts : TextFile;
|
scriptopts : TextFile;
|
||||||
checked : integer;
|
checked : integer;
|
||||||
begin
|
begin
|
||||||
ResetGrids(Self);
|
ResetGrids(Self);
|
||||||
matext := '.MAT';
|
|
||||||
cvecext := '.CVE';
|
|
||||||
rvecext := '.RVE';
|
|
||||||
scaext := '.SCA';
|
|
||||||
scripteditorfrm.FileListBox1.Directory := Options.DefaultDataPath;
|
scripteditorfrm.FileListBox1.Directory := Options.DefaultDataPath;
|
||||||
scripteditorfrm.FileListBox1.Update;
|
scripteditorfrm.FileListBox1.Update;
|
||||||
count := scripteditorfrm.FileListBox1.Items.Count;
|
count := scripteditorfrm.FileListBox1.Items.Count;
|
||||||
@ -326,9 +335,9 @@ begin
|
|||||||
if extstr = rvecext then RowVecsBox.Items.Add(filename);
|
if extstr = rvecext then RowVecsBox.Items.Add(filename);
|
||||||
if extstr = scaext then ScalarsBox.Items.Add(filename);
|
if extstr = scaext then ScalarsBox.Items.Add(filename);
|
||||||
end;
|
end;
|
||||||
if FileExists('Options.SCR') then
|
if FileExists('options.scr') then
|
||||||
begin
|
begin
|
||||||
AssignFile(scriptopts, 'Options.SCR');
|
AssignFile(scriptopts, 'options.scr');
|
||||||
Reset(scriptopts);
|
Reset(scriptopts);
|
||||||
Readln(scriptopts,checked);
|
Readln(scriptopts,checked);
|
||||||
if checked = 1 then scriptoptsfrm.CheckGroup1.Checked[0] := true;
|
if checked = 1 then scriptoptsfrm.CheckGroup1.Checked[0] := true;
|
||||||
@ -340,19 +349,18 @@ end;
|
|||||||
|
|
||||||
procedure TMatManFrm.Grid1Click(Sender: TObject);
|
procedure TMatManFrm.Grid1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
CurrentGrid := 1;
|
CurrentGrid := 1;
|
||||||
CurrentObjName := MatOneEdit.Text;
|
CurrentObjName := MatOneEdit.Text;
|
||||||
GridNoEdit.Text := IntToStr(1);
|
GridNoEdit.Text := IntToStr(1);
|
||||||
if ((Rows1 > 2) and (Cols1 > 2)) then CurrentObjType := 1;
|
if ((Rows1 > 2) and (Cols1 > 2)) then CurrentObjType := 1;
|
||||||
if ((Rows1 > 2) and (Cols1 = 2)) then CurrentObjType := 2;
|
if ((Rows1 > 2) and (Cols1 = 2)) then CurrentObjType := 2;
|
||||||
if ((Rows1 = 2) and (Cols1 > 2)) then CurrentObjType := 3;
|
if ((Rows1 = 2) and (Cols1 > 2)) then CurrentObjType := 3;
|
||||||
if ((Rows1 = 2) and (Cols1 = 2)) then CurrentObjType := 4;
|
if ((Rows1 = 2) and (Cols1 = 2)) then CurrentObjType := 4;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMatManFrm.Grid1KeyPress(Sender: TObject; var Key: char);
|
procedure TMatManFrm.Grid1KeyPress(Sender: TObject; var Key: char);
|
||||||
var
|
var
|
||||||
instr : string;
|
instr : string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Ord(Key) = 13 then // return pressed
|
if Ord(Key) = 13 then // return pressed
|
||||||
begin
|
begin
|
||||||
@ -1507,14 +1515,14 @@ end;
|
|||||||
|
|
||||||
procedure TMatManFrm.OpenFileMnuClick(Sender: TObject);
|
procedure TMatManFrm.OpenFileMnuClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
OpenDialog1.Filter := 'Matrix (*.mat)|*.MAT|Col.Vector (*.CVE)|*.CVE|RowVector (*.RVE)|*.RVE|Scaler (*.scl)|*.SCA|All (*.*)|*.*';
|
OpenDialog1.Filter := FILE_FILTERS;
|
||||||
OpenDialog1.FilterIndex := CurrentObjType;
|
OpenDialog1.FilterIndex := CurrentObjType;
|
||||||
case CurrentObjType of
|
case CurrentObjType of
|
||||||
1 : OpenDialog1.DefaultExt := '.MAT';
|
1 : OpenDialog1.DefaultExt := '.mat';
|
||||||
2 : OpenDialog1.DefaultExt := '.CVE';
|
2 : OpenDialog1.DefaultExt := '.cve';
|
||||||
3 : OpenDialog1.DefaultExt := '.RVE';
|
3 : OpenDialog1.DefaultExt := '.rve';
|
||||||
4 : OpenDialog1.DefaultExt := '.SCA';
|
4 : OpenDialog1.DefaultExt := '.sca';
|
||||||
else OpenDialog1.DefaultExt := '.MAT';
|
else OpenDialog1.DefaultExt := '.mat';
|
||||||
end;
|
end;
|
||||||
GridNoEdit.Text := IntToStr(CurrentGrid);
|
GridNoEdit.Text := IntToStr(CurrentGrid);
|
||||||
GetGridData(CurrentGrid);
|
GetGridData(CurrentGrid);
|
||||||
@ -3914,13 +3922,13 @@ var
|
|||||||
BackUpName : string;
|
BackUpName : string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SaveDialog1.Filter := 'Matrix (*.mat)|*.MAT|Col.Vector (*.CVE)|*.CVE|RowVector (*.RVE)|*.RVE|Scaler (*.scl)|*.SCA|All (*.*)|*.*';
|
SaveDialog1.Filter := FILE_FILTERS;
|
||||||
SaveDialog1.FilterIndex := CurrentObjType;
|
SaveDialog1.FilterIndex := CurrentObjType;
|
||||||
case CurrentObjType of
|
case CurrentObjType of
|
||||||
1 : SaveDialog1.DefaultExt := '.MAT';
|
1 : SaveDialog1.DefaultExt := '.mat';
|
||||||
2 : SaveDialog1.DefaultExt := '.CVE';
|
2 : SaveDialog1.DefaultExt := '.cve';
|
||||||
3 : SaveDialog1.DefaultExt := '.RVE';
|
3 : SaveDialog1.DefaultExt := '.rve';
|
||||||
4 : SaveDialog1.DefaultExt := '.SCA';
|
4 : SaveDialog1.DefaultExt := '.sca';
|
||||||
end;
|
end;
|
||||||
BackUpName := ExtractFileName(CurrentObjName);
|
BackUpName := ExtractFileName(CurrentObjName);
|
||||||
SaveDialog1.FileName := BackUpName;
|
SaveDialog1.FileName := BackUpName;
|
||||||
@ -6586,7 +6594,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMatManFrm.DynMatPrint(var xmat: DynMat; rows, cols: integer;
|
procedure TMatManFrm.DynMatPrint(var xmat: DynMat; rows, cols: integer;
|
||||||
var title: string; var ColHeadings: Dynstrarray);
|
var title: string; var ColHeadings: DynStrArray);
|
||||||
var
|
var
|
||||||
i, j, first, last, nflds : integer;
|
i, j, first, last, nflds : integer;
|
||||||
done : boolean;
|
done : boolean;
|
||||||
|
Reference in New Issue
Block a user