-
Notifications
You must be signed in to change notification settings - Fork 0
/
pm_obj.pas
321 lines (287 loc) · 6.66 KB
/
pm_obj.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
Unit PM_Obj;
INTERFACE
Uses
Use32,
App,Objects,Views,Dialogs,Drivers,Menus,Memory,HistList,
{** pm units **}
Incl,Parser,Dates;
Type
PMyProgram=^TMyProgram;
TMyProgram=Object(TProgram)
Constructor Init;
Procedure InitScreen;Virtual;
procedure InitDesktop; virtual;
procedure InitMenuBar; virtual;
procedure InitStatusLine; virtual;
Destructor Done;Virtual;
End;
Type
PMyApplication=^TMyApplication;
TMyApplication=Object(TMyProgram)
Constructor Init;
Destructor Done; Virtual;
End;
Type
PProgressBar=^TProgressBar;
{ TProgressBar=Object(TDialog)
Bar:PStaticText;
Constructor Init(var Bounds: TRect; ATitle: TTitleStr);
Procedure DrawSkeleton;
Destructor Done;virtual;}
TProgressBar=Object(TStaticText)
Constructor Init(var Bounds: TRect; AText: String);
Procedure Draw;virtual;
Procedure DrawSkeleton;
Destructor Done;virtual;
End;
Type
PLogScroller=^TLogScroller;
TLogScroller=Object(TScroller)
Log:PStringCollection;
Constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
PScrollBar);
Procedure Draw;virtual;
Destructor Done;virtual;
End;
Type
PBackgroundWindow=^TBackgroundWindow;
TBackgroundWindow=Object(TWindow)
Constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber:
Integer);
Destructor Done;virtual;
End;
Type
PInfoWindow=^TInfoWindow;
TInfoWindow=Object(TWindow)
Constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber:
Integer);
Destructor Done;virtual;
End;
Type
PLogWindow=^TLogWindow;
TLogWindow=Object(TWindow)
{ LogScroller:PLogScroller;}
Constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber:
Integer);
Destructor Done;virtual;
End;
IMPLEMENTATION
{*** Begin TMyProgram ***}
procedure TMyProgram.InitScreen;
begin
{ FIXME}
{ Temp. disabled}
Exit;
(* if Lo(ScreenMode) <> smMono then
begin
if ScreenMode and smFont8x8 <> 0 then
ShadowSize.X := 1 else
ShadowSize.X := 2;
ShadowSize.Y := 1;
ShowMarkers := False;
if Lo(ScreenMode) = smBW80 then
AppPalette := apBlackWhite else
AppPalette := apColor;
end else
begin
ShadowSize.X := 0;
ShadowSize.Y := 0;
ShowMarkers := True;
AppPalette := apMonochrome;
end; *)
end;
Constructor TMyProgram.Init;
var
R: TRect;
begin
Application := @Self;
InitScreen;
R.Assign(0, 0, ScreenWidth, ScreenHeight);
TGroup.Init(R);
State := sfVisible + sfSelected + sfFocused + sfModal + sfExposed;
Options := 0;
Buffer := ScreenBuffer;
InitDesktop;
InitStatusLine;
InitMenuBar;
if Desktop <> nil then
Insert(Desktop);
if StatusLine <> nil then
Insert(StatusLine);
if MenuBar <> nil then
Insert(MenuBar);
end;
destructor TMyProgram.Done;
begin
if Desktop <> nil then
Begin
Dispose(Desktop, Done);
Desktop:=Nil;
End;
if MenuBar <> nil then
Begin
Dispose(MenuBar, Done);
MenuBar:=Nil;
End;
if StatusLine <> nil then
Begin
Dispose(StatusLine, Done);
StatusLine:=Nil;
End;
Application := nil;
inherited Done;
end;
procedure TMyProgram.InitDesktop;
var
R: TRect;
Begin
If MODE_NOCONSOLE Then
Desktop:=Nil
Else
Begin
GetExtent(R);
Inc(R.A.Y);
Dec(R.B.Y);
New(Desktop, Init(R));
End;
End;
procedure TMyProgram.InitMenuBar;
var
R: TRect;
Begin
If MODE_NOCONSOLE Then
MenuBar:=Nil
Else
Begin
GetExtent(R);
R.B.Y := R.A.Y + 1;
MenuBar := New(PMenuBar, Init(R, nil));
End;
End;
procedure TMyProgram.InitStatusLine;
var
R: TRect;
Begin
If MODE_NOCONSOLE Then
StatusLine:=Nil
Else
Begin
GetExtent(R);
R.A.Y := R.B.Y - 1;
New(StatusLine, Init(R,
NewStatusDef(0, $FFFF,
NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit,
StdStatusKeys(nil)), nil)));
End;
End;
{*** End TMyProgram ***}
{*** Begin TMyApplication ***}
Constructor TMyApplication.Init;
Begin
InitMemory;
InitVideo;
InitEvents;
{***** Отключаем нафиг дурацкий хандлер ошибок из TV *****}
{ InitSysError;}
InitHistory;
TMyProgram.Init;
End;
Destructor TMyApplication.Done;
Begin
TMyProgram.Done;
DoneHistory;
DoneSysError;
DoneEvents;
DoneVideo;
DoneMemory;
End;
{*** End TMyApplication ***}
{*** Begin TProgressBar ***}
Constructor TProgressBar.Init;
Begin
Inherited Init(Bounds,AText);
DrawSkeleton;
End;
Procedure TProgressBar.DrawSkeleton;
Var
R: Trect;
Begin
End;
Procedure TProgressBar.Draw;
Var
R: Trect;
Begin
End;
Destructor TProgressBar.Done;
Begin
Inherited Done;
End;
{*** End TProgressBar ***}
{*** Begin TLogScroller ***}
Constructor TLogScroller.Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
PScrollBar);
Begin
Inherited Init(Bounds,AHScrollBar,AVScrollBar);
Log:=New(PStringCollection,Init(5,5));
Log^.Duplicates:=True;
Log^.Insert(NewStr('┌[BEGIN]─['+GetDateString+']─['+GetTimeString+']─['+PntMasterVersion+']'));
GrowMode:=gfGrowHiX+gfGrowHiY+gfGrowRel;
SetLimit(SizeOf(String),Log^.Count);
End;
Procedure TLogScroller.Draw;
var
color: byte;
Y, I: Integer;
B: TDrawBuffer;
begin { draw only what's visible }
Color:= GetColor(1);
for y:= 0 to Size.Y-1 do
begin
MoveChar(B,' ',Color,Size.X);
I:= Delta.Y+Y;
if (I < Log^.Count) and (Log^.At(I) <> nil) then
MoveStr(B, Copy(PString(Log^.At(I))^,Delta.X+1, Size.X), Color);
WriteLine(0,Y,Size.X,1,B);
end;
End;
Destructor TLogScroller.Done;
Begin
Dispose(Log);
Inherited Done;
End;
{*** End TLogScroller ***}
{*** Begin TBackgroundWindow ***}
Constructor TBackgroundWindow.Init;
Begin
Inherited Init(Bounds,ATitle,ANumber);
End;
Destructor TBackgroundWindow.Done;
Begin
Inherited Done;
End;
{*** End TBackgroundWindow ***}
{*** Begin TInfoWindow ***}
Constructor TInfoWindow.Init;
Begin
Inherited Init(Bounds,ATitle,ANumber);
{ ProgressBar:=New(PProgressBar,Init(ProgressBarRect,'Progress bar'));
Insert(ProgressBar);}
End;
Destructor TInfoWindow.Done;
Begin
Inherited Done;
End;
{*** End TInfoWindow ***}
{*** Begin TLogWindow ***}
Constructor TLogWindow.Init;
Begin
Inherited Init(Bounds,ATitle,ANumber);
End;
Destructor TLogWindow.Done;
Begin
{ Dispose(LogScroller,Done);}
Inherited Done;
End;
{*** End TLogWindow ***}
Begin
End.