Changeset 246


Ignore:
Timestamp:
May 21, 2020, 8:17:38 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Update from trunk rev 245.
  • Modified: Vcl prefix/suffix changed to Native.
Location:
branches/highdpi
Files:
3 added
46 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/AI/Liberator/Liberator.ai.txt

    r124 r246  
    11#NAME Liberator AI
    22#GAMEVERSION 1.2.0
    3 #BEGINNER
    43#PATH Liberator.dll
    54#CREDITS Liberator AI by Dirk (http://c-evo.org/bb/viewtopic.php?f=5&t=162).
  • branches/highdpi/Back.lfm

    r210 r246  
    1818  LCLVersion = '1.6.2.0'
    1919  WindowState = wsMaximized
     20  PixelsPerInch = 96
     21  Scaled = False
    2022end
  • branches/highdpi/Back.pas

    r210 r246  
    6565begin
    6666  if FullScreen then begin
    67     WindowState := wsMaximized;
     67    WindowState := wsFullScreen;
    6868    if not Assigned(Img) then begin
    6969      FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
     
    7575  end else begin
    7676    WindowState := wsNormal;
    77     Width := StartDlg.Width + 16;
    78     Height := StartDlg.Height + 16;
    79     Left := StartDlg.Left - 8;
    80     Top := StartDlg.Top - 8;
     77    BoundsRect := Bounds(StartDlg.Left - 8, StartDlg.Top - 8,
     78      StartDlg.Width + 16, StartDlg.Height + 16);
    8179  end;
    8280end;
  • branches/highdpi/Database.pas

    r210 r246  
    2929
    3030  CityOwnTile = 13;
     31
     32type
     33  TGameMode = (moLoading_Fast, moLoading, moMovie, moPlaying);
    3134
    3235var
     
    4548  GTurn: Integer; { current turn }
    4649  GTestFlags: Integer;
    47   Mode: (moLoading_Fast, moLoading, moMovie, moPlaying);
     50  Mode: TGameMode;
    4851  GWonder: array [0 .. 27] of TWonderInfo;
    4952  ServerVersion: array [0 .. nPl - 1] of integer;
  • branches/highdpi/Direct.lfm

    r210 r246  
    1818  OnShow = FormShow
    1919  LCLVersion = '1.8.0.6'
     20  PixelsPerInch = 96
     21  Scaled = False
    2022end
  • branches/highdpi/GameServer.pas

    r210 r246  
    45034503end; { <<<server }
    45044504
     4505function ExtractFileNameWithoutExt(const Filename: string): string;
     4506var
     4507  P: Integer;
     4508begin
     4509  Result := Filename;
     4510  P := Length(Result);
     4511  while P > 0 do begin
     4512    case Result[P] of
     4513      PathDelim: Exit;
     4514      {$ifdef windows}
     4515      '/': if ('/' in AllowDirectorySeparators) then Exit;
     4516      {$endif}
     4517      '.': Exit(Copy(Result, 1, P - 1));
     4518    end;
     4519    Dec(P);
     4520  end;
     4521end;
     4522
    45054523{ TBrain }
    45064524
  • branches/highdpi/Inp.lfm

    r210 r246  
    1717  OnShow = FormShow
    1818  PixelsPerInch = 96
     19  Scaled = False
    1920  object OKBtn: TButtonA
    2021    Left = 66
  • branches/highdpi/Install/deb/debian/install

    r125 r246  
    1010Localization usr/share/c-evo
    1111Maps usr/share/c-evo
     12Saved usr/share/c-evo
    1213
    1314AI/StdAI/StdAI.ai.txt usr/share/c-evo/AI/StdAI
  • branches/highdpi/Install/win/C-evo.iss

    r210 r246  
    1 ; Script generated by the Inno Setup Script Wizard.
    2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
    3 
    4 #define MyAppName "C-evo"
    5 #define MyAppVersion "1.2.0"
    6 #define MyAppPublisher "Chronosoft"
    7 #define MyAppPublisherShort "Chronosoft"
    8 #define MyAppURL "https://app.zdechov.net/c-evo"
    9 #define MyAppExeName "C-evo.exe"
    10 #define MyAppDebugName "C-evo.dbg"
    11 #define MyAppSubDir "../.."
     1#include "Common.iss"
    122
    133[Setup]
    14 ; NOTE: The value of AppId uniquely identifies this application.
    15 ; Do not use the same AppId value in installers for other applications.
    16 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
    17 AppId={{6B40AF4D-C38C-4474-9614-8F0C4376C1CF}
    18 AppName={#MyAppName}
    19 AppVersion={#MyAppVersion}
    20 AppVerName={#MyAppName} {#MyAppVersion}
    21 UninstallDisplayName={#MyAppName}
    22 UninstallDisplayIcon="{app}\{#MyAppExeName}"
    23 VersionInfoVersion={#MyAppVersion}
    24 VersionInfoCompany={#MyAppPublisher} 
    25 AppPublisher={#MyAppPublisher}
    26 AppPublisherURL={#MyAppURL}
    27 AppSupportURL={#MyAppURL}
    28 AppUpdatesURL={#MyAppURL}
    29 DefaultDirName={pf}\{#MyAppName}
    30 DefaultGroupName={#MyAppName}
    31 AllowNoIcons=yes
    32 OutputDir=.
    33 OutputBaseFilename=Install-{#MyAppName}-{#MyAppVersion}
    34 Compression=lzma
    35 SolidCompression=yes
    36 ChangesAssociations=yes
    374; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
    385; done in "64-bit mode" on x64, meaning it should use the native
     
    4310; installation to run on all architectures (including Itanium,
    4411; since it's capable of running 32-bit code too).
    45 
    46 [Languages]
    47 Name: "en"; MessagesFile: "compiler:Default.isl"
    48 Name: "cs"; MessagesFile: "compiler:Languages\Czech.isl"
    49 Name: "de"; MessagesFile: "compiler:Languages\German.isl"
    50 Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
    51 Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"
    52 
    53 [Tasks]
    54 Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags:
    55 
    56 [Registry]
    57 Root: HKCU; Subkey: "Software\C-evo"; Flags: uninsdeletekey
    58 
    59 #define FileTypeName "C-evo book"
    60 Root: HKCR; Subkey: ".cevo"; ValueType: string; ValueName: ""; ValueData: "{#FileTypeName}"; Flags: uninsdeletevalue
    61 Root: HKCR; Subkey: "{#FileTypeName}"; ValueType: string; ValueName: ""; ValueData: "{#FileTypeName}"; Flags: uninsdeletekey
    62 Root: HKCR; Subkey: "{#FileTypeName}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
    63 Root: HKCR; Subkey: "{#FileTypeName}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
     12OutputBaseFilename=Install-{#MyAppName}-{#MyAppVersion}
    6413
    6514[Components]
    66 Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed
    67 Name: "maps"; Description: "Maps"; Types: full
    68 Name: "lang"; Description: "Language files"; Types: full
    69 Name: "lang\cs"; Description: "Czech"; Types: full
    70 Name: "lang\de"; Description: "German"; Types: full
    71 Name: "lang\it"; Description: "Italian"; Types: full
    72 Name: "lang\ru"; Description: "Russian"; Types: full
    73 Name: "lang\zhHans"; Description: "Chinese Simplified"; Types: full
    74 Name: "lang\zhHant"; Description: "Chinese Traditional"; Types: full
    75 Name: "ai"; Description: "AI files"; Types: full
    76 Name: "ai\stdai"; Description: "StdAI"; Types: full
    77 Name: "ai\ai_uo"; Description: "AI_UO"; Types: full; Check: not Is64BitInstallMode;
    78 Name: "ai\capital_ai"; Description: "Capital AI"; Types: full; Check: not Is64BitInstallMode;
    79 Name: "ai\aias"; Description: "AIAS"; Types: full; Check: not Is64BitInstallMode;
    80 Name: "ai\civseed"; Description: "Civilisation Seed AI"; Types: full; Check: not Is64BitInstallMode;
    81 Name: "ai\crystal"; Description: "Crystal"; Types: full; Check: not Is64BitInstallMode;
    82 Name: "ai\kiai"; Description: "KIAI"; Types: full; Check: not Is64BitInstallMode;
    83 Name: "ai\liberator"; Description: "Liberator"; Types: full; Check: not Is64BitInstallMode;
    84 Name: "ai\seti"; Description: "SETI"; Types: full; Check: not Is64BitInstallMode;
    85 Name: "ai\shah"; Description: "Shah"; Types: full; Check: not Is64BitInstallMode;
    86 Name: "ai_template"; Description: "AI template"; Types: full
     15Name: "ai\ai_uo"; Description: "AI_UO"; Types: full
     16Name: "ai\capital_ai"; Description: "Capital AI"; Types: full
     17Name: "ai\aias"; Description: "AIAS"; Types: full
     18Name: "ai\civseed"; Description: "Civilisation Seed AI"; Types: full
     19Name: "ai\crystal"; Description: "Crystal"; Types: full
     20Name: "ai\kiai"; Description: "KIAI"; Types: full
     21Name: "ai\liberator"; Description: "Liberator"; Types: full
     22Name: "ai\seti"; Description: "SETI"; Types: full
     23Name: "ai\shah"; Description: "Shah"; Types: full
    8724
    8825[Files]
    89 Source: "{#MyAppSubDir}\lib\x86_64-win64-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode; Components: main
    90 Source: "{#MyAppSubDir}\lib\i386-win32-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode; Components: main
    91 Source: "{#MyAppSubDir}\Graphics\*"; DestDir: "{app}\Graphics"; Flags: ignoreversion; Components: main
    92 Source: "{#MyAppSubDir}\Sounds\*.*"; DestDir: "{app}\Sounds"; Flags: ignoreversion; Components: main
    93 Source: "{#MyAppSubDir}\Tribes\*.*"; DestDir: "{app}\Tribes"; Flags: ignoreversion; Components: main
    94 Source: "{#MyAppSubDir}\Localization\cs\*.*"; DestDir: "{app}\Localization\cs"; Flags: ignoreversion recursesubdirs; Components: lang\cs
    95 Source: "{#MyAppSubDir}\Localization\de\*.*"; DestDir: "{app}\Localization\de"; Flags: ignoreversion recursesubdirs; Components: lang\de
    96 Source: "{#MyAppSubDir}\Localization\it\*.*"; DestDir: "{app}\Localization\it"; Flags: ignoreversion recursesubdirs; Components: lang\it
    97 Source: "{#MyAppSubDir}\Localization\ru\*.*"; DestDir: "{app}\Localization\ru"; Flags: ignoreversion recursesubdirs; Components: lang\ru
    98 Source: "{#MyAppSubDir}\Localization\zh-Hans\*.*"; DestDir: "{app}\Localization\zh-Hans"; Flags: ignoreversion recursesubdirs; Components: lang\zhHans
    99 Source: "{#MyAppSubDir}\Localization\zh-Hant\*.*"; DestDir: "{app}\Localization\zh-Hant"; Flags: ignoreversion recursesubdirs; Components: lang\zhHant
    100 Source: "{#MyAppSubDir}\Help\*.*"; DestDir: "{app}\Help"; Flags: ignoreversion; Components: main
    101 Source: "{#MyAppSubDir}\Fonts.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main
    102 Source: "{#MyAppSubDir}\Language.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main
    103 Source: "{#MyAppSubDir}\Language2.txt"; DestDir: "{app}"; Flags: ignoreversion; Components: main
    104 Source: "{#MyAppSubDir}\AI Template\*.*"; DestDir: "{app}\AI Template"; Flags: ignoreversion recursesubdirs; Components: ai_template
    105 Source: "{#MyAppSubDir}\AI\StdAI\lib\x86_64-win64-Release\StdAI.dll"; DestDir: "{app}\AI\StdAI"; DestName: "StdAI-win64.dll"; Flags: ignoreversion; Components: ai\stdai
    106 Source: "{#MyAppSubDir}\AI\StdAI\lib\i386-win32-Release\StdAI.dll"; DestDir: "{app}\AI\StdAI"; DestName: "StdAI-win32.dll"; Flags: ignoreversion; Components: ai\stdai
    107 Source: "{#MyAppSubDir}\AI\StdAI\StdAI.png"; DestDir: "{app}\AI\StdAI"; Flags: ignoreversion; Components: ai\stdai
    108 Source: "{#MyAppSubDir}\AI\StdAI\StdAI.ai.txt"; DestDir: "{app}\AI\StdAI"; Flags: ignoreversion; Components: ai\stdai
    109 Source: "{#MyAppSubDir}\AI\AI_UO\*.*"; DestDir: "{app}\AI\AI_UO"; Flags: ignoreversion; Components: ai\ai_uo
    110 Source: "{#MyAppSubDir}\AI\AIAS\*.*"; DestDir: "{app}\AI\AIAS"; Flags: ignoreversion; Components: ai\aias
    111 Source: "{#MyAppSubDir}\AI\Capital AI\*.*"; DestDir: "{app}\AI\Capital AI"; Flags: ignoreversion; Components: ai\capital_ai
    112 Source: "{#MyAppSubDir}\AI\Civilisation Seed AI\*.*"; DestDir: "{app}\AI\Civilisation Seed AI"; Flags: ignoreversion; Components: ai\civseed
    113 Source: "{#MyAppSubDir}\AI\Crystal\*.*"; DestDir: "{app}\AI\Crystal"; Flags: ignoreversion; Components: ai\crystal
    114 Source: "{#MyAppSubDir}\AI\KIAI\*.*"; DestDir: "{app}\AI\KIAI"; Flags: ignoreversion; Components: ai\kiai
    115 Source: "{#MyAppSubDir}\AI\Liberator\*.*"; DestDir: "{app}\AI\Liberator"; Flags: ignoreversion; Components: ai\liberator
    116 Source: "{#MyAppSubDir}\AI\SETI\*.*"; DestDir: "{app}\AI\SETI"; Flags: ignoreversion; Components: ai\seti
    117 Source: "{#MyAppSubDir}\AI\Shah\*.*"; DestDir: "{app}\AI\Shah"; Flags: ignoreversion; Components: ai\shah
    118 Source: "{#MyAppSubDir}\Maps\*.*"; DestDir: "{localappdata}\c-evo\Maps"; Flags: ignoreversion; Components: maps
    119 Source: "{#MyAppSubDir}\Saved\*.*"; DestDir: "{localappdata}\c-evo\Saved"; Flags: ignoreversion; Components: main
    120 ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
    121 
    122 [Icons]
    123 Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
    124 Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
    125 Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
    126 
    127 [Run]
    128 Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent
    129 
     26Source: "{#MyAppSubDir}\lib\x86_64-win64-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Components: main; Check: not Is64BitInstallMode
     27Source: "{#MyAppSubDir}\lib\i386-win32-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Components: main; Check: Is64BitInstallMode
     28Source: "{#MyAppSubDir}\AI\StdAI\lib\i386-win32-Release\StdAI.dll"; DestDir: "{app}\AI\StdAI"; DestName: "StdAI-win32.dll"; Flags: ignoreversion; Components: ai\stdai; Check: not Is64BitInstallMode
     29Source: "{#MyAppSubDir}\AI\StdAI\lib\x86_64-win64-Release\StdAI.dll"; DestDir: "{app}\AI\StdAI"; DestName: "StdAI-win64.dll"; Flags: ignoreversion; Components: ai\stdai; Check: Is64BitInstallMode
     30Source: "{#MyAppSubDir}\AI\AI_UO\*.*"; DestDir: "{app}\AI\AI_UO"; Flags: ignoreversion; Components: ai\ai_uo; Check: not Is64BitInstallMode
     31Source: "{#MyAppSubDir}\AI\AIAS\*.*"; DestDir: "{app}\AI\AIAS"; Flags: ignoreversion; Components: ai\aias; Check: not Is64BitInstallMode
     32Source: "{#MyAppSubDir}\AI\Capital AI\*.*"; DestDir: "{app}\AI\Capital AI"; Flags: ignoreversion; Components: ai\capital_ai; Check: not Is64BitInstallMode
     33Source: "{#MyAppSubDir}\AI\Civilisation Seed AI\*.*"; DestDir: "{app}\AI\Civilisation Seed AI"; Flags: ignoreversion; Components: ai\civseed; Check: not Is64BitInstallMode
     34Source: "{#MyAppSubDir}\AI\Crystal\*.*"; DestDir: "{app}\AI\Crystal"; Flags: ignoreversion; Components: ai\crystal; Check: not Is64BitInstallMode
     35Source: "{#MyAppSubDir}\AI\KIAI\*.*"; DestDir: "{app}\AI\KIAI"; Flags: ignoreversion; Components: ai\kiai; Check: not Is64BitInstallMode
     36Source: "{#MyAppSubDir}\AI\Liberator\*.*"; DestDir: "{app}\AI\Liberator"; Flags: ignoreversion; Components: ai\liberator; Check: not Is64BitInstallMode
     37Source: "{#MyAppSubDir}\AI\SETI\*.*"; DestDir: "{app}\AI\SETI"; Flags: ignoreversion; Components: ai\seti; Check: not Is64BitInstallMode
     38Source: "{#MyAppSubDir}\AI\Shah\*.*"; DestDir: "{app}\AI\Shah"; Flags: ignoreversion; Components: ai\shah; Check: not Is64BitInstallMode
  • branches/highdpi/Install/win/build.bat

    r160 r246  
    44  set LAZDIR=C:\lazarus
    55)
     6
     7set INNO_SETUP="c:\Program Files (x86)\Inno Setup 6\ISCC.exe"
    68
    79rem Build AI
     
    3335copy %MAIN_EXE% %WIN64_EXE%
    3436
    35 "c:\Program Files (x86)\Inno Setup 5\ISCC.exe" "C-evo.iss"
     37%INNO_SETUP% "C-evo.iss"
     38%INNO_SETUP% "C-evo 32-bit.iss"
     39%INNO_SETUP% "C-evo 64-bit.iss"
  • branches/highdpi/Integrated.lpi

    r214 r246  
    1616      <ResourceType Value="res"/>
    1717      <UseXPManifest Value="True"/>
    18       <XPManifest>
    19         <DpiAware Value="True"/>
    20       </XPManifest>
    2118      <Icon Value="0"/>
    2219      <Resources Count="2">
     
    143140        <ComponentName Value="StartDlg"/>
    144141        <HasResources Value="True"/>
     142        <ResourceBaseClass Value="Form"/>
    145143      </Unit8>
    146144      <Unit9>
     
    163161        <ComponentName Value="Background"/>
    164162        <HasResources Value="True"/>
     163        <ResourceBaseClass Value="Form"/>
    165164      </Unit11>
    166165      <Unit12>
  • branches/highdpi/LocalPlayer/CityScreen.lfm

    r210 r246  
    2121  OnShow = FormShow
    2222  PixelsPerInch = 96
     23  Scaled = False
    2324  object CloseBtn: TButtonA
    2425    Left = 335
  • branches/highdpi/LocalPlayer/CityScreen.pas

    r210 r246  
    435435    end;
    436436  end;
    437 
    438   procedure MakeRed(X, Y, W, H: Integer);
    439   var
    440     XX, YY: Integer;
    441     Gray: Integer;
    442     PixelPtr: TPixelPointer;
    443   begin
    444     X := ScaleToVcl(X);
    445     Y := ScaleToVcl(Y);
    446     W := ScaleToVcl(W);
    447     H := ScaleToVcl(H);
    448     Offscreen.BeginUpdate;
    449     PixelPtr := PixelPointer(Offscreen, X, Y);
    450     for YY := 0 to H - 1 do begin
    451       for XX := 0 to W - 1 do begin
    452         Gray := (Integer(PixelPtr.Pixel^.B) + Integer(PixelPtr.Pixel^.G) +
    453         Integer(PixelPtr.Pixel^.R)) * 85 shr 8;
    454         PixelPtr.Pixel^.B := 0;
    455         PixelPtr.Pixel^.G := 0;
    456         PixelPtr.Pixel^.R := Gray; // 255-(255-gray) div 2;
    457         PixelPtr.NextPixel;
    458       end;
    459       PixelPtr.NextLine;
    460     end;
    461     Offscreen.EndUpdate;
    462   end;
    463 
    464437var
    465438  line, MessageCount: integer;
     
    565538  if not IsCityAlive then
    566539  begin
    567     MakeRed(18, 280, 298, 40);
     540    MakeRed(Offscreen, 18, 280, 298, 40);
    568541    if cGov = gAnarchy then
    569542      s := Phrases.Lookup('GOVERNMENT', gAnarchy)
     
    701674    else
    702675    begin
    703       MakeRed(xHapp + dxBar - 6, yHapp + 2 * dyBar, wBar + 10, 38);
     676      MakeRed(Offscreen, xHapp + dxBar - 6, yHapp + 2 * dyBar, wBar + 10, 38);
    704677      CountBar(offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 18,
    705678        Phrases.Lookup('LACK'), -Report.HappinessBalance, RedTex);
     
    726699    else
    727700    begin
    728       MakeRed(xFood + dxBar - 6, yFood + 2 * dyBar, wBar + 10, 38);
     701      MakeRed(Offscreen, xFood + dxBar - 6, yFood + 2 * dyBar, wBar + 10, 38);
    729702      CountBar(offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 1,
    730703        Phrases.Lookup('LACK'), -Report.FoodSurplus, RedTex);
     
    759732    else
    760733    begin
    761       MakeRed(xProd + dxBar - 6, yProd + dyBar + 17, wBar + 10, 38);
     734      MakeRed(Offscreen, xProd + dxBar - 6, yProd + dyBar + 17, wBar + 10, 38);
    762735      CountBar(offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 3,
    763736        Phrases.Lookup('LACK'), -Report.Production, RedTex);
     
    16841657  end
    16851658  else
     1659  if OpenSoundEvent >= 0 then
    16861660    Play(CityEventSoundItem[OpenSoundEvent]);
    16871661  OpenSoundEvent := -2;
  • branches/highdpi/LocalPlayer/Diagram.lfm

    r244 r246  
    1818  OnShow = FormShow
    1919  PixelsPerInch = 96
     20  Scaled = False
    2021  object CloseBtn: TButtonB
    2122    Left = 380
  • branches/highdpi/LocalPlayer/Draft.lfm

    r210 r246  
    1919  OnShow = FormShow
    2020  LCLVersion = '1.6.0.4'
     21  PixelsPerInch = 96
     22  Scaled = False
    2123  object OKBtn: TButtonA
    2224    Left = 196
  • branches/highdpi/LocalPlayer/Help.lfm

    r210 r246  
    2222  OnPaint = FormPaint
    2323  PixelsPerInch = 96
     24  Scaled = False
    2425  object CloseBtn: TButtonB
    2526    Left = 522
  • branches/highdpi/LocalPlayer/Help.pas

    r213 r246  
    443443  MaxSum = 9 * 9 * 255 * 75 div 100;
    444444var
    445   x, y, dx, dy, xSrc, ySrc, Sum, xx: integer;
     445  x, y, dx, dy, xSrc, ySrc, sum, xx: integer;
    446446  Heaven: array [0..nHeaven] of integer;
    447   PaintPtr: TPixelPointer;
    448   CoalPtr: TPixelPointer;
     447  PaintPtr, CoalPtr: TPixelPointer;
    449448  ImpPtr: array [-1..1] of TPixelPointer;
    450449begin
     
    458457  xSrc := iix mod 7 * xSizeBig;
    459458  ySrc := (iix div 7 + 1) * ySizeBig;
    460   for y := 0 to ScaleToVcl(ySizeBig * 2) - 1 do
    461     if ((ScaleToVcl(y0) + y) >= 0) and ((ScaleToVcl(y0) + y) < ScaleToVcl(InnerHeight)) then begin
    462       PaintPtr := PixelPointer(OffScreen, 0, ScaleToVcl(y0) + y);
    463       CoalPtr := PixelPointer(Templates, 0, ScaleToVcl(yCoal) + y);
     459  for y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do
     460    if ((ScaleToNative(y0) + y) >= 0) and ((ScaleToNative(y0) + y) < ScaleToNative(InnerHeight)) then begin
     461      PaintPtr := PixelPointer(OffScreen, 0, ScaleToNative(y0) + y);
     462      CoalPtr := PixelPointer(Templates, 0, ScaleToNative(yCoal) + y);
    464463      for dy := -1 to 1 do
    465         if ((Max(y + ScaleToVcl(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToVcl(dy), 0) shr 1) < ScaleToVcl(ySizeBig)) then
    466           ImpPtr[dy] := PixelPointer(BigImp, 0, ScaleToVcl(ySrc) + (Max(y + ScaleToVcl(dy), 0) shr 1));
    467       for x := 0 to ScaleToVcl(xSizeBig * 2) - 1 do begin
    468         Sum := 0;
     464        if ((Max(y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then
     465          ImpPtr[dy] := PixelPointer(BigImp, 0, ScaleToNative(ySrc) + (Max(y + ScaleToNative(dy), 0) shr 1));
     466      for x := 0 to ScaleToNative(xSizeBig) * 2 - 1 do begin
     467        sum := 0;
    469468        for dx := -1 to 1 do begin
    470           xx := ScaleToVcl(xSrc) + Max((x + ScaleToVcl(dx)), 0) shr 1;
     469          xx := ScaleToNative(xSrc) + Max((x + ScaleToNative(dx)), 0) shr 1;
    471470          for dy := -1 to 1 do begin
    472471            ImpPtr[dy].SetX(xx);
    473             if ((y + ScaleToVcl(dy)) shr 1 < 0) or ((y + ScaleToVcl(dy)) shr 1 >= ScaleToVcl(ySizeBig)) or
    474               ((x + ScaleToVcl(dx)) shr 1 < 0) or ((x + ScaleToVcl(dx)) shr 1 >= ScaleToVcl(xSizeBig)) or
    475               ((y + ScaleToVcl(dy)) shr 1 < ScaleToVcl(nHeaven)) and
     472            if ((y + ScaleToNative(dy)) shr 1 < 0) or ((y + ScaleToNative(dy)) shr 1 >= ScaleToNative(ySizeBig)) or
     473              ((x + ScaleToNative(dx)) shr 1 < 0) or ((x + ScaleToNative(dx)) shr 1 >= ScaleToNative(xSizeBig)) or
     474              ((y + ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and
    476475              (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 +
    477               ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromVcl(y) + dy) shr 1]) then
    478               Sum := Sum + 9 * 255
     476              ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then
     477              sum := sum + 9 * 255
    479478            else
    480               Sum := Sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
     479              sum := sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
    481480                ImpPtr[dy].Pixel^.R;
    482481          end;
    483482        end;
    484         if Sum < MaxSum then begin // no saturation
    485           CoalPtr.SetX(ScaleToVcl(xCoal) + x);
    486           Sum := 1 shl 22 - (MaxSum - Sum) * (256 - CoalPtr.Pixel^.B * 2);
     483        if sum < MaxSum then begin // no saturation
     484          CoalPtr.SetX(ScaleToNative(xCoal) + x);
     485          sum := 1 shl 22 - (MaxSum - sum) * (256 - CoalPtr.Pixel^.B * 2);
    487486          PaintPtr.SetX(x0 + x);
    488           PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * Sum shr 22;
    489           PaintPtr.Pixel^.G := PaintPtr.Pixel^.G * Sum shr 22;
    490           PaintPtr.Pixel^.R := PaintPtr.Pixel^.R * Sum shr 22;
     487          PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * sum shr 22;
     488          PaintPtr.Pixel^.G := PaintPtr.Pixel^.G * sum shr 22;
     489          PaintPtr.Pixel^.R := PaintPtr.Pixel^.R * sum shr 22;
    491490        end;
    492491      end;
  • branches/highdpi/LocalPlayer/IsoEngine.pas

    r212 r246  
    10151015            1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1));
    10161016          Borders.BeginUpdate;
    1017           PixelPtr := PixelPointer(Borders, ScaleToVcl(0), ScaleToVcl(p1 * (yyt * 2)));
    1018           for dy := 0 to ScaleToVcl(yyt * 2) - 1 do begin
    1019             for dx := 0 to ScaleToVcl(xxt * 2) - 1 do begin
     1017          PixelPtr := PixelPointer(Borders, ScaleToNative(0), ScaleToNative(p1 * (yyt * 2)));
     1018          for dy := 0 to ScaleToNative(yyt * 2) - 1 do begin
     1019            for dx := 0 to ScaleToNative(xxt * 2) - 1 do begin
    10201020              if PixelPtr.Pixel^.B = 99 then begin
    10211021                PixelPtr.Pixel^.B := Tribe[p1].Color shr 16 and $FF;
     
    13391339begin
    13401340  FOutput.BeginUpdate;
    1341   Line := PixelPointer(FOutput, ScaleToVcl(x0), ScaleToVcl(y0));
    1342   for y := 0 to ScaleToVcl(Height) - 1 do begin
    1343     y_n := (ScaleFromVcl(y) + y0 - ym) / yyt;
    1344     if Abs(y_n) < rShade then begin
     1341  Line := PixelPointer(FOutput, ScaleToNative(x0), ScaleToNative(y0));
     1342  for y := 0 to ScaleToNative(Height) - 1 do begin
     1343    y_n := (ScaleFromNative(y) + y0 - ym) / yyt;
     1344    if abs(y_n) < rShade then begin
    13451345      // Darken left and right parts of elipsis
    1346       w_n := Sqrt(Sqr(rShade) - Sqr(y_n));
    1347       wBright := Trunc(w_n * xxt + 0.5);
     1346      w_n := sqrt(sqr(rShade) - sqr(y_n));
     1347      wBright := trunc(w_n * xxt + 0.5);
    13481348      Line.SetX(0);
    1349       MakeDark(@Line, ScaleToVcl(xm - wBright));
    1350       Line.SetX(ScaleToVcl(xm + wBright));
    1351       MakeDark(@Line, ScaleToVcl(Width - xm - wBright));
     1349      MakeDark(@Line, ScaleToNative(xm - wBright));
     1350      Line.SetX(ScaleToNative(xm + wBright));
     1351      MakeDark(@Line, ScaleToNative(Width - xm - wBright));
    13521352    end else begin
    13531353      // Darken entire line
    13541354      Line.SetX(0);
    1355       MakeDark(@Line, ScaleToVcl(Width));
     1355      MakeDark(@Line, ScaleToNative(Width));
    13561356    end;
    13571357    Line.NextLine;
  • branches/highdpi/LocalPlayer/MessgEx.lfm

    r210 r246  
    2020  OnShow = FormShow
    2121  PixelsPerInch = 96
     22  Scaled = False
    2223  object Button1: TButtonA
    2324    Left = 43
  • branches/highdpi/LocalPlayer/MessgEx.pas

    r216 r246  
    212212        Sleep(1);
    213213        Ticks := NowPrecise;
    214       until MovieCancelled or (MillisecondOf(Ticks - Ticks0) >= 1500);
     214      until MovieCancelled or (Round((Ticks - Ticks0) / OneMillisecond) >= 1500);
    215215      Hide;
    216216    end;
     
    237237  Screwed: array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of single;
    238238  SrcPtr: TPixelPointer;
    239 begin
     239  Width: Integer;
     240  Height: Integer;
     241begin
     242  Width := 56;
     243  Height := 40;
    240244  if IconIndex >= 0 then begin
    241245    xIcon := IconIndex mod 7 * xSizeBig;
    242246    yIcon := (IconIndex + SystemIconLines * 7) div 7 * ySizeBig;
    243247    // prepare screwed icon
    244     fillchar(Screwed, sizeof(Screwed), 0);
     248    FillChar(Screwed, sizeof(Screwed), 0);
    245249    BigImp.BeginUpdate;
    246     for iy := 0 to 39 do begin
    247       for ix := 0 to 55 do begin
    248         SrcPtr := PixelPointer(BigImp, ix + xIcon, iy + yIcon);
    249         xR := ix * (37 + iy * 5 / 40) / 56;
     250    SrcPtr := PixelPointer(BigImp, ScaleToNative(xIcon), ScaleToNative(yIcon));
     251    for iy := 0 to ScaleToNative(Height) - 1 do begin
     252      for ix := 0 to ScaleToNative(Width) - 1 do begin
     253        xR := ScaleFromNative(ix) * (37 + ScaleFromNative(iy) * 5 / Height) / Width;
    250254        xDst := Trunc(xR);
    251255        xR := Frac(xR);
    252         x1 := (120 - ix) * (120 - ix) - 10000;
    253         yR := iy * 18 / 40 + x1 * x1 / 4000000;
     256        x1 := (120 - ScaleFromNative(ix)) * (120 - ScaleFromNative(ix)) - 10000;
     257        yR := ScaleFromNative(iy) * 18 / Height + x1 * x1 / 4000000;
    254258        yDst := Trunc(yR);
    255259        yR := Frac(yR);
     
    272276            Screwed[xDst + dx, yDst + dy, 3] := Screwed[xDst + dx, yDst + dy,
    273277              3] + share;
    274           end;
    275       end;
     278        end;
     279        SrcPtr.NextPixel;
     280      end;
     281      SrcPtr.NextLine;
    276282    end;
    277283    BigImp.EndUpdate;
     
    373379      begin
    374380        p1 := MyRO.Wonder[IconIndex].EffectiveOwner;
     381        // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
     382        Buffer.Canvas.FillRect(0, 0, 1, 1);
    375383        DpiBitCanvas(Buffer.Canvas, 0, 0, xSizeBig + 2 * GlowRange,
    376384          ySizeBig + 2 * GlowRange, Canvas,
  • branches/highdpi/LocalPlayer/NatStat.lfm

    r244 r246  
    1717  OnShow = FormShow
    1818  PixelsPerInch = 96
     19  Scaled = False
    1920  object ToggleBtn: TButtonB
    2021    Left = 6
  • branches/highdpi/LocalPlayer/Select.lfm

    r244 r246  
    2323  OnShow = FormShow
    2424  PixelsPerInch = 96
     25  Scaled = False
    2526  object CloseBtn: TButtonB
    2627    Left = 343
  • branches/highdpi/LocalPlayer/Select.pas

    r244 r246  
    578578                    295 + (AdvIcon[lix] - 84) div 8 * 21);
    579579                j := AdvValue[lix] div 1000;
    580                 DpiBitCanvas(Canvas, (8 + 16 - 4), y0 + 2, 14, 14,
     580                DpiBitCanvas(offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14,
    581581                  GrExt[HGrSystem].Mask.Canvas, 127 + j * 15,
    582582                  85, SRCAND);
     
    754754        end;
    755755      end;
     756
    756757    for i := -1 to DispLines do
    757758      if (i + sb.Position >= 0) and (i + sb.Position < Lines[Layer]) then
  • branches/highdpi/LocalPlayer/TechTree.pas

    r210 r246  
    99
    1010type
     11
     12  { TTechTreeDlg }
     13
    1114  TTechTreeDlg = class(TDrawDlg)
    1215    CloseBtn: TButtonB;
    1316    procedure FormCreate(Sender: TObject);
     17    procedure FormDestroy(Sender: TObject);
    1418    procedure FormPaint(Sender: TObject);
    1519    procedure FormShow(Sender: TObject);
     
    2428    xOffset, yOffset, xDown, yDown: Integer;
    2529    Image: TDpiBitmap;
    26     dragging: boolean;
     30    Dragging: Boolean;
    2731  end;
    2832
     
    7276  InitButtons;
    7377  Image := nil;
     78end;
     79
     80procedure TTechTreeDlg.FormDestroy(Sender: TObject);
     81begin
     82  FreeAndNil(Image);
    7483end;
    7584
     
    121130  X, Y, ad: Integer;
    122131  s: string;
     132  NewWidth: Integer;
     133  NewHeight: Integer;
    123134const
    124135  TransparentColor = $7F007F;
     
    164175
    165176  // fit window to image, center image in window, center window to screen
    166   width := min(DpiScreen.width - 40, Image.width + LeftBorder + RightBorder + 2 *
    167     BlackBorder);
    168   height := min(DpiScreen.height - 40, Image.height + TopBorder + BottomBorder + 2
    169     * BlackBorder);
    170   Left := (DpiScreen.width - width) div 2;
    171   Top := (DpiScreen.height - height) div 2;
     177  NewWidth := Min(DpiScreen.Width - 40, Image.Width + LeftBorder + RightBorder + 2 * BlackBorder);
     178  NewHeight := Min(DpiScreen.Height - 40, Image.Height + TopBorder + BottomBorder + 2 * BlackBorder);
     179  BoundsRect := Bounds((DpiScreen.Width - NewWidth) div 2,
     180    (DpiScreen.Height - NewHeight) div 2,
     181    NewWidth, NewHeight);
    172182  CloseBtn.Left := width - CloseBtn.width - BlackBorder - 8;
    173183  CloseBtn.Top := BlackBorder + 8;
    174   xOffset := (ClientWidth - Image.width + LeftBorder - RightBorder) div 2 -
     184  xOffset := (ClientWidth - Image.Width + LeftBorder - RightBorder) div 2 -
    175185    BlackBorder;
    176   yOffset := ClientHeight - 2 * BlackBorder - Image.height - BottomBorder;
     186  yOffset := ClientHeight - 2 * BlackBorder - Image.Height - BottomBorder;
    177187end;
    178188
  • branches/highdpi/LocalPlayer/Term.lfm

    r244 r246  
    11object MainScreen: TMainScreen
    22  Left = 231
    3   Height = 600
     3  Height = 480
    44  Top = 190
    5   Width = 1000
     5  Width = 800
    66  HorzScrollBar.Visible = False
    77  VertScrollBar.Visible = False
    88  Caption = 'C-evo'
    9   ClientHeight = 600
    10   ClientWidth = 1000
     9  ClientHeight = 480
     10  ClientWidth = 800
    1111  Color = clBtnFace
    12   Constraints.MinHeight = 600
    13   Constraints.MinWidth = 1000
    14   DesignTimePPI = 120
     12  Constraints.MinHeight = 480
     13  Constraints.MinWidth = 800
    1514  Font.Color = clWindowText
    16   Font.Height = -16
     15  Font.Height = -13
    1716  Font.Name = 'MS Sans Serif'
    1817  KeyPreview = True
     
    3130  OnShow = FormShow
    3231  Position = poDefault
    33   LCLVersion = '2.0.6.0'
     32  PixelsPerInch = 96
     33  Scaled = False
     34  LCLVersion = '1.6.0.4'
    3435  WindowState = wsMaximized
    3536  object UnitBtn: TButtonB
    3637    Tag = 14
    37     Left = 260
    38     Height = 31
    39     Top = 480
    40     Width = 31
     38    Left = 208
     39    Height = 25
     40    Top = 384
     41    Width = 25
    4142    Visible = False
    4243    Down = False
     
    4748  object MapBtn0: TButtonC
    4849    Tag = 51
    49     Left = 20
    50     Height = 15
    51     Top = 380
    52     Width = 15
     50    Left = 16
     51    Height = 12
     52    Top = 304
     53    Width = 12
    5354    Visible = False
    5455    Down = False
     
    5960  object MapBtn1: TButtonC
    6061    Tag = 291
    61     Left = 20
    62     Height = 15
    63     Top = 400
    64     Width = 15
     62    Left = 16
     63    Height = 12
     64    Top = 320
     65    Width = 12
    6566    Visible = False
    6667    Down = False
     
    7172  object MapBtn4: TButtonC
    7273    Tag = 1028
    73     Left = 20
    74     Height = 15
    75     Top = 460
    76     Width = 15
     74    Left = 16
     75    Height = 12
     76    Top = 368
     77    Width = 12
    7778    Visible = False
    7879    Down = False
     
    8384  object MapBtn5: TButtonC
    8485    Tag = 1328
    85     Left = 20
    86     Height = 15
    87     Top = 480
    88     Width = 15
     86    Left = 16
     87    Height = 12
     88    Top = 384
     89    Width = 12
    8990    Visible = False
    9091    Down = False
     
    9596  object MapBtn6: TButtonC
    9697    Tag = 1541
    97     Left = 20
    98     Height = 15
    99     Top = 500
    100     Width = 15
     98    Left = 16
     99    Height = 12
     100    Top = 400
     101    Width = 12
    101102    Visible = False
    102103    Down = False
     
    107108  object TerrainBtn: TButtonB
    108109    Tag = 28
    109     Left = 300
    110     Height = 31
    111     Top = 480
    112     Width = 31
     110    Left = 240
     111    Height = 25
     112    Top = 384
     113    Width = 25
    113114    Visible = False
    114115    Down = False
     
    119120  object UnitInfoBtn: TButtonB
    120121    Tag = 15
    121     Left = 220
    122     Height = 31
    123     Top = 480
    124     Width = 31
     122    Left = 176
     123    Height = 25
     124    Top = 384
     125    Width = 25
    125126    Visible = False
    126127    Down = False
     
    130131  end
    131132  object EOT: TEOTButton
    132     Left = 890
    133     Height = 60
    134     Top = 460
    135     Width = 60
     133    Left = 712
     134    Height = 48
     135    Top = 368
     136    Width = 48
    136137    Visible = False
    137138    Down = False
     
    142143  object MenuArea: TArea
    143144    Left = 2
    144     Height = 45
     145    Height = 36
    145146    Top = 1
    146     Width = 45
     147    Width = 36
    147148  end
    148149  object TreasuryArea: TArea
    149     Left = 260
    150     Height = 45
     150    Left = 208
     151    Height = 36
    151152    Top = 1
    152     Width = 205
     153    Width = 164
    153154  end
    154155  object ResearchArea: TArea
    155     Left = 480
    156     Height = 45
     156    Left = 384
     157    Height = 36
    157158    Top = 1
    158     Width = 300
     159    Width = 240
    159160  end
    160161  object ManagementArea: TArea
    161     Left = 880
    162     Height = 50
    163     Top = 390
    164     Width = 70
     162    Left = 704
     163    Height = 40
     164    Top = 312
     165    Width = 56
    165166  end
    166167  object MovieSpeed1Btn: TButtonB
    167168    Tag = 256
    168     Left = 480
    169     Height = 31
    170     Top = 480
    171     Width = 31
     169    Left = 384
     170    Height = 25
     171    Top = 384
     172    Width = 25
    172173    Visible = False
    173174    Down = False
     
    178179  object MovieSpeed2Btn: TButtonB
    179180    Tag = 512
    180     Left = 520
    181     Height = 31
    182     Top = 480
    183     Width = 31
     181    Left = 416
     182    Height = 25
     183    Top = 384
     184    Width = 25
    184185    Visible = False
    185186    Down = False
     
    190191  object MovieSpeed3Btn: TButtonB
    191192    Tag = 768
    192     Left = 560
    193     Height = 31
    194     Top = 480
    195     Width = 31
     193    Left = 448
     194    Height = 25
     195    Top = 384
     196    Width = 25
    196197    Visible = False
    197198    Down = False
     
    202203  object MovieSpeed4Btn: TButtonB
    203204    Tag = 1024
    204     Left = 600
    205     Height = 31
    206     Top = 480
    207     Width = 31
     205    Left = 480
     206    Height = 25
     207    Top = 384
     208    Width = 25
    208209    Visible = False
    209210    Down = False
     
    216217    Interval = 50
    217218    OnTimer = Timer1Timer
    218     left = 10
    219     top = 60
     219    left = 8
     220    top = 48
    220221  end
    221222  object GamePopup: TDpiPopupMenu
    222223    AutoPopup = False
    223     left = 50
    224     top = 60
     224    left = 40
     225    top = 48
    225226    object mHelp: TDpiMenuItem
    226227      Tag = 7
     
    458459          RadioItem = True
    459460          OnClick = mBigTilesClick
    460         end
     461        end             
    461462      end
    462463      object mSound: TDpiMenuItem
     
    586587  object UnitPopup: TDpiPopupMenu
    587588    AutoPopup = False
    588     left = 130
    589     top = 60
     589    left = 104
     590    top = 48
    590591    object mdisband: TDpiMenuItem
    591592      Tag = 72
     
    669670  object StatPopup: TDpiPopupMenu
    670671    AutoPopup = False
    671     left = 90
    672     top = 60
     672    left = 72
     673    top = 48
    673674    object mUnitStat: TDpiMenuItem
    674675      Tag = 9
     
    725726  end
    726727  object EditPopup: TDpiPopupMenu
    727     left = 210
    728     top = 60
     728    left = 168
     729    top = 48
    729730    object mCreateUnit: TDpiMenuItem
    730731      Tag = 47
     
    732733  end
    733734  object TerrainPopup: TDpiPopupMenu
    734     left = 170
    735     top = 60
     735    left = 136
     736    top = 48
    736737    object mtrans: TDpiMenuItem
    737738      Tag = 273
  • branches/highdpi/LocalPlayer/Term.pas

    r244 r246  
    287287    Offscreen: TDpiBitmap;
    288288    OffscreenUser: TDpiForm;
    289     procedure CreateParams(var p: TCreateParams); override;
    290289    procedure Client(Command, NewPlayer: integer; var Data);
    291290    procedure SetAIName(p: integer; Name: string);
     
    532531  SmallScreen, GameOK, MapValid, skipped, idle: boolean;
    533532
    534   SaveOption: array [0..nSaveOption - 1] of integer;
    535   MiniColors: array [0..fTerrain, 0..1] of TColor;
     533  SaveOption: array [0 .. nSaveOption - 1] of integer;
     534  MiniColors: array [0 .. 11, 0 .. 1] of TColor;
    536535  MainMap: TIsoMap;
    537536  CurrentMoveInfo: record AfterMovePaintRadius, AfterAttackExpeller: integer;
     
    555554  Sharpen = 80;
    556555type
    557   TBuffer = array [0 .. 99999, 0 .. 2] of integer;
     556  TBuffer = array [0 .. 99999, 0 .. 2] of Integer;
    558557var
    559   sum, Cnt, dx, dy, nx, ny, ix, iy, ir, x, y, c, ch, xdivider,
    560     ydivider: integer;
    561   resampled: ^TBuffer;
     558  Sum, Cnt, dx, dy, nx, ny, ix, iy, ir, x, y, c, ch: Integer;
     559  xdivider, ydivider: Integer;
     560  Resampled: ^TBuffer;
    562561  PixelPtr: TPixelPointer;
    563562begin
    564   nx := BigImp.width div xSizeBig * xSizeSmall;
    565   ny := BigImp.height div ySizeBig * ySizeSmall;
     563  nx := BigImp.Width div xSizeBig * xSizeSmall;
     564  ny := BigImp.Height div ySizeBig * ySizeSmall;
    566565
    567566  // resample icons
    568   GetMem(resampled, nx * ny * 12);
    569   FillChar(resampled^, nx * ny * 12, 0);
     567  GetMem(Resampled, nx * ny * 12);
     568  FillChar(Resampled^, nx * ny * 12, 0);
    570569  BigImp.BeginUpdate;
    571   for ix := 0 to BigImp.width div xSizeBig - 1 do
    572     for iy := 0 to BigImp.height div ySizeBig - 1 do
    573       for y := 0 to ySizeBig - 2 * cut - 1 do
    574       begin
    575         ydivider := (y * ySizeSmall div (ySizeBig - 2 * cut) + 1) *
    576           (ySizeBig - 2 * cut) - y * ySizeSmall;
     570  for ix := 0 to BigImp.Width div xSizeBig - 1 do
     571    for iy := 0 to BigImp.Height div ySizeBig - 1 do begin
     572      PixelPtr := PixelPointer(BigImp, ScaleToNative(ix * xSizeBig),
     573        ScaleToNative(cut + iy * ySizeBig));
     574      for y := 0 to ScaleToNative(ySizeBig - 2 * cut) - 1 do begin
     575        ydivider := (ScaleFromNative(y) * ySizeSmall div (ySizeBig - 2 * cut) + 1) *
     576          (ySizeBig - 2 * cut) - ScaleFromNative(y) * ySizeSmall;
    577577        if ydivider > ySizeSmall then
    578578          ydivider := ySizeSmall;
    579         PixelPtr := PixelPointer(BigImp, 0, cut + iy * ySizeBig + y);
    580         for x := 0 to xSizeBig - 1 do
    581         begin
    582           ir := ix * xSizeSmall + iy * nx * ySizeSmall + x *
    583             xSizeSmall div xSizeBig + y *
     579        for x := 0 to ScaleToNative(xSizeBig) - 1 do begin
     580          ir := ix * xSizeSmall + iy * nx * ySizeSmall + ScaleFromNative(x) *
     581            xSizeSmall div xSizeBig + ScaleFromNative(y) *
    584582            ySizeSmall div (ySizeBig - 2 * cut) * nx;
    585           xdivider := (x * xSizeSmall div xSizeBig + 1) * xSizeBig - x *
    586             xSizeSmall;
     583          xdivider := (ScaleFromNative(x) * xSizeSmall div xSizeBig + 1) *
     584            xSizeBig - ScaleFromNative(x) * xSizeSmall;
    587585          if xdivider > xSizeSmall then
    588586            xdivider := xSizeSmall;
    589           for ch := 0 to 2 do
    590           begin
    591             PixelPtr.SetX(ix * xSizeBig + x);
     587          for ch := 0 to 2 do begin
    592588            c := PixelPtr.Pixel^.Planes[ch];
    593             inc(resampled[ir, ch], c * xdivider * ydivider);
     589            Inc(Resampled[ir, ch], c * xdivider * ydivider);
    594590            if xdivider < xSizeSmall then
    595               inc(resampled[ir + 1, ch], c * (xSizeSmall - xdivider) *
     591              Inc(Resampled[ir + 1, ch], c * (xSizeSmall - xdivider) *
    596592                ydivider);
    597593            if ydivider < ySizeSmall then
    598               inc(resampled[ir + nx, ch],
     594              Inc(Resampled[ir + nx, ch],
    599595                c * xdivider * (ySizeSmall - ydivider));
    600596            if (xdivider < xSizeSmall) and (ydivider < ySizeSmall) then
    601               inc(resampled[ir + nx + 1, ch], c * (xSizeSmall - xdivider) *
     597              Inc(Resampled[ir + nx + 1, ch], c * (xSizeSmall - xdivider) *
    602598                (ySizeSmall - ydivider));
    603599          end;
     600          PixelPtr.NextPixel;
    604601        end;
     602        PixelPtr.NextLine;
    605603      end;
     604    end;
    606605  BigImp.EndUpdate;
    607606
    608   // sharpen resampled icons
     607  // Sharpen Resampled icons
    609608  SmallImp.SetSize(nx, ny);
    610609  SmallImp.BeginUpdate;
    611   for y := 0 to ny - 1 do begin
    612     PixelPtr := PixelPointer(SmallImp, 0, y);
    613     for x := 0 to nx - 1 do
     610  PixelPtr := PixelPointer(SmallImp);
     611  for y := 0 to ScaleToNative(ny) - 1 do begin
     612    for x := 0 to ScaleToNative(nx) - 1 do begin
    614613      for ch := 0 to 2 do begin
    615         sum := 0;
     614        Sum := 0;
    616615        Cnt := 0;
    617616        for dy := -1 to 1 do
    618           if ((dy >= 0) or (y mod ySizeSmall > 0)) and
    619             ((dy <= 0) or (y mod ySizeSmall < ySizeSmall - 1)) then
     617          if ((dy >= 0) or (ScaleFromNative(y) mod ySizeSmall > 0)) and
     618            ((dy <= 0) or (ScaleFromNative(y) mod ySizeSmall < ySizeSmall - 1)) then
    620619            for dx := -1 to 1 do
    621               if ((dx >= 0) or (x mod xSizeSmall > 0)) and
    622                 ((dx <= 0) or (x mod xSizeSmall < xSizeSmall - 1)) then
     620              if ((dx >= 0) or (ScaleFromNative(x) mod xSizeSmall > 0)) and
     621                ((dx <= 0) or (ScaleFromNative(x) mod xSizeSmall < xSizeSmall - 1)) then
    623622              begin
    624                 inc(sum, resampled[x + dx + nx * (y + dy), ch]);
    625                 inc(Cnt);
     623                Inc(Sum, Resampled[ScaleFromNative(x) + dx + nx * (ScaleFromNative(y) + dy), ch]);
     624                Inc(Cnt);
    626625              end;
    627         sum := ((Cnt * Sharpen + 800) * resampled[x + nx * y, ch] - sum *
     626        Sum := ((Cnt * Sharpen + 800) * Resampled[ScaleFromNative(x) + nx * ScaleFromNative(y), ch] - Sum *
    628627          Sharpen) div (800 * xSizeBig * (ySizeBig - 2 * cut));
    629         if sum < 0 then sum := 0;
    630         if sum > 255 then sum := 255;
    631         PixelPtr.SetX(x);
    632         PixelPtr.Pixel^.Planes[ch] := sum;
     628        if Sum < 0 then Sum := 0;
     629        if Sum > 255 then Sum := 255;
     630        PixelPtr.Pixel^.Planes[ch] := Sum;
    633631      end;
     632      PixelPtr.NextPixel;
     633    end;
     634    PixelPtr.NextLine;
    634635  end;
    635636  SmallImp.EndUpdate;
    636   FreeMem(resampled);
     637  FreeMem(Resampled);
    637638end;
    638639
     
    33993400{ *** main part *** }
    34003401
    3401 procedure TMainScreen.CreateParams(var p: TCreateParams);
    3402 begin
    3403   inherited;
    3404   if FullScreen then begin
    3405     p.Style := $87000000;
    3406     BorderStyle := bsNone;
    3407     BorderIcons := [];
    3408   end;
    3409 end;
    3410 
    34113402procedure TMainScreen.FormCreate(Sender: TObject);
    34123403var
     
    40774068  MiniPixel := PixelPointer(Mini);
    40784069  PrevMiniPixel := PixelPointer(Mini);
    4079   for y := 0 to ScaleToVcl(G.ly) - 1 do
    4080   begin
    4081     for x := 0 to ScaleToVcl(G.lx) - 1 do
    4082       if MyMap[ScaleFromVcl(x) + G.lx * ScaleFromVcl(y)] and fTerrain <> fUNKNOWN then
    4083       begin
    4084         Loc := ScaleFromVcl(x) + G.lx * ScaleFromVcl(y);
     4070  for y := 0 to ScaleToNative(G.ly) - 1 do
     4071  begin
     4072    for x := 0 to ScaleToNative(G.lx) - 1 do
     4073      if MyMap[ScaleFromNative(x) + G.lx * ScaleFromNative(y)] and fTerrain <> fUNKNOWN then
     4074      begin
     4075        Loc := ScaleFromNative(x) + G.lx * ScaleFromNative(y);
    40854076        for i := 0 to 1 do
    40864077        begin
    4087           xm := ((x - ScaleToVcl(xwMini)) * 2 + i + y and 1 - ScaleToVcl(hw) +
    4088             ScaleToVcl(G.lx) * 5) mod (ScaleToVcl(G.lx) * 2);
     4078          xm := ((x - ScaleToNative(xwMini)) * 2 + i + y and 1 - ScaleToNative(hw) +
     4079            ScaleToNative(G.lx) * 5) mod (ScaleToNative(G.lx) * 2);
    40894080          MiniPixel.SetXY(xm, y);
    40904081          cm := MiniColors[MyMap[Loc] and fTerrain, i];
     
    60926083      NoMap.PaintUnit(xMoving - xMin, yMoving - yMin, UnitInfo, 0);
    60936084      PaintBufferToScreen(xMin, yMin, xRange, yRange);
     6085      {$IFDEF LINUX}
     6086      // TODO: Force animation under linux
     6087      DpiApplication.ProcessMessages;
     6088      {$ENDIF}
    60946089
    60956090      SliceCount := 0;
     
    60976092      repeat
    60986093        if (SliceCount = 0) or
    6099           (MillisecondOf(Ticks - Ticks0) * 12 * (SliceCount + 1) div SliceCount
     6094          (Round(((Ticks - Ticks0) * 12) / OneMillisecond) * (SliceCount + 1) div SliceCount
    61006095          < MoveTime) then
    61016096        begin
    61026097          if not idle or (GameMode = cMovie) then
    61036098            DpiApplication.ProcessMessages;
    6104           {$IFDEF LINUX}
    6105           // TODO: Force animation under linux
    6106           DpiApplication.ProcessMessages;
    6107           {$ENDIF}
    61086099          Sleep(1);
    61096100          inc(SliceCount)
    61106101        end;
    61116102        Ticks := NowPrecise;
    6112       until (Ticks - Ticks0) / OneMillisecond * 12 >= MoveTime;
     6103      until (((Ticks - Ticks0) * 12) / OneMillisecond) >= MoveTime;
    61136104      Ticks0 := Ticks
    61146105    end;
     
    65516542          time1 := NowPrecise;
    65526543          SimpleMessage(Format('Map repaint time: %.3f ms',
    6553             [MillisecondOf(time1 - time0)]));
     6544            [(time1 - time0) / OneMillisecond]));
    65546545        end
    65556546    end
     
    76287619        InitPopup(GamePopup);
    76297620        if FullScreen then
    7630           // GamePopup.FItems.Count
    76317621          GamePopup.Popup(Left, Top + TopBarHeight - 1)
    76327622        else
     
    78077797procedure TMainScreen.FormShow(Sender: TObject);
    78087798begin
    7809   Timer1.Enabled := true;
    7810   Left := 0;
    7811   Top := 0;
     7799  if FullScreen then begin
     7800    WindowState := wsFullScreen;
     7801    BorderStyle := bsNone;
     7802    BorderIcons := [];
     7803  end else begin
     7804    WindowState := wsMaximized;
     7805    BorderStyle := bsSizeable;
     7806    BorderIcons := [biSystemMenu, biMinimize, biMaximize];
     7807  end;
     7808  Timer1.Enabled := True;
    78127809end;
    78137810
  • branches/highdpi/LocalPlayer/Wonders.lfm

    r210 r246  
    1717  OnShow = FormShow
    1818  PixelsPerInch = 96
     19  Scaled = False
    1920  object CloseBtn: TButtonB
    2021    Left = 442
  • branches/highdpi/LocalPlayer/Wonders.pas

    r210 r246  
    8787procedure TWondersDlg.PaintBackgroundShape;
    8888const
    89   darken = 24;
     89  Darken = 24;
    9090  // space=pi/120;
    9191  amax0 = 15734; // 1 shl 16*tan(pi/12-space);
     
    103103  C: Integer;
    104104  Ch: Integer;
    105   Line: array [0..1] of TPixelPointer;
     105  Line: array [0..3] of TPixelPointer;
    106106  Width: Integer;
    107107  Height: Integer;
    108   CenterNative: TPoint;
    109 begin
    110   Width := ScaleToVcl(180);
    111   Height := ScaleToVcl(128);
    112   CenterNative := ScalePointtoVcl(Center);
     108begin
     109  Width := ScaleToNative(180);
     110  Height := ScaleToNative(128);
    113111  Offscreen.BeginUpdate;
    114   Line[0] := PixelPointer(Offscreen);
    115   Line[1] := PixelPointer(Offscreen);
     112  Line[0] := PixelPointer(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y));
     113  Line[1] := PixelPointer(Offscreen, ScaleToNative(Center.X), ScaleToNative(Center.Y) - 1);
     114  Line[2] := PixelPointer(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y));
     115  Line[3] := PixelPointer(Offscreen, ScaleToNative(Center.X) - 1, ScaleToNative(Center.Y) - 1);
    116116  for Y := 0 to Height - 1 do begin
    117117    for X := 0 to Width - 1 do begin
    118118      r := X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4));
    119119      ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y;
    120       if (r < ScaleToVcl(8) * Height * Width * Width) and
     120      if (r < ScaleToNative(8) * Height * Width * Width) and
    121121        ((r >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and
    122122        ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and
    123         ((ax < amax1 * X) or (ax > amin3 * X))) then
    124         for i := 0 to 1 do
    125           for ch := 0 to 2 do begin
    126             Line[0].SetXY(CenterNative.X + X, CenterNative.Y + Y);
    127             Line[1].SetXY(CenterNative.X + X, CenterNative.Y - 1 - Y);
    128             c := Line[i].Pixel^.Planes[ch] - darken;
    129             if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    130               else Line[i].Pixel^.Planes[ch] := c;
    131             Line[0].SetXY(CenterNative.X - 1 - X, CenterNative.Y + Y);
    132             Line[1].SetXY(CenterNative.X - 1 - X, CenterNative.Y - 1 - Y);
    133             c := Line[i].Pixel^.Planes[ch] - darken;
    134             if c < 0 then Line[i].Pixel^.Planes[ch] := 0
    135               else Line[i].Pixel^.Planes[ch] := c;
    136           end;
    137     end;
     123        ((ax < amax1 * X) or (ax > amin3 * X))) then begin
     124        for ch := 0 to 2 do begin
     125          c := Line[0].Pixel^.Planes[ch] - Darken;
     126          if c < 0 then Line[0].Pixel^.Planes[ch] := 0
     127            else Line[0].Pixel^.Planes[ch] := c;
     128          c := Line[1].Pixel^.Planes[ch] - Darken;
     129          if c < 0 then Line[1].Pixel^.Planes[ch] := 0
     130            else Line[1].Pixel^.Planes[ch] := c;
     131          c := Line[2].Pixel^.Planes[ch] - Darken;
     132          if c < 0 then Line[2].Pixel^.Planes[ch] := 0
     133            else Line[2].Pixel^.Planes[ch] := c;
     134          c := Line[3].Pixel^.Planes[ch] - Darken;
     135          if c < 0 then Line[3].Pixel^.Planes[ch] := 0
     136            else Line[3].Pixel^.Planes[ch] := c;
     137        end;
     138      end;
     139      Line[0].NextPixel;
     140      Line[1].NextPixel;
     141      Line[2].PreviousPixel;
     142      Line[3].PreviousPixel;
     143    end;
     144    Line[0].NextLine;
     145    Line[1].PreviousLine;
     146    Line[2].NextLine;
     147    Line[3].PreviousLine;
    138148  end;
    139149  Offscreen.EndUpdate;
     
    150160  x0Src := (i mod 7) * xSizeBig;
    151161  y0Src := (i div 7 + SystemIconLines) * ySizeBig;
    152 
    153   Src := PixelPointer(BigImp, ScaleToVcl(x0Src), ScaleToVcl(y0Src));
    154   Dst := PixelPointer(Offscreen, ScaleToVcl(x0Dst), ScaleToVcl(y0Dst));
    155   for Y := 0 to ScaleToVcl(ySizeBig) - 1 do begin
    156     for X := 0 to ScaleToVcl(xSizeBig) - 1 do begin
     162  Src := PixelPointer(BigImp, ScaleToNative(x0Src), ScaleToNative(y0Src));
     163  Dst := PixelPointer(Offscreen, ScaleToNative(x0Dst), ScaleToNative(y0Dst));
     164  for Y := 0 to ScaleToNative(ySizeBig) - 1 do begin
     165    for X := 0 to ScaleToNative(xSizeBig) - 1 do begin
    157166      Darken := ((255 - Src.Pixel^.B) * 3 + (255 - Src.Pixel^.G) *
    158167        15 + (255 - Src.Pixel^.R) * 9) div 128;
  • branches/highdpi/Locale.lfm

    r210 r246  
    1515  OnShow = FormShow
    1616  LCLVersion = '2.0.2.0'
     17  Position = poScreenCenter
     18  PixelsPerInch = 96
     19  Scaled = False
    1720  object List: TDpiListBox
    1821    Tag = 15360
  • branches/highdpi/Log.lfm

    r244 r246  
    1818  OnKeyUp = FormKeyUp
    1919  PixelsPerInch = 96
     20  Scaled = False
    2021  object List: TMemo
    2122    Left = 0
  • branches/highdpi/Messg.lfm

    r210 r246  
    2020  OnShow = FormShow
    2121  LCLVersion = '1.8.0.6'
     22  PixelsPerInch = 96
     23  Scaled = False
    2224  object Button1: TButtonA
    2325    Left = 101
  • branches/highdpi/Packages/CevoComponents/CevoComponents.lpk

    r210 r246  
    106106      <Item1>
    107107        <PackageName Value="DpiControls"/>
    108         <DefaultFilename Value="..\DpiControls\DpiControls.lpk" Prefer="True"/>
    109108      </Item1>
    110109      <Item2>
  • branches/highdpi/Packages/CevoComponents/Directories.pas

    r210 r246  
    6363end;
    6464
     65procedure CopyDir(SourceDir, DestinationDir, Filter: string);
     66var
     67  Src, Dst: TSearchRec;
     68begin
     69  if not DirectoryExists(DestinationDir) then CreateDir(DestinationDir);
     70  if FindFirst(SourceDir + DirectorySeparator + Filter, $21, Src) = 0 then
     71    repeat
     72      if (FindFirst(DestinationDir + DirectorySeparator + Src.Name, $21, Dst) <> 0) or
     73        (Dst.Time < Src.Time) then
     74        CopyFile(SourceDir + DirectorySeparator + Src.Name,
     75          DestinationDir + DirectorySeparator + Src.Name, false);
     76      FindClose(Dst);
     77    until FindNext(Src) <> 0;
     78  FindClose(Src);
     79end;
     80
    6581procedure UnitInit;
    6682var
    6783  AppDataDir: string;
    68   src, dst: TSearchRec;
    6984begin
    7085  LocaleCode := '';
     
    7994    DataDir := AppDataDir;
    8095  end;
    81   if not DirectoryExists(GetSavedDir) then CreateDir(GetSavedDir);
    82   if not DirectoryExists(GetMapsDir) then CreateDir(GetMapsDir);
    8396
    84   // Copy appdata if not done yet
    85   if FindFirst(GetSavedDir(True) + DirectorySeparator + '*.cevo', $21, src) = 0 then
    86     repeat
    87       if (FindFirst(GetSavedDir(True) + DirectorySeparator + src.Name, $21, dst) <> 0) or
    88         (dst.Time < src.Time) then
    89         CopyFile(PChar(GetSavedDir(True) + DirectorySeparator + src.Name),
    90           PChar(GetSavedDir(True) + DirectorySeparator + src.Name), false);
    91       FindClose(dst);
    92     until FindNext(src) <> 0;
    93   FindClose(src);
    94 
    95   // Copy appdata if not done yet
    96   if FindFirst(GetMapsDir(True) + DirectorySeparator + '*.*', $21, src) = 0 then
    97     repeat
    98       if (FindFirst(GetMapsDir(True) + DirectorySeparator + src.Name, $21, dst) <> 0) or
    99         (dst.Time < src.Time) then
    100         CopyFile(PChar(GetMapsDir(True) + DirectorySeparator + src.Name),
    101           PChar(GetMapsDir(True) + DirectorySeparator + src.Name), false);
    102       FindClose(dst);
    103     until FindNext(src) <> 0;
    104   FindClose(src);
     97  CopyDir(GetSavedDir(True), GetSavedDir(False), '*.*');
     98  CopyDir(GetMapsDir(True), GetMapsDir(False), '*.*');
    10599end;
    106100
  • branches/highdpi/Packages/CevoComponents/DrawDlg.pas

    r212 r246  
    1313
    1414  TDrawDlg = class(TDpiForm)
    15   public
    16     constructor Create(AOwner: TComponent); override;
    17     destructor Destroy; override;
    18     procedure SmartInvalidate; virtual;
    1915  private
    2016    MoveFormPos: TPoint;
     
    3329    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    3430    procedure MouseLeave; override;
     31  public
     32    constructor Create(AOwner: TComponent); override;
     33    destructor Destroy; override;
     34    procedure SmartInvalidate; virtual;
    3535  end;
    3636
     
    127127  inherited;
    128128  {$IFDEF LINUX}
    129   // HitTest is not supported under Linux GTK2 so use form inside move mechanizm
    130   NewFormPos := ScreenToClient(DpiMouse.CursorPos);
    131   if (NewFormPos.X >= 0) and (NewFormPos.X < Width) and
    132     (NewFormPos.Y >= 0) and (NewFormPos.Y < Height) then begin
    133     MoveMousePos := ClientToScreen(Point(X, Y));
    134     MoveFormPos := Point(Left, Top);
    135     MousePosNew := DpiMouse.CursorPos;
    136     // Activate move only if mouse position was not changed during inherited call
    137     if (MousePosNew.X = MoveMousePos.X) and (MousePosNew.Y = MoveMousePos.Y) then begin
    138       MoveActive := True;
    139     end;
    140   end else MoveActive := False;
     129  // Only if client is not doing own mouse move handling
     130  if not Assigned(OnMouseDown) or not Assigned(OnMouseMove) or not Assigned(OnMouseUp) then begin
     131    // HitTest is not supported under Linux GTK2 so use form inside move mechanizm
     132    NewFormPos := ScreenToClient(DpiMouse.CursorPos);
     133    if (NewFormPos.X >= 0) and (NewFormPos.X < Width) and
     134      (NewFormPos.Y >= 0) and (NewFormPos.Y < Height) then begin
     135      MoveMousePos := ClientToScreen(Point(X, Y));
     136      MoveFormPos := Point(Left, Top);
     137      MousePosNew := DpiMouse.CursorPos;
     138      // Activate move only if mouse position was not changed during inherited call
     139      if (MousePosNew.X = MoveMousePos.X) and (MousePosNew.Y = MoveMousePos.Y) then begin
     140        MoveActive := True;
     141      end;
     142    end else MoveActive := False;
     143  end;
    141144  {$ENDIF}
    142145end;
  • branches/highdpi/Packages/CevoComponents/ScreenTools.pas

    r244 r246  
    3535procedure Sprite(dst: TDpiBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
    3636  overload;
    37 procedure MakeBlue(dst: TDpiBitmap; x, y, Width, Height: Integer);
     37procedure MakeBlue(Dst: TDpiBitmap; X, Y, Width, Height: Integer);
     38procedure MakeRed(Dst: TDpiBitmap; X, Y, Width, Height: Integer);
    3839procedure ImageOp_B(dst, Src: TDpiBitmap; xDst, yDst, xSrc, ySrc, Width, Height: Integer);
    3940procedure ImageOp_BCC(dst, Src: TDpiBitmap;
     
    4142procedure ImageOp_CBC(Dst, Src: TDpiBitmap; xDst, yDst, xSrc, ySrc, Width, Height,
    4243  Color0, Color2: Integer);
    43 procedure ImageOp_CCC(bmp: TDpiBitmap; x, y, w, h, Color0, Color1, Color2: Integer);
     44procedure ImageOp_CCC(bmp: TDpiBitmap; x, y, Width, Height, Color0, Color1, Color2: Integer);
    4445function DpiBitCanvas(DestCanvas: TDpiCanvas; X, Y, Width, Height: Integer;
    4546  SrcCanvas: TDpiCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean; overload;
     
    5758procedure FrameImage(ca: TDpiCanvas; Src: TDpiBitmap;
    5859  x, y, Width, Height, xSrc, ySrc: integer; IsControl: boolean = False);
    59 procedure GlowFrame(dst: TDpiBitmap; x0, y0, Width, Height: integer; cl: TColor);
     60procedure GlowFrame(Dst: TDpiBitmap; x0, y0, Width, Height: integer; cl: TColor);
    6061procedure InitOrnament;
    6162procedure InitCityMark(const T: TTexture);
     
    363364  Bitmap.BeginUpdate;
    364365  PixelPtr := PixelPointer(Bitmap);
    365   for Y := 0 to ScaleToVcl(Bitmap.Height) - 1 do begin
    366     for X := 0 to ScaleToVcl(Bitmap.Width) - 1 do begin
     366  for Y := 0 to ScaleToNative(Bitmap.Height) - 1 do begin
     367    for X := 0 to ScaleToNative(Bitmap.Width) - 1 do begin
    367368      PixelPtr.Pixel^ := ApplyGammaToPixel(PixelPtr.Pixel^);
    368369      PixelPtr.NextPixel;
     
    381382  SrcPtr := PixelPointer(Src);
    382383  DstPtr := PixelPointer(Dst);
    383   for Y := 0 to ScaleToVcl(Src.Height) - 1 do begin
    384     for X := 0 to ScaleToVcl(Src.Width) - 1 do begin
     384  for Y := 0 to ScaleToNative(Src.Height - 1) do begin
     385    for X := 0 to ScaleToNative(Src.Width - 1) do begin
    385386      DstPtr.Pixel^.B := SrcPtr.Pixel^.B;
    386387      DstPtr.Pixel^.G := SrcPtr.Pixel^.B;
     
    403404    Path := Path + '.png';
    404405  if ExtractFileExt(Path) = '.jpg' then begin
    405     jtex := tDpijpegimage.Create;
     406    jtex := TDpiJpegImage.Create;
    406407    try
    407408      jtex.LoadFromFile(Path);
     
    505506    DataPixel := PixelPointer(GrExt[nGrExt].Data);
    506507    MaskPixel := PixelPointer(GrExt[nGrExt].Mask);
    507     for y := 0 to ScaleToVcl(Source.Height) - 1 do begin
    508       for x := 0 to ScaleToVcl(xmax) - 1 do begin
     508    for y := 0 to ScaleToNative(Source.Height) - 1 do begin
     509      for x := 0 to ScaleToNative(xmax) - 1 do begin
    509510        OriginalColor := DataPixel.Pixel^.ARGB and $FFFFFF;
    510511        if (OriginalColor = $FF00FF) or (OriginalColor = $7F007F) then
     
    538539end;
    539540
    540 procedure MakeBlue(dst: TDpiBitmap; x, y, Width, Height: Integer);
    541 var
    542   XX, YY: integer;
     541procedure MakeBlue(Dst: TDpiBitmap; X, Y, Width, Height: Integer);
     542var
     543  XX, YY: Integer;
    543544  PixelPtr: TPixelPointer;
    544545begin
    545   X := ScaleToVcl(X);
    546   Y := ScaleToVcl(Y);
    547   Width := ScaleToVcl(Width);
    548   Height := ScaleToVcl(Height);
    549546  Dst.BeginUpdate;
    550   PixelPtr := PixelPointer(Dst, X, Y);
    551   for yy := 0 to Height - 1 do begin
    552     for xx := 0 to Width - 1 do begin
     547  PixelPtr := PixelPointer(Dst, ScaleToNative(X), ScaleToNative(Y));
     548  for yy := 0 to ScaleToNative(Height) - 1 do begin
     549    for xx := 0 to ScaleToNative(Width) - 1 do begin
    553550      PixelPtr.Pixel^.B := PixelPtr.Pixel^.B div 2;
    554551      PixelPtr.Pixel^.G := PixelPtr.Pixel^.G div 2;
     
    561558end;
    562559
     560procedure MakeRed(Dst: TDpiBitmap; X, Y, Width, Height: Integer);
     561var
     562  XX, YY: Integer;
     563  Gray: Integer;
     564  PixelPtr: TPixelPointer;
     565begin
     566  Dst.BeginUpdate;
     567  PixelPtr := PixelPointer(Dst, ScaleToNative(X), ScaleToNative(Y));
     568  for YY := 0 to ScaleToNative(Height) - 1 do begin
     569    for XX := 0 to ScaleToNative(Width) - 1 do begin
     570      Gray := (Integer(PixelPtr.Pixel^.B) + Integer(PixelPtr.Pixel^.G) +
     571        Integer(PixelPtr.Pixel^.R)) * 85 shr 8;
     572      PixelPtr.Pixel^.B := 0;
     573      PixelPtr.Pixel^.G := 0;
     574      PixelPtr.Pixel^.R := Gray; // 255-(255-gray) div 2;
     575      PixelPtr.NextPixel;
     576    end;
     577    PixelPtr.NextLine;
     578  end;
     579  Dst.EndUpdate;
     580end;
     581
    563582procedure ImageOp_B(dst, Src: TDpiBitmap; xDst, yDst, xSrc, ySrc, Width, Height: Integer);
    564583// Src is template
     
    570589  PixelDst: TPixelPointer;
    571590begin
    572   xDst := ScaleToVcl(xDst);
    573   yDst := ScaleToVcl(yDst);
    574   xSrc := ScaleToVcl(xSrc);
    575   ySrc := ScaleToVcl(ySrc);
    576   Width := ScaleToVcl(Width);
    577   Height := ScaleToVcl(Height);
     591  xDst := ScaleToNative(xDst);
     592  yDst := ScaleToNative(yDst);
     593  xSrc := ScaleToNative(xSrc);
     594  ySrc := ScaleToNative(ySrc);
     595  Width := ScaleToNative(Width);
     596  Height := ScaleToNative(Height);
    578597  //Assert(Src.PixelFormat = pf8bit);
    579598  Assert(dst.PixelFormat = pf24bit);
     
    588607    yDst := 0;
    589608  end;
    590   if xDst + Width > ScaleToVcl(dst.Width) then
    591     Width := ScaleToVcl(dst.Width) - xDst;
    592   if yDst + Height > ScaleToVcl(dst.Height) then
    593     Height := ScaleToVcl(dst.Height) - yDst;
     609  if xDst + Width > ScaleToNative(dst.Width) then
     610    Width := ScaleToNative(dst.Width) - xDst;
     611  if yDst + Height > ScaleToNative(dst.Height) then
     612    Height := ScaleToNative(dst.Height) - yDst;
    594613  if (Width < 0) or (Height < 0) then
    595614    exit;
     
    638657  DstPixel: TPixelPointer;
    639658begin
    640   xDst := ScaleToVcl(xDst);
    641   yDst := ScaleToVcl(yDst);
    642   xSrc := ScaleToVcl(xSrc);
    643   ySrc := ScaleToVcl(ySrc);
    644   Width := ScaleToVcl(Width);
    645   Height := ScaleToVcl(Height);
     659  xDst := ScaleToNative(xDst);
     660  yDst := ScaleToNative(yDst);
     661  xSrc := ScaleToNative(xSrc);
     662  ySrc := ScaleToNative(ySrc);
     663  Width := ScaleToNative(Width);
     664  Height := ScaleToNative(Height);
    646665  if xDst < 0 then begin
    647666    Width := Width + xDst;
     
    654673    yDst := 0;
    655674  end;
    656   if xDst + Width > ScaleToVcl(dst.Width) then
    657     Width := ScaleToVcl(dst.Width) - xDst;
    658   if yDst + Height > ScaleToVcl(dst.Height) then
    659     Height := ScaleToVcl(dst.Height) - yDst;
     675  if xDst + Width > ScaleToNative(dst.Width) then
     676    Width := ScaleToNative(dst.Width) - xDst;
     677  if yDst + Height > ScaleToNative(dst.Height) then
     678    Height := ScaleToNative(dst.Height) - yDst;
    660679  if (Width < 0) or (Height < 0) then
    661680    exit;
     
    705724  DstPixel: TPixelPointer;
    706725begin
    707   xDst := ScaleToVcl(xDst);
    708   yDst := ScaleToVcl(yDst);
    709   xSrc := ScaleToVcl(xSrc);
    710   ySrc := ScaleToVcl(ySrc);
    711   Width := ScaleToVcl(Width);
    712   Height := ScaleToVcl(Height);
     726  xDst := ScaleToNative(xDst);
     727  yDst := ScaleToNative(yDst);
     728  xSrc := ScaleToNative(xSrc);
     729  ySrc := ScaleToNative(ySrc);
     730  Width := ScaleToNative(Width);
     731  Height := ScaleToNative(Height);
    713732  Src.BeginUpdate;
    714733  Dst.BeginUpdate;
     
    743762end;
    744763
    745 procedure ImageOp_CCC(bmp: TDpiBitmap; x, y, w, h, Color0, Color1, Color2: Integer);
     764procedure ImageOp_CCC(bmp: TDpiBitmap; x, y, Width, Height, Color0, Color1, Color2: Integer);
    746765// Bmp is template
    747766// B channel = Color0 amp, 128=original brightness
     
    752771  PixelPtr: TPixelPointer;
    753772begin
    754   X := ScaleToVcl(X);
    755   Y := ScaleToVcl(Y);
    756   W := ScaleToVcl(W);
    757   H := ScaleToVcl(H);
     773  X := ScaleToNative(X);
     774  Y := ScaleToNative(Y);
     775  Width := ScaleToNative(Width);
     776  Height := ScaleToNative(Height);
    758777  bmp.BeginUpdate;
    759778  assert(bmp.PixelFormat = pf24bit);
    760   h := y + h;
     779  Height := y + Height;
    761780  PixelPtr := PixelPointer(Bmp, x, y);
    762   while y < h do begin
    763     for i := 0 to w - 1 do begin
     781  while y < Height do begin
     782    for i := 0 to Width - 1 do begin
    764783      Red := ((PixelPtr.Pixel^.B * (Color0 and $0000FF) + PixelPtr.Pixel^.G *
    765784        (Color1 and $0000FF) + PixelPtr.Pixel^.R * (Color2 and $0000FF)) shr 8) and $ff;
     
    799818  SrcCanvas: TDpiCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean;
    800819begin
     820  {$IFDEF WINDOWS}
     821  // LCLIntf.BitBlt is slower than direct Windows BitBlt
     822  Result := Windows.DpiBitBlt(DestCanvas.Handle, X, Y, Width, Height, SrcCanvas.Handle, XSrc, YSrc, Rop);
     823  {$ELSE}
    801824  Result := DpiBitBlt(DestCanvas.Handle, X, Y, Width, Height, SrcCanvas.Handle, XSrc, YSrc, Rop);
     825  {$ENDIF}
    802826end;
    803827
     
    903927end;
    904928
    905 procedure GlowFrame(dst: TDpiBitmap; x0, y0, Width, Height: Integer; cl: TColor);
     929procedure GlowFrame(Dst: TDpiBitmap; x0, y0, Width, Height: Integer; cl: TColor);
    906930var
    907931  x, y, ch, r: Integer;
     
    909933  DpiGlowRange: Integer;
    910934begin
    911   DpiGlowRange := ScaleToVcl(GlowRange);
    912   X0 := ScaleToVcl(X0);
    913   Y0 := ScaleToVcl(Y0);
    914   Width := ScaleToVcl(Width);
    915   Height := ScaleToVcl(Height);
    916   dst.BeginUpdate;
    917   DstPtr := PixelPointer(dst, x0, y0);
     935  DpiGlowRange := ScaleToNative(GlowRange);
     936  X0 := ScaleToNative(X0);
     937  Y0 := ScaleToNative(Y0);
     938  Width := ScaleToNative(Width);
     939  Height := ScaleToNative(Height);
     940  Dst.BeginUpdate;
     941  DstPtr := PixelPointer(Dst, x0 - DpiGlowRange + 1, y0 - DpiGlowRange + 1);
    918942  for y := -DpiGlowRange + 1 to Height - 1 + DpiGlowRange - 1 do begin
    919943    for x := -DpiGlowRange + 1 to Width - 1 + DpiGlowRange - 1 do begin
    920       DstPtr.SetXY(x, y);
    921944      if x < 0 then
    922945        if y < 0 then
     
    937960      else if y >= Height then
    938961        r := y - (Height - 1)
    939       else
     962      else begin
     963        DstPtr.NextPixel;
    940964        continue;
     965      end;
    941966      if r = 0 then
    942967        r := 1;
     
    946971            (DstPtr.Pixel^.Planes[2 - ch] * (r - 1) + (cl shr (8 * ch) and $FF) *
    947972            (DpiGlowRange - r)) div (DpiGlowRange - 1);
    948     end;
    949   end;
    950   dst.EndUpdate;
     973      DstPtr.NextPixel;
     974    end;
     975    DstPtr.NextLine;
     976  end;
     977  Dst.EndUpdate;
    951978end;
    952979
     
    15091536  // texturize background
    15101537  Dest.BeginUpdate;
    1511   TexWidth := ScaleToVcl(Texture.Width);
    1512   TexHeight := ScaleToVcl(Texture.Height);
     1538  TexWidth := Texture.Width;
     1539  TexHeight := Texture.Height;
    15131540  DstPixel := PixelPointer(Dest);
    15141541  SrcPixel := PixelPointer(Texture);
    1515   for Y := 0 to ScaleToVcl(Dest.Height) - 1 do begin
    1516     for X := 0 to ScaleToVcl(Dest.Width) - 1 do begin
     1542  for Y := 0 to ScaleToNative(Dest.Height) - 1 do begin
     1543    for X := 0 to ScaleToNative(Dest.Width) - 1 do begin
    15171544      if (DstPixel.Pixel^.ARGB and $FFFFFF) = TransparentColor then begin
    15181545        SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight);
     
    15351562  Bitmap.BeginUpdate;
    15361563  PicturePixel := PixelPointer(Bitmap);
    1537   for y := 0 to ScaleToVcl(Bitmap.Height) - 1 do begin
    1538     for x := 0 to ScaleToVcl(Bitmap.Width) - 1 do begin
     1564  for y := 0 to ScaleToNative(Bitmap.Height) - 1 do begin
     1565    for x := 0 to ScaleToNative(Bitmap.Width) - 1 do begin
    15391566      PicturePixel.Pixel^.B := Max(PicturePixel.Pixel^.B - Change, 0);
    15401567      PicturePixel.Pixel^.G := Max(PicturePixel.Pixel^.G - Change, 0);
     
    15451572  end;
    15461573  Bitmap.EndUpdate;
     1574end;
     1575
     1576function ScaleToNative(Value: Integer): Integer;
     1577begin
     1578  Result := Value;
     1579end;
     1580
     1581function ScaleFromNative(Value: Integer): Integer;
     1582begin
     1583  Result := Value;
    15471584end;
    15481585
  • branches/highdpi/Packages/CevoComponents/UPixelPointer.pas

    r210 r246  
    2727    BytesPerPixel: Integer;
    2828    BytesPerLine: Integer;
    29     procedure NextLine; inline; // Move pointer to start of new base line
     29    procedure NextLine; inline; // Move pointer to start of next line
     30    procedure PreviousLine; inline; // Move pointer to start of previous line
    3031    procedure NextPixel; inline; // Move pointer to next pixel
     32    procedure PreviousPixel; inline; // Move pointer to previous pixel
    3133    procedure SetXY(X, Y: Integer); inline; // Set pixel position relative to base
    3234    procedure SetX(X: Integer); inline; // Set horizontal pixel position relative to base
     
    4749end;
    4850
     51procedure TPixelPointer.PreviousLine;
     52begin
     53  Line := Pointer(Line) - BytesPerLine;
     54  Pixel := Line;
     55end;
     56
    4957procedure TPixelPointer.NextPixel; inline;
    5058begin
    5159  Pixel := Pointer(Pixel) + BytesPerPixel;
     60end;
     61
     62procedure TPixelPointer.PreviousPixel;
     63begin
     64  Pixel := Pointer(Pixel) - BytesPerPixel;
    5265end;
    5366
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r244 r246  
    7777  protected
    7878    procedure ScreenChanged;
    79     function GetVclFont: TFont; virtual;
     79    function GetNativeFont: TFont; virtual;
    8080  public
    81     VclFont: TFont;
     81    NativeFont: TFont;
    8282    constructor Create;
    8383    destructor Destroy; override;
     
    162162    procedure SetOnResize(AValue: TNotifyEvent);
    163163    procedure SetShowHint(AValue: Boolean);
    164     procedure VclFormResize(Sender: TObject);
    165     procedure VclChangeBounds(Sender: TObject);
     164    procedure NativeFormResize(Sender: TObject);
     165    procedure NativeChangeBounds(Sender: TObject);
    166166    procedure DoFormResize;
    167167    procedure DoChangeBounds;
     
    186186    procedure SetVisible(AValue: Boolean); virtual;
    187187    procedure SetWidth(AValue: Integer); virtual;
    188     function GetVclControl: TControl; virtual;
    189     procedure UpdateVclControl; virtual;
     188    function GetNativeControl: TControl; virtual;
     189    procedure UpdateNativeControl; virtual;
    190190    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
    191191      X, Y: Integer); virtual;
     
    247247  protected
    248248    FDpi: Integer;
    249     function GetVclGraphic: TGraphic; virtual;
     249    function GetNativeGraphic: TGraphic; virtual;
    250250    function GetWidth: Integer; virtual; abstract;
    251251    function GetHeight: Integer; virtual; abstract;
     
    256256    function GetDpi: Integer; virtual;
    257257  public
    258     VclGraphicClass: TGraphicClass;
     258    NativeGraphicClass: TGraphicClass;
    259259    constructor Create; virtual;
    260260    procedure LoadFromFile(const Filename: string); virtual;
     
    271271    function GetRawImage: TRawImage;
    272272  protected
    273     function GetVclGraphic: TGraphic; override;
    274     function GetVclRasterImage: TRasterImage; virtual;
     273    function GetNativeGraphic: TGraphic; override;
     274    function GetNativeRasterImage: TRasterImage; virtual;
    275275  public
    276276    property RawImage: TRawImage read GetRawImage;
     
    282282  private
    283283    FFont: TDpiFont;
    284     FVclCanvas: TCanvas;
     284    FNativeCanvas: TCanvas;
    285285    function GetBrush: TBrush;
    286286    function GetHandle: HDC;
     
    294294    procedure SetPen(AValue: TPen);
    295295    procedure SetPixel(X, Y: Integer; AValue: TColor);
    296     procedure SetVclCanvas(AValue: TCanvas);
     296    procedure SetNativeCanvas(AValue: TCanvas);
    297297  protected
    298     function GetVclCanvas: TCanvas; virtual;
     298    function GetNativeCanvas: TCanvas; virtual;
    299299  public
    300     property VclCanvas: TCanvas read FVclCanvas write SetVclCanvas;
     300    property NativeCanvas: TCanvas read FNativeCanvas write SetNativeCanvas;
    301301    procedure StretchDraw(const DestRect: TRect; SrcGraphic: TDpiGraphic); virtual;
    302302    procedure FrameRect(Rect: TRect);
     
    331331  private
    332332    FOnPaint: TNotifyEvent;
    333     VclGraphicControl: TGraphicControl;
     333    NativeGraphicControl: TGraphicControl;
    334334    FCanvas: TDpiCanvas;
    335335    function GetOnPaint: TNotifyEvent;
     
    339339  protected
    340340    procedure Paint; virtual;
    341     function GetVclControl: TControl; override;
    342     function GetVclGraphicControl: TGraphicControl; virtual;
    343     procedure UpdateVclControl; override;
     341    function GetNativeControl: TControl; override;
     342    function GetNativeGraphicControl: TGraphicControl; virtual;
     343    procedure UpdateNativeControl; override;
    344344    property OnPaint: TNotifyEvent read GetOnPaint write SetOnPaint;
    345345  public
     
    367367    procedure SetTabStop(AValue: Boolean);
    368368  protected
    369     function GetVclControl: TControl; override;
    370     function GetVclWinControl: TWinControl; virtual;
     369    function GetNativeControl: TControl; override;
     370    function GetNativeWinControl: TWinControl; virtual;
    371371  public
    372372    Controls: TDpiControls;
     
    395395    procedure SetPixelsPerInch(AValue: Integer);
    396396  protected
    397     function GetVclWinControl: TWinControl; override;
    398     function GetVclCustomControl: TCustomControl; virtual;
     397    function GetNativeWinControl: TWinControl; override;
     398    function GetNativeCustomControl: TCustomControl; virtual;
    399399  public
    400400    property Canvas: TDpiCanvas read GetCanvas;
     
    421421    FVertScrollBar: TDpiControlScrollBar;
    422422  protected
    423     function GetVclCustomControl: TCustomControl; override;
    424     function GetVclScrollingWinControl: TScrollingWinControl; virtual;
     423    function GetNativeCustomControl: TCustomControl; override;
     424    function GetNativeScrollingWinControl: TScrollingWinControl; virtual;
    425425  public
    426426    constructor Create(TheOwner: TComponent); override;
     
    480480    procedure CreateParams(var p: TCreateParams); virtual;
    481481    procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
    482     function GetVclScrollingWinControl: TScrollingWinControl; override;
    483     function GetVclForm: TForm; virtual;
    484     procedure UpdateVclControl; override;
     482    function GetNativeScrollingWinControl: TScrollingWinControl; override;
     483    function GetNativeForm: TForm; virtual;
     484    procedure UpdateNativeControl; override;
    485485  public
    486     VclForm: TForm;
     486    NativeForm: TForm;
    487487    procedure AfterConstruction; override;
    488488    property ModalResult: TModalResult read GetModalResult write SetModalResult;
     
    527527  private
    528528  protected
    529     function GetVclControl: TControl; override;
     529    function GetNativeControl: TControl; override;
    530530  public
    531     VclButton: TButton;
     531    NativeButton: TButton;
    532532    destructor Destroy; override;
    533533  published
     
    559559    procedure SetTopIndex(AValue: Integer);
    560560  protected
    561     function GetVclWinControl: TWinControl; override;
    562     function GetVclListBox: TListBox; virtual;
     561    function GetNativeWinControl: TWinControl; override;
     562    function GetNativeListBox: TListBox; virtual;
    563563  public
    564     VclListBox: TListBox;
     564    NativeListBox: TListBox;
    565565    destructor Destroy; override;
    566566    property ItemIndex: Integer read GetItemIndex write SetItemIndex;
     
    598598    procedure SetPosition(AValue: Integer);
    599599  protected
    600     function GetVclControl: TControl; override;
     600    function GetNativeControl: TControl; override;
    601601  public
    602     VclScrollBar: TScrollBar;
     602    NativeScrollBar: TScrollBar;
    603603    destructor Destroy; override;
    604604  published
     
    627627    function GetHeight: Integer; override;
    628628    function GetWidth: Integer; override;
    629     function GetVclBitmap: TCustomBitmap; virtual;
    630     function GetVclRasterImage: TRasterImage; override;
     629    function GetNativeBitmap: TCustomBitmap; virtual;
     630    function GetNativeRasterImage: TRasterImage; override;
    631631    procedure SetHeight(AValue: Integer); override;
    632632    procedure SetWidth(AValue: Integer); override;
    633633    procedure ScreenChanged; override;
    634634  public
    635     VclBitmap: TBitmap;
     635    NativeBitmap: TBitmap;
    636636    procedure BeginUpdate;
    637637    procedure EndUpdate;
     
    669669  protected
    670670  public
    671     VclImage: TImage;
    672     function GetVclControl: TControl; override;
     671    NativeImage: TImage;
     672    function GetNativeControl: TControl; override;
    673673    destructor Destroy; override;
    674674  published
     
    682682  TDpiPaintBox = class(TDpiGraphicControl)
    683683  public
    684     VclPaintBox: TPaintBox;
    685     function GetVclGraphicControl: TGraphicControl; override;
     684    NativePaintBox: TPaintBox;
     685    function GetNativeGraphicControl: TGraphicControl; override;
    686686    constructor Create(TheOwner: TComponent); override;
    687687    destructor Destroy; override;
     
    718718    destructor Destroy; override;
    719719    procedure UpdateScreen;
    720     procedure UpdateActiveFormFromVclScreen;
     720    procedure UpdateActiveFormFromNativeScreen;
    721721    property FormCount: Integer read GetFormCount;
    722722    property Forms[Index: Integer]: TDpiForm read GetForms;
     
    735735  TDpiJpegImage = class(TDpiBitmap)
    736736  protected
    737     function GetVclBitmap: TCustomBitmap; override;
    738     function GetVclJpeg: TJPEGImage; virtual;
     737    function GetNativeBitmap: TCustomBitmap; override;
     738    function GetNativeJpeg: TJPEGImage; virtual;
    739739  public
    740     VclJpeg: TJPEGImage;
     740    NativeJpeg: TJPEGImage;
    741741    constructor Create; override;
    742742  end;
     
    746746  TDpiPortableNetworkGraphic = class(TDpiBitmap)
    747747  protected
    748     function GetVclBitmap: TCustomBitmap; override;
    749     function GetVclPng: TPortableNetworkGraphic; virtual;
     748    function GetNativeBitmap: TCustomBitmap; override;
     749    function GetNativePng: TPortableNetworkGraphic; virtual;
    750750  public
    751     VclPng: TPortableNetworkGraphic;
     751    NativePng: TPortableNetworkGraphic;
    752752    constructor Create; override;
    753753  end;
     
    767767    procedure SetTitle(AValue: string);
    768768  protected
    769     function GetVclApplication: TApplication; virtual;
     769    function GetNativeApplication: TApplication; virtual;
    770770  public
    771771    constructor Create(AOwner: TComponent); override;
     
    828828    procedure OnClickHandler(Sender: TObject);
    829829  protected
    830     function GetVclMenuItem: TMenuItem; virtual;
     830    function GetNativeMenuItem: TMenuItem; virtual;
    831831    procedure SetParentComponent(AValue: TComponent); override;
    832832  public
    833     VclMenuItem: TMenuItem;
     833    NativeMenuItem: TMenuItem;
    834834    constructor Create(AOwner: TComponent); override;
    835835    destructor Destroy; override;
     
    861861    FItems: TDpiMenuItem;
    862862  protected
    863     function GetVclMenu: TMenu; virtual;
     863    function GetNativeMenu: TMenu; virtual;
    864864  public
    865865    property Items: TDpiMenuItem read FItems;
     
    875875    procedure SetAutoPopup(AValue: Boolean);
    876876  protected
    877     function GetVclMenu: TMenu; override;
    878     function GetVclPopupMenu: TPopupMenu; virtual;
     877    function GetNativeMenu: TMenu; override;
     878    function GetNativePopupMenu: TPopupMenu; virtual;
    879879  public
    880     VclPopupMenu: TPopupMenu;
     880    NativePopupMenu: TPopupMenu;
    881881    procedure PopUp;
    882882    procedure PopUp(X, Y: Integer); virtual;
     
    897897function DpiBitBltCanvas(Dest: TDpiCanvas; X, Y, Width, Height: Integer; Src: TDpiCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean;
    898898function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
    899 function ScaleToVcl(Value: Integer): Integer;
    900 function ScaleFromVcl(Value: Integer): Integer;
    901 function ScalePointToVcl(Value: TPoint): TPoint;
    902 function ScalePointFromVcl(Value: TPoint): TPoint;
    903 function ScaleSizeToVcl(Value: TSize): TSize;
    904 function ScaleSizeFromVcl(Value: TSize): TSize;
    905 function ScaleRectToVcl(Value: TRect): TRect;
    906 function ScaleRectFromVcl(Value: TRect): TRect;
     899function ScaleToNative(Value: Integer): Integer;
     900function ScaleFromNative(Value: Integer): Integer;
     901function ScalePointToNative(Value: TPoint): TPoint;
     902function ScalePointFromNative(Value: TPoint): TPoint;
     903function ScaleSizeToNative(Value: TSize): TSize;
     904function ScaleSizeFromNative(Value: TSize): TSize;
     905function ScaleRectToNative(Value: TRect): TRect;
     906function ScaleRectFromNative(Value: TRect): TRect;
    907907
    908908
     
    933933function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
    934934begin
    935   Result := CreateRectRgn(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2),
    936     ScaleToVcl(Y2));
    937 end;
    938 
    939 function ScaleToVcl(Value: Integer): Integer;
     935  Result := CreateRectRgn(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2),
     936    ScaleToNative(Y2));
     937end;
     938
     939function ScaleToNative(Value: Integer): Integer;
    940940begin
    941941  Result := Round(Value * DpiScreen.Dpi / 96);
    942942end;
    943943
    944 function ScaleFromVcl(Value: Integer): Integer;
     944function ScaleFromNative(Value: Integer): Integer;
    945945begin
    946946  Result := Round(Value * 96 / DpiScreen.Dpi);
    947947end;
    948948
    949 function ScalePointToVcl(Value: TPoint): TPoint;
    950 begin
    951   Result.X := ScaleToVcl(Value.X);
    952   Result.Y := ScaleToVcl(Value.Y);
    953 end;
    954 
    955 function ScalePointFromVcl(Value: TPoint): TPoint;
    956 begin
    957   Result.X := ScaleFromVcl(Value.X);
    958   Result.Y := ScaleFromVcl(Value.Y);
    959 end;
    960 
    961 function ScaleSizeToVcl(Value: TSize): TSize;
    962 begin
    963   Result.Width := ScaleToVcl(Value.Width);
    964   Result.Height := ScaleToVcl(Value.Height);
    965 end;
    966 
    967 function ScaleSizeFromVcl(Value: TSize): TSize;
    968 begin
    969   Result.Width := ScaleFromVcl(Value.Width);
    970   Result.Height := ScaleFromVcl(Value.Height);
    971 end;
    972 
    973 function ScaleRectToVcl(Value: TRect): TRect;
    974 begin
    975   Result.Left := ScaleToVcl(Value.Left);
    976   Result.Top := ScaleToVcl(Value.Top);
    977   Result.Right := ScaleToVcl(Value.Right);
    978   Result.Bottom := ScaleToVcl(Value.Bottom);
    979 end;
    980 
    981 function ScaleRectFromVcl(Value: TRect): TRect;
    982 begin
    983   Result.Left := ScaleFromVcl(Value.Left);
    984   Result.Top := ScaleFromVcl(Value.Top);
    985   Result.Right := ScaleFromVcl(Value.Right);
    986   Result.Bottom := ScaleFromVcl(Value.Bottom);
     949function ScalePointToNative(Value: TPoint): TPoint;
     950begin
     951  Result.X := ScaleToNative(Value.X);
     952  Result.Y := ScaleToNative(Value.Y);
     953end;
     954
     955function ScalePointFromNative(Value: TPoint): TPoint;
     956begin
     957  Result.X := ScaleFromNative(Value.X);
     958  Result.Y := ScaleFromNative(Value.Y);
     959end;
     960
     961function ScaleSizeToNative(Value: TSize): TSize;
     962begin
     963  Result.Width := ScaleToNative(Value.Width);
     964  Result.Height := ScaleToNative(Value.Height);
     965end;
     966
     967function ScaleSizeFromNative(Value: TSize): TSize;
     968begin
     969  Result.Width := ScaleFromNative(Value.Width);
     970  Result.Height := ScaleFromNative(Value.Height);
     971end;
     972
     973function ScaleRectToNative(Value: TRect): TRect;
     974begin
     975  Result.Left := ScaleToNative(Value.Left);
     976  Result.Top := ScaleToNative(Value.Top);
     977  Result.Right := ScaleToNative(Value.Right);
     978  Result.Bottom := ScaleToNative(Value.Bottom);
     979end;
     980
     981function ScaleRectFromNative(Value: TRect): TRect;
     982begin
     983  Result.Left := ScaleFromNative(Value.Left);
     984  Result.Top := ScaleFromNative(Value.Top);
     985  Result.Right := ScaleFromNative(Value.Right);
     986  Result.Bottom := ScaleFromNative(Value.Bottom);
    987987end;
    988988
     
    990990  YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean;
    991991begin
    992   Result := BitBlt(DestDC, ScaleToVcl(X), ScaleToVcl(Y), ScaleToVcl(Width),
    993     ScaleToVcl(Height), SrcDC, ScaleToVcl(XSrc), ScaleToVcl(YSrc), Rop);
     992  Result := BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), ScaleToNative(Width),
     993    ScaleToNative(Height), SrcDC, ScaleToNative(XSrc), ScaleToNative(YSrc), Rop);
    994994end;
    995995
    996996{ TDpiMenu }
    997997
    998 function TDpiMenu.GetVclMenu: TMenu;
     998function TDpiMenu.GetNativeMenu: TMenu;
    999999begin
    10001000  Result := nil;
     
    10171017function TDpiMenuItem.GetCaption: TTranslateString;
    10181018begin
    1019   Result := GetVclMenuItem.Caption;
     1019  Result := GetNativeMenuItem.Caption;
    10201020end;
    10211021
    10221022function TDpiMenuItem.GetChecked: Boolean;
    10231023begin
    1024   Result := GetVclMenuItem.Checked;
     1024  Result := GetNativeMenuItem.Checked;
    10251025end;
    10261026
     
    10321032function TDpiMenuItem.GetEnabled: Boolean;
    10331033begin
    1034   Result := GetVclMenuItem.Enabled;
     1034  Result := GetNativeMenuItem.Enabled;
    10351035end;
    10361036
    10371037function TDpiMenuItem.GetGroupIndex: Byte;
    10381038begin
    1039   Result := GetVclMenuItem.GroupIndex;
     1039  Result := GetNativeMenuItem.GroupIndex;
    10401040end;
    10411041
     
    10521052function TDpiMenuItem.GetRadioItem: Boolean;
    10531053begin
    1054   Result := GetVclMenuItem.RadioItem;
     1054  Result := GetNativeMenuItem.RadioItem;
    10551055end;
    10561056
    10571057function TDpiMenuItem.GetShortCut: TShortCut;
    10581058begin
    1059   Result := GetVclMenuItem.ShortCut;
     1059  Result := GetNativeMenuItem.ShortCut;
    10601060end;
    10611061
    10621062function TDpiMenuItem.GetVisible: Boolean;
    10631063begin
    1064   Result := GetVclMenuItem.Visible;
     1064  Result := GetNativeMenuItem.Visible;
    10651065end;
    10661066
     
    10921092procedure TDpiMenuItem.SetCaption(AValue: TTranslateString);
    10931093begin
    1094   GetVclMenuItem.Caption := AValue;
     1094  GetNativeMenuItem.Caption := AValue;
    10951095end;
    10961096
    10971097procedure TDpiMenuItem.SetChecked(AValue: Boolean);
    10981098begin
    1099   GetVclMenuItem.Checked := AValue;
     1099  GetNativeMenuItem.Checked := AValue;
    11001100end;
    11011101
    11021102procedure TDpiMenuItem.SetEnabled(AValue: Boolean);
    11031103begin
    1104   GetVclMenuItem.Enabled := AValue;
     1104  GetNativeMenuItem.Enabled := AValue;
    11051105end;
    11061106
    11071107procedure TDpiMenuItem.SetGroupIndex(AValue: Byte);
    11081108begin
    1109   GetVclMenuItem.GroupIndex := AValue;
     1109  GetNativeMenuItem.GroupIndex := AValue;
    11101110end;
    11111111
     
    11171117procedure TDpiMenuItem.SetRadioItem(AValue: Boolean);
    11181118begin
    1119   GetVclMenuItem.RadioItem := AValue;
     1119  GetNativeMenuItem.RadioItem := AValue;
    11201120end;
    11211121
    11221122procedure TDpiMenuItem.SetShortCut(AValue: TShortCut);
    11231123begin
    1124   GetVclMenuItem.ShortCut := AValue;
     1124  GetNativeMenuItem.ShortCut := AValue;
    11251125end;
    11261126
    11271127procedure TDpiMenuItem.SetVisible(AValue: Boolean);
    11281128begin
    1129   GetVclMenuItem.Visible := AValue;
     1129  GetNativeMenuItem.Visible := AValue;
    11301130end;
    11311131
     
    11391139begin
    11401140  FItems.Delete(Index);
    1141   GetVclMenuItem.Delete(Index);
     1141  GetNativeMenuItem.Delete(Index);
    11421142end;
    11431143
     
    11501150begin
    11511151  FItems.Insert(Index, Item);
    1152   GetVclMenuItem.Insert(Index, Item.GetVclMenuItem);
     1152  GetNativeMenuItem.Insert(Index, Item.GetNativeMenuItem);
    11531153end;
    11541154
     
    11711171end;
    11721172
    1173 function TDpiMenuItem.GetVclMenuItem: TMenuItem;
    1174 begin
    1175   if not Assigned(VclMenuItem) then begin
    1176     VclMenuItem := TMenuItem.Create(nil);
    1177     VclMenuItem.Name := 'Vcl' + Name;
    1178     VclMenuItem.OnClick := @OnClickHandler;
    1179   end;
    1180   Result := VclMenuItem;
     1173function TDpiMenuItem.GetNativeMenuItem: TMenuItem;
     1174begin
     1175  if not Assigned(NativeMenuItem) then begin
     1176    NativeMenuItem := TMenuItem.Create(nil);
     1177    NativeMenuItem.Name := 'Native' + Name;
     1178    NativeMenuItem.OnClick := @OnClickHandler;
     1179  end;
     1180  Result := NativeMenuItem;
    11811181end;
    11821182
     
    12201220procedure TDpiPopupMenu.PopUp(X, Y: Integer);
    12211221begin
    1222   GetVclPopupMenu.PopUp(ScaleToVcl(X), ScaleToVcl(Y));
     1222  GetNativePopupMenu.PopUp(ScaleToNative(X), ScaleToNative(Y));
    12231223end;
    12241224
     
    12261226begin
    12271227  inherited;
    1228   GetVclPopupMenu;
     1228  GetNativePopupMenu;
    12291229end;
    12301230
    12311231function TDpiPopupMenu.GetAutoPopup: Boolean;
    12321232begin
    1233   Result := GetVclPopupMenu.AutoPopup;
     1233  Result := GetNativePopupMenu.AutoPopup;
    12341234end;
    12351235
    12361236procedure TDpiPopupMenu.SetAutoPopup(AValue: Boolean);
    12371237begin
    1238   GetVclPopupMenu.AutoPopup := AValue;
    1239 end;
    1240 
    1241 function TDpiPopupMenu.GetVclMenu: TMenu;
    1242 begin
    1243   Result := GetVclPopupMenu;
    1244 end;
    1245 
    1246 function TDpiPopupMenu.GetVclPopupMenu: TPopupMenu;
    1247 begin
    1248   if not Assigned(VclPopupMenu) then begin
    1249     VclPopupMenu := TPopupMenu.Create(nil);
    1250     if Assigned(Items.VclMenuItem) then Items.VclMenuItem.Free;
    1251     Items.VclMenuItem := VclPopupMenu.Items;
    1252   end;
    1253   Result := VclPopupMenu;
     1238  GetNativePopupMenu.AutoPopup := AValue;
     1239end;
     1240
     1241function TDpiPopupMenu.GetNativeMenu: TMenu;
     1242begin
     1243  Result := GetNativePopupMenu;
     1244end;
     1245
     1246function TDpiPopupMenu.GetNativePopupMenu: TPopupMenu;
     1247begin
     1248  if not Assigned(NativePopupMenu) then begin
     1249    NativePopupMenu := TPopupMenu.Create(nil);
     1250    if Assigned(Items.NativeMenuItem) then Items.NativeMenuItem.Free;
     1251    Items.NativeMenuItem := NativePopupMenu.Items;
     1252  end;
     1253  Result := NativePopupMenu;
    12541254end;
    12551255
    12561256destructor TDpiPopupMenu.Destroy;
    12571257begin
    1258   if Assigned(VclPopupMenu) then FreeAndNil(VclPopupMenu);
     1258  if Assigned(NativePopupMenu) then FreeAndNil(NativePopupMenu);
    12591259  inherited Destroy;
    12601260end;
     
    12641264function TDpiMouse.GetCursorPos: TPoint;
    12651265begin
    1266   Result := ScalePointFromVcl(Mouse.CursorPos);
     1266  Result := ScalePointFromNative(Mouse.CursorPos);
    12671267end;
    12681268
    12691269procedure TDpiMouse.SetCursorPos(AValue: TPoint);
    12701270begin
    1271   Mouse.CursorPos := ScalePointToVcl(AValue);
     1271  Mouse.CursorPos := ScalePointToNative(AValue);
    12721272end;
    12731273
     
    13051305{ TDpiScrollingWinControl }
    13061306
    1307 function TDpiScrollingWinControl.GetVclCustomControl: TCustomControl;
    1308 begin
    1309   Result := GetVclScrollingWinControl;
    1310 end;
    1311 
    1312 function TDpiScrollingWinControl.GetVclScrollingWinControl: TScrollingWinControl;
     1307function TDpiScrollingWinControl.GetNativeCustomControl: TCustomControl;
     1308begin
     1309  Result := GetNativeScrollingWinControl;
     1310end;
     1311
     1312function TDpiScrollingWinControl.GetNativeScrollingWinControl: TScrollingWinControl;
    13131313begin
    13141314  Result := nil;
     
    13661366function TDpiApplication.GetTitle: string;
    13671367begin
    1368   Result := GetVclApplication.Title;
     1368  Result := GetNativeApplication.Title;
    13691369end;
    13701370
    13711371function TDpiApplication.GetShowMainForm: Boolean;
    13721372begin
    1373   Result := GetVclApplication.ShowMainForm;
     1373  Result := GetNativeApplication.ShowMainForm;
    13741374end;
    13751375
     
    13861386procedure TDpiApplication.SetShowMainForm(AValue: Boolean);
    13871387begin
    1388   GetVclApplication.ShowMainForm := AValue;
     1388  GetNativeApplication.ShowMainForm := AValue;
    13891389end;
    13901390
    13911391procedure TDpiApplication.SetTitle(AValue: string);
    13921392begin
    1393   GetVclApplication.Title := AValue;
    1394 end;
    1395 
    1396 function TDpiApplication.GetVclApplication: TApplication;
     1393  GetNativeApplication.Title := AValue;
     1394end;
     1395
     1396function TDpiApplication.GetNativeApplication: TApplication;
    13971397begin
    13981398  Result := Application;
     
    14191419begin
    14201420  if (FMainForm <> nil) and GetShowMainForm then FMainForm.Show;
    1421   GetVclApplication.Run;
     1421  GetNativeApplication.Run;
    14221422end;
    14231423
    14241424procedure TDpiApplication.Initialize;
    14251425begin
    1426   GetVclApplication.Initialize;
     1426  GetNativeApplication.Initialize;
    14271427  DpiScreen.UpdateScreen;
    14281428end;
     
    14351435procedure TDpiApplication.ProcessMessages;
    14361436begin
    1437   GetVclApplication.ProcessMessages;
     1437  GetNativeApplication.ProcessMessages;
    14381438end;
    14391439
     
    14461446  then
    14471447    FMainForm := AForm;
    1448   GetVclApplication.UpdateMainForm(AForm.GetVclForm);
     1448  GetNativeApplication.UpdateMainForm(AForm.GetNativeForm);
    14491449end;
    14501450
     
    14791479    AForm := TDpiForm(Instance);
    14801480    UpdateMainForm(AForm);
    1481     if FMainForm = AForm then AForm.GetVclForm.HandleNeeded;
     1481    if FMainForm = AForm then AForm.GetNativeForm.HandleNeeded;
    14821482    if AForm.FormStyle = fsSplash then begin
    14831483      // show the splash form and handle the paint message
     
    14971497{ TDpiJpegImage }
    14981498
    1499 function TDpiJpegImage.GetVclBitmap: TCustomBitmap;
    1500 begin
    1501   Result := GetVclJpeg;
    1502 end;
    1503 
    1504 function TDpiJpegImage.GetVclJpeg: TJPEGImage;
    1505 begin
    1506   if not Assigned(VclJpeg) then VclJpeg := TJPEGImage.Create;
    1507   Result := VclJpeg;
     1499function TDpiJpegImage.GetNativeBitmap: TCustomBitmap;
     1500begin
     1501  Result := GetNativeJpeg;
     1502end;
     1503
     1504function TDpiJpegImage.GetNativeJpeg: TJPEGImage;
     1505begin
     1506  if not Assigned(NativeJpeg) then NativeJpeg := TJPEGImage.Create;
     1507  Result := NativeJpeg;
    15081508end;
    15091509
     
    15111511begin
    15121512  inherited;
    1513   VclGraphicClass := TJPEGImage;
     1513  NativeGraphicClass := TJPEGImage;
    15141514end;
    15151515
    15161516{ TDpiPortableNetworkGraphic }
    15171517
    1518 function TDpiPortableNetworkGraphic.GetVclBitmap: TCustomBitmap;
    1519 begin
    1520   Result := GetVclPng;
    1521 end;
    1522 
    1523 function TDpiPortableNetworkGraphic.GetVclPng: TPortableNetworkGraphic;
    1524 begin
    1525   if not Assigned(VclPng) then VclPng := TPortableNetworkGraphic.Create;
    1526   Result := VclPng;
     1518function TDpiPortableNetworkGraphic.GetNativeBitmap: TCustomBitmap;
     1519begin
     1520  Result := GetNativePng;
     1521end;
     1522
     1523function TDpiPortableNetworkGraphic.GetNativePng: TPortableNetworkGraphic;
     1524begin
     1525  if not Assigned(NativePng) then NativePng := TPortableNetworkGraphic.Create;
     1526  Result := NativePng;
    15271527end;
    15281528
     
    15301530begin
    15311531  inherited;
    1532   VclGraphicClass := TPortableNetworkGraphic;
     1532  NativeGraphicClass := TPortableNetworkGraphic;
    15331533end;
    15341534
     
    15371537function TDpiCustomControl.GetOnPaint: TNotifyEvent;
    15381538begin
    1539   Result := GetVclCustomControl.OnPaint;
     1539  Result := GetNativeCustomControl.OnPaint;
    15401540end;
    15411541
    15421542function TDpiCustomControl.GetPixelsPerInch: Integer;
    15431543begin
    1544 //  Result := GetVclCustomControl.P;
     1544//  Result := GetNativeCustomControl.P;
    15451545end;
    15461546
     
    15491549  if not Assigned(FCanvas) then begin
    15501550    FCanvas := TDpiCanvas.Create;
    1551     FCanvas.VclCanvas := GetVclCustomControl.Canvas;
     1551    FCanvas.NativeCanvas := GetNativeCustomControl.Canvas;
    15521552  end;
    15531553  Result := FCanvas;
     
    15561556procedure TDpiCustomControl.SetOnPaint(AValue: TNotifyEvent);
    15571557begin
    1558   GetVclCustomControl.OnPaint := AValue;
     1558  GetNativeCustomControl.OnPaint := AValue;
    15591559end;
    15601560
     
    15641564end;
    15651565
    1566 function TDpiCustomControl.GetVclWinControl: TWinControl;
    1567 begin
    1568   Result := GetVclCustomControl;
    1569 end;
    1570 
    1571 function TDpiCustomControl.GetVclCustomControl: TCustomControl;
     1566function TDpiCustomControl.GetNativeWinControl: TWinControl;
     1567begin
     1568  Result := GetNativeCustomControl;
     1569end;
     1570
     1571function TDpiCustomControl.GetNativeCustomControl: TCustomControl;
    15721572begin
    15731573  Result := nil;
     
    15781578function TDpiScrollBar.GetBorderSpacing: TControlBorderSpacing;
    15791579begin
    1580   Result := VclScrollBar.BorderSpacing;
     1580  Result := NativeScrollBar.BorderSpacing;
    15811581end;
    15821582
    15831583function TDpiScrollBar.GetKind: TScrollBarKind;
    15841584begin
    1585   Result := VclScrollBar.Kind;
     1585  Result := NativeScrollBar.Kind;
    15861586end;
    15871587
    15881588function TDpiScrollBar.GetMax: Integer;
    15891589begin
    1590   Result := VclScrollBar.Max;
     1590  Result := NativeScrollBar.Max;
    15911591end;
    15921592
    15931593function TDpiScrollBar.GetMin: Integer;
    15941594begin
    1595   Result := VclScrollBar.Min;
     1595  Result := NativeScrollBar.Min;
    15961596end;
    15971597
    15981598function TDpiScrollBar.GetOnChange: TNotifyEvent;
    15991599begin
    1600   Result := VclScrollBar.OnChange;
     1600  Result := NativeScrollBar.OnChange;
    16011601end;
    16021602
    16031603function TDpiScrollBar.GetPageSize: Integer;
    16041604begin
    1605   Result := VclScrollBar.PageSize;
     1605  Result := NativeScrollBar.PageSize;
    16061606end;
    16071607
    16081608function TDpiScrollBar.GetPosition: Integer;
    16091609begin
    1610   Result := VclScrollBar.Position;
     1610  Result := NativeScrollBar.Position;
    16111611end;
    16121612
    16131613procedure TDpiScrollBar.SetBorderSpacing(AValue: TControlBorderSpacing);
    16141614begin
    1615   VclScrollBar.BorderSpacing := AValue;
     1615  NativeScrollBar.BorderSpacing := AValue;
    16161616end;
    16171617
    16181618procedure TDpiScrollBar.SetKind(AValue: TScrollBarKind);
    16191619begin
    1620   VclScrollBar.Kind := AValue;
     1620  NativeScrollBar.Kind := AValue;
    16211621end;
    16221622
    16231623procedure TDpiScrollBar.SetMax(AValue: Integer);
    16241624begin
    1625   VclScrollBar.Max := AValue;
     1625  NativeScrollBar.Max := AValue;
    16261626end;
    16271627
    16281628procedure TDpiScrollBar.SetMin(AValue: Integer);
    16291629begin
    1630   VclScrollBar.Min := Avalue;
     1630  NativeScrollBar.Min := Avalue;
    16311631end;
    16321632
    16331633procedure TDpiScrollBar.SetOnChange(AValue: TNotifyEvent);
    16341634begin
    1635   VclScrollBar.OnChange := AValue;
     1635  NativeScrollBar.OnChange := AValue;
    16361636end;
    16371637
    16381638procedure TDpiScrollBar.SetPageSize(AValue: Integer);
    16391639begin
    1640   VclScrollBar.PageSize := AValue;
     1640  NativeScrollBar.PageSize := AValue;
    16411641end;
    16421642
    16431643procedure TDpiScrollBar.SetPosition(AValue: Integer);
    16441644begin
    1645   VclScrollBar.Position := AValue;
    1646 end;
    1647 
    1648 function TDpiScrollBar.GetVclControl: TControl;
    1649 begin
    1650   if not Assigned(VclScrollBar) then VclScrollBar := TScrollBar.Create(nil);
    1651   Result := VclScrollBar;
     1645  NativeScrollBar.Position := AValue;
     1646end;
     1647
     1648function TDpiScrollBar.GetNativeControl: TControl;
     1649begin
     1650  if not Assigned(NativeScrollBar) then NativeScrollBar := TScrollBar.Create(nil);
     1651  Result := NativeScrollBar;
    16521652end;
    16531653
    16541654destructor TDpiScrollBar.Destroy;
    16551655begin
    1656   FreeAndNil(VclScrollBar);
     1656  FreeAndNil(NativeScrollBar);
    16571657  inherited Destroy;
    16581658end;
     
    16621662function TDpiRasterImage.GetRawImage: TRawImage;
    16631663begin
    1664   Result := GetVclRasterImage.RawImage;
    1665 end;
    1666 
    1667 function TDpiRasterImage.GetVclRasterImage: TRasterImage;
    1668 begin
    1669   Result := GetVclRasterImage;
    1670 end;
    1671 
    1672 function TDpiRasterImage.GetVclGraphic: TGraphic;
    1673 begin
    1674   Result := GetVclRasterImage;
     1664  Result := GetNativeRasterImage.RawImage;
     1665end;
     1666
     1667function TDpiRasterImage.GetNativeRasterImage: TRasterImage;
     1668begin
     1669  Result := GetNativeRasterImage;
     1670end;
     1671
     1672function TDpiRasterImage.GetNativeGraphic: TGraphic;
     1673begin
     1674  Result := GetNativeRasterImage;
    16751675end;
    16761676
    16771677{ TDpiGraphic }
    16781678
    1679 function TDpiGraphic.GetVclGraphic: TGraphic;
     1679function TDpiGraphic.GetNativeGraphic: TGraphic;
    16801680begin
    16811681  Result := nil;
     
    17061706  Bitmap: TGraphic;
    17071707begin
    1708   Bitmap := VclGraphicClass.Create;
     1708  Bitmap := NativeGraphicClass.Create;
    17091709  Bitmap.LoadFromFile(FileName);
    17101710  Width := Bitmap.Width;
    17111711  Height := Bitmap.Height;
    17121712  if Self is TDpiBitmap then
    1713     TBitmap(GetVclGraphic).Canvas.StretchDraw(Bounds(0, 0,
    1714     TBitmap(GetVclGraphic).Width, TBitmap(GetVclGraphic).Height), Bitmap)
     1713    TBitmap(GetNativeGraphic).Canvas.StretchDraw(Bounds(0, 0,
     1714    TBitmap(GetNativeGraphic).Width, TBitmap(GetNativeGraphic).Height), Bitmap)
    17151715    else raise Exception.Create('Unsupported class ' + Self.ClassName);
    17161716  Bitmap.Free;
     
    17211721  Bitmap: TGraphic;
    17221722begin
    1723   Bitmap := VclGraphicClass.Create;
     1723  Bitmap := NativeGraphicClass.Create;
    17241724  Bitmap.Width := Width;
    17251725  Bitmap.Height := Height;
    17261726  if Self is TDpiBitmap then begin
    17271727    if Bitmap is TRasterImage then
    1728       (Bitmap as TRasterImage).Canvas.StretchDraw(Bounds(0, 0, Bitmap.Width, Bitmap.Height), TBitmap(GetVclGraphic))
     1728      (Bitmap as TRasterImage).Canvas.StretchDraw(Bounds(0, 0, Bitmap.Width, Bitmap.Height), TBitmap(GetNativeGraphic))
    17291729      else raise Exception.Create('Expected TRasterImage but got ' + Bitmap.ClassName);
    17301730  end else raise Exception.Create('Unsupported class ' + Self.ClassName);
     
    17441744  if not Assigned(FCanvas) then begin
    17451745    FCanvas := TDpiCanvas.Create;
    1746     FCanvas.VclCanvas := GetVclBitmap.Canvas;
     1746    FCanvas.NativeCanvas := GetNativeBitmap.Canvas;
    17471747  end;
    17481748  Result := FCanvas;
     
    17511751function TDpiBitmap.GetPixelFormat: TPixelFormat;
    17521752begin
    1753   Result := GetVclBitmap.PixelFormat;
     1753  Result := GetNativeBitmap.PixelFormat;
    17541754end;
    17551755
    17561756function TDpiBitmap.GetScanLine(Row: Integer): Pointer;
    17571757begin
    1758   Result := GetVclBitmap.ScanLine[Row];
     1758  Result := GetNativeBitmap.ScanLine[Row];
    17591759end;
    17601760
     
    17671767begin
    17681768  FHeight := AValue;
    1769   GetVclBitmap.Height := ScaleToVcl(AValue);
     1769  GetNativeBitmap.Height := ScaleToNative(AValue);
    17701770end;
    17711771
    17721772procedure TDpiBitmap.SetPixelFormat(AValue: TPixelFormat);
    17731773begin
    1774   GetVclBitmap.PixelFormat := AValue;
     1774  GetNativeBitmap.PixelFormat := AValue;
    17751775end;
    17761776
     
    17781778begin
    17791779  FWidth := AValue;
    1780   GetVclBitmap.Width := ScaleToVcl(AValue);
     1780  GetNativeBitmap.Width := ScaleToNative(AValue);
    17811781end;
    17821782
     
    17871787  NewHeight: Integer;
    17881788begin
    1789   NewWidth := ScaleToVcl(Width);
    1790   NewHeight := ScaleToVcl(Height);
    1791   if Assigned(VclBitmap) and ((NewWidth <> VclBitmap.Width) or (NewHeight <> VclBitmap.Height)) then begin
     1789  NewWidth := ScaleToNative(Width);
     1790  NewHeight := ScaleToNative(Height);
     1791  if Assigned(NativeBitmap) and ((NewWidth <> NativeBitmap.Width) or (NewHeight <> NativeBitmap.Height)) then begin
    17921792    // Rescale bitmap to new size
    17931793    Bitmap := TBitmap.Create;
    17941794    Bitmap.SetSize(NewWidth, NewHeight);
    1795     Bitmap.PixelFormat := VclBitmap.PixelFormat;
    1796     Bitmap.Canvas.StretchDraw(Bounds(0, 0, NewWidth, NewHeight), VclBitmap);
    1797     VclBitmap.Free;
    1798     VclBitmap := Bitmap;
    1799     Canvas.VclCanvas := VclBitmap.Canvas;
    1800   end;
    1801 end;
    1802 
    1803 function TDpiBitmap.GetVclBitmap: TCustomBitmap;
    1804 begin
    1805   if not Assigned(VclBitmap) then begin
    1806     VclBitmap := TBitmap.Create;
    1807     Canvas.VclCanvas := VclBitmap.Canvas;
    1808   end;
    1809   Result := VclBitmap;
     1795    Bitmap.PixelFormat := NativeBitmap.PixelFormat;
     1796    Bitmap.Canvas.StretchDraw(Bounds(0, 0, NewWidth, NewHeight), NativeBitmap);
     1797    NativeBitmap.Free;
     1798    NativeBitmap := Bitmap;
     1799    Canvas.NativeCanvas := NativeBitmap.Canvas;
     1800  end;
     1801end;
     1802
     1803function TDpiBitmap.GetNativeBitmap: TCustomBitmap;
     1804begin
     1805  if not Assigned(NativeBitmap) then begin
     1806    NativeBitmap := TBitmap.Create;
     1807    Canvas.NativeCanvas := NativeBitmap.Canvas;
     1808  end;
     1809  Result := NativeBitmap;
    18101810end;
    18111811
    18121812procedure TDpiBitmap.BeginUpdate;
    18131813begin
    1814   GetVclBitmap.BeginUpdate;
     1814  GetNativeBitmap.BeginUpdate;
    18151815end;
    18161816
    18171817procedure TDpiBitmap.EndUpdate;
    18181818begin
    1819   GetVclBitmap.EndUpdate;
     1819  GetNativeBitmap.EndUpdate;
    18201820end;
    18211821
     
    18241824  FWidth := AWidth;
    18251825  FHeight := AHeight;
    1826   GetVclBitmap.SetSize(ScaleToVcl(AWidth), ScaleToVcl(AHeight));
     1826  GetNativeBitmap.SetSize(ScaleToNative(AWidth), ScaleToNative(AHeight));
    18271827end;
    18281828
     
    18301830begin
    18311831  inherited;
    1832   VclGraphicClass := TBitmap;
     1832  NativeGraphicClass := TBitmap;
    18331833end;
    18341834
     
    18361836begin
    18371837  FreeAndNil(FCanvas);
    1838   FreeAndNil(VclBitmap);
     1838  FreeAndNil(NativeBitmap);
    18391839  inherited;
    18401840end;
     
    18431843begin
    18441844  if Source is TDpiBitmap then begin
    1845     GetVclBitmap.Assign((Source as TDpiBitmap).GetVclBitmap);
     1845    GetNativeBitmap.Assign((Source as TDpiBitmap).GetNativeBitmap);
    18461846  end else inherited;
    18471847end;
    18481848
    1849 function TDpiBitmap.GetVclRasterImage: TRasterImage;
    1850 begin
    1851   Result := GetVclBitmap;
     1849function TDpiBitmap.GetNativeRasterImage: TRasterImage;
     1850begin
     1851  Result := GetNativeBitmap;
    18521852end;
    18531853
     
    18561856function TDpiListBox.GetBorderStyle: TBorderStyle;
    18571857begin
    1858   Result := GetVclListBox.BorderStyle;
     1858  Result := GetNativeListBox.BorderStyle;
    18591859end;
    18601860
    18611861function TDpiListBox.GetCount: Integer;
    18621862begin
    1863   Result := GetVclListBox.Count;
     1863  Result := GetNativeListBox.Count;
    18641864end;
    18651865
    18661866function TDpiListBox.GetExtendedSelect: Boolean;
    18671867begin
    1868   Result := GetVclListBox.ExtendedSelect;
     1868  Result := GetNativeListBox.ExtendedSelect;
    18691869end;
    18701870
    18711871function TDpiListBox.GetIntegralHeight: Boolean;
    18721872begin
    1873   Result := GetVclListBox.IntegralHeight;
     1873  Result := GetNativeListBox.IntegralHeight;
    18741874end;
    18751875
    18761876function TDpiListBox.GetItemHeight: Integer;
    18771877begin
    1878   Result := GetVclListBox.ItemHeight;
     1878  Result := GetNativeListBox.ItemHeight;
    18791879end;
    18801880
    18811881function TDpiListBox.GetItemIndex: Integer;
    18821882begin
    1883   Result := GetVclListBox.ItemIndex;
     1883  Result := GetNativeListBox.ItemIndex;
    18841884end;
    18851885
    18861886function TDpiListBox.GetItems: TStrings;
    18871887begin
    1888   Result := GetVclListBox.Items;
     1888  Result := GetNativeListBox.Items;
    18891889end;
    18901890
    18911891function TDpiListBox.GetParentFont: Boolean;
    18921892begin
    1893   Result := GetVclListBox.ParentFont;
     1893  Result := GetNativeListBox.ParentFont;
    18941894end;
    18951895
    18961896function TDpiListBox.GetScrollWidth: Integer;
    18971897begin
    1898   Result := GetVclListBox.ScrollWidth;
     1898  Result := GetNativeListBox.ScrollWidth;
    18991899end;
    19001900
    19011901function TDpiListBox.GetTopIndex: Integer;
    19021902begin
    1903   Result := GetVclListBox.TopIndex;
     1903  Result := GetNativeListBox.TopIndex;
    19041904end;
    19051905
    19061906procedure TDpiListBox.SetBorderStyle(AValue: TBorderStyle);
    19071907begin
    1908   GetVclListBox.BorderStyle := AValue;
     1908  GetNativeListBox.BorderStyle := AValue;
    19091909end;
    19101910
    19111911procedure TDpiListBox.SetExtendedSelect(AValue: Boolean);
    19121912begin
    1913   GetVclListBox.ExtendedSelect := AValue;
     1913  GetNativeListBox.ExtendedSelect := AValue;
    19141914end;
    19151915
    19161916procedure TDpiListBox.SetIntegralHeight(AValue: Boolean);
    19171917begin
    1918   GetVclListBox.IntegralHeight := AValue;
     1918  GetNativeListBox.IntegralHeight := AValue;
    19191919end;
    19201920
    19211921procedure TDpiListBox.SetItemHeight(AValue: Integer);
    19221922begin
    1923   GetVclListBox.ItemHeight := AValue;
     1923  GetNativeListBox.ItemHeight := AValue;
    19241924end;
    19251925
    19261926procedure TDpiListBox.SetItemIndex(AValue: Integer);
    19271927begin
    1928   GetVclListBox.ItemIndex := AValue;
     1928  GetNativeListBox.ItemIndex := AValue;
    19291929end;
    19301930
    19311931procedure TDpiListBox.SetItems(AValue: TStrings);
    19321932begin
    1933   GetVclListBox.Items := AValue;
     1933  GetNativeListBox.Items := AValue;
    19341934end;
    19351935
    19361936procedure TDpiListBox.SetParentFont(AValue: Boolean);
    19371937begin
    1938   GetVclListBox.ParentFont := AValue;
     1938  GetNativeListBox.ParentFont := AValue;
    19391939end;
    19401940
    19411941procedure TDpiListBox.SetScrollWidth(AValue: Integer);
    19421942begin
    1943   GetVclListBox.ScrollWidth := AValue;
     1943  GetNativeListBox.ScrollWidth := AValue;
    19441944end;
    19451945
    19461946procedure TDpiListBox.SetTopIndex(AValue: Integer);
    19471947begin
    1948   GetVclListBox.TopIndex := AValue;
    1949 end;
    1950 
    1951 function TDpiListBox.GetVclWinControl: TWinControl;
    1952 begin
    1953   Result := GetVclListBox;
    1954 end;
    1955 
    1956 function TDpiListBox.GetVclListBox: TListBox;
    1957 begin
    1958   if not Assigned(VclListBox) then VclListBox := TListBox.Create(nil);
    1959   Result := VclListBox;
     1948  GetNativeListBox.TopIndex := AValue;
     1949end;
     1950
     1951function TDpiListBox.GetNativeWinControl: TWinControl;
     1952begin
     1953  Result := GetNativeListBox;
     1954end;
     1955
     1956function TDpiListBox.GetNativeListBox: TListBox;
     1957begin
     1958  if not Assigned(NativeListBox) then NativeListBox := TListBox.Create(nil);
     1959  Result := NativeListBox;
    19601960end;
    19611961
    19621962destructor TDpiListBox.Destroy;
    19631963begin
    1964   FreeAndNil(VclListBox);
     1964  FreeAndNil(NativeListBox);
    19651965  inherited Destroy;
    19661966end;
     
    19681968{ TDpiPaintBox }
    19691969
    1970 function TDpiPaintBox.GetVclGraphicControl: TGraphicControl;
    1971 begin
    1972   if not Assigned(VclPaintBox) then VclPaintBox := TPaintBox.Create(nil);
    1973   Result := VclPaintBox;
     1970function TDpiPaintBox.GetNativeGraphicControl: TGraphicControl;
     1971begin
     1972  if not Assigned(NativePaintBox) then NativePaintBox := TPaintBox.Create(nil);
     1973  Result := NativePaintBox;
    19741974end;
    19751975
     
    19781978  inherited;
    19791979  Canvas := TDpiCanvas.Create;
    1980   Canvas.VclCanvas := VclPaintBox.Canvas;
    1981   Canvas.Font.VclFont := VclPaintBox.Canvas.Font;
    1982   UpdateVclControl;
     1980  Canvas.NativeCanvas := NativePaintBox.Canvas;
     1981  Canvas.Font.NativeFont := NativePaintBox.Canvas.Font;
     1982  UpdateNativeControl;
    19831983  ScreenChanged;
    19841984end;
     
    19861986destructor TDpiPaintBox.Destroy;
    19871987begin
    1988   FreeAndNil(VclPaintBox);
     1988  FreeAndNil(NativePaintBox);
    19891989  inherited;
    19901990end;
     
    20062006function TDpiCanvas.GetBrush: TBrush;
    20072007begin
    2008   Result := GetVclCanvas.Brush;
     2008  Result := GetNativeCanvas.Brush;
    20092009end;
    20102010
    20112011function TDpiCanvas.GetHandle: HDC;
    20122012begin
    2013   Result := GetVclCanvas.Handle;
     2013  Result := GetNativeCanvas.Handle;
    20142014end;
    20152015
    20162016function TDpiCanvas.GetHeight: Integer;
    20172017begin
    2018   Result := ScaleFromVcl(GetVclCanvas.Height);
     2018  Result := ScaleFromNative(GetNativeCanvas.Height);
    20192019end;
    20202020
    20212021function TDpiCanvas.GetPen: TPen;
    20222022begin
    2023   Result := GetVclCanvas.Pen;
     2023  Result := GetNativeCanvas.Pen;
    20242024end;
    20252025
    20262026function TDpiCanvas.GetPixel(X, Y: Integer): TColor;
    20272027begin
    2028   Result := GetVclCanvas.Pixels[ScaleToVcl(X), ScaleToVcl(Y)];
     2028  Result := GetNativeCanvas.Pixels[ScaleToNative(X), ScaleToNative(Y)];
    20292029end;
    20302030
    20312031function TDpiCanvas.GetWidth: Integer;
    20322032begin
    2033   Result := ScaleFromVcl(GetVclCanvas.Width);
     2033  Result := ScaleFromNative(GetNativeCanvas.Width);
    20342034end;
    20352035
    20362036procedure TDpiCanvas.SetBrush(AValue: TBrush);
    20372037begin
    2038   GetVclCanvas.Brush := AValue;
     2038  GetNativeCanvas.Brush := AValue;
    20392039end;
    20402040
     
    20472047procedure TDpiCanvas.SetHandle(AValue: HDC);
    20482048begin
    2049   GetVclCanvas.Handle := AValue;
     2049  GetNativeCanvas.Handle := AValue;
    20502050end;
    20512051
    20522052procedure TDpiCanvas.SetPen(AValue: TPen);
    20532053begin
    2054   GetVclCanvas.Pen := AValue;
     2054  GetNativeCanvas.Pen := AValue;
    20552055end;
    20562056
     
    20602060  BrushColor: TColor;
    20612061begin
    2062  { BrushStyle := GetVclCanvas.Brush.Style;
    2063   BrushColor := GetVclCanvas.Brush.Color;
    2064   GetVclCanvas.Brush.Color := AValue;
    2065   GetVclCanvas.Brush.Style := bsClear;
    2066   GetVclCanvas.FillRect(ScaleToVcl(X), ScaleToVcl(Y), ScaleToVcl(X + 1) - 1, ScaleToVcl(Y + 1) - 1);
    2067   GetVclCanvas.Brush.Style := BrushStyle;
    2068   GetVclCanvas.Brush.Color := BrushColor;
     2062 { BrushStyle := GetNativeCanvas.Brush.Style;
     2063  BrushColor := GetNativeCanvas.Brush.Color;
     2064  GetNativeCanvas.Brush.Color := AValue;
     2065  GetNativeCanvas.Brush.Style := bsClear;
     2066  GetNativeCanvas.FillRect(ScaleToNative(X), ScaleToNative(Y), ScaleToNative(X + 1) - 1, ScaleToNative(Y + 1) - 1);
     2067  GetNativeCanvas.Brush.Style := BrushStyle;
     2068  GetNativeCanvas.Brush.Color := BrushColor;
    20692069  }
    2070   GetVclCanvas.Pixels[ScaleToVcl(X), ScaleToVcl(Y)] := AValue;
    2071 end;
    2072 
    2073 procedure TDpiCanvas.SetVclCanvas(AValue: TCanvas);
    2074 begin
    2075   if FVclCanvas = AValue then Exit;
    2076   FVclCanvas := AValue;
    2077   FFont.VclFont := FVclCanvas.Font;
    2078 end;
    2079 
    2080 function TDpiCanvas.GetVclCanvas: TCanvas;
    2081 begin
    2082   //if not Assigned(VclCanvas) then VclCanvas := TCanvas.Create;
    2083   Result := VclCanvas;
     2070  GetNativeCanvas.Pixels[ScaleToNative(X), ScaleToNative(Y)] := AValue;
     2071end;
     2072
     2073procedure TDpiCanvas.SetNativeCanvas(AValue: TCanvas);
     2074begin
     2075  if FNativeCanvas = AValue then Exit;
     2076  FNativeCanvas := AValue;
     2077  FFont.NativeFont := FNativeCanvas.Font;
     2078end;
     2079
     2080function TDpiCanvas.GetNativeCanvas: TCanvas;
     2081begin
     2082  //if not Assigned(NativeCanvas) then NativeCanvas := TCanvas.Create;
     2083  Result := NativeCanvas;
    20842084end;
    20852085
     
    20872087  );
    20882088begin
    2089   GetVclCanvas.StretchDraw(ScaleRectToVcl(DestRect), SrcGraphic.GetVclGraphic);
     2089  GetNativeCanvas.StretchDraw(ScaleRectToNative(DestRect), SrcGraphic.GetNativeGraphic);
    20902090end;
    20912091
    20922092procedure TDpiCanvas.FrameRect(Rect: TRect);
    20932093begin
    2094   GetVclCanvas.FrameRect(ScaleRectToVcl(Rect));
     2094  GetNativeCanvas.FrameRect(ScaleRectToNative(Rect));
    20952095end;
    20962096
    20972097procedure TDpiCanvas.Rectangle(X1, Y1, X2, Y2: Integer);
    20982098begin
    2099   GetVclCanvas.Rectangle(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2), ScaleToVcl(Y2));
     2099  GetNativeCanvas.Rectangle(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2), ScaleToNative(Y2));
    21002100end;
    21012101
     
    21072107function TDpiCanvas.TextWidth(Text: string): Integer;
    21082108begin
    2109   Result := ScaleFromVcl(GetVclCanvas.TextWidth(Text));
     2109  Result := ScaleFromNative(GetNativeCanvas.TextWidth(Text));
    21102110end;
    21112111
    21122112function TDpiCanvas.TextHeight(Text: string): Integer;
    21132113begin
    2114   Result := ScaleFromVcl(GetVclCanvas.TextHeight(Text));
     2114  Result := ScaleFromNative(GetNativeCanvas.TextHeight(Text));
    21152115end;
    21162116
    21172117function TDpiCanvas.TextExtent(Text: string): TSize;
    21182118begin
    2119   Result := ScaleSizeFromVcl(GetVclCanvas.TextExtent(Text));
     2119  Result := ScaleSizeFromNative(GetNativeCanvas.TextExtent(Text));
    21202120end;
    21212121
    21222122procedure TDpiCanvas.TextOut(X, Y: Integer; Text: string);
    21232123begin
    2124   GetVclCanvas.TextOut(ScaleToVcl(X), ScaleToVcl(Y), Text);
     2124  GetNativeCanvas.TextOut(ScaleToNative(X), ScaleToNative(Y), Text);
    21252125end;
    21262126
    21272127procedure TDpiCanvas.TextRect(ARect: TRect; X, Y: Integer; Text: string);
    21282128begin
    2129   GetVclCanvas.TextRect(ARect, ScaleToVcl(X), ScaleToVcl(Y), Text);
     2129  GetNativeCanvas.TextRect(ARect, ScaleToNative(X), ScaleToNative(Y), Text);
    21302130end;
    21312131
    21322132procedure TDpiCanvas.MoveTo(X, Y: Integer);
    21332133begin
    2134   GetVclCanvas.MoveTo(ScaleToVcl(X), ScaleToVcl(Y));
     2134  GetNativeCanvas.MoveTo(ScaleToNative(X), ScaleToNative(Y));
    21352135end;
    21362136
    21372137procedure TDpiCanvas.LineTo(X, Y: Integer);
    21382138begin
    2139   GetVclCanvas.LineTo(ScaleToVcl(X), ScaleToVcl(Y));
     2139  GetNativeCanvas.LineTo(ScaleToNative(X), ScaleToNative(Y));
    21402140end;
    21412141
    21422142procedure TDpiCanvas.FillRect(ARect: TRect);
    21432143begin
    2144   GetVclCanvas.FillRect(ScaleRectToVcl(ARect));
     2144  GetNativeCanvas.FillRect(ScaleRectToNative(ARect));
    21452145end;
    21462146
    21472147procedure TDpiCanvas.FillRect(X1, Y1, X2, Y2: Integer);
    21482148begin
    2149   GetVclCanvas.FillRect(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2), ScaleToVcl(Y2));
     2149  GetNativeCanvas.FillRect(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2), ScaleToNative(Y2));
    21502150end;
    21512151
    21522152procedure TDpiCanvas.Draw(X, Y: Integer; Source: TDpiGraphic);
    21532153begin
    2154   GetVclCanvas.Draw(ScaleToVcl(X), ScaleToVcl(Y), Source.GetVclGraphic);
     2154  GetNativeCanvas.Draw(ScaleToNative(X), ScaleToNative(Y), Source.GetNativeGraphic);
    21552155end;
    21562156
     
    21582158  Source: TRect);
    21592159begin
    2160   GetVclCanvas.CopyRect(Dest, SrcCanvas.VclCanvas, ScaleRectToVcl(Source));
     2160  GetNativeCanvas.CopyRect(Dest, SrcCanvas.NativeCanvas, ScaleRectToNative(Source));
    21612161end;
    21622162
     
    21912191end;
    21922192
    2193 function TDpiGraphicControl.GetVclControl: TControl;
    2194 begin
    2195   Result := GetVclGraphicControl;
    2196 end;
    2197 
    2198 function TDpiGraphicControl.GetVclGraphicControl: TGraphicControl;
    2199 begin
    2200   if not Assigned(VclGraphicControl) then begin
    2201     VclGraphicControl := TGraphicControl.Create(nil);
    2202   end;
    2203   Result := VclGraphicControl;
    2204 end;
    2205 
    2206 procedure TDpiGraphicControl.UpdateVclControl;
     2193function TDpiGraphicControl.GetNativeControl: TControl;
     2194begin
     2195  Result := GetNativeGraphicControl;
     2196end;
     2197
     2198function TDpiGraphicControl.GetNativeGraphicControl: TGraphicControl;
     2199begin
     2200  if not Assigned(NativeGraphicControl) then begin
     2201    NativeGraphicControl := TGraphicControl.Create(nil);
     2202  end;
     2203  Result := NativeGraphicControl;
     2204end;
     2205
     2206procedure TDpiGraphicControl.UpdateNativeControl;
    22072207begin
    22082208  inherited;
    2209   TGraphicControlEx(GetVclGraphicControl).OnPaint := @PaintHandler;
     2209  TGraphicControlEx(GetNativeGraphicControl).OnPaint := @PaintHandler;
    22102210end;
    22112211
     
    22242224  inherited;
    22252225  FCanvas := TDpiCanvas.Create;
    2226   FCanvas.VclCanvas := GetVclGraphicControl.Canvas;
     2226  FCanvas.NativeCanvas := GetNativeGraphicControl.Canvas;
    22272227end;
    22282228
     
    22402240  if FStretch = AValue then Exit;
    22412241  FStretch := AValue;
    2242   VclImage.Stretch := AValue;
     2242  NativeImage.Stretch := AValue;
    22432243end;
    22442244
     
    22492249end;
    22502250
    2251 function TDpiImage.GetVclControl: TControl;
    2252 begin
    2253   if not Assigned(VclImage) then VclImage := TImage.Create(nil);
    2254   Result := VclImage;
     2251function TDpiImage.GetNativeControl: TControl;
     2252begin
     2253  if not Assigned(NativeImage) then NativeImage := TImage.Create(nil);
     2254  Result := NativeImage;
    22552255end;
    22562256
    22572257destructor TDpiImage.Destroy;
    22582258begin
    2259   FreeAndNil(VclImage);
     2259  FreeAndNil(NativeImage);
    22602260  inherited Destroy;
    22612261end;
     
    22672267  if FSize = AValue then Exit;
    22682268  FSize := AValue;
    2269   GetVclFont.Size := AValue;
     2269  GetNativeFont.Size := AValue;
    22702270  DoChange;
    22712271end;
     
    22782278procedure TDpiFont.SetStyle(AValue: TFontStyles);
    22792279begin
    2280   GetVclFont.Style := AValue;
     2280  GetNativeFont.Style := AValue;
    22812281end;
    22822282
     
    22862286end;
    22872287
    2288 function TDpiFont.GetVclFont: TFont;
    2289 begin
    2290   if not Assigned(VclFont) then VclFont := TFont.Create;
    2291   Result := VclFont;
     2288function TDpiFont.GetNativeFont: TFont;
     2289begin
     2290  if not Assigned(NativeFont) then NativeFont := TFont.Create;
     2291  Result := NativeFont;
    22922292end;
    22932293
     
    23002300procedure TDpiFont.SetPixelsPerInch(AValue: Integer);
    23012301begin
    2302   GetVclFont.PixelsPerInch := PixelsPerInch;
     2302  GetNativeFont.PixelsPerInch := PixelsPerInch;
    23032303end;
    23042304
    23052305function TDpiFont.GetName: string;
    23062306begin
    2307   Result := GetVclFont.Name;
     2307  Result := GetNativeFont.Name;
    23082308end;
    23092309
    23102310function TDpiFont.GetColor: TColor;
    23112311begin
    2312   Result := GetVclFont.Color;
     2312  Result := GetNativeFont.Color;
    23132313end;
    23142314
    23152315function TDpiFont.GetCharSet: TFontCharSet;
    23162316begin
    2317   Result := GetVclFont.CharSet;
     2317  Result := GetNativeFont.CharSet;
    23182318end;
    23192319
    23202320function TDpiFont.GetHeight: Integer;
    23212321begin
    2322   Result := GetVclFont.Height;
     2322  Result := GetNativeFont.Height;
    23232323end;
    23242324
    23252325function TDpiFont.GetPixelsPerInch: Integer;
    23262326begin
    2327   Result := GetVclFont.PixelsPerInch;
     2327  Result := GetNativeFont.PixelsPerInch;
    23282328end;
    23292329
    23302330function TDpiFont.GetStyle: TFontStyles;
    23312331begin
    2332   Result := GetVclFont.Style;
     2332  Result := GetNativeFont.Style;
    23332333end;
    23342334
    23352335function TDpiFont.IsNameStored: Boolean;
    23362336begin
    2337   Result := GetVclFont.Name <> 'default';
     2337  Result := GetNativeFont.Name <> 'default';
    23382338end;
    23392339
    23402340procedure TDpiFont.SetCharSet(AValue: TFontCharSet);
    23412341begin
    2342   GetVclFont.CharSet := AValue;
     2342  GetNativeFont.CharSet := AValue;
    23432343end;
    23442344
    23452345procedure TDpiFont.SetColor(AValue: TColor);
    23462346begin
    2347   GetVclFont.Color := AValue;
     2347  GetNativeFont.Color := AValue;
    23482348end;
    23492349
    23502350procedure TDpiFont.SetHeight(AValue: Integer);
    23512351begin
    2352   GetVclFont.Height := AValue;
     2352  GetNativeFont.Height := AValue;
    23532353end;
    23542354
    23552355procedure TDpiFont.SetName(AValue: string);
    23562356begin
    2357   GetVclFont.Name := AValue;
     2357  GetNativeFont.Name := AValue;
    23582358end;
    23592359
     
    23712371begin
    23722372  if Source is TDpiFont then begin
    2373     GetVclFont.Assign((Source as TDpiFont).GetVclFont);
     2373    GetNativeFont.Assign((Source as TDpiFont).GetNativeFont);
    23742374    Size := (Source as TDpiFont).Size;
    23752375    FOnChange := (Source as TDpiFont).FOnChange;
     
    23812381function TDpiWinControl.GetHandle: HWND;
    23822382begin
    2383   Result := GetVclWinControl.Handle;
     2383  Result := GetNativeWinControl.Handle;
    23842384end;
    23852385
    23862386function TDpiWinControl.GetOnKeyDown: TKeyEvent;
    23872387begin
    2388   Result := GetVclWinControl.OnKeyDown;
     2388  Result := GetNativeWinControl.OnKeyDown;
    23892389end;
    23902390
    23912391function TDpiWinControl.GetOnKeyPress: TKeyPressEvent;
    23922392begin
    2393   Result := GetVclWinControl.OnKeyPress;
     2393  Result := GetNativeWinControl.OnKeyPress;
    23942394end;
    23952395
    23962396function TDpiWinControl.GetOnKeyUp: TKeyEvent;
    23972397begin
    2398   Result := GetVclWinControl.OnKeyUp;
     2398  Result := GetNativeWinControl.OnKeyUp;
    23992399end;
    24002400
    24012401function TDpiWinControl.GetTabOrder: TTabOrder;
    24022402begin
    2403   Result := GetVclWinControl.TabOrder;
     2403  Result := GetNativeWinControl.TabOrder;
    24042404end;
    24052405
    24062406function TDpiWinControl.GetTabStop: Boolean;
    24072407begin
    2408   Result := GetVclWinControl.TabStop;
     2408  Result := GetNativeWinControl.TabStop;
    24092409end;
    24102410
    24112411procedure TDpiWinControl.SetHandle(AValue: HWND);
    24122412begin
    2413   GetVclWinControl.Handle := AValue;
     2413  GetNativeWinControl.Handle := AValue;
    24142414end;
    24152415
    24162416procedure TDpiWinControl.SetOnKeyDown(AValue: TKeyEvent);
    24172417begin
    2418   GetVclWinControl.OnKeyDown := AValue;
     2418  GetNativeWinControl.OnKeyDown := AValue;
    24192419end;
    24202420
    24212421procedure TDpiWinControl.SetOnKeyPress(AValue: TKeyPressEvent);
    24222422begin
    2423   GetVclWinControl.OnKeyPress := AValue;
     2423  GetNativeWinControl.OnKeyPress := AValue;
    24242424end;
    24252425
    24262426procedure TDpiWinControl.SetOnKeyUp(AValue: TKeyEvent);
    24272427begin
    2428   GetVclWinControl.OnKeyUp := AValue;
     2428  GetNativeWinControl.OnKeyUp := AValue;
    24292429end;
    24302430
    24312431procedure TDpiWinControl.SetTabOrder(AValue: TTabOrder);
    24322432begin
    2433   GetVclWinControl.TabOrder := AValue;
     2433  GetNativeWinControl.TabOrder := AValue;
    24342434end;
    24352435
    24362436procedure TDpiWinControl.SetTabStop(AValue: Boolean);
    24372437begin
    2438   GetVclWinControl.TabStop := AValue;
    2439 end;
    2440 
    2441 function TDpiWinControl.GetVclControl: TControl;
    2442 begin
    2443   Result := GetVclWinControl;
    2444 end;
    2445 
    2446 function TDpiWinControl.GetVclWinControl: TWinControl;
     2438  GetNativeWinControl.TabStop := AValue;
     2439end;
     2440
     2441function TDpiWinControl.GetNativeControl: TControl;
     2442begin
     2443  Result := GetNativeWinControl;
     2444end;
     2445
     2446function TDpiWinControl.GetNativeWinControl: TWinControl;
    24472447begin
    24482448  Result := nil;
     
    24872487function TDpiScreen.GetWidth: Integer;
    24882488begin
    2489   Result := ScaleFromVcl(Screen.Width);
     2489  Result := ScaleFromNative(Screen.Width);
    24902490end;
    24912491
     
    25022502function TDpiScreen.GetHeight: Integer;
    25032503begin
    2504   Result := ScaleFromVcl(Screen.Height);
     2504  Result := ScaleFromNative(Screen.Height);
    25052505end;
    25062506
     
    25782578end;
    25792579
    2580 procedure TDpiScreen.UpdateActiveFormFromVclScreen;
     2580procedure TDpiScreen.UpdateActiveFormFromNativeScreen;
    25812581var
    25822582  I: Integer;
     
    25872587    for I := 0 to FormCount - 1 do begin
    25882588      F := Forms[I];
    2589       if F.GetVclForm = Screen.ActiveForm then begin
     2589      if F.GetNativeForm = Screen.ActiveForm then begin
    25902590        FActiveForm := F;
    25912591        Break;
     
    25972597{ TDpiButton }
    25982598
    2599 function TDpiButton.GetVclControl: TControl;
    2600 begin
    2601   if not Assigned(VclButton) then VclButton := TButton.Create(nil);
    2602   Result := VclButton;
     2599function TDpiButton.GetNativeControl: TControl;
     2600begin
     2601  if not Assigned(NativeButton) then NativeButton := TButton.Create(nil);
     2602  Result := NativeButton;
    26032603end;
    26042604
    26052605destructor TDpiButton.Destroy;
    26062606begin
    2607   FreeAndNil(VclButton);
     2607  FreeAndNil(NativeButton);
    26082608  inherited;
    26092609end;
     
    26202620procedure TDpiControl.SetVisible(AValue: Boolean);
    26212621begin
    2622   GetVclControl.Visible := AValue;
     2622  GetNativeControl.Visible := AValue;
    26232623end;
    26242624
     
    26302630end;
    26312631
    2632 function TDpiControl.GetVclControl: TControl;
     2632function TDpiControl.GetNativeControl: TControl;
    26332633begin
    26342634  Result := nil;
    26352635end;
    26362636
    2637 procedure TDpiControl.UpdateVclControl;
    2638 begin
    2639   Font.VclFont := GetVclControl.Font;
    2640   GetVclControl.OnResize := @VclFormResize;
    2641   GetVclControl.OnChangeBounds := @VclChangeBounds;
    2642   TControlEx(GetVclControl).OnMouseDown := @MouseDownHandler;
    2643   TControlEx(GetVclControl).OnMouseUp := @MouseUpHandler;
    2644   TControlEx(GetVclControl).OnMouseMove := @MouseMoveHandler;
    2645   TControlEx(GetVclControl).OnMouseEnter := @MouseEnterHandler;
    2646   TControlEx(GetVclControl).OnMouseLeave := @MouseLeaveHandler;
    2647   TControlEx(GetVclControl).OnMouseWheel := @MouseWheelHandler;
     2637procedure TDpiControl.UpdateNativeControl;
     2638begin
     2639  Font.NativeFont := GetNativeControl.Font;
     2640  GetNativeControl.OnResize := @NativeFormResize;
     2641  GetNativeControl.OnChangeBounds := @NativeChangeBounds;
     2642  TControlEx(GetNativeControl).OnMouseDown := @MouseDownHandler;
     2643  TControlEx(GetNativeControl).OnMouseUp := @MouseUpHandler;
     2644  TControlEx(GetNativeControl).OnMouseMove := @MouseMoveHandler;
     2645  TControlEx(GetNativeControl).OnMouseEnter := @MouseEnterHandler;
     2646  TControlEx(GetNativeControl).OnMouseLeave := @MouseLeaveHandler;
     2647  TControlEx(GetNativeControl).OnMouseWheel := @MouseWheelHandler;
    26482648end;
    26492649
     
    26512651  Shift: TShiftState; X, Y: Integer);
    26522652begin
    2653   MouseDown(Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
    2654   if Assigned(FOnMouseDown) then FOnMouseDown(Self, Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
     2653  MouseDown(Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
     2654  if Assigned(FOnMouseDown) then FOnMouseDown(Self, Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
    26552655end;
    26562656
     
    26582658  Shift: TShiftState; X, Y: Integer);
    26592659begin
    2660   MouseUp(Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
    2661   if Assigned(FOnMouseUp) then FOnMouseUp(Self, Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
     2660  MouseUp(Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
     2661  if Assigned(FOnMouseUp) then FOnMouseUp(Self, Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
    26622662end;
    26632663
     
    26652665  Y: Integer);
    26662666begin
    2667   MouseMove(Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
    2668   if Assigned(FOnMouseMove) then FOnMouseMove(Self, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
     2667  MouseMove(Shift, ScaleFromNative(X), ScaleFromNative(Y));
     2668  if Assigned(FOnMouseMove) then FOnMouseMove(Self, Shift, ScaleFromNative(X), ScaleFromNative(Y));
    26692669end;
    26702670
     
    26732673begin
    26742674  if Assigned(FOnMouseWheel) then FOnMouseWheel(Self, Shift, WheelDelta,
    2675     ScalePointFromVcl(MousePos), Handled);
     2675    ScalePointFromNative(MousePos), Handled);
    26762676end;
    26772677
     
    27122712function TDpiControl.ScreenToClient(const APoint: TPoint): TPoint;
    27132713begin
    2714   Result := ScalePointFromVcl(GetVclControl.ScreenToClient(ScalePointToVcl(APoint)));
     2714  Result := ScalePointFromNative(GetNativeControl.ScreenToClient(ScalePointToNative(APoint)));
    27152715end;
    27162716
    27172717function TDpiControl.ClientToScreen(const APoint: TPoint): TPoint;
    27182718begin
    2719   Result := ScalePointFromVcl(GetVclControl.ClientToScreen(ScalePointToVcl(APoint)));
     2719  Result := ScalePointFromNative(GetNativeControl.ClientToScreen(ScalePointToNative(APoint)));
    27202720end;
    27212721
     
    27232723  const OnVisibleChangedEvent: TNotifyEvent; AsFirst: boolean);
    27242724begin
    2725   GetVclControl.AddHandlerOnVisibleChanged(OnVisibleChangedEvent, AsFirst);
     2725  GetNativeControl.AddHandlerOnVisibleChanged(OnVisibleChangedEvent, AsFirst);
    27262726end;
    27272727
     
    27292729  const OnVisibleChangedEvent: TNotifyEvent);
    27302730begin
    2731   GetVclControl.RemoveHandlerOnVisibleChanged(OnVisibleChangedEvent);
     2731  GetNativeControl.RemoveHandlerOnVisibleChanged(OnVisibleChangedEvent);
    27322732end;
    27332733
     
    27592759procedure TDpiControl.Invalidate;
    27602760begin
    2761   GetVclControl.Invalidate;
     2761  GetNativeControl.Invalidate;
    27622762end;
    27632763
    27642764procedure TDpiControl.Repaint;
    27652765begin
    2766   GetVclControl.Repaint;
     2766  GetNativeControl.Repaint;
    27672767end;
    27682768
    27692769procedure TDpiControl.Update;
    27702770begin
    2771   GetVclControl.Update;
     2771  GetNativeControl.Update;
    27722772end;
    27732773
     
    27912791  if Assigned(TheOwner) and (TheOwner is TDpiWinControl) then
    27922792    Parent := TDpiWinControl(TheOwner);
    2793   GetVclControl;
    2794   UpdateVclControl;
     2793  GetNativeControl;
     2794  UpdateNativeControl;
    27952795  ScreenChanged;
    27962796end;
     
    28122812procedure TDpiControl.SetCaption(AValue: string);
    28132813begin
    2814   GetVclControl.Caption := AValue;
     2814  GetNativeControl.Caption := AValue;
    28152815end;
    28162816
     
    28212821    FParent.Controls.Remove(Self);
    28222822    if Assigned(FParent) and (FParent is TDpiWinControl) then
    2823       GetVclControl.Parent := nil;
     2823      GetNativeControl.Parent := nil;
    28242824  end;
    28252825  FParent := AValue;
     
    28272827    FParent.Controls.Add(Self);
    28282828    if Assigned(FParent) and (FParent is TDpiWinControl) then
    2829       GetVclControl.Parent := TDpiWinControl(FParent).GetVclWinControl;
     2829      GetNativeControl.Parent := TDpiWinControl(FParent).GetNativeWinControl;
    28302830  end;
    28312831end;
     
    28392839procedure TDpiControl.SetHint(AValue: string);
    28402840begin
    2841   GetVclControl.Hint := AValue;
     2841  GetNativeControl.Hint := AValue;
    28422842end;
    28432843
     
    28522852function TDpiControl.GetAlign: TAlign;
    28532853begin
    2854   Result := GetVclControl.Align;
     2854  Result := GetNativeControl.Align;
    28552855end;
    28562856
    28572857function TDpiControl.GetAnchors: TAnchors;
    28582858begin
    2859   Result := GetVclControl.Anchors;
     2859  Result := GetNativeControl.Anchors;
    28602860end;
    28612861
    28622862function TDpiControl.GetClientHeight: Integer;
    28632863begin
    2864   Result := ScaleFromVcl(GetVclControl.ClientHeight);
     2864  Result := ScaleFromNative(GetNativeControl.ClientHeight);
    28652865end;
    28662866
    28672867function TDpiControl.GetClientWidth: Integer;
    28682868begin
    2869   Result := ScaleFromVcl(GetVclControl.ClientWidth);
     2869  Result := ScaleFromNative(GetNativeControl.ClientWidth);
    28702870end;
    28712871
    28722872function TDpiControl.GetColor: TColor;
    28732873begin
    2874   Result := GetVclControl.Color;
     2874  Result := GetNativeControl.Color;
    28752875end;
    28762876
    28772877function TDpiControl.GetCursor: TCursor;
    28782878begin
    2879   Result := GetVclControl.Cursor;
     2879  Result := GetNativeControl.Cursor;
    28802880end;
    28812881
    28822882function TDpiControl.GetEnabled: Boolean;
    28832883begin
    2884   Result := GetVclControl.Enabled;
     2884  Result := GetNativeControl.Enabled;
    28852885end;
    28862886
    28872887function TDpiControl.GetHint: string;
    28882888begin
    2889   Result := GetVclControl.Hint;
     2889  Result := GetNativeControl.Hint;
    28902890end;
    28912891
    28922892function TDpiControl.GetOnClick: TNotifyEvent;
    28932893begin
    2894   Result := GetVclControl.OnClick;
     2894  Result := GetNativeControl.OnClick;
    28952895end;
    28962896
    28972897function TDpiControl.GetShowHint: Boolean;
    28982898begin
    2899   Result := GetVclControl.ShowHint;
     2899  Result := GetNativeControl.ShowHint;
    29002900end;
    29012901
    29022902function TDpiControl.GetVisible: Boolean;
    29032903begin
    2904   Result := GetVclControl.Visible;
     2904  Result := GetNativeControl.Visible;
    29052905end;
    29062906
     
    29122912procedure TDpiControl.SetAlign(AValue: TAlign);
    29132913begin
    2914   GetVclControl.Align := AValue;
     2914  GetNativeControl.Align := AValue;
    29152915end;
    29162916
    29172917procedure TDpiControl.SetAnchors(AValue: TAnchors);
    29182918begin
    2919   GetVclControl.Anchors := AValue;
     2919  GetNativeControl.Anchors := AValue;
    29202920end;
    29212921
     
    29272927procedure TDpiControl.SetClientHeight(AValue: Integer);
    29282928begin
    2929   GetVclControl.ClientHeight := ScaletoVcl(AValue);
     2929  GetNativeControl.ClientHeight := ScaleToNative(AValue);
    29302930end;
    29312931
    29322932procedure TDpiControl.SetClientWidth(AValue: Integer);
    29332933begin
    2934   GetVclControl.ClientWidth := ScaletoVcl(AValue);
     2934  GetNativeControl.ClientWidth := ScaleToNative(AValue);
    29352935end;
    29362936
    29372937procedure TDpiControl.SetColor(AValue: TColor);
    29382938begin
    2939   GetVclControl.Color := AValue;
     2939  GetNativeControl.Color := AValue;
    29402940end;
    29412941
    29422942procedure TDpiControl.SetCursor(AValue: TCursor);
    29432943begin
    2944   GetVclControl.Cursor := AValue;
     2944  GetNativeControl.Cursor := AValue;
    29452945end;
    29462946
    29472947procedure TDpiControl.SetEnabled(AValue: Boolean);
    29482948begin
    2949   GetVclControl.Enabled := AValue;
     2949  GetNativeControl.Enabled := AValue;
    29502950end;
    29512951
     
    29582958procedure TDpiControl.SetOnClick(AValue: TNotifyEvent);
    29592959begin
    2960   GetVclControl.OnClick := AValue;
     2960  GetNativeControl.OnClick := AValue;
    29612961end;
    29622962
     
    29692969procedure TDpiControl.SetShowHint(AValue: Boolean);
    29702970begin
    2971   GetVclControl.ShowHint := AValue;
    2972 end;
    2973 
    2974 procedure TDpiControl.VclFormResize(Sender: TObject);
    2975 begin
    2976   BoundsRect := ScaleRectFromVcl(GetVclControl.BoundsRect);
     2971  GetNativeControl.ShowHint := AValue;
     2972end;
     2973
     2974procedure TDpiControl.NativeFormResize(Sender: TObject);
     2975begin
     2976  BoundsRect := ScaleRectFromNative(GetNativeControl.BoundsRect);
    29772977  DoFormResize;
    29782978end;
    29792979
    2980 procedure TDpiControl.VclChangeBounds(Sender: TObject);
     2980procedure TDpiControl.NativeChangeBounds(Sender: TObject);
    29812981var
    29822982  NewBounds: TRect;
    29832983begin
    2984   NewBounds := ScaleRectFromVcl(GetVclControl.BoundsRect);
     2984  NewBounds := ScaleRectFromNative(GetNativeControl.BoundsRect);
    29852985  if NewBounds <> BoundsRect then begin
    29862986    BoundsRect := NewBounds;
     
    30013001function TDpiControl.GetCaption: string;
    30023002begin
    3003   Result := GetVclControl.Caption;
     3003  Result := GetNativeControl.Caption;
    30043004end;
    30053005
    30063006procedure TDpiControl.FontChanged(Sender: TObject);
    30073007begin
    3008   GetVclControl.Font.Size := ScaleToVcl(Font.Size);
     3008  GetNativeControl.Font.Size := ScaleToNative(Font.Size);
    30093009end;
    30103010
    30113011procedure TDpiControl.UpdateBounds;
    30123012begin
    3013   GetVclControl.BoundsRect := ScaleRectToVcl(BoundsRect);
     3013  GetNativeControl.BoundsRect := ScaleRectToNative(BoundsRect);
    30143014end;
    30153015
     
    30513051function TDpiForm.GetBorderIcons: TBorderIcons;
    30523052begin
    3053   Result := GetVclForm.BorderIcons;
     3053  Result := GetNativeForm.BorderIcons;
    30543054end;
    30553055
    30563056function TDpiForm.GetBorderStyle: TFormBorderStyle;
    30573057begin
    3058   Result := GetVclForm.BorderStyle;
     3058  Result := GetNativeForm.BorderStyle;
    30593059end;
    30603060
    30613061function TDpiForm.GetDesignTimePPI: Integer;
    30623062begin
    3063   Result := GetVclForm.DesignTimePPI;
     3063  Result := GetNativeForm.DesignTimePPI;
    30643064end;
    30653065
    30663066function TDpiForm.GetFormState: TFormState;
    30673067begin
    3068   Result := GetVclForm.FormState;
     3068  Result := GetNativeForm.FormState;
    30693069end;
    30703070
    30713071function TDpiForm.GetFormStyle: TFormStyle;
    30723072begin
    3073   Result := GetVclForm.FormStyle;
     3073  Result := GetNativeForm.FormStyle;
    30743074end;
    30753075
    30763076function TDpiForm.GetKeyPreview: Boolean;
    30773077begin
    3078   Result := GetVclForm.KeyPreview;
     3078  Result := GetNativeForm.KeyPreview;
    30793079end;
    30803080
    30813081function TDpiForm.GetLCLVersion: string;
    30823082begin
    3083   Result := GetVclForm.LCLVersion;
     3083  Result := GetNativeForm.LCLVersion;
    30843084end;
    30853085
    30863086function TDpiForm.GetModalResult: TModalResult;
    30873087begin
    3088   Result := GetVclForm.ModalResult;
     3088  Result := GetNativeForm.ModalResult;
    30893089end;
    30903090
    30913091function TDpiForm.GetOnCloseQuery: TCloseQueryEvent;
    30923092begin
    3093   Result := GetVclForm.OnCloseQuery;
     3093  Result := GetNativeForm.OnCloseQuery;
    30943094end;
    30953095
    30963096function TDpiForm.GetOnCreate: TNotifyEvent;
    30973097begin
    3098   Result := GetVclForm.OnCreate;
     3098  Result := GetNativeForm.OnCreate;
    30993099end;
    31003100
    31013101function TDpiForm.GetOnDeactivate: TNotifyEvent;
    31023102begin
    3103   Result := GetVclForm.OnDeactivate;
     3103  Result := GetNativeForm.OnDeactivate;
    31043104end;
    31053105
    31063106function TDpiForm.GetOnDestroy: TNotifyEvent;
    31073107begin
    3108   Result := GetVclForm.OnDestroy;
     3108  Result := GetNativeForm.OnDestroy;
    31093109end;
    31103110
    31113111function TDpiForm.GetOnHide: TNotifyEvent;
    31123112begin
    3113   Result := GetVclForm.OnHide;
     3113  Result := GetNativeForm.OnHide;
    31143114end;
    31153115
    31163116function TDpiForm.GetOnShow: TNotifyEvent;
    31173117begin
    3118   Result := GetVclForm.OnShow;
     3118  Result := GetNativeForm.OnShow;
    31193119end;
    31203120
    31213121function TDpiForm.GetPosition: TPosition;
    31223122begin
    3123   Result := GetVclForm.Position;
     3123  Result := GetNativeForm.Position;
    31243124end;
    31253125
    31263126function TDpiForm.GetWindowState: TWindowState;
    31273127begin
    3128   Result := GetVclForm.WindowState;
     3128  Result := GetNativeForm.WindowState;
    31293129end;
    31303130
    31313131procedure TDpiForm.SetBorderIcons(AValue: TBorderIcons);
    31323132begin
    3133   GetVclForm.BorderIcons := AValue;
     3133  GetNativeForm.BorderIcons := AValue;
    31343134end;
    31353135
    31363136procedure TDpiForm.SetBorderStyle(AValue: TFormBorderStyle);
    31373137begin
    3138   GetVclForm.BorderStyle := AValue;
     3138  GetNativeForm.BorderStyle := AValue;
    31393139end;
    31403140
    31413141procedure TDpiForm.SetDesignTimePPI(AValue: Integer);
    31423142begin
    3143   GetVclForm.DesignTimePPI := AValue;
     3143  GetNativeForm.DesignTimePPI := AValue;
    31443144end;
    31453145
    31463146procedure TDpiForm.SetFormStyle(AValue: TFormStyle);
    31473147begin
    3148   GetVclForm.FormStyle := AValue;
     3148  GetNativeForm.FormStyle := AValue;
    31493149end;
    31503150
    31513151procedure TDpiForm.SetKeyPreview(AValue: Boolean);
    31523152begin
    3153   GetVclForm.KeyPreview := AValue;
     3153  GetNativeForm.KeyPreview := AValue;
    31543154end;
    31553155
    31563156procedure TDpiForm.SetLCLVersion(AValue: string);
    31573157begin
    3158   GetVclForm.LCLVersion := AValue;
     3158  GetNativeForm.LCLVersion := AValue;
    31593159end;
    31603160
    31613161procedure TDpiForm.SetModalResult(AValue: TModalResult);
    31623162begin
    3163   GetVclForm.ModalResult := AValue;
     3163  GetNativeForm.ModalResult := AValue;
    31643164end;
    31653165
    31663166procedure TDpiForm.SetOnCloseQuery(AValue: TCloseQueryEvent);
    31673167begin
    3168   GetVclForm.OnCloseQuery := AValue;
     3168  GetNativeForm.OnCloseQuery := AValue;
    31693169end;
    31703170
    31713171procedure TDpiForm.SetOnCreate(AValue: TNotifyEvent);
    31723172begin
    3173   GetVclForm.OnCreate := AValue;
     3173  GetNativeForm.OnCreate := AValue;
    31743174end;
    31753175
    31763176procedure TDpiForm.SetOnDeactivate(AValue: TNotifyEvent);
    31773177begin
    3178   GetVclForm.OnDeactivate := AValue;
     3178  GetNativeForm.OnDeactivate := AValue;
    31793179end;
    31803180
    31813181procedure TDpiForm.SetOnDestroy(AValue: TNotifyEvent);
    31823182begin
    3183   GetVclForm.OnDestroy := AValue;
     3183  GetNativeForm.OnDestroy := AValue;
    31843184end;
    31853185
    31863186procedure TDpiForm.SetOnHide(AValue: TNotifyEvent);
    31873187begin
    3188   GetVclForm.OnHide := AValue;
     3188  GetNativeForm.OnHide := AValue;
    31893189end;
    31903190
    31913191procedure TDpiForm.SetOnShow(AValue: TNotifyEvent);
    31923192begin
    3193   GetVclForm.OnShow := AValue;
     3193  GetNativeForm.OnShow := AValue;
    31943194end;
    31953195
    31963196procedure TDpiForm.DoOnCreate;
    31973197begin
    3198   if Assigned(GetVclForm.OnCreate) then
    3199     GetVclForm.OnCreate(Self);
     3198  if Assigned(GetNativeForm.OnCreate) then
     3199    GetNativeForm.OnCreate(Self);
    32003200end;
    32013201
     
    32073207procedure TDpiForm.SetPosition(AValue: TPosition);
    32083208begin
    3209   GetVclForm.Position := AValue;
     3209  GetNativeForm.Position := AValue;
    32103210end;
    32113211
    32123212procedure TDpiForm.SetWindowState(AValue: TWindowState);
    32133213begin
    3214   GetVclForm.WindowState := AValue;
     3214  GetNativeForm.WindowState := AValue;
    32153215end;
    32163216
     
    32253225begin
    32263226  DpiScreen.FActiveForm := DpiScreen.FActiveFormPrev;
    3227   //DpiScreen.UpdateActiveFormFromVclScreen;
     3227  //DpiScreen.UpdateActiveFormFromNativeScreen;
    32283228  if Assigned(FOnDeactivate) then FOnDeactivate(Sender);
    32293229end;
     
    32463246procedure TDpiForm.CreateParams(var p: TCreateParams);
    32473247begin
    3248   // TODO: VclForm.CreateParams(P);
     3248  // TODO: NativeForm.CreateParams(P);
    32493249end;
    32503250
     
    32653265end;
    32663266
    3267 function TDpiForm.GetVclScrollingWinControl: TScrollingWinControl;
    3268 begin
    3269   Result := GetVclForm;
    3270 end;
    3271 
    3272 function TDpiForm.GetVclForm: TForm;
    3273 begin
    3274   if not Assigned(VclForm) then begin
    3275     VclForm := TFormEx.CreateNew(nil);
    3276     (VclForm as TFormEx).OnMessage := @FormMessageHandler;
    3277     //VclForm := TForm.Create(nil);
    3278   end;
    3279   Result := VclForm;
    3280 end;
    3281 
    3282 procedure TDpiForm.UpdateVclControl;
     3267function TDpiForm.GetNativeScrollingWinControl: TScrollingWinControl;
     3268begin
     3269  Result := GetNativeForm;
     3270end;
     3271
     3272function TDpiForm.GetNativeForm: TForm;
     3273begin
     3274  if not Assigned(NativeForm) then begin
     3275    NativeForm := TFormEx.CreateNew(nil);
     3276    (NativeForm as TFormEx).OnMessage := @FormMessageHandler;
     3277    //NativeForm := TForm.Create(nil);
     3278  end;
     3279  Result := NativeForm;
     3280end;
     3281
     3282procedure TDpiForm.UpdateNativeControl;
    32833283begin
    32843284  inherited;
    3285   GetVclForm.OnActivate := @ActivateHandler;
    3286   GetVclForm.OnDeactivate := @DeactivateHandler;
    3287   GetVclForm.OnClose := @CloseHandler;
    3288   GetVclForm.OnCloseQuery := @CloseQueryHandler;
    3289   GetVclForm.Name := Name + 'Vcl';
     3285  GetNativeForm.OnActivate := @ActivateHandler;
     3286  GetNativeForm.OnDeactivate := @DeactivateHandler;
     3287  GetNativeForm.OnClose := @CloseHandler;
     3288  GetNativeForm.OnCloseQuery := @CloseQueryHandler;
     3289  GetNativeForm.Name := Name + 'Native';
    32903290end;
    32913291
     
    32983298function TDpiForm.ShowModal: Integer;
    32993299begin
    3300   Result := GetVclForm.ShowModal;
     3300  Result := GetNativeForm.ShowModal;
    33013301end;
    33023302
     
    33583358procedure TDpiForm.BringToFront;
    33593359begin
    3360   GetVclForm.BringToFront;
     3360  GetNativeForm.BringToFront;
    33613361end;
    33623362
     
    33833383  end;
    33843384  ScreenChanged;
    3385   UpdateVclControl;
     3385  UpdateNativeControl;
    33863386end;
    33873387
     
    33953395begin
    33963396  // TODO: Can't destroy directly?
    3397   //FreeAndNil(VclForm);
     3397  //FreeAndNil(NativeForm);
    33983398  DpiScreen.RemoveForm(Self);
    33993399end;
     
    34013401initialization
    34023402
    3403 RegisterPropertyToSkip(TDpiForm, 'OldCreateOrder', 'VCL compatibility property', '');
    3404 RegisterPropertyToSkip(TDpiForm, 'TextHeight', 'VCL compatibility property', '');
    3405 RegisterPropertyToSkip(TDpiForm, 'Scaled', 'VCL compatibility property', '');
    3406 RegisterPropertyToSkip(TDpiForm, 'TransparentColorValue', 'VCL compatibility property', '');
     3403RegisterPropertyToSkip(TDpiForm, 'OldCreateOrder', 'Native compatibility property', '');
     3404RegisterPropertyToSkip(TDpiForm, 'TextHeight', 'Native compatibility property', '');
     3405RegisterPropertyToSkip(TDpiForm, 'Scaled', 'Native compatibility property', '');
     3406RegisterPropertyToSkip(TDpiForm, 'TransparentColorValue', 'Native compatibility property', '');
    34073407DpiScreen := TDpiScreen.Create;
    34083408DpiApplication := TDpiApplication.Create(nil);
  • branches/highdpi/Start.lfm

    r244 r246  
    11object StartDlg: TStartDlg
     2  Left = 246
     3  Height = 326
     4  Top = 120
     5  Width = 556
     6  BorderIcons = []
     7  BorderStyle = bsNone
     8  Caption = 'C-evo'
    29  ClientHeight = 326
    310  ClientWidth = 556
    4   Top = 120
    5   Left = 246
    6   Width = 556
    7   Height = 326
    8   Caption = 'C-evo'
    9   Enabled = True
    10   ShowHint = False
     11  Color = clBtnFace
     12  DesignTimePPI = 144
    1113  Font.Color = clWindowText
     14  Font.Height = -13
    1215  Font.Name = 'MS Sans Serif'
    13   Font.PixelsPerInch = 144
    14   Font.Height = -13
    15   Align = alNone
    16   Color = clBtnFace
     16  FormStyle = fsStayOnTop
     17  OnClose = FormClose
     18  OnCreate = FormCreate
     19  OnDestroy = FormDestroy
     20  OnHide = FormHide
     21  OnKeyDown = FormKeyDown
    1722  OnMouseDown = FormMouseDown
    1823  OnMouseMove = FormMouseMove
    1924  OnMouseUp = FormMouseUp
    20   OnKeyDown = FormKeyDown
    2125  OnPaint = FormPaint
    22   HorzScrollBar.Visible = False
    23   VertScrollBar.Visible = False
    24   DesignTimePPI = 144
    25   FormStyle = fsStayOnTop
    26   BorderStyle = bsNone
    27   BorderIcons = []
    28   LCLVersion = '2.0.8.0'
    2926  OnShow = FormShow
    30   OnHide = FormHide
    31   OnCreate = FormCreate
    32   OnDestroy = FormDestroy
    33   OnClose = FormClose
     27  LCLVersion = '2.0.2.0'
     28  PixelsPerInch = 96
     29  Scaled = False
    3430  object StartBtn: TButtonA
    3531    Tag = 15104
    36     ClientHeight = 25
    37     ClientWidth = 100
     32    Left = 389
     33    Height = 25
    3834    Top = 286
    39     Left = 389
    4035    Width = 100
    41     Height = 25
    42     Enabled = True
    43     ShowHint = False
    44     Font.Color = clDefault
    45     Font.PixelsPerInch = 144
    46     Align = alNone
    47     Color = clBtnFace
     36    Down = False
     37    Permanent = False
    4838    OnClick = StartBtnClick
    49     Visible = True
    50     Down = False
    51     Permanent = False
    5239  end
    5340  object Down1Btn: TButtonC
    5441    Tag = 4096
    55     ClientHeight = 12
    56     ClientWidth = 12
     42    Left = 522
     43    Height = 12
    5744    Top = 111
    58     Left = 522
    59     Width = 12
    60     Height = 12
    61     Enabled = True
    62     ShowHint = True
    63     Font.Color = clDefault
    64     Font.PixelsPerInch = 144
    65     Align = alNone
    66     Color = clBtnFace
     45    Width = 12
     46    Down = False
     47    Permanent = False
    6748    OnClick = Down1BtnClick
    68     Visible = True
    69     Down = False
    70     Permanent = False
    7149    ButtonIndex = 0
    7250  end
    7351  object Up1Btn: TButtonC
    7452    Tag = 4096
    75     ClientHeight = 12
    76     ClientWidth = 12
     53    Left = 522
     54    Height = 12
    7755    Top = 99
    78     Left = 522
    79     Width = 12
    80     Height = 12
    81     Enabled = True
    82     ShowHint = True
    83     Font.Color = clDefault
    84     Font.PixelsPerInch = 144
    85     Align = alNone
    86     Color = clBtnFace
     56    Width = 12
     57    Down = False
     58    Permanent = False
    8759    OnClick = Up1BtnClick
    88     Visible = True
    89     Down = False
    90     Permanent = False
    9160    ButtonIndex = 1
    9261  end
    9362  object RenameBtn: TButtonB
    9463    Tag = 10240
    95     ClientHeight = 25
    96     ClientWidth = 25
     64    Left = 412
     65    Height = 25
    9766    Top = 98
    98     Left = 412
    99     Width = 25
    100     Height = 25
    101     Enabled = True
    102     ShowHint = True
    103     Font.Color = clDefault
    104     Font.PixelsPerInch = 144
    105     Align = alNone
    106     Color = clBtnFace
     67    Width = 25
     68    Visible = False
     69    Down = False
     70    Permanent = False
    10771    OnClick = RenameBtnClick
    108     Visible = False
    109     Down = False
    110     Permanent = False
    11172    ButtonIndex = 31
    11273  end
    11374  object DeleteBtn: TButtonB
    11475    Tag = 10240
    115     ClientHeight = 25
    116     ClientWidth = 25
     76    Left = 441
     77    Height = 25
    11778    Top = 98
    118     Left = 441
    119     Width = 25
    120     Height = 25
    121     Enabled = True
    122     ShowHint = True
    123     Font.Color = clDefault
    124     Font.PixelsPerInch = 144
    125     Align = alNone
    126     Color = clBtnFace
     79    Width = 25
     80    Visible = False
     81    Down = False
     82    Permanent = False
    12783    OnClick = DeleteBtnClick
    128     Visible = False
    129     Down = False
    130     Permanent = False
    13184    ButtonIndex = 21
    13285  end
    13386  object Down2Btn: TButtonC
    13487    Tag = 6912
    135     ClientHeight = 12
    136     ClientWidth = 12
     88    Left = 522
     89    Height = 12
    13790    Top = 249
    138     Left = 522
    139     Width = 12
    140     Height = 12
    141     Enabled = True
    142     ShowHint = True
    143     Font.Color = clDefault
    144     Font.PixelsPerInch = 144
    145     Align = alNone
    146     Color = clBtnFace
     91    Width = 12
     92    Visible = False
     93    Down = False
     94    Permanent = False
    14795    OnClick = Down2BtnClick
    148     Visible = False
    149     Down = False
    150     Permanent = False
    15196    ButtonIndex = 0
    15297  end
    15398  object Up2Btn: TButtonC
    15499    Tag = 6912
    155     ClientHeight = 12
    156     ClientWidth = 12
     100    Left = 522
     101    Height = 12
    157102    Top = 237
    158     Left = 522
    159     Width = 12
    160     Height = 12
    161     Enabled = True
    162     ShowHint = True
    163     Font.Color = clDefault
    164     Font.PixelsPerInch = 144
    165     Align = alNone
    166     Color = clBtnFace
     103    Width = 12
     104    Visible = False
     105    Down = False
     106    Permanent = False
    167107    OnClick = Up2BtnClick
    168     Visible = False
    169     Down = False
    170     Permanent = False
    171108    ButtonIndex = 1
    172109  end
    173110  object QuitBtn: TButtonB
    174111    Tag = 268435200
    175     ClientHeight = 25
    176     ClientWidth = 25
     112    Left = 530
     113    Height = 25
    177114    Top = 7
    178     Left = 530
    179     Width = 25
    180     Height = 25
    181     Enabled = True
    182     ShowHint = True
    183     Font.Color = clDefault
    184     Font.PixelsPerInch = 144
    185     Align = alNone
    186     Color = clBtnFace
     115    Width = 25
     116    Down = False
     117    Permanent = False
    187118    OnClick = QuitBtnClick
    188     Visible = True
    189     Down = False
    190     Permanent = False
    191119    ButtonIndex = 0
    192120  end
    193121  object CustomizeBtn: TButtonC
    194122    Tag = 768
    195     ClientHeight = 12
    196     ClientWidth = 12
     123    Left = 120
     124    Height = 12
    197125    Top = 302
    198     Left = 120
    199     Width = 12
    200     Height = 12
    201     Enabled = True
    202     ShowHint = True
    203     Font.Color = clDefault
    204     Font.PixelsPerInch = 144
    205     Align = alNone
    206     Color = clBtnFace
     126    Width = 12
     127    Down = False
     128    Permanent = False
    207129    OnClick = CustomizeBtnClick
    208     Visible = True
    209     Down = False
    210     Permanent = False
    211130    ButtonIndex = 0
    212131  end
    213132  object AutoDiffUpBtn: TButtonC
    214     ClientHeight = 12
    215     ClientWidth = 12
     133    Left = 280
     134    Height = 12
    216135    Top = 237
     136    Width = 12
     137    Down = False
     138    Permanent = False
     139    OnClick = AutoDiffUpBtnClick
     140    ButtonIndex = 1
     141  end
     142  object AutoDiffDownBtn: TButtonC
    217143    Left = 280
    218     Width = 12
    219     Height = 12
    220     Enabled = True
    221     ShowHint = True
    222     Font.Color = clDefault
    223     Font.PixelsPerInch = 144
    224     Align = alNone
    225     Color = clBtnFace
    226     OnClick = AutoDiffUpBtnClick
    227     Visible = True
    228     Down = False
    229     Permanent = False
    230     ButtonIndex = 1
    231   end
    232   object AutoDiffDownBtn: TButtonC
    233     ClientHeight = 12
    234     ClientWidth = 12
     144    Height = 12
    235145    Top = 249
    236     Left = 280
    237     Width = 12
    238     Height = 12
    239     Enabled = True
    240     ShowHint = True
    241     Font.Color = clDefault
    242     Font.PixelsPerInch = 144
    243     Align = alNone
    244     Color = clBtnFace
     146    Width = 12
     147    Down = False
     148    Permanent = False
    245149    OnClick = AutoDiffDownBtnClick
    246     Visible = True
    247     Down = False
    248     Permanent = False
    249150    ButtonIndex = 0
    250151  end
    251152  object AutoEnemyUpBtn: TButtonC
    252     ClientHeight = 12
    253     ClientWidth = 12
     153    Left = 206
     154    Height = 12
    254155    Top = 152
     156    Width = 12
     157    Down = False
     158    Permanent = False
     159    OnClick = AutoEnemyUpBtnClick
     160    ButtonIndex = 1
     161  end
     162  object AutoEnemyDownBtn: TButtonC
    255163    Left = 206
    256     Width = 12
    257     Height = 12
    258     Enabled = True
    259     ShowHint = True
    260     Font.Color = clDefault
    261     Font.PixelsPerInch = 144
    262     Align = alNone
    263     Color = clBtnFace
    264     OnClick = AutoEnemyUpBtnClick
    265     Visible = True
    266     Down = False
    267     Permanent = False
    268     ButtonIndex = 1
    269   end
    270   object AutoEnemyDownBtn: TButtonC
    271     ClientHeight = 12
    272     ClientWidth = 12
     164    Height = 12
    273165    Top = 164
    274     Left = 206
    275     Width = 12
    276     Height = 12
    277     Enabled = True
    278     ShowHint = True
    279     Font.Color = clDefault
    280     Font.PixelsPerInch = 144
    281     Align = alNone
    282     Color = clBtnFace
     166    Width = 12
     167    Down = False
     168    Permanent = False
    283169    OnClick = AutoEnemyDownBtnClick
    284     Visible = True
    285     Down = False
    286     Permanent = False
    287170    ButtonIndex = 0
    288171  end
    289172  object ReplayBtn: TButtonB
    290173    Tag = 2048
    291     ClientHeight = 25
    292     ClientWidth = 25
     174    Left = 352
     175    Height = 25
    293176    Top = 286
    294     Left = 352
    295     Width = 25
    296     Height = 25
    297     Enabled = True
    298     ShowHint = True
    299     Font.Color = clDefault
    300     Font.PixelsPerInch = 144
    301     Align = alNone
    302     Color = clBtnFace
     177    Width = 25
     178    Down = False
     179    Permanent = False
    303180    OnClick = ReplayBtnClick
    304     Visible = True
    305     Down = False
    306     Permanent = False
    307181    ButtonIndex = 19
    308182  end
    309183  object List: TDpiListBox
    310184    Tag = 15360
    311     ClientHeight = 238
    312     ClientWidth = 266
     185    Left = 45
     186    Height = 238
    313187    Top = 64
    314     Left = 45
    315188    Width = 266
    316     Height = 238
    317     Enabled = True
    318     ShowHint = False
     189    BorderStyle = bsNone
     190    Color = clBlack
     191    ExtendedSelect = False
    319192    Font.Color = 4176863
     193    Font.Height = -15
    320194    Font.Name = 'Times New Roman'
    321195    Font.Style = [fsBold]
    322     Font.PixelsPerInch = 144
    323     Font.Height = -15
    324     Align = alNone
    325     Color = clBlack
     196    IntegralHeight = True
     197    ItemHeight = 0
    326198    OnClick = ListClick
     199    ParentFont = False
     200    ScrollWidth = 266
    327201    TabOrder = 0
    328     TabStop = True
     202    TabStop = False
    329203    TopIndex = -1
    330     ScrollWidth = 266
    331     ParentFont = False
    332     ItemHeight = 0
    333     IntegralHeight = True
    334     ExtendedSelect = False
    335     BorderStyle = bsSingle
    336204    Visible = False
    337205  end
  • branches/highdpi/Start.pas

    r244 r246  
    4848    Bitmap: TDpiBitmap; { game world sample preview }
    4949    Size: TPoint;
    50     Colors: array [0..fTerrain, 0..1] of TColor;
     50    Colors: array [0 .. 11, 0 .. 1] of TColor;
    5151    Mode: TMiniMode;
    5252    procedure LoadFromLogFile(FileName: string; var LastTurn: Integer);
     
    355355  Bitmap.BeginUpdate;
    356356  MiniPixel := PixelPointer(Bitmap);
    357   for y := 0 to ScaleToVcl(Size.Y) - 1 do begin
    358     for x := 0 to ScaleToVcl(Size.X) - 1 do begin
     357  for y := 0 to ScaleToNative(Size.Y) - 1 do begin
     358    for x := 0 to ScaleToNative(Size.X) - 1 do begin
    359359      for i := 0 to 1 do begin
    360         xm := (x * 2 + i + y and 1) mod (ScaleToVcl(Size.X) * 2);
     360        xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);
    361361        MiniPixel.SetX(xm);
    362362        cm := Colors
    363           [Map[ScaleFromVcl(x) * lxmax div Size.X + lxmax *
    364           ((ScaleFromVcl(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and
     363          [Map[ScaleFromNative(x) * lxmax div Size.X + lxmax *
     364          ((ScaleFromNative(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and
    365365          fTerrain, i];
    366366        MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3;
     
    388388    MiniPixel := PixelPointer(Bitmap);
    389389    PrevMiniPixel := PixelPointer(Bitmap, 0, -1);
    390     for y := 0 to ScaleToVcl(Size.Y) - 1 do begin
    391       for x := 0 to ScaleToVcl(Size.X) - 1 do begin
     390    for y := 0 to ScaleToNative(Size.Y) - 1 do begin
     391      for x := 0 to ScaleToNative(Size.X) - 1 do begin
    392392        for i := 0 to 1 do begin
    393           xm := (x * 2 + i + y and 1) mod (ScaleToVcl(Size.X) * 2);
     393          xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);
    394394          MiniPixel.SetX(xm);
    395           Tile := SaveMap[ScaleFromVcl(x) + Size.X * ScaleFromVcl(y)];
     395          Tile := SaveMap[ScaleFromNative(x) + Size.X * ScaleFromNative(y)];
    396396          if Tile and fTerrain = fUNKNOWN then
    397397            cm := $000000
     
    694694    Location := Point((DpiScreen.Width - 800) * 3 div 8,
    695695      DpiScreen.Height - Height - (DpiScreen.Height - 600) div 3);
    696     Left := Location.X;
    697     Top := Location.Y;
     696    BoundsRect := Bounds(Location.X, Location.Y, Width, Height);
    698697
    699698    r0 := DpiCreateRectRgn(0, 0, Width, Height);
     
    708707    DeleteObject(r0); // causes crash with Windows 95
    709708  end else begin
    710     Left := (DpiScreen.Width - Width) div 2;
    711     Top := (DpiScreen.Height - Height) div 2;
     709    BoundsRect := Bounds((DpiScreen.Width - Width) div 2,
     710      (DpiScreen.Height - Height) div 2, Width, Height)
    712711  end;
    713712end;
     
    16091608  if Tab <> tbNew then
    16101609    if List.Count > 0 then begin
    1611       if (List.Count > ListIndex[Tab]) then
     1610      if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then
    16121611        List.ItemIndex := ListIndex[Tab]
    16131612        else List.ItemIndex := 0;
Note: See TracChangeset for help on using the changeset viewer.