Changeset 465 for branches/highdpi/LocalPlayer/MessgEx.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/MessgEx.pas
r412 r465 5 5 6 6 uses 7 UDpiControls, Messg, Protocol, ScreenTools, Platform, DateUtils, 8 LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, ButtonA,9 ButtonB, StdCtrls, DrawDlg;7 UDpiControls, Messg, Protocol, ScreenTools, Platform, DateUtils, LCLIntf, LCLType, Messages, 8 SysUtils, Classes, Graphics, Controls, Forms, ButtonA, ButtonB, StdCtrls, 9 DrawDlg, Help; 10 10 11 11 type … … 13 13 mikPureIcon, mikMyArmy, mikEnemyArmy, mikFullControl, mikShip, mikBigIcon, 14 14 mikEnemyShipComplete); 15 16 { TMessgExDlg } 15 17 16 18 TMessgExDlg = class(TBaseMessgDlg) … … 32 34 Kind: TMessageKind; 33 35 IconIndex: Integer; 34 HelpKind: Integer;36 HelpKind: TLinkCategory; 35 37 HelpNo: Integer; 36 38 CenterTo: Integer; 37 39 IconKind: TMessageIconKind; 38 40 OpenSound: string; 39 function ShowModal: integer; override;41 function ShowModal: Integer; override; 40 42 procedure CancelMovie; 41 43 private 42 MovieCancelled: boolean;43 procedure PaintBook(ca: TDpiCanvas; x, y, clPage, clCover: integer);44 MovieCancelled: Boolean; 45 procedure PaintBook(ca: TDpiCanvas; X, Y, clPage, clCover: Integer); 44 46 procedure PaintMyArmy; 45 47 procedure PaintEnemyArmy; … … 47 49 end; 48 50 49 var50 MessgExDlg: TMessgExDlg;51 51 52 52 procedure SoundMessageEx(SimpleText, SoundItem: string); 53 procedure TribeMessage( p: integer; SimpleText, SoundItem: string);53 procedure TribeMessage(P: Integer; SimpleText, SoundItem: string); 54 54 function SimpleQuery(QueryKind: TMessageKind; SimpleText, SoundItem: string) 55 : integer;55 : Integer; 56 56 procedure ContextMessage(SimpleText, SoundItem: string; 57 ContextKind, ContextNo: integer); 57 ContextKind: TLinkCategory; ContextNo: Integer); 58 58 59 59 60 implementation 60 61 61 62 uses 62 ClientTools, BaseWin, Term, Help, UnitStat, Tribes, UPixelPointer,63 IsoEngine,Diagram, Sound;63 ClientTools, BaseWin, Term, UnitStat, Tribes, PixelPointer, 64 Diagram, Sound; 64 65 65 66 {$R *.lfm} … … 78 79 procedure TMessgExDlg.FormShow(Sender: TObject); 79 80 var 80 i: integer;81 I: Integer; 81 82 begin 82 83 if IconKind = mikEnemyArmy then … … 147 148 end; 148 149 149 SplitText( true);150 SplitText(True); 150 151 ClientHeight := 72 + Border + TopSpace + Lines * MessageLineSpacing; 151 152 if GameMode = cMovie then … … 178 179 end; 179 180 end; 180 for i:= 0 to ControlCount - 1 do181 Controls[ i].Top := ClientHeight - (34 + Border);181 for I := 0 to ControlCount - 1 do 182 Controls[I].Top := ClientHeight - (34 + Border); 182 183 if Kind = mkModel then 183 184 EInput.Top := ClientHeight - (76 + Border); 184 185 end; 185 186 186 function TMessgExDlg.ShowModal: integer;187 function TMessgExDlg.ShowModal: Integer; 187 188 var 188 189 Ticks0: TDateTime; 189 190 Ticks: TDateTime; 190 191 begin 192 Caption := Phrases.Lookup('TITLE_MESSAGE'); 191 193 if GameMode = cMovie then 192 194 begin 193 195 if not((GameMode = cMovie) and (MovieSpeed = 4)) then 194 196 begin 195 MovieCancelled := false;197 MovieCancelled := False; 196 198 Show; 197 199 Ticks0 := NowPrecise; … … 203 205 Hide; 204 206 end; 205 result := mrOk;207 Result := mrOk; 206 208 end 207 209 else 208 result := inherited; 210 Result := inherited; 211 //Gtk2Fix; 209 212 end; 210 213 211 214 procedure TMessgExDlg.CancelMovie; 212 215 begin 213 MovieCancelled := true;214 end; 215 216 procedure TMessgExDlg.PaintBook(ca: TDpiCanvas; x, y, clPage, clCover: integer);216 MovieCancelled := True; 217 end; 218 219 procedure TMessgExDlg.PaintBook(ca: TDpiCanvas; X, Y, clPage, clCover: Integer); 217 220 const 218 221 xScrewed = 77; … … 220 223 wScrewed = 43; 221 224 hScrewed = 27; 225 type 226 TScrewed = array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of Single; 222 227 var 223 ix, iy, xDst, yDst, dx, dy, xIcon, yIcon: integer;228 ix, iy, xDst, yDst, dx, dy, xIcon, yIcon: Integer; 224 229 BookRect: TRect; 225 x1, xR, yR, share: single;226 Screwed: array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of single;230 x1, xR, yR, share: Single; 231 Screwed: TScrewed; 227 232 SrcPtr: TPixelPointer; 228 233 Width: Integer; … … 235 240 yIcon := (IconIndex + SystemIconLines * 7) div 7 * ySizeBig; 236 241 // prepare screwed icon 237 FillChar(Screwed, sizeof(Screwed), 0);242 Screwed := Default(TScrewed); 238 243 BigImp.BeginUpdate; 239 SrcPtr := PixelPointer(BigImp, ScaleToNative(xIcon), ScaleToNative(yIcon));244 SrcPtr := TPixelPointer.Create(BigImp, ScaleToNative(xIcon), ScaleToNative(yIcon)); 240 245 for iy := 0 to ScaleToNative(Height) - 1 do begin 241 246 for ix := 0 to ScaleToNative(Width) - 1 do begin … … 277 282 BookRect := SmallBook.BoundsRect; 278 283 end; 279 x := x- BookRect.Width div 2;284 X := X - BookRect.Width div 2; 280 285 281 286 // paint 282 287 UnshareBitmap(LogoBuffer); 283 DpiBit Canvas(LogoBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, ca, x, y);288 DpiBitBltCanvas(LogoBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, ca, X, Y); 284 289 285 290 if IconIndex >= 0 then … … 294 299 ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), BookRect, clCover, clPage); 295 300 296 DpiBit Canvas(ca, x, y, BookRect.Width, BookRect.Height, LogoBuffer.Canvas, 0, 0);301 DpiBitBltCanvas(ca, X, Y, BookRect.Width, BookRect.Height, LogoBuffer.Canvas, 0, 0); 297 302 end; 298 303 … … 303 308 procedure TMessgExDlg.PaintEnemyArmy; 304 309 var 305 emix, ix, iy, x, y, count, UnitsInLine: integer;310 emix, ix, iy, X, Y, count, UnitsInLine: Integer; 306 311 begin 307 312 ix := 0; … … 314 319 for count := 0 to LostArmy[emix] - 1 do 315 320 begin 316 x:= ClientWidth div 2 + ix * 64 - UnitsInLine * 32;317 y:= 26 + Border + TopSpace + Lines * MessageLineSpacing + iy * 48;321 X := ClientWidth div 2 + ix * 64 - UnitsInLine * 32; 322 Y := 26 + Border + TopSpace + Lines * MessageLineSpacing + iy * 48; 318 323 with MyRO.EnemyModel[emix], Tribe[Owner].ModelPicture[mix] do 319 324 begin 320 DpiBit Canvas(Canvas, x, y, 64, 48, HGr.Mask.Canvas,325 DpiBitBltCanvas(Canvas, X, Y, 64, 48, HGr.Mask.Canvas, 321 326 pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCAND); 322 DpiBit Canvas(Canvas, x, y, 64, 48, HGr.Data.Canvas,327 DpiBitBltCanvas(Canvas, X, Y, 64, 48, HGr.Data.Canvas, 323 328 pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCPAINT); 324 329 end; 325 330 326 331 // next position 327 inc(ix);332 Inc(ix); 328 333 if ix = LostUnitsPerLine then 329 334 begin // next line 330 335 ix := 0; 331 inc(iy);336 Inc(iy); 332 337 if iy = 6 then 333 exit;338 Exit; 334 339 UnitsInLine := nLostArmy - LostUnitsPerLine * iy; 335 340 if UnitsInLine > LostUnitsPerLine then … … 341 346 procedure TMessgExDlg.FormPaint(Sender: TObject); 342 347 var 343 p1, clSaveTextLight, clSaveTextShade: integer;348 p1, clSaveTextLight, clSaveTextShade: Integer; 344 349 begin 345 350 if (IconKind = mikImp) and (IconIndex = 27) then … … 362 367 p1 := MyRO.Wonder[IconIndex].EffectiveOwner; 363 368 UnshareBitmap(Buffer); 364 DpiBit Canvas(Buffer.Canvas, 0, 0, xSizeBig + 2 * GlowRange,369 DpiBitBltCanvas(Buffer.Canvas, 0, 0, xSizeBig + 2 * GlowRange, 365 370 ySizeBig + 2 * GlowRange, Canvas, 366 371 ClientWidth div 2 - (28 + GlowRange), 24 - GlowRange); 367 DpiBit Canvas(Buffer.Canvas, GlowRange, GlowRange, xSizeBig, ySizeBig,372 DpiBitBltCanvas(Buffer.Canvas, GlowRange, GlowRange, xSizeBig, ySizeBig, 368 373 BigImp.Canvas, IconIndex mod 7 * xSizeBig, 369 374 (IconIndex + SystemIconLines * 7) div 7 * ySizeBig); … … 373 378 GlowFrame(Buffer, GlowRange, GlowRange, xSizeBig, ySizeBig, 374 379 Tribe[p1].Color); 375 DpiBit Canvas(Canvas, ClientWidth div 2 - (28 + GlowRange),380 DpiBitBltCanvas(Canvas, ClientWidth div 2 - (28 + GlowRange), 376 381 24 - GlowRange, xSizeBig + 2 * GlowRange, ySizeBig + 2 * GlowRange, 377 382 Buffer.Canvas, 0, 0); … … 387 392 end; 388 393 mikModel: 389 with Tribe[ me].ModelPicture[IconIndex] do394 with Tribe[Me].ModelPicture[IconIndex] do 390 395 begin 391 396 FrameImage(Canvas, BigImp, ClientWidth div 2 - 28, 24, xSizeBig, 392 397 ySizeBig, 0, 0); 393 DpiBit Canvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44,398 DpiBitBltCanvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44, 394 399 HGr.Mask.Canvas, pix mod 10 * 65 + 1, 395 400 pix div 10 * 49 + 1, SRCAND); 396 DpiBit Canvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44,401 DpiBitBltCanvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44, 397 402 HGr.Data.Canvas, pix mod 10 * 65 + 1, 398 403 pix div 10 * 49 + 1, SRCPAINT); … … 406 411 Frame(Canvas, ClientWidth div 2 - 32 - 1, 24 - 1, 407 412 ClientWidth div 2 + 32, 24 + 48, $000000, $000000); 408 DpiBit Canvas(Canvas, ClientWidth div 2 - 32, 24, 64, 48,413 DpiBitBltCanvas(Canvas, ClientWidth div 2 - 32, 24, 64, 48, 409 414 Tribe[IconIndex].faceHGr.Data.Canvas, 410 415 1 + Tribe[IconIndex].facepix mod 10 * 65, … … 420 425 mikEnemyShipComplete: 421 426 begin 422 DpiBit Canvas(Buffer.Canvas, 0, 0, 140, 120, Canvas,427 DpiBitBltCanvas(Buffer.Canvas, 0, 0, 140, 120, Canvas, 423 428 (ClientWidth - 140) div 2, 24); 424 429 ImageOp_BCC(Buffer, Templates.Data, Point(0, 0), StarshipDeparted.BoundsRect, 0, $FFFFFF); 425 DpiBit Canvas(Canvas, (ClientWidth - 140) div 2, 24, 140, 120,430 DpiBitBltCanvas(Canvas, (ClientWidth - 140) div 2, 24, 140, 120, 426 431 Buffer.Canvas, 0, 0); 427 432 end; … … 451 456 begin 452 457 if Kind = mkOkHelp then 453 HelpDlg.ShowNewContent(wmSubmodal, HelpKind, HelpNo)458 MainScreen.HelpDlg.ShowNewContent(wmSubmodal, HelpKind, HelpNo) 454 459 else if Kind = mkModel then 455 UnitStatDlg.ShowNewContent_OwnModel(wmSubmodal, IconIndex)460 MainScreen.UnitStatDlg.ShowNewContent_OwnModel(wmSubmodal, IconIndex) 456 461 else 457 462 ModalResult := mrIgnore; … … 482 487 // because Messg.SoundMessage not capable of movie mode 483 488 begin 484 with M essgExDlg do489 with MainScreen.MessgExDlg do 485 490 begin 486 491 MessgText := SimpleText; … … 491 496 end; 492 497 493 procedure TribeMessage( p: integer; SimpleText, SoundItem: string);494 begin 495 with M essgExDlg do498 procedure TribeMessage(P: Integer; SimpleText, SoundItem: string); 499 begin 500 with MainScreen.MessgExDlg do 496 501 begin 497 502 OpenSound := SoundItem; … … 499 504 Kind := mkOk; 500 505 IconKind := mikTribe; 501 IconIndex := p;506 IconIndex := P; 502 507 ShowModal; 503 508 end; … … 505 510 506 511 function SimpleQuery(QueryKind: TMessageKind; SimpleText, SoundItem: string) 507 : integer;508 begin 509 with M essgExDlg do512 : Integer; 513 begin 514 with MainScreen.MessgExDlg do 510 515 begin 511 516 MessgText := SimpleText; … … 513 518 Kind := QueryKind; 514 519 ShowModal; 515 result := ModalResult;520 Result := ModalResult; 516 521 end; 517 522 end; 518 523 519 524 procedure ContextMessage(SimpleText, SoundItem: string; 520 ContextKind , ContextNo: integer);521 begin 522 with M essgExDlg do525 ContextKind: TLinkCategory; ContextNo: Integer); 526 begin 527 with MainScreen.MessgExDlg do 523 528 begin 524 529 MessgText := SimpleText; … … 543 548 end; 544 549 545 546 initialization547 548 550 end.
Note:
See TracChangeset
for help on using the changeset viewer.