Ignore:
Timestamp:
May 23, 2020, 12:45:14 AM (5 years ago)
Author:
chronos
Message:
  • Fixed: Scrolling under HighDPI. ScrollDC needs to be scaled as well.
Location:
branches/highdpi/LocalPlayer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Help.pas

    r247 r252  
    110110    procedure WaterSign(x0, y0, iix: Integer);
    111111    procedure Search(SearchString: string);
    112     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     112    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    113113    procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
    114114  public
     
    342342end;
    343343
    344 procedure THelpDlg.OnScroll(var m: TMessage);
     344procedure THelpDlg.OnScroll(var Msg: TMessage);
    345345begin
    346346  { TODO: Handled by MouseWheel event
    347   if ScrollBar.Process(m) then begin
     347  if ScrollBar.Process(Msg) then begin
    348348    Sel := -1;
    349349    SmartUpdateContent(true)
     
    357357    Line(Canvas, Sel, false);
    358358    Sel := -1
    359   end
     359  end;
    360360end;
    361361
  • branches/highdpi/LocalPlayer/Select.pas

    r246 r252  
    5959    function RenameCity(cix: integer): boolean;
    6060    function RenameModel(mix: integer): boolean;
    61     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     61    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    6262    procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
    6363  public
     
    133133end;
    134134
    135 procedure TListDlg.OnScroll(var m: TMessage);
     135procedure TListDlg.OnScroll(var Msg: TMessage);
    136136begin
    137137  { TODO: Handled by MouseWheel event
    138   if sb.Process(m) then  begin
     138  if sb.Process(Msg) then  begin
    139139    Sel := -2;
    140140    SmartUpdateContent(true);
  • branches/highdpi/LocalPlayer/Term.pas

    r251 r252  
    280280    procedure LoadSettings;
    281281    procedure SaveSettings;
    282     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     282    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    283283    procedure OnEOT(var Msg: TMessage); message WM_EOT;
    284284    procedure SoundPreload(Check: integer);
     
    36203620end;
    36213621
    3622 procedure TMainScreen.OnScroll(var m: TMessage);
    3623 begin
    3624   if sb.Process(m) then begin
     3622procedure TMainScreen.OnScroll(var Msg: TMessage);
     3623begin
     3624  if sb.Process(Msg) then begin
    36253625    PanelPaint;
    36263626    Update;
     
    36303630procedure TMainScreen.OnEOT(var Msg: TMessage);
    36313631begin
    3632   EndTurn
     3632  EndTurn;
    36333633end;
    36343634
     
    36383638  begin
    36393639    MessgExDlg.CancelMovie;
    3640     Server(sBreak, me, 0, nil^)
     3640    Server(sBreak, me, 0, nil^);
    36413641  end
    36423642  else if ClientMode < 0 then
     
    36473647  begin
    36483648    Jump[pTurn] := 0;
    3649     StartRunning := false
     3649    StartRunning := false;
    36503650  end
    36513651  else
    3652     EndTurn
     3652    EndTurn;
    36533653end;
    36543654
     
    41444144end;
    41454145
    4146 {$IFDEF LINUX}
    4147 // Can't do scrolling of DC under Linux, then fallback into BitBlt.
    4148 function ScrollDC(Canvas: TDpiCanvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean;
    4149 begin
    4150   Result := DpiBitCanvas(Canvas, lprcScroll.Left + dx, lprcScroll.Top + dy, lprcScroll.Right - lprcScroll.Left, lprcScroll.Bottom - lprcScroll.Top,
    4151     Canvas, lprcScroll.Left, lprcScroll.Top);
    4152 end;
    4153 {$ENDIF}
    4154 
    41554146procedure TMainScreen.MainOffscreenPaint;
    41564147var
     
    41994190    offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    42004191    rec := Rect(0, 0, MapWidth, MapHeight);
    4201 {$IFDEF WINDOWS}
    4202     ScrollDC(offscreen.Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
     4192    DpiScrollDC(offscreen.Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    42034193      rec, rec, 0, nil);
    4204 {$ENDIF}
    4205 {$IFDEF LINUX}
    4206     ScrollDC(offscreen.Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    4207       rec, rec, 0, nil);
    4208 {$ENDIF}
    42094194    for DoInvalidate := false to FastScrolling do
    42104195    begin
     
    42124197      begin
    42134198        rec.Bottom := MapHeight - overlap;
    4214 {$IFDEF WINDOWS}
    4215         ScrollDC(Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt, rec,
     4199        DpiScrollDC(Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt, rec,
    42164200          rec, 0, nil);
    4217 {$ENDIF}
    4218 {$IFDEF LINUX}
    4219         ScrollDC(Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    4220           rec, rec, 0, nil);
    4221 {$ENDIF}
    42224201        ProcessOptions := prInvalidate;
    42234202      end
     
    50745053          if DpiMouse.CursorPos.x = 0 then
    50755054            dx := -speed // scroll left
    5076           else if DpiMouse.CursorPos.x = DpiScreen.width - 1 then
     5055          else if DpiMouse.CursorPos.x >= DpiScreen.width - 1 then
    50775056            dx := speed; // scroll right
    50785057        if DpiMouse.CursorPos.y = 0 then
    50795058          dy := -speed // scroll up
    5080         else if (DpiMouse.CursorPos.y = DpiScreen.height - 1) and
     5059        else if (DpiMouse.CursorPos.y >= DpiScreen.height - 1) and
    50815060          (DpiMouse.CursorPos.x >= TerrainBtn.Left + TerrainBtn.width) and
    50825061          (DpiMouse.CursorPos.x < xRightPanel + 10 - 8) then
Note: See TracChangeset for help on using the changeset viewer.