Changeset 622 for trunk/LocalPlayer


Ignore:
Timestamp:
Sep 15, 2024, 10:04:45 PM (2 months ago)
Author:
chronos
Message:
  • Modified: Show windows by default on primary screen if multiple monitors present.
Location:
trunk/LocalPlayer
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Battle.pas

    r565 r622  
    207207    OKBtn.Visible := True;
    208208    CancelBtn.Visible := True;
    209     Left := (Screen.Width - ClientWidth) div 2; // center on screen
    210     Top := (Screen.Height - ClientHeight) div 2;
     209    CenterToScreen;
    211210  end
    212211  else
  • trunk/LocalPlayer/CityScreen.pas

    r617 r622  
    11001100      end;
    11011101
    1102   if WindowMode = wmModal then
    1103   begin { center on screen }
    1104     Left := (Screen.Width - Width) div 2;
    1105     Top := (Screen.Height - Height) div 2;
    1106   end;
     1102  if WindowMode = wmModal then CenterToScreen;
    11071103
    11081104  Caption := CityName(C.ID);
  • trunk/LocalPlayer/Diagram.pas

    r550 r622  
    291291procedure TDiaDlg.FormShow(Sender: TObject);
    292292begin
    293   if WindowMode = wmModal then
    294   begin { center on screen }
    295     Left := (Screen.Width - Width) div 2;
    296     Top := (Screen.Height - Height) div 2;
    297   end;
     293  if WindowMode = wmModal then CenterToScreen;
    298294  OffscreenPaint;
    299295end;
  • trunk/LocalPlayer/Draft.pas

    r558 r622  
    485485  yView := yView0 - Cut;
    486486
    487   if WindowMode = wmModal then
    488   begin { center on screen }
    489     Left := (Screen.Width - Template.Width) div 2;
    490     Top := (Screen.Height - (Template.Height - Cut)) div 2;
    491   end;
     487  if WindowMode = wmModal then CenterToScreen(Template.Width, Template.Height - Cut);
    492488
    493489  SetDomain(Domain);
  • trunk/LocalPlayer/Enhance.pas

    r558 r622  
    131131  TypeChanged: Boolean;
    132132begin
    133   OffscreenUser := Self;
     133  inherited;
    134134  Offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    135135  FillOffscreen(0, 0, InnerWidth, InnerHeight);
  • trunk/LocalPlayer/MessgEx.pas

    r570 r622  
    169169    0:
    170170      begin
    171         Left := (Screen.Width - Width) div 2;
    172         Top := (Screen.Height - Height) div 2 - MapCenterUp;
     171        Left := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 2;
     172        Top := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) div 2 - MapCenterUp;
    173173      end;
    174174    1:
    175175      begin
    176         Left := (Screen.Width - Width) div 4;
    177         Top := (Screen.Height - Height) * 2 div 3 - MapCenterUp;
     176        Left := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 4;
     177        Top := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) * 2 div 3 - MapCenterUp;
    178178      end;
    179179    -1:
    180180      begin
    181         Left := (Screen.Width - Width) div 4;
    182         Top := (Screen.Height - Height) div 3 - MapCenterUp;
     181        Left := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 4;
     182        Top := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) div 3 - MapCenterUp;
    183183      end;
    184184  end;
  • trunk/LocalPlayer/Nego.pas

    r592 r622  
    485485  OkEnabled: Boolean;
    486486begin
    487   if (OffscreenUser <> nil) and (OffscreenUser <> Self) then
    488     OffscreenUser.Update;
    489   // complete working with old owner to prevent rebound
    490   OffscreenUser := Self;
     487  inherited;
    491488
    492489  if (DipCommand >= 0) and (Page = History[Me].N) then
     
    917914      { opLowTreaty:
    918915        begin
    919         if MyRO.Treaty[DipMem[Me].pContact]=trNone then Price:=opTreaty+trCeaseFire
    920         else Price:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]-1;
     916        if MyRO.Treaty[DipMem[Me].pContact] = trNone then Price := opTreaty + trCeaseFire
     917        else Price := opTreaty + MyRO.Treaty[DipMem[Me].pContact]-  1;
    921918        end }
    922919    end;
  • trunk/LocalPlayer/Rates.pas

    r565 r622  
    4040procedure TRatesDlg.FormCreate(Sender: TObject);
    4141begin
    42   TitleHeight := Screen.Height;
     42  TitleHeight := Screen.PrimaryMonitor.Height;
    4343  InitButtons;
    4444end;
  • trunk/LocalPlayer/Select.pas

    r613 r622  
    15451545var
    15461546  I: Integer;
     1547  NewTop, NewLeft: Integer;
    15471548begin
    15481549  Result := -1;
     
    16431644  begin { center on screen }
    16441645    if Kind = kTribe then
    1645       Left := (Screen.Width - 800) * 3 div 8 + 130
     1646      NewLeft := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - 800) * 3 div 8 + 130
    16461647    else
    1647       Left := (Screen.Width - Width) div 2;
    1648     Top := (Screen.Height - Height) div 2;
     1648      NewLeft := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 2;
     1649    NewTop := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) div 2;
    16491650    if Kind = kProject then
    1650       Top := Top + 48;
     1651      NewTop := NewTop + 48;
     1652    BoundsRect := Bounds(NewLeft, NewTop, Width, Height);
    16511653  end;
    16521654
  • trunk/LocalPlayer/TechTree.pas

    r577 r622  
    214214
    215215  // Fit window to image, center image in window, center window to screen
    216   NewWidth := Min(Screen.Width - 40, Image.Width + LeftBorder + RightBorder +
     216  NewWidth := Min(Screen.PrimaryMonitor.Width - 40, Image.Width + LeftBorder + RightBorder +
    217217    2 * BlackBorder);
    218   NewHeight := Min(Screen.Height - 40, Image.Height + TopBorder + BottomBorder +
     218  NewHeight := Min(Screen.PrimaryMonitor.Height - 40, Image.Height + TopBorder + BottomBorder +
    219219    2 * BlackBorder);
    220   BoundsRect := Bounds((Screen.Width - NewWidth) div 2,
    221     (Screen.Height - NewHeight) div 2, NewWidth, NewHeight);
     220  BoundsRect := Bounds(Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - NewWidth) div 2,
     221    Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - NewHeight) div 2, NewWidth, NewHeight);
    222222  CloseBtn.Left := Width - CloseBtn.Width - BlackBorder - 8;
    223223  CloseBtn.Top := BlackBorder + 8;
  • trunk/LocalPlayer/Term.pas

    r621 r622  
    1212{$ENDIF}
    1313  Protocol, Tribes, PVSB, ClientTools, ScreenTools, BaseWin, Messg, ButtonBase,
    14   LCLIntf, LCLType, Menus, SysUtils, Classes, DrawDlg, Types, Math,
     14  LCLIntf, LCLType, SysUtils, Classes, DrawDlg, Types, Math,
    1515  DateUtils, Platform, ButtonB, ButtonC, EOTButton, Area, Help,
    1616  GraphicSet, MiniMap, IsoEngine, Wonders, TechTree, Enhance, Nego, CityType,
     
    26432643          MainTexture.Age := -1;
    26442644        Tribes.Init;
    2645         HelpDlg.UserLeft := (Screen.Width - HelpDlg.Width) div 2;
    2646         HelpDlg.UserTop := (Screen.Height - HelpDlg.Height) div 2;
     2645        HelpDlg.UserLeft := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - HelpDlg.Width) div 2;
     2646        HelpDlg.UserTop := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - HelpDlg.Height) div 2;
    26472647        HelpDlg.Difficulty := 0;
    26482648        if Command = cStartCredits then
     
    59635963      if BattleDlg.Left < 0 then
    59645964        BattleDlg.Left := 0
    5965       else if BattleDlg.Left + BattleDlg.Width > Screen.Width then
    5966         BattleDlg.Left := Screen.Width - BattleDlg.Width;
     5965      else if BattleDlg.Left + BattleDlg.Width > Screen.DesktopWidth then
     5966        BattleDlg.Left := Screen.DesktopWidth - BattleDlg.Width;
    59675967      BattleDlg.Top := Y - BattleDlg.Height div 2;
    59685968      if BattleDlg.Top < 0 then
    59695969        BattleDlg.Top := 0
    5970       else if BattleDlg.Top + BattleDlg.Height > Screen.Height then
    5971         BattleDlg.Top := Screen.Height - BattleDlg.Height;
     5970      else if BattleDlg.Top + BattleDlg.Height > Screen.DesktopHeight then
     5971        BattleDlg.Top := Screen.DesktopHeight - BattleDlg.Height;
    59725972      BattleDlg.IsSuicideQuery := False;
    59735973      BattleDlg.Show;
     
    80658065procedure TMainScreen.FormShow(Sender: TObject);
    80668066begin
    8067   if FullScreen then BoundsRect := Bounds(0, 0, Screen.Width, Screen.Height)
     8067  if FullScreen then BoundsRect := Screen.PrimaryMonitor.BoundsRect
    80688068    else BoundsRect := TermBounds;
    80698069  FormRestoredSize := TermBounds;
     
    83878387
    83888388  if Form is TListDlg then begin;
    8389     ListDlg.UserLeft := 8;
    8390     ListDlg.UserTop := TopBarHeight + 8;
     8389    ListDlg.UserLeft := Screen.PrimaryMonitor.Left + 8;
     8390    ListDlg.UserTop := Screen.PrimaryMonitor.Top + TopBarHeight + 8;
    83918391  end;
    83928392  if Form is THelpDlg then begin
    8393    HelpDlg.UserLeft := Screen.Width - HelpDlg.Width - 8;
    8394     HelpDlg.UserTop := TopBarHeight + 8;
     8393    HelpDlg.UserLeft := Screen.PrimaryMonitor.Left + Screen.PrimaryMonitor.Width - HelpDlg.Width - 8;
     8394    HelpDlg.UserTop := Screen.PrimaryMonitor.Top + TopBarHeight + 8;
    83958395  end;
    83968396  if Form is TUnitStatDlg then begin
    8397     UnitStatDlg.UserLeft := 397;
    8398     UnitStatDlg.UserTop := TopBarHeight + 64;
     8397    UnitStatDlg.UserLeft := Screen.PrimaryMonitor.Left + 397;
     8398    UnitStatDlg.UserTop := Screen.PrimaryMonitor.Top + TopBarHeight + 64;
    83998399  end;
    84008400  if Form is TDiaDlg then begin
    8401     DiaDlg.UserLeft := (Screen.Width - DiaDlg.Width) div 2;
    8402     DiaDlg.UserTop := (Screen.Height - DiaDlg.Height) div 2;
     8401    DiaDlg.UserLeft := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - DiaDlg.Width) div 2;
     8402    DiaDlg.UserTop := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - DiaDlg.Height) div 2;
    84038403  end;
    84048404  if Form is TNatStatDlg then begin
    8405     NatStatDlg.UserLeft := Screen.Width - NatStatDlg.Width - 8;
    8406     NatStatDlg.UserTop := Screen.Height - PanelHeight - NatStatDlg.Height - 8;
     8405    NatStatDlg.UserLeft := Screen.PrimaryMonitor.Left + Screen.PrimaryMonitor.Width - NatStatDlg.Width - 8;
     8406    NatStatDlg.UserTop := Screen.PrimaryMonitor.Top + Screen.PrimaryMonitor.Height - PanelHeight - NatStatDlg.Height - 8;
    84078407    if NatStatDlg.UserTop < 8 then
    84088408      NatStatDlg.UserTop := 8;
  • trunk/LocalPlayer/UnitStat.pas

    r536 r622  
    7777  NoMap := TIsoMap.Create;
    7878  AgePrepared := -2;
    79   TitleHeight := Screen.Height;
     79  TitleHeight := Screen.PrimaryMonitor.Height;
    8080  InitButtons;
    8181
     
    164164  if Kind in [dkOwnModel, dkEnemyModel] then
    165165  begin
    166     Left := UserLeft;
    167     Top := UserTop;
     166    BoundsRect := Bounds(UserLeft, UserTop, Width, Height);
    168167  end else begin
    169     Left := (Screen.Width - Width) div 2;
    170     Top := (Screen.Height - Height) div 2;
     168    BoundsRect := Bounds(Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 2,
     169      Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) div 2,
     170      Width, Height);
    171171  end;
    172172
Note: See TracChangeset for help on using the changeset viewer.