- Timestamp:
- Sep 15, 2024, 10:04:45 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Back.lfm
r426 r622 12 12 Font.Height = -30 13 13 Font.Name = 'MS Sans Serif' 14 OnClose = FormClose15 14 OnCreate = FormCreate 16 15 OnDestroy = FormDestroy -
trunk/Back.pas
r468 r622 18 18 procedure FormShow(Sender: TObject); 19 19 procedure FormCreate(Sender: TObject); 20 procedure FormClose(Sender: TObject; var Action: TCloseAction);21 20 private 22 21 Img: TBitmap; … … 54 53 begin 55 54 if Assigned(Img) then 56 BitBltCanvas(Canvas, Screen. Width - Img.Width - (Screen.Width - 800) *57 3 div 8, (Screen. Height - 600) div 3, Img.Width, Img.Height,55 BitBltCanvas(Canvas, Screen.PrimaryMonitor.Width - Img.Width - (Screen.PrimaryMonitor.Width - 800) * 56 3 div 8, (Screen.PrimaryMonitor.Height - 600) div 3, Img.Width, Img.Height, 58 57 Img.Canvas, 0, 0); 59 end;60 61 procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction);62 begin63 58 end; 64 59 … … 68 63 begin 69 64 if FullScreen then begin 65 BoundsRect := Screen.PrimaryMonitor.BoundsRect; 70 66 WindowState := TWindowState.wsFullScreen; 71 67 if not Assigned(Img) then begin -
trunk/Inp.pas
r570 r622 89 89 EditInput.SelLength := Length(EditInput.Text); 90 90 if Center then 91 CenterToRect( Rect(0, 0, Screen.Width, Screen.Height));91 CenterToRect(Screen.PrimaryMonitor.BoundsRect); 92 92 Gtk2DisableControlStyling(EditInput); 93 93 end; -
trunk/LocalPlayer/Battle.pas
r565 r622 207 207 OKBtn.Visible := True; 208 208 CancelBtn.Visible := True; 209 Left := (Screen.Width - ClientWidth) div 2; // center on screen 210 Top := (Screen.Height - ClientHeight) div 2; 209 CenterToScreen; 211 210 end 212 211 else -
trunk/LocalPlayer/CityScreen.pas
r617 r622 1100 1100 end; 1101 1101 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; 1107 1103 1108 1104 Caption := CityName(C.ID); -
trunk/LocalPlayer/Diagram.pas
r550 r622 291 291 procedure TDiaDlg.FormShow(Sender: TObject); 292 292 begin 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; 298 294 OffscreenPaint; 299 295 end; -
trunk/LocalPlayer/Draft.pas
r558 r622 485 485 yView := yView0 - Cut; 486 486 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); 492 488 493 489 SetDomain(Domain); -
trunk/LocalPlayer/Enhance.pas
r558 r622 131 131 TypeChanged: Boolean; 132 132 begin 133 OffscreenUser := Self;133 inherited; 134 134 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 135 135 FillOffscreen(0, 0, InnerWidth, InnerHeight); -
trunk/LocalPlayer/MessgEx.pas
r570 r622 169 169 0: 170 170 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; 173 173 end; 174 174 1: 175 175 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; 178 178 end; 179 179 -1: 180 180 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; 183 183 end; 184 184 end; -
trunk/LocalPlayer/Nego.pas
r592 r622 485 485 OkEnabled: Boolean; 486 486 begin 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; 491 488 492 489 if (DipCommand >= 0) and (Page = History[Me].N) then … … 917 914 { opLowTreaty: 918 915 begin 919 if MyRO.Treaty[DipMem[Me].pContact] =trNone then Price:=opTreaty+trCeaseFire920 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; 921 918 end } 922 919 end; -
trunk/LocalPlayer/Rates.pas
r565 r622 40 40 procedure TRatesDlg.FormCreate(Sender: TObject); 41 41 begin 42 TitleHeight := Screen. Height;42 TitleHeight := Screen.PrimaryMonitor.Height; 43 43 InitButtons; 44 44 end; -
trunk/LocalPlayer/Select.pas
r613 r622 1545 1545 var 1546 1546 I: Integer; 1547 NewTop, NewLeft: Integer; 1547 1548 begin 1548 1549 Result := -1; … … 1643 1644 begin { center on screen } 1644 1645 if Kind = kTribe then 1645 Left := (Screen.Width - 800) * 3 div 8 + 1301646 NewLeft := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - 800) * 3 div 8 + 130 1646 1647 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; 1649 1650 if Kind = kProject then 1650 Top := Top + 48; 1651 NewTop := NewTop + 48; 1652 BoundsRect := Bounds(NewLeft, NewTop, Width, Height); 1651 1653 end; 1652 1654 -
trunk/LocalPlayer/TechTree.pas
r577 r622 214 214 215 215 // 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 + 217 217 2 * BlackBorder); 218 NewHeight := Min(Screen. Height - 40, Image.Height + TopBorder + BottomBorder +218 NewHeight := Min(Screen.PrimaryMonitor.Height - 40, Image.Height + TopBorder + BottomBorder + 219 219 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); 222 222 CloseBtn.Left := Width - CloseBtn.Width - BlackBorder - 8; 223 223 CloseBtn.Top := BlackBorder + 8; -
trunk/LocalPlayer/Term.pas
r621 r622 12 12 {$ENDIF} 13 13 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, 15 15 DateUtils, Platform, ButtonB, ButtonC, EOTButton, Area, Help, 16 16 GraphicSet, MiniMap, IsoEngine, Wonders, TechTree, Enhance, Nego, CityType, … … 2643 2643 MainTexture.Age := -1; 2644 2644 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; 2647 2647 HelpDlg.Difficulty := 0; 2648 2648 if Command = cStartCredits then … … 5963 5963 if BattleDlg.Left < 0 then 5964 5964 BattleDlg.Left := 0 5965 else if BattleDlg.Left + BattleDlg.Width > Screen. Width then5966 BattleDlg.Left := Screen. Width - BattleDlg.Width;5965 else if BattleDlg.Left + BattleDlg.Width > Screen.DesktopWidth then 5966 BattleDlg.Left := Screen.DesktopWidth - BattleDlg.Width; 5967 5967 BattleDlg.Top := Y - BattleDlg.Height div 2; 5968 5968 if BattleDlg.Top < 0 then 5969 5969 BattleDlg.Top := 0 5970 else if BattleDlg.Top + BattleDlg.Height > Screen. Height then5971 BattleDlg.Top := Screen. Height - BattleDlg.Height;5970 else if BattleDlg.Top + BattleDlg.Height > Screen.DesktopHeight then 5971 BattleDlg.Top := Screen.DesktopHeight - BattleDlg.Height; 5972 5972 BattleDlg.IsSuicideQuery := False; 5973 5973 BattleDlg.Show; … … 8065 8065 procedure TMainScreen.FormShow(Sender: TObject); 8066 8066 begin 8067 if FullScreen then BoundsRect := Bounds(0, 0, Screen.Width, Screen.Height)8067 if FullScreen then BoundsRect := Screen.PrimaryMonitor.BoundsRect 8068 8068 else BoundsRect := TermBounds; 8069 8069 FormRestoredSize := TermBounds; … … 8387 8387 8388 8388 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; 8391 8391 end; 8392 8392 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; 8395 8395 end; 8396 8396 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; 8399 8399 end; 8400 8400 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; 8403 8403 end; 8404 8404 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; 8407 8407 if NatStatDlg.UserTop < 8 then 8408 8408 NatStatDlg.UserTop := 8; -
trunk/LocalPlayer/UnitStat.pas
r536 r622 77 77 NoMap := TIsoMap.Create; 78 78 AgePrepared := -2; 79 TitleHeight := Screen. Height;79 TitleHeight := Screen.PrimaryMonitor.Height; 80 80 InitButtons; 81 81 … … 164 164 if Kind in [dkOwnModel, dkEnemyModel] then 165 165 begin 166 Left := UserLeft; 167 Top := UserTop; 166 BoundsRect := Bounds(UserLeft, UserTop, Width, Height); 168 167 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); 171 171 end; 172 172 -
trunk/NoTerm.pas
r549 r622 87 87 procedure TNoTermDlg.FormCreate(Sender: TObject); 88 88 begin 89 Left := Screen.Width - Width - 8;90 Top := 8;89 BoundsRect := Bounds(Screen.PrimaryMonitor.Left + Screen.PrimaryMonitor.Width - Width - 8, 90 8, Width, Height); 91 91 Caption := Phrases.Lookup('AIT'); 92 92 Canvas.Brush.Style := TBrushStyle.bsClear; -
trunk/Packages/CevoComponents/BaseWin.pas
r620 r622 103 103 TitleHeight := WideFrame; 104 104 ModalFrameIndent := 45; 105 UserLeft := (Screen.Width - Width) div 2;106 UserTop := (Screen.Height - Height) div 2;105 UserLeft := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 2; 106 UserTop := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) div 2; 107 107 end; 108 108 -
trunk/Packages/CevoComponents/DrawDlg.pas
r617 r622 35 35 destructor Destroy; override; 36 36 procedure SmartInvalidate; virtual; 37 procedure CenterToScreen; overload; 38 procedure CenterToScreen(AWidth, AHeight: Integer); overload; 37 39 end; 38 40 … … 210 212 end; 211 213 214 procedure TDrawDlg.CenterToScreen; 215 begin 216 BoundsRect := Bounds( 217 Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 2, 218 Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - Height) div 2, 219 Width, Height); 220 end; 221 222 procedure TDrawDlg.CenterToScreen(AWidth, AHeight: Integer); 223 begin 224 BoundsRect := Bounds( 225 Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - AWidth) div 2, 226 Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - AHeight) div 2, 227 Width, Height); 228 end; 229 212 230 { TBaseMessgDlg } 213 231 214 232 procedure TBaseMessgDlg.FormCreate(Sender: TObject); 215 233 begin 216 Left := (Screen.Width - Width) div 2;234 Left := Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - Width) div 2; 217 235 Canvas.Font.Assign(UniFont[ftNormal]); 218 236 Canvas.Brush.Style := TBrushStyle.bsClear; 219 237 MessgText := ''; 220 238 TopSpace := 0; 221 TitleHeight := Screen. Height;239 TitleHeight := Screen.PrimaryMonitor.Height; 222 240 if csDesigning in ComponentState then Exit; 223 241 InitButtons; … … 287 305 var 288 306 I: Integer; 289 begin 290 Height := 72 + Border + TopSpace + Lines * MessageLineSpacing; 291 Top := (Screen.Height - Height) div 2; 292 for i := 0 to ControlCount - 1 do 293 Controls[i].Top := Height - (34 + Border); 307 NewHeight: Integer; 308 NewTop: Integer; 309 begin 310 NewHeight := 72 + Border + TopSpace + Lines * MessageLineSpacing; 311 NewTop := Screen.PrimaryMonitor.Top + (Screen.PrimaryMonitor.Height - NewHeight) div 2; 312 BoundsRect := Bounds(Left, NewTop, Width, NewHeight); 313 for I := 0 to ControlCount - 1 do 314 Controls[I].Top := NewHeight - (34 + Border); 294 315 end; 295 316 -
trunk/Packages/DpiControls/Dpi.Forms.pas
r500 r622 202 202 end; 203 203 204 { TMonitor } 205 206 TMonitor = class 207 private 208 function GetLeft: Integer; 209 function GetHeight: Integer; 210 function GetTop: Integer; 211 function GetWidth: Integer; 212 function GetBoundsRect: TRect; 213 public 214 NativeMonitor: Forms.TMonitor; 215 property Left: Integer read GetLeft; 216 property Height: Integer read GetHeight; 217 property Top: Integer read GetTop; 218 property Width: Integer read GetWidth; 219 property BoundsRect: TRect read GetBoundsRect; 220 end; 221 204 222 { TScreen } 205 223 … … 209 227 FActiveForm: TForm; 210 228 FPrevActiveForms: TForms; 229 FPrimaryMonitor: TMonitor; 211 230 FForms: TForms; 212 231 procedure AddForm(AForm: TForm); … … 215 234 function GetDesktopTop: Integer; 216 235 function GetDesktopWidth: Integer; 236 function GetPrimaryMonitor: TMonitor; 217 237 procedure RemoveForm(AForm: TForm); 218 238 function GetActiveForm: TForm; … … 248 268 property DesktopWidth: Integer read GetDesktopWidth; 249 269 property DesktopHeight: Integer read GetDesktopHeight; 270 property PrimaryMonitor: TMonitor read GetPrimaryMonitor; 250 271 end; 251 272 … … 477 498 begin 478 499 Result := Application.MessageBox(Text, Caption, Flags); 500 end; 501 502 { TMonitor } 503 504 function TMonitor.GetLeft: Integer; 505 begin 506 Result := ScaleFromNative(NativeMonitor.Left); 507 end; 508 509 function TMonitor.GetHeight: Integer; 510 begin 511 Result := ScaleFromNative(NativeMonitor.Height); 512 end; 513 514 function TMonitor.GetTop: Integer; 515 begin 516 Result := ScaleFromNative(NativeMonitor.Top); 517 end; 518 519 function TMonitor.GetWidth: Integer; 520 begin 521 Result := ScaleFromNative(NativeMonitor.Width); 522 end; 523 524 function TMonitor.GetBoundsRect: TRect; 525 begin 526 Result := ScaleRectFromNative(NativeMonitor.BoundsRect); 479 527 end; 480 528 … … 944 992 end; 945 993 994 function TScreen.GetPrimaryMonitor: TMonitor; 995 begin 996 if not Assigned(FPrimaryMonitor) then begin 997 FPrimaryMonitor := TMonitor.Create; 998 FPrimaryMonitor.NativeMonitor := LCLScreen.PrimaryMonitor; 999 end; 1000 Result := FPrimaryMonitor; 1001 end; 1002 946 1003 procedure TScreen.RemoveForm(AForm: TForm); 947 1004 begin … … 1006 1063 FreeAndNil(FForms); 1007 1064 FreeAndNil(FPrevActiveForms); 1065 if Assigned(FPrimaryMonitor) then 1066 FreeAndNil(FPrimaryMonitor); 1008 1067 inherited; 1009 1068 end; -
trunk/Start.pas
r597 r622 252 252 end; // default AI not found, use any 253 253 254 DirectDlg.Left := (Screen.Width - DirectDlg.Width) div 2; 255 DirectDlg.Top := (Screen.Height - DirectDlg.Height) div 2; 254 DirectDlg.CenterToScreen; 256 255 257 256 UpdateInterface; … … 509 508 begin 510 509 if FullScreen then begin 511 Location := Point( (Screen.Width - 800) * 3 div 8,512 Screen. Height - Height - (Screen.Height - 600) div 3);510 Location := Point(Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - 800) * 3 div 8, 511 Screen.PrimaryMonitor.Top + Screen.PrimaryMonitor.Height - Height - (Screen.PrimaryMonitor.Height - 600) div 3); 513 512 BoundsRect := Bounds(Location.X, Location.Y, Width, Height); 514 513 … … 524 523 DeleteObject(r0); // causes crash with Windows 95 525 524 end else begin 526 BoundsRect := Bounds((Screen.Width - Width) div 2, 527 (Screen.Height - Height) div 2, Width, Height); 525 CenterToScreen; 528 526 end; 529 527 end;
Note:
See TracChangeset
for help on using the changeset viewer.