source: branches/delphi/LocalPlayer/Draft.pas

Last change on this file was 6, checked in by chronos, 8 years ago
  • Modified: Formated all project source files using Delphi formatter as original indentation and other formatting was really bad.
File size: 20.0 KB
Line 
1{$INCLUDE switches}
2unit Draft;
3
4interface
5
6uses
7 Protocol, ClientTools, Term, ScreenTools, PVSB, BaseWin,
8
9 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls,
10 ButtonA,
11 ButtonB, ButtonBase, Area;
12
13type
14 TDraftDlg = class(TBufferedDrawDlg)
15 OKBtn: TButtonA;
16 CloseBtn: TButtonB;
17 GroundArea: TArea;
18 SeaArea: TArea;
19 AirArea: TArea;
20 procedure FormCreate(Sender: TObject);
21 procedure FormShow(Sender: TObject);
22 procedure CloseBtnClick(Sender: TObject);
23 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
24 Shift: TShiftState; x, y: integer);
25 procedure OKBtnClick(Sender: TObject);
26 procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
27 Shift: TShiftState; x, y: integer);
28 procedure FormDestroy(Sender: TObject);
29 public
30 procedure ShowNewContent(NewMode: integer);
31 protected
32 procedure OffscreenPaint; override;
33 private
34 Domain, MaxLines, Lines, Cut, yDomain, yFeature, yWeight, yTotal, yView,
35 IncCap, DecCap: integer;
36 code: array [0 .. nFeature - 1] of integer;
37 Template, Back: TBitmap;
38 function IsFeatureInList(d, i: integer): boolean;
39 procedure SetDomain(d: integer);
40 end;
41
42var
43 DraftDlg: TDraftDlg;
44
45implementation
46
47uses Help, Tribes, Directories;
48
49{$R *.DFM}
50
51const
52 MaxLines0 = 11;
53 LinePitch = 20;
54 xDomain = 30;
55 yDomain0 = 464;
56 DomainPitch = 40;
57 xFeature = 38;
58 yFeature0 = 42;
59 xWeight = 100;
60 yWeight0 = 271;
61 xTotal = 20;
62 xTotal2 = 34;
63 yTotal0 = 354;
64 xView = 17;
65 yView0 = 283;
66
67procedure TDraftDlg.FormCreate(Sender: TObject);
68begin
69 inherited;
70 InitButtons();
71 HelpContext := 'CLASSES';
72 Caption := Phrases.Lookup('TITLE_DRAFT');
73 OKBtn.Caption := Phrases.Lookup('BTN_OK');
74
75 if not Phrases2FallenBackToEnglish then
76 begin
77 GroundArea.Hint := Phrases2.Lookup('DRAFTDOMAIN', 0);
78 SeaArea.Hint := Phrases2.Lookup('DRAFTDOMAIN', 1);
79 AirArea.Hint := Phrases2.Lookup('DRAFTDOMAIN', 2);
80 end
81 else
82 begin
83 GroundArea.Hint := Phrases.Lookup('DOMAIN', 0);
84 SeaArea.Hint := Phrases.Lookup('DOMAIN', 1);
85 AirArea.Hint := Phrases.Lookup('DOMAIN', 2);
86 end;
87
88 Back := TBitmap.Create;
89 Back.PixelFormat := pf24bit;
90 Back.Width := ClientWidth;
91 Back.Height := ClientHeight;
92 Template := TBitmap.Create;
93 LoadGraphicFile(Template, HomeDir + 'Graphics\MiliRes', gfNoGamma);
94 Template.PixelFormat := pf8bit;
95end;
96
97procedure TDraftDlg.FormDestroy(Sender: TObject);
98begin
99 Template.Free;
100end;
101
102procedure TDraftDlg.CloseBtnClick(Sender: TObject);
103begin
104 ModalResult := mrCancel;
105end;
106
107procedure TDraftDlg.OffscreenPaint;
108
109 function DomainAvailable(d: integer): boolean;
110 begin
111 result := (upgrade[d, 0].Preq = preNone) or
112 (MyRO.Tech[upgrade[d, 0].Preq] >= tsApplicable);
113 end;
114
115 procedure PaintTotalBars;
116 var
117 i, y, dx, num, w: integer;
118 s: string;
119 begin
120 with offscreen.Canvas do
121 begin
122 // strength bar
123 y := yTotal;
124 DarkGradient(offscreen.Canvas, xTotal - 6, y + 1, 184, 2);
125 DarkGradient(offscreen.Canvas, xTotal2 + 172, y + 1, 95, 2);
126 RisedTextOut(offscreen.Canvas, xTotal - 2, y,
127 Phrases.Lookup('UNITSTRENGTH'));
128 RisedTextOut(offscreen.Canvas, xTotal + 112 + 30, y,
129 'x' + IntToStr(MyRO.DevModel.MStrength));
130 RisedTextOut(offscreen.Canvas, xTotal2 + 148 + 30, y, '=');
131 s := IntToStr(MyRO.DevModel.Attack) + '/' +
132 IntToStr(MyRO.DevModel.Defense);
133 RisedTextOut(offscreen.Canvas, xTotal2 + 170 + 64 + 30 -
134 BiColorTextWidth(offscreen.Canvas, s), y, s);
135
136 // transport bar
137 if MyRO.DevModel.MTrans > 0 then
138 begin
139 y := yTotal + 19;
140 DarkGradient(offscreen.Canvas, xTotal - 6, y + 1, 184, 1);
141 DarkGradient(offscreen.Canvas, xTotal2 + 172, y + 1, 95, 1);
142 RisedTextOut(offscreen.Canvas, xTotal - 2, y,
143 Phrases.Lookup('UNITTRANSPORT'));
144 RisedTextOut(offscreen.Canvas, xTotal + 112 + 30, y,
145 'x' + IntToStr(MyRO.DevModel.MTrans));
146 RisedTextOut(offscreen.Canvas, xTotal2 + 148 + 30, y, '=');
147
148 Font.Color := $000000;
149 dx := -237 - 30;
150 for i := mcFirstNonCap - 1 downto 3 do
151 if i in [mcSeaTrans, mcCarrier, mcAirTrans] then
152 begin
153 num := MyRO.DevModel.Cap[i] * MyRO.DevModel.MTrans;
154 if num > 0 then
155 begin
156 inc(dx, 15);
157 Brush.Color := $C0C0C0;
158 FrameRect(Rect(xTotal2 - 3 - dx, y + 2,
159 xTotal2 + 11 - dx, y + 16));
160 Brush.Style := bsClear;
161 Sprite(offscreen, HGrSystem, xTotal2 - 1 - dx, y + 4, 10, 10,
162 66 + i mod 11 * 11, 137 + i div 11 * 11);
163 if num > 1 then
164 begin
165 s := IntToStr(num);
166 w := TextWidth(s);
167 inc(dx, w + 1);
168 Brush.Color := $FFFFFF;
169 FillRect(Rect(xTotal2 - 3 - dx, y + 2,
170 xTotal2 + w - 1 - dx, y + 16));
171 Brush.Style := bsClear;
172 Textout(xTotal2 - 3 - dx + 1, y, s);
173 end;
174 end;
175 end
176 end;
177
178 // speed bar
179 y := yTotal + 38;
180 LoweredTextOut(offscreen.Canvas, -1, MainTexture, xTotal - 2, y,
181 Phrases.Lookup('UNITSPEED'));
182 DLine(offscreen.Canvas, xTotal - 2, xTotal + 174, y + 16,
183 MainTexture.clBevelShade, MainTexture.clBevelLight);
184 DLine(offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, y + 16,
185 MainTexture.clBevelShade, MainTexture.clBevelLight);
186 s := MovementToString(MyRO.DevModel.Speed);
187 RisedTextOut(offscreen.Canvas, xTotal2 + 170 + 64 + 30 -
188 TextWidth(s), y, s);
189
190 // cost bar
191 y := yTotal + 57;
192 LoweredTextOut(offscreen.Canvas, -1, MainTexture, xTotal - 2, y,
193 Phrases.Lookup('UNITCOST'));
194 LoweredTextOut(offscreen.Canvas, -1, MainTexture, xTotal + 112 + 30, y,
195 'x' + IntToStr(MyRO.DevModel.MCost));
196 LoweredTextOut(offscreen.Canvas, -1, MainTexture,
197 xTotal2 + 148 + 30, y, '=');
198 DLine(offscreen.Canvas, xTotal - 2, xTotal + 174, y + 16,
199 MainTexture.clBevelShade, MainTexture.clBevelLight);
200 DLine(offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, y + 16,
201 MainTexture.clBevelShade, MainTexture.clBevelLight);
202 s := IntToStr(MyRO.DevModel.Cost);
203 RisedTextOut(offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 12 -
204 TextWidth(s), y, s);
205 Sprite(offscreen, HGrSystem, xTotal2 + 170 + 54 + 30, y + 4, 10,
206 10, 88, 115);
207
208 if G.Difficulty[me] <> 2 then
209 begin // corrected cost bar
210 y := yTotal + 76;
211 LoweredTextOut(offscreen.Canvas, -1, MainTexture, xTotal - 2, y,
212 Phrases.Lookup('COSTDIFF' + char(48 + G.Difficulty[me])));
213 LoweredTextOut(offscreen.Canvas, -1, MainTexture,
214 xTotal2 + 148 + 30, y, '=');
215 DLine(offscreen.Canvas, xTotal - 2, xTotal + 174, y + 16,
216 MainTexture.clBevelShade, MainTexture.clBevelLight);
217 DLine(offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, y + 16,
218 MainTexture.clBevelShade, MainTexture.clBevelLight);
219 s := IntToStr(MyRO.DevModel.Cost * BuildCostMod
220 [G.Difficulty[me]] div 12);
221 RisedTextOut(offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 12 -
222 TextWidth(s), y, s);
223 Sprite(offscreen, HGrSystem, xTotal2 + 170 + 54 + 30, y + 4, 10,
224 10, 88, 115);
225 end;
226 end;
227 end;
228
229var
230 i, j, x, d, n, TextColor, CapWeight, DomainCount: integer;
231begin
232 inherited;
233
234 ClientHeight := Template.Height - Cut;
235 if ClientHeight > hMainTexture then
236 // assemble background from 2 texture tiles
237 begin
238 bitblt(Back.Canvas.Handle, 0, 0, ClientWidth, 64,
239 MainTexture.Image.Canvas.Handle, (wMainTexture - ClientWidth) div 2,
240 hMainTexture - 64, SRCCOPY);
241 bitblt(Back.Canvas.Handle, 0, 64, ClientWidth, ClientHeight - 64,
242 MainTexture.Image.Canvas.Handle, (wMainTexture - ClientWidth) div 2,
243 0, SRCCOPY);
244 end
245 else
246 bitblt(Back.Canvas.Handle, 0, 0, ClientWidth, ClientHeight,
247 MainTexture.Image.Canvas.Handle, (wMainTexture - ClientWidth) div 2,
248 (hMainTexture - ClientHeight) div 2, SRCCOPY);
249 ImageOp_B(Back, Template, 0, 0, 0, 0, Template.Width, 64);
250 ImageOp_B(Back, Template, 0, 64, 0, 64 + Cut, Template.Width,
251 Template.Height - 64 - Cut);
252
253 bitblt(offscreen.Canvas.Handle, 0, 0, ClientWidth, ClientHeight,
254 Back.Canvas.Handle, 0, 0, SRCCOPY);
255
256 offscreen.Canvas.Font.Assign(UniFont[ftCaption]);
257 RisedTextOut(offscreen.Canvas, 10, 7, Caption);
258 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
259
260 with MyRO.DevModel do
261 begin
262 DomainCount := 0;
263 for d := 0 to nDomains - 1 do
264 if DomainAvailable(d) then
265 inc(DomainCount);
266 if DomainCount > 1 then
267 begin
268 for d := 0 to nDomains - 1 do
269 if DomainAvailable(d) then
270 begin
271 x := xDomain + d * DomainPitch;
272 if d = Domain then
273 ImageOp_BCC(offscreen, Templates, x, yDomain, 142, 246 + 37 * d, 36,
274 36, 0, $00C0FF)
275 else
276 ImageOp_BCC(offscreen, Templates, x, yDomain, 142, 246 + 37 * d, 36,
277 36, 0, $606060);
278 end;
279 Frame(offscreen.Canvas, xDomain - 11, yDomain - 3,
280 xDomain + 2 * DomainPitch + 46, yDomain + 38, $B0B0B0, $FFFFFF);
281 RFrame(offscreen.Canvas, xDomain - 12, yDomain - 4,
282 xDomain + 2 * DomainPitch + 47, yDomain + 39, $FFFFFF, $B0B0B0);
283 end;
284 GroundArea.Top := yDomain;
285 GroundArea.Visible := DomainAvailable(dGround);
286 SeaArea.Top := yDomain;
287 SeaArea.Visible := DomainAvailable(dSea);
288 AirArea.Top := yDomain;
289 AirArea.Visible := DomainAvailable(dAir);
290
291 PaintTotalBars;
292
293 // display weight
294 with offscreen.Canvas do
295 begin
296 for i := 0 to MaxWeight - 1 do
297 if i < Weight then
298 ImageOp_BCC(offscreen, Templates, xWeight + 20 * i, yWeight, 123, 400,
299 18, 20, 0, $949494)
300 else
301 ImageOp_BCC(offscreen, Templates, xWeight + 20 * i, yWeight, 105, 400,
302 18, 20, 0, $949494);
303 end;
304
305 with offscreen.Canvas do
306 for i := 0 to Lines - 1 do
307 begin
308 if not(code[i] in AutoFeature) then
309 begin
310 // paint +/- butttons
311 if code[i] < mcFirstNonCap then
312 begin
313 Dump(offscreen, HGrSystem, xFeature - 21, yFeature + 2 + LinePitch *
314 i, 12, 12, 169, 172);
315 Dump(offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *
316 i, 12, 12, 169, 159);
317 RFrame(offscreen.Canvas, xFeature - (21 + 1),
318 yFeature + 2 + LinePitch * i - 1, xFeature - (21 - 24),
319 yFeature + 2 + LinePitch * i + 12, MainTexture.clBevelShade,
320 MainTexture.clBevelLight);
321 end
322 else
323 begin
324 Dump(offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *
325 i, 12, 12, 169, 185 + 13 * MyRO.DevModel.Cap[code[i]]);
326 RFrame(offscreen.Canvas, xFeature - (9 + 1),
327 yFeature + 2 + LinePitch * i - 1, xFeature - (21 - 24),
328 yFeature + 2 + LinePitch * i + 12, MainTexture.clBevelShade,
329 MainTexture.clBevelLight);
330 end;
331
332 // paint cost
333 LightGradient(offscreen.Canvas, xFeature + 34,
334 yFeature + LinePitch * i, 50, GrExt[HGrSystem].Data.Canvas.Pixels
335 [187, 137]);
336 if (Domain = dGround) and (code[i] = mcDefense) then
337 CapWeight := 2
338 else
339 CapWeight := Feature[code[i]].Weight;
340 n := CapWeight + Feature[code[i]].Cost;
341 d := 6;
342 while (n - 1) * d * 2 > 48 - 10 do
343 dec(d);
344 for j := 0 to n - 1 do
345 if j < CapWeight then
346 Sprite(offscreen, HGrSystem, xFeature + 54 + (j * 2 + 1 - n) * d,
347 yFeature + 2 + LinePitch * i + 1, 10, 10, 88, 126)
348 else
349 Sprite(offscreen, HGrSystem, xFeature + 54 + (j * 2 + 1 - n) * d,
350 yFeature + 2 + LinePitch * i + 1, 10, 10, 88, 115);
351 end; // if not (code[i] in AutoFeature)
352 DarkGradient(offscreen.Canvas, xFeature + 17,
353 yFeature + LinePitch * i, 16, 1);
354 Frame(offscreen.Canvas, xFeature + 18, yFeature + 1 + LinePitch * i,
355 xFeature + 20 - 2 + 13, yFeature + 2 + 1 - 2 + 13 + LinePitch * i,
356 $C0C0C0, $C0C0C0);
357 Sprite(offscreen, HGrSystem, xFeature + 20, yFeature + 2 + 1 + LinePitch
358 * i, 10, 10, 66 + code[i] mod 11 * 11, 137 + code[i] div 11 * 11);
359
360 if MyRO.DevModel.Cap[code[i]] > 0 then
361 TextColor := MainTexture.clLitText
362 else
363 TextColor := -1;
364
365 if code[i] < mcFirstNonCap then
366 LoweredTextOut(offscreen.Canvas, TextColor, MainTexture, xFeature + 7,
367 yFeature + LinePitch * i - 1, IntToStr(MyRO.DevModel.Cap[code[i]]));
368 LoweredTextOut(offscreen.Canvas, TextColor, MainTexture, xFeature + 88,
369 yFeature + LinePitch * i - 1, Phrases.Lookup('FEATURES', code[i]));
370 end;
371 end;
372
373 // free features
374 j := 0;
375 for i := 0 to nFeature - 1 do
376 if (i in AutoFeature) and (1 shl Domain and Feature[i].Domains <> 0) and
377 (Feature[i].Preq <> preNA) and
378 ((Feature[i].Preq = preSun) and (MyRO.Wonder[woSun].EffectiveOwner = me)
379 or (Feature[i].Preq >= 0) and (MyRO.Tech[Feature[i].Preq] >= tsApplicable)
380 ) and not((Feature[i].Preq = adSteamEngine) and
381 (MyRO.Tech[adNuclearPower] >= tsApplicable)) then
382 begin
383 DarkGradient(offscreen.Canvas, xWeight + 4, yWeight + 32 + LinePitch
384 * j, 16, 1);
385 Frame(offscreen.Canvas, xWeight + 5, yWeight + 33 + LinePitch * j,
386 xWeight + 18, yWeight + 47 + LinePitch * j, $C0C0C0, $C0C0C0);
387 Sprite(offscreen, HGrSystem, xWeight + 7, yWeight + 36 + LinePitch * j,
388 10, 10, 66 + i mod 11 * 11, 137 + i div 11 * 11);
389 LoweredTextOut(offscreen.Canvas, -1, MainTexture, xWeight + 26,
390 yWeight + 31 + LinePitch * j, Phrases.Lookup('FEATURES', i));
391 inc(j);
392 end;
393
394 with Tribe[me].ModelPicture[MyRO.nModel] do
395 begin
396 FrameImage(offscreen.Canvas, BigImp, xView + 4, yView + 4, xSizeBig,
397 ySizeBig, 0, 0);
398 Sprite(offscreen, HGr, xView, yView, 64, 44, pix mod 10 * 65 + 1,
399 pix div 10 * 49 + 1);
400 end;
401 MarkUsedOffscreen(ClientWidth, ClientHeight);
402end; { MainPaint }
403
404procedure TDraftDlg.SetDomain(d: integer);
405
406 function Prio(fix: integer): integer;
407 var
408 FeaturePreq: integer;
409 begin
410 FeaturePreq := Feature[fix].Preq;
411 assert(FeaturePreq <> preNA);
412 if fix < mcFirstNonCap then
413 result := 10000 + fix
414 else if FeaturePreq = preNone then
415 result := 20000
416 else if FeaturePreq < 0 then
417 result := 40000
418 else
419 result := 30000 + AdvValue[FeaturePreq];
420 if not(fix in AutoFeature) then
421 inc(result, 90000);
422 end;
423
424var
425 i, j, x: integer;
426begin
427 Domain := d;
428 Lines := 0;
429 for i := 0 to nFeature - 1 do
430 if IsFeatureInList(Domain, i) then
431 begin
432 code[Lines] := i;
433 inc(Lines)
434 end;
435 yFeature := yFeature0 + (MaxLines - Lines) * LinePitch div 2;
436
437 // sort features
438 for i := 0 to Lines - 2 do
439 for j := i + 1 to Lines - 1 do
440 if Prio(code[i]) > Prio(code[j]) then
441 begin // exchange
442 x := code[i];
443 code[i] := code[j];
444 code[j] := x
445 end;
446end;
447
448function TDraftDlg.IsFeatureInList(d, i: integer): boolean;
449begin
450 result := not(i in AutoFeature) and (1 shl d and Feature[i].Domains <> 0) and
451 (Feature[i].Preq <> preNA) and
452 ((Feature[i].Preq = preNone) or (Feature[i].Preq = preSun) and
453 (MyRO.Wonder[woSun].EffectiveOwner = me) or (Feature[i].Preq >= 0) and
454 (MyRO.Tech[Feature[i].Preq] >= tsApplicable));
455end;
456
457procedure TDraftDlg.FormShow(Sender: TObject);
458var
459 count, d, i: integer;
460begin
461 Domain := dGround;
462 while (Domain < dAir) and (upgrade[Domain, 0].Preq <> preNone) and
463 (MyRO.Tech[upgrade[Domain, 0].Preq] < tsApplicable) do
464 inc(Domain);
465
466 // count max number of features in any domain
467 MaxLines := 0;
468 for d := 0 to nDomains - 1 do
469 if (upgrade[d, 0].Preq = preNone) or
470 (MyRO.Tech[upgrade[d, 0].Preq] >= tsApplicable) then
471 begin
472 count := 0;
473 for i := 0 to nFeature - 1 do
474 if IsFeatureInList(d, i) then
475 inc(count);
476 if count > MaxLines then
477 MaxLines := count;
478 end;
479 Cut := (MaxLines0 - MaxLines) * LinePitch;
480 OKBtn.Top := 477 - Cut;
481 yDomain := yDomain0 - Cut;
482 yWeight := yWeight0 - Cut;
483 yTotal := yTotal0 - Cut;
484 yView := yView0 - Cut;
485
486 if WindowMode = wmModal then
487 begin { center on screen }
488 Left := (Screen.Width - Template.Width) div 2;
489 Top := (Screen.Height - (Template.Height - Cut)) div 2;
490 end;
491
492 SetDomain(Domain);
493 Server(sCreateDevModel, me, Domain, nil^);
494 MyModel[MyRO.nModel] := MyRO.DevModel;
495 InitMyModel(MyRO.nModel, false);
496 OffscreenPaint;
497 IncCap := -1;
498 DecCap := -1;
499end;
500
501procedure TDraftDlg.ShowNewContent(NewMode: integer);
502begin
503 inherited ShowNewContent(NewMode);
504end;
505
506procedure TDraftDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
507 Shift: TShiftState; x, y: integer);
508var
509 i, d: integer;
510begin
511 if Button = mbLeft then
512 begin
513 for d := 0 to nDomains - 1 do
514 if (d <> Domain) and ((upgrade[d, 0].Preq = preNone) or
515 (MyRO.Tech[upgrade[d, 0].Preq] >= tsApplicable)) and
516 (x >= xDomain + d * DomainPitch) and
517 (x < xDomain + d * DomainPitch + 36) and (y >= yDomain) and
518 (y < yDomain + 36) then
519 begin
520 SetDomain(d);
521 Server(sCreateDevModel, me, Domain, nil^);
522 MyModel[MyRO.nModel] := MyRO.DevModel;
523 InitMyModel(MyRO.nModel, false);
524 SmartUpdateContent;
525 end;
526
527 if (y >= yFeature) and (y < yFeature + LinePitch * Lines) then
528 begin
529 i := (y - yFeature) div LinePitch;
530 if (x >= xFeature - 21) and (x < ClientWidth) and (ssShift in Shift) then
531 HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkFeature, code[i])
532 else if not(code[i] in AutoFeature) then
533 begin
534 if (code[i] < mcFirstNonCap) and (x >= xFeature - 21) and
535 (x < xFeature - 21 + 12) then
536 begin
537 IncCap := code[i];
538 Dump(offscreen, HGrSystem, xFeature - 21, yFeature + 2 + LinePitch *
539 i, 12, 12, 182, 172);
540 SmartInvalidate;
541 end
542 else if (x >= xFeature - 9) and (x < xFeature - 9 + 12) then
543 begin
544 DecCap := code[i];
545 if code[i] < mcFirstNonCap then
546 Dump(offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *
547 i, 12, 12, 182, 159)
548 else
549 Dump(offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *
550 i, 12, 12, 182, 185 + 13 * MyRO.DevModel.Cap[code[i]]);
551 SmartInvalidate;
552 end;
553 end
554 end
555 end
556end;
557
558procedure TDraftDlg.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
559 Shift: TShiftState; x, y: integer);
560var
561 NewValue: integer;
562begin
563 if IncCap >= 0 then
564 begin
565 NewValue := MyRO.DevModel.Cap[IncCap] + 1;
566 Server(sSetDevModelCap + NewValue shl 4, me, IncCap, nil^);
567 MyModel[MyRO.nModel] := MyRO.DevModel;
568 InitMyModel(MyRO.nModel, false);
569 SmartUpdateContent;
570 IncCap := -1;
571 end
572 else if DecCap >= 0 then
573 begin
574 if (DecCap >= mcFirstNonCap) or (MyRO.DevModel.Cap[DecCap] > 0) then
575 begin
576 NewValue := MyRO.DevModel.Cap[DecCap] - 1;
577 if DecCap >= mcFirstNonCap then
578 NewValue := -NewValue;
579 Server(sSetDevModelCap + NewValue shl 4, me, DecCap, nil^);
580 MyModel[MyRO.nModel] := MyRO.DevModel;
581 InitMyModel(MyRO.nModel, false);
582 end;
583 SmartUpdateContent;
584 DecCap := -1;
585 end;
586end;
587
588procedure TDraftDlg.OKBtnClick(Sender: TObject);
589begin
590 ModalResult := mrOK;
591end;
592
593end.
Note: See TracBrowser for help on using the repository browser.