-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmooset.pas
115 lines (106 loc) · 2.47 KB
/
mooset.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
unit mooset;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmMovieSettings = class(TForm)
cmdOK: TButton;
cmdCancel: TButton;
m_strWidth: TEdit;
m_strHeight: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure cmdOKClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
m_bOK : BOOLEAN;
end;
implementation
{$R *.dfm}
procedure TfrmMovieSettings.cmdOKClick(Sender: TObject);
var
v, code : integer;
begin
val(m_strWidth.Text, v, code);
if (code <> 0) then
begin
MessageBox(handle, 'The width value can only be an integer value', 'Error', MB_OK or MB_ICONERROR);
exit;
end;
val(m_strHeight.Text, v, code);
if (code <> 0) then
begin
MessageBox(handle, 'The height value can only be an integer value', 'Error', MB_OK or MB_ICONERROR);
exit;
end;
m_bOK := TRUE;
{assignfile(t, 'settings.cfg');
if not fileexists('settings.cfg') then
begin
rewrite(t);
end else
begin
reset(t);
end;
while not (eof(t)) do
begin
read(t, strHeading);
if uppercase(strHeading) = '[MOVIE WIDTH]' then
begin
strValue := m_strWidth.Text;
write(t, strValue);
end else
if uppercase(strHeading) = '[MOVIE HEIGHT]' then
begin
strValue := m_strHeight.Text;
write(t, strValue);
end else
begin
read(t, strValue);
end;
end;
closefile(t);}
Close;
end;
procedure TfrmMovieSettings.cmdCancelClick(Sender: TObject);
begin
m_bOK := FALSe;
Close;
end;
procedure TfrmMovieSettings.FormCreate(Sender: TObject);
type
str128 = string[128];
var
t : file of str128;
strHeading, strValue : str128;
begin
if (fileexists('settings.cfg')) then
begin
assignfile(t, 'settings.cfg');
reset(t);
while not eof(t) do
begin
read(t, strHeading);
if (uppercase(strHeading) = '[MOVIE WIDTH]') then
begin
read(t, strValue);
m_strWidth.Text := strValue;
end else
if (uppercase(strHeading) = '[MOVIE HEIGHT]') then
begin
read(t, strValue);
m_strHeight.Text := strValue;
end else
begin
read(t, strValue);
end;
end;
closefile(t);
end;
end;
end.