Changeset 178 for branches/highdpi/LocalPlayer/Term.pas
- Timestamp:
- Jun 23, 2019, 3:15:29 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Term.pas
r173 r178 13 13 Protocol, Tribes, PVSB, ClientTools, ScreenTools, BaseWin, Messg, ButtonBase, 14 14 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, DrawDlg, Types, 15 Forms, Menus, ExtCtrls, dateutils, Platform, ButtonB, ButtonC, EOTButton, Area; 15 Forms, Menus, ExtCtrls, dateutils, Platform, ButtonB, ButtonC, EOTButton, Area, 16 UDpiControls; 16 17 17 18 const … … 228 229 BrushType: Cardinal; 229 230 trix: array [0 .. 63] of integer; 230 AILogo: array [0 .. nPl - 1] of T Bitmap;231 Mini, Panel, TopBar: T Bitmap;231 AILogo: array [0 .. nPl - 1] of TDpiBitmap; 232 Mini, Panel, TopBar: TDpiBitmap; 232 233 sb: TPVScrollbar; 233 234 Closable, RepaintOnResize, Tracking, TurnComplete, Edited, GoOnPhase, … … 276 277 public 277 278 UsedOffscreenWidth, UsedOffscreenHeight: integer; 278 Offscreen: T Bitmap;279 OffscreenUser: T Form;279 Offscreen: TDpiBitmap; 280 OffscreenUser: TDpiForm; 280 281 procedure CreateParams(var p: TCreateParams); override; 281 282 procedure Client(Command, NewPlayer: integer; var Data); … … 428 429 CityRepMask: Cardinal; 429 430 ReceivedOffer: TOffer; 430 Buffer: T Bitmap;431 SmallImp: T Bitmap;431 Buffer: TDpiBitmap; 432 SmallImp: TDpiBitmap; 432 433 BlinkON: Boolean; 433 434 DestinationMarkON: Boolean; … … 455 456 procedure InitMyModel(mix: integer; final: boolean); 456 457 457 procedure ImpImage(ca: T Canvas; x, y, iix: integer; Government: integer = -1;458 procedure ImpImage(ca: TDpiCanvas; x, y, iix: integer; Government: integer = -1; 458 459 IsControl: boolean = false); 459 460 procedure HelpOnTerrain(Loc, NewMode: integer); 460 461 461 462 462 implementation 463 463 464 464 uses 465 465 Directories, IsoEngine, CityScreen, Draft, MessgEx, Select, CityType, Help, 466 UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, PixelPointer, Sound,466 UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, 467 467 Battle, Rates, TechTree, Registry; 468 468 … … 620 620 end; 621 621 622 procedure ImpImage(ca: T Canvas; x, y, iix: integer; Government: integer;622 procedure ImpImage(ca: TDpiCanvas; x, y, iix: integer; Government: integer; 623 623 IsControl: boolean); 624 624 begin … … 859 859 end; 860 860 861 procedure PaintZoomedTile(dst: T Bitmap; x, y, Loc: integer);861 procedure PaintZoomedTile(dst: TDpiBitmap; x, y, Loc: integer); 862 862 863 863 procedure TSprite(xDst, yDst, xSrc, ySrc: integer); … … 1088 1088 if G.RO[DipMem[me].pContact] <> nil then 1089 1089 begin // close windows for next player 1090 for i := 0 to Screen.FormCount - 1 do1091 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg)1090 for i := 0 to DpiScreen.FormCount - 1 do 1091 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) 1092 1092 then 1093 Screen.Forms[i].Close;1093 DpiScreen.Forms[i].Close; 1094 1094 end 1095 1095 else … … 1116 1116 if G.RO[DipMem[me].pContact] <> nil then 1117 1117 begin // close windows for next player 1118 for i := 0 to Screen.FormCount - 1 do1119 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg)1118 for i := 0 to DpiScreen.FormCount - 1 do 1119 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) 1120 1120 then 1121 Screen.Forms[i].Close;1121 DpiScreen.Forms[i].Close; 1122 1122 end 1123 1123 else … … 1231 1231 begin 1232 1232 if AILogo[p] = nil then 1233 AILogo[p] := T Bitmap.Create;1233 AILogo[p] := TDpiBitmap.Create; 1234 1234 if not LoadGraphicFile(AILogo[p], HomeDir + Name + '.png', gfNoError) then 1235 1235 begin … … 1497 1497 1498 1498 HGrStdUnits := LoadGraphicSet('StdUnits.png'); 1499 SmallImp := T Bitmap.Create;1499 SmallImp := TDpiBitmap.Create; 1500 1500 SmallImp.PixelFormat := pf24bit; 1501 1501 InitSmallImp; … … 1811 1811 end; 1812 1812 1813 for i := 0 to Screen.FormCount - 1 do1814 if Screen.Forms[i] is TBufferedDrawDlg then1815 Screen.Forms[i].Enabled := true;1813 for i := 0 to DpiScreen.FormCount - 1 do 1814 if DpiScreen.Forms[i] is TBufferedDrawDlg then 1815 DpiScreen.Forms[i].Enabled := true; 1816 1816 1817 1817 if ClientMode <> cResume then … … 1824 1824 // first turn after anarchy -- don't show despotism palace! 1825 1825 Update; 1826 for i := 0 to Screen.FormCount - 1 do1827 if ( Screen.Forms[i].Visible) and (Screen.Forms[i] is TBufferedDrawDlg)1826 for i := 0 to DpiScreen.FormCount - 1 do 1827 if (DpiScreen.Forms[i].Visible) and (DpiScreen.Forms[i] is TBufferedDrawDlg) 1828 1828 then 1829 1829 begin 1830 if @ Screen.Forms[i].OnShow <> nil then1831 Screen.Forms[i].OnShow(nil);1832 Screen.Forms[i].Invalidate;1833 Screen.Forms[i].Update;1830 if @DpiScreen.Forms[i].OnShow <> nil then 1831 DpiScreen.Forms[i].OnShow(nil); 1832 DpiScreen.Forms[i].Invalidate; 1833 DpiScreen.Forms[i].Update; 1834 1834 end; 1835 1835 … … 2665 2665 SaveSettings; 2666 2666 CityDlg.CloseAction := None; 2667 for i := 0 to Screen.FormCount - 1 do2668 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg)2667 for i := 0 to DpiScreen.FormCount - 1 do 2668 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) 2669 2669 then 2670 Screen.Forms[i].Close;2670 DpiScreen.Forms[i].Close; 2671 2671 if LogDlg.Visible then 2672 2672 LogDlg.Close; … … 3409 3409 i, j: integer; 3410 3410 begin 3411 MainFormKeyDown := FormKeyDown;3412 3411 BaseWin.CreateOffscreen(Offscreen); 3413 3412 … … 3508 3507 end; 3509 3508 3510 Mini := T Bitmap.Create;3509 Mini := TDpiBitmap.Create; 3511 3510 Mini.PixelFormat := pf24bit; 3512 Panel := T Bitmap.Create;3511 Panel := TDpiBitmap.Create; 3513 3512 Panel.PixelFormat := pf24bit; 3514 3513 Panel.Canvas.Font.Assign(UniFont[ftSmall]); 3515 3514 Panel.Canvas.Brush.Style := bsClear; 3516 TopBar := T Bitmap.Create;3515 TopBar := TDpiBitmap.Create; 3517 3516 TopBar.PixelFormat := pf24bit; 3518 3517 TopBar.Canvas.Font.Assign(UniFont[ftNormal]); 3519 3518 TopBar.Canvas.Brush.Style := bsClear; 3520 Buffer := T Bitmap.Create;3519 Buffer := TDpiBitmap.Create; 3521 3520 Buffer.PixelFormat := pf24bit; 3522 3521 if 2 * lxmax > 3 * xSizeBig then … … 3538 3537 procedure TMainScreen.FormDestroy(Sender: TObject); 3539 3538 var 3540 I: Integer; 3541 begin 3542 MainFormKeyDown := nil; 3539 i: integer; 3540 begin 3543 3541 FreeAndNil(sb); 3544 3542 FreeAndNil(TopBar); … … 3546 3544 FreeAndNil(Buffer); 3547 3545 FreeAndNil(Panel); 3548 for I:= 0 to nPl - 1 do3546 for i := 0 to nPl - 1 do 3549 3547 if AILogo[i] <> nil then 3550 FreeAndNil(AILogo[ I]);3548 FreeAndNil(AILogo[i]); 3551 3549 FreeAndNil(Offscreen); 3552 3550 end; … … 3753 3751 if supervising and (me <> 0) then 3754 3752 begin 3755 for i := 0 to Screen.FormCount - 1 do3756 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then3757 Screen.Forms[i].Close; // close windows3753 for i := 0 to DpiScreen.FormCount - 1 do 3754 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) then 3755 DpiScreen.Forms[i].Close; // close windows 3758 3756 ItsMeAgain(0); 3759 3757 end; … … 3899 3897 if IsMultiPlayerGame then 3900 3898 begin // close windows for next player 3901 for i := 0 to Screen.FormCount - 1 do3902 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then3903 Screen.Forms[i].Close;3899 for i := 0 to DpiScreen.FormCount - 1 do 3900 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) then 3901 DpiScreen.Forms[i].Close; 3904 3902 end 3905 3903 else … … 3911 3909 end; 3912 3910 for i := 0 to Screen.FormCount - 1 do 3913 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then3914 Screen.Forms[i].Enabled := false;3911 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) then 3912 DpiScreen.Forms[i].Enabled := false; 3915 3913 3916 3914 if Server(sTurn, pTurn, 0, nil^) >= rExecuted then … … 4179 4177 {$IFDEF LINUX} 4180 4178 // Can't do scrolling of DC under Linux, then fallback into BitBlt. 4181 function ScrollDC(Canvas: T Canvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean;4179 function ScrollDC(Canvas: TDpiCanvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean; 4182 4180 begin 4183 4181 BitBltCanvas(Canvas, lprcScroll.Left + dx, lprcScroll.Top + dy, lprcScroll.Right - lprcScroll.Left, lprcScroll.Bottom - lprcScroll.Top, … … 5080 5078 begin 5081 5079 if idle and (me >= 0) and (GameMode <> cMovie) then 5082 if (fsModal in Screen.ActiveForm.FormState) or5083 ( Screen.ActiveForm is TBufferedDrawDlg) and5084 (TBufferedDrawDlg( Screen.ActiveForm).WindowMode <> wmPersistent) then5080 if (fsModal in DpiScreen.ActiveForm.FormState) or 5081 (DpiScreen.ActiveForm is TBufferedDrawDlg) and 5082 (TBufferedDrawDlg(DpiScreen.ActiveForm).WindowMode <> wmPersistent) then 5085 5083 begin 5086 5084 BlinkTime := BlinkOnTime + BlinkOffTime - 1; … … 5117 5115 if (dx <> 0) or (dy <> 0) then 5118 5116 begin 5119 if ( Screen.ActiveForm <> MainScreen) and5120 (@ Screen.ActiveForm.OnDeactivate <> nil) then5121 Screen.ActiveForm.OnDeactivate(nil);5117 if (DpiScreen.ActiveForm <> MainScreen) and 5118 (@DpiScreen.ActiveForm.OnDeactivate <> nil) then 5119 DpiScreen.ActiveForm.OnDeactivate(nil); 5122 5120 Scroll(dx, dy); 5123 5121 end … … 6458 6456 ((p = 0) or (1 shl p and G.RO[0].Alive <> 0)) then 6459 6457 begin 6460 for i := 0 to Screen.FormCount - 1 do6461 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then6462 Screen.Forms[i].Close; // close windows6458 for i := 0 to DpiScreen.FormCount - 1 do 6459 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) then 6460 DpiScreen.Forms[i].Close; // close windows 6463 6461 ItsMeAgain(p); 6464 6462 SumCities(TaxSum, ScienceSum); … … 8003 8001 Centre(CenterLoc); 8004 8002 PaintAllMaps; 8005 for i := 0 to Screen.FormCount - 1 do8006 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then8007 TBufferedDrawDlg( Screen.Forms[i]).SmartUpdateContent(false);8003 for i := 0 to DpiScreen.FormCount - 1 do 8004 if DpiScreen.Forms[i].Visible and (DpiScreen.Forms[i] is TBufferedDrawDlg) then 8005 TBufferedDrawDlg(DpiScreen.Forms[i]).SmartUpdateContent(false); 8008 8006 end; 8009 8007
Note:
See TracChangeset
for help on using the changeset viewer.