Changeset 473 for trunk/LocalPlayer


Ignore:
Timestamp:
Dec 4, 2023, 12:13:15 PM (13 months ago)
Author:
chronos
Message:
  • Added: Custom DPI configuration in Settings dialog.
  • Fixed: Better High DPI support.
Location:
trunk/LocalPlayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/MessgEx.pas

    r471 r473  
    103103  else
    104104    Button1.Left := 159;
    105   RemoveBtn.Left := ClientWidth - 38;
     105  RemoveBtn.Left := Width - 38;
    106106  case Kind of
    107107    mkYesNo, mkYesNoCancel:
     
    151151
    152152  SplitText(True);
    153   ClientHeight := 72 + Border + TopSpace + Lines * MessageLineSpacing;
     153  Height := 72 + Border + TopSpace + Lines * MessageLineSpacing;
    154154  if GameMode = cMovie then
    155     ClientHeight := ClientHeight - 32;
     155    Height := Height - 32;
    156156  if Kind = mkModel then
    157     ClientHeight := ClientHeight + 36;
     157    Height := Height + 36;
    158158  if IconKind in [mikMyArmy, mikEnemyArmy] then
    159159  begin
    160160    if nLostArmy > LostUnitsPerLine * 6 then
    161       ClientHeight := ClientHeight + 6 * 48
     161      Height := Height + 6 * 48
    162162    else
    163       ClientHeight := ClientHeight + ((nLostArmy - 1) div LostUnitsPerLine
     163      Height := Height + ((nLostArmy - 1) div LostUnitsPerLine
    164164        + 1) * 48;
    165165  end;
     
    167167    0:
    168168      begin
    169         Left := (Screen.Width - ClientWidth) div 2;
    170         Top := (Screen.Height - ClientHeight) div 2 - MapCenterUp;
     169        Left := (Screen.Width - Width) div 2;
     170        Top := (Screen.Height - Height) div 2 - MapCenterUp;
    171171      end;
    172172    1:
    173173      begin
    174         Left := (Screen.Width - ClientWidth) div 4;
    175         Top := (Screen.Height - ClientHeight) * 2 div 3 - MapCenterUp;
     174        Left := (Screen.Width - Width) div 4;
     175        Top := (Screen.Height - Height) * 2 div 3 - MapCenterUp;
    176176      end;
    177177    -1:
    178178      begin
    179         Left := (Screen.Width - ClientWidth) div 4;
    180         Top := (Screen.Height - ClientHeight) div 3 - MapCenterUp;
     179        Left := (Screen.Width - Width) div 4;
     180        Top := (Screen.Height - Height) div 3 - MapCenterUp;
    181181      end;
    182182  end;
    183183  for I := 0 to ControlCount - 1 do
    184     Controls[I].Top := ClientHeight - (34 + Border);
     184    Controls[I].Top := Height - (34 + Border);
    185185  if Kind = mkModel then
    186     EInput.Top := ClientHeight - (76 + Border);
     186    EInput.Top := Height - (76 + Border);
    187187end;
    188188
     
    321321    for count := 0 to LostArmy[emix] - 1 do
    322322    begin
    323       X := ClientWidth div 2 + ix * 64 - UnitsInLine * 32;
     323      X := Width div 2 + ix * 64 - UnitsInLine * 32;
    324324      Y := 26 + Border + TopSpace + Lines * MessageLineSpacing + iy * 48;
    325325      with MyRO.EnemyModel[emix], Tribe[Owner].ModelPicture[mix] do
     
    371371        BitBltCanvas(Buffer.Canvas, 0, 0, xSizeBig + 2 * GlowRange,
    372372          ySizeBig + 2 * GlowRange, Canvas,
    373           ClientWidth div 2 - (28 + GlowRange), 24 - GlowRange);
     373          Width div 2 - (28 + GlowRange), 24 - GlowRange);
    374374        BitBltCanvas(Buffer.Canvas, GlowRange, GlowRange, xSizeBig, ySizeBig,
    375375          BigImp.Canvas, IconIndex mod 7 * xSizeBig,
     
    380380          GlowFrame(Buffer, GlowRange, GlowRange, xSizeBig, ySizeBig,
    381381            Tribe[p1].Color);
    382         BitBltCanvas(Canvas, ClientWidth div 2 - (28 + GlowRange),
     382        BitBltCanvas(Canvas, Width div 2 - (28 + GlowRange),
    383383          24 - GlowRange, xSizeBig + 2 * GlowRange, ySizeBig + 2 * GlowRange,
    384384          Buffer.Canvas, 0, 0);
    385385      end
    386386      else
    387         ImpImage(Canvas, ClientWidth div 2 - 28, 24, IconIndex);
     387        ImpImage(Canvas, Width div 2 - 28, 24, IconIndex);
    388388    mikAge:
    389389      begin
    390390        if IconIndex = 0 then
    391           ImpImage(Canvas, ClientWidth div 2 - 28, 24, -7)
     391          ImpImage(Canvas, Width div 2 - 28, 24, -7)
    392392        else
    393           ImpImage(Canvas, ClientWidth div 2 - 28, 24, 24 + IconIndex)
     393          ImpImage(Canvas, Width div 2 - 28, 24, 24 + IconIndex)
    394394      end;
    395395    mikModel:
    396396      with Tribe[Me].ModelPicture[IconIndex] do
    397397      begin
    398         FrameImage(Canvas, BigImp, ClientWidth div 2 - 28, 24, xSizeBig,
     398        FrameImage(Canvas, BigImp, Width div 2 - 28, 24, xSizeBig,
    399399          ySizeBig, 0, 0);
    400         BitBltCanvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44,
     400        BitBltCanvas(Canvas, Width div 2 - 32, 20, 64, 44,
    401401          HGr.Mask.Canvas, pix mod 10 * 65 + 1,
    402402          pix div 10 * 49 + 1, SRCAND);
    403         BitBltCanvas(Canvas, ClientWidth div 2 - 32, 20, 64, 44,
     403        BitBltCanvas(Canvas, Width div 2 - 32, 20, 64, 44,
    404404          HGr.Data.Canvas, pix mod 10 * 65 + 1,
    405405          pix div 10 * 49 + 1, SRCPAINT);
    406406      end;
    407407    mikBook:
    408       PaintBook(Canvas, ClientWidth div 2, 24, MainTexture.ColorPage,
     408      PaintBook(Canvas, Width div 2, 24, MainTexture.ColorPage,
    409409        MainTexture.ColorCover);
    410410    mikTribe:
    411411      if Assigned(Tribe[IconIndex].faceHGr) then
    412412      begin
    413         Frame(Canvas, ClientWidth div 2 - 32 - 1, 24 - 1,
    414           ClientWidth div 2 + 32, 24 + 48, $000000, $000000);
    415         BitBltCanvas(Canvas, ClientWidth div 2 - 32, 24, 64, 48,
     413        Frame(Canvas, Width div 2 - 32 - 1, 24 - 1,
     414          Width div 2 + 32, 24 + 48, $000000, $000000);
     415        BitBltCanvas(Canvas, Width div 2 - 32, 24, 64, 48,
    416416          Tribe[IconIndex].faceHGr.Data.Canvas,
    417417          1 + Tribe[IconIndex].facepix mod 10 * 65,
     
    419419      end;
    420420    mikPureIcon:
    421       FrameImage(Canvas, BigImp, ClientWidth div 2 - 28, 24, xSizeBig, ySizeBig,
     421      FrameImage(Canvas, BigImp, Width div 2 - 28, 24, xSizeBig, ySizeBig,
    422422        IconIndex mod 7 * xSizeBig, IconIndex div 7 * ySizeBig);
    423423    mikBigIcon:
    424       FrameImage(Canvas, BigImp, ClientWidth div 2 - 3 * 28, 32, xSizeBig * 3,
     424      FrameImage(Canvas, BigImp, Width div 2 - 3 * 28, 32, xSizeBig * 3,
    425425        ySizeBig * 3, IconIndex mod 2 * 3 * xSizeBig,
    426426        IconIndex div 2 * 3 * ySizeBig);
     
    428428      begin
    429429        BitBltCanvas(Buffer.Canvas, 0, 0, 140, 120, Canvas,
    430           (ClientWidth - 140) div 2, 24);
     430          (Width - 140) div 2, 24);
    431431        ImageOp_BCC(Buffer, Templates.Data, Point(0, 0), StarshipDeparted.BoundsRect, 0, $FFFFFF);
    432         BitBltCanvas(Canvas, (ClientWidth - 140) div 2, 24, 140, 120,
     432        BitBltCanvas(Canvas, (Width - 140) div 2, 24, 140, 120,
    433433          Buffer.Canvas, 0, 0);
    434434      end;
     
    438438      PaintEnemyArmy;
    439439    mikFullControl:
    440       Sprite(Canvas, HGrSystem2, ClientWidth div 2 - 31, 24, 63, 63, 1, 281);
     440      Sprite(Canvas, HGrSystem2, Width div 2 - 31, 24, 63, 63, 1, 281);
    441441    mikShip:
    442       PaintColonyShip(Canvas, IconIndex, 17, ClientWidth - 34, 38);
     442      PaintColonyShip(Canvas, IconIndex, 17, Width - 34, 38);
    443443  end;
    444444
  • trunk/LocalPlayer/Select.pas

    r471 r473  
    180180  if S <> '' then
    181181    LoweredTextOut(Canvas, -1, MainTexture,
    182       (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, 31, S);
     182      (Width - BiColorTextWidth(Canvas, S)) div 2, 31, S);
    183183  if not MultiPage and (Kind in [kProject, kAdvance, kFarAdvance]) and not Phrases2FallenBackToEnglish
    184184  then
     
    186186    S := Phrases2.Lookup('SHIFTCLICK');
    187187    LoweredTextOut(Canvas, -2, MainTexture,
    188       (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, ClientHeight - 29, S);
     188      (Width - BiColorTextWidth(Canvas, S)) div 2, Height - 29, S);
    189189  end;
    190190end;
     
    231231      if Y + TextSize.cy >= TitleHeight + InnerHeight then
    232232        TextSize.cy := TitleHeight + InnerHeight - Y;
    233       Fill(ca, X, Y, TextSize.cx, TextSize.cy, (Maintexture.Width - ClientWidth)
    234         div 2, (Maintexture.Height - ClientHeight) div 2);
     233      Fill(ca, X, Y, TextSize.cx, TextSize.cy, (Maintexture.Width - Width)
     234        div 2, (Maintexture.Height - Height) div 2);
    235235    end;
    236236    LoweredTextOut(ca, Color, MainTexture, X, Y, S);
     
    811811    if ScienceNation <> OldScienceNation then
    812812    begin
    813       Fill(Canvas, 9, ClientHeight - 29, ClientWidth - 18, 24,
    814         (Maintexture.Width - ClientWidth) div 2,
    815         (Maintexture.Height - ClientHeight) div 2);
     813      Fill(Canvas, 9, Height - 29, Width - 18, 24,
     814        (Maintexture.Width - Width) div 2,
     815        (Maintexture.Height - Height) div 2);
    816816      if ScienceNation >= 0 then
    817817      begin
     
    823823          S := S + ' (' + TurnToString(MyRO.EnemyReport[ScienceNation]
    824824            .TurnOfCivilReport) + ')'; // old report
    825         xScreen := (ClientWidth - BiColorTextWidth(Canvas, S)) div 2;
     825        xScreen := (Width - BiColorTextWidth(Canvas, S)) div 2;
    826826        LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10,
    827           ClientHeight - 29, S);
     827          Height - 29, S);
    828828        BitBltCanvas(ScienceNationDotBuffer.Canvas, 0, 0, ScienceNationDot.Width,
    829           ScienceNationDot.Height, Canvas, xScreen - 10, ClientHeight - 27);
     829          ScienceNationDot.Height, Canvas, xScreen - 10, Height - 27);
    830830        ImageOp_BCC(ScienceNationDotBuffer, Templates.Data, Point(0, 0),
    831831          ScienceNationDot.BoundsRect, MainTexture.ColorBevelShade, Tribe[ScienceNation].Color);
    832         BitBltCanvas(Canvas, xScreen - 10, ClientHeight - 27, ScienceNationDot.Width,
     832        BitBltCanvas(Canvas, xScreen - 10, Height - 27, ScienceNationDot.Width,
    833833          ScienceNationDot.Height, ScienceNationDotBuffer.Canvas, 0, 0);
    834834      end;
     
    15771577      DispLines := MaxLines;
    15781578    InnerHeight := LineDistance * (DispLines + 1) + 24;
    1579     ClientHeight := InnerHeight + TitleHeight + WideFrame;
     1579    Height := InnerHeight + TitleHeight + WideFrame;
    15801580  end
    15811581  else
     
    15841584      DispLines := MaxLines;
    15851585    InnerHeight := LineDistance * (DispLines + 1) + 24;
    1586     ClientHeight := InnerHeight + TitleHeight + NarrowFrame;
    1587   end;
    1588   Assert(ClientHeight <= Maintexture.Height);
     1586    Height := InnerHeight + TitleHeight + NarrowFrame;
     1587  end;
     1588  Assert(Height <= Maintexture.Height);
    15891589
    15901590  TechNameSpace := 224;
     
    16181618    InnerWidth := 363;
    16191619  end;
    1620   ClientWidth := InnerWidth + 2 * SideFrame;
    1621 
    1622   CloseBtn.Left := ClientWidth - 38;
     1620  Width := InnerWidth + 2 * SideFrame;
     1621
     1622  CloseBtn.Left := Width - 38;
    16231623  CaptionLeft := ToggleBtn.Left + ToggleBtn.Width;
    16241624  CaptionRight := CloseBtn.Left;
     
    16451645  if Kind = kProject then
    16461646  begin
    1647     Layer0Btn.Top := ClientHeight - 31;
    1648     Layer0Btn.Left := ClientWidth div 2 - (12 + 29);
     1647    Layer0Btn.Top := Height - 31;
     1648    Layer0Btn.Left := Width div 2 - (12 + 29);
    16491649    Layer0Btn.Down := True;
    1650     Layer1Btn.Top := ClientHeight - 31;
    1651     Layer1Btn.Left := ClientWidth div 2 - (12 - 29);
     1650    Layer1Btn.Top := Height - 31;
     1651    Layer1Btn.Left := Width div 2 - (12 - 29);
    16521652    Layer1Btn.Down := False;
    1653     Layer2Btn.Top := ClientHeight - 31;
    1654     Layer2Btn.Left := ClientWidth div 2 - 12;
     1653    Layer2Btn.Top := Height - 31;
     1654    Layer2Btn.Left := Width div 2 - 12;
    16551655    Layer2Btn.Down := False;
    16561656  end;
     
    16671667var
    16681668  I: Integer;
    1669   ShowFocus, forceclose: Boolean;
    1670 begin
    1671   forceclose := (ListKind <> Kind) and
     1669  ShowFocus, ForceClose: Boolean;
     1670begin
     1671  ForceClose := (ListKind <> Kind) and
    16721672    not((Kind = kCities) and (ListKind = kCityEvents)) and
    16731673    not((Kind = kCityEvents) and (ListKind = kCities)) and
     
    17461746  CloseBtn.Visible := not(Kind in MustChooseKind);
    17471747
    1748   inherited ShowNewContent(NewMode, forceclose);
     1748  inherited ShowNewContent(NewMode, ForceClose);
    17491749end;
    17501750
Note: See TracChangeset for help on using the changeset viewer.