Changeset 170 for trunk/Forms/UFormMain.pas
- Timestamp:
- Nov 23, 2017, 5:02:49 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r158 r170 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 UGame, LCLType, Menus, ActnList, ComCtrls, types, dateutils, XMLConf, DOM; 9 UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM, 10 UGeometry; 10 11 11 12 const … … 137 138 if Assigned(Core.CurrentClient) then 138 139 with Core.CurrentClient do begin 139 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height);140 View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0), TPoint.Create(PaintBox1.Width, PaintBox1.Height)); 140 141 if csOpaque in PaintBox1.ControlStyle then begin 141 142 TempBitmap.SetSize(PaintBox1.Width, PaintBox1.Height); … … 166 167 if Assigned(Core.CurrentClient) then 167 168 with Core.CurrentClient do 168 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height);169 View.DestRect := TRect.CreateBounds(TPoint.Create(0, 0), TPoint.Create(PaintBox1.Width, PaintBox1.Height)); 169 170 Redraw; 170 171 end; … … 252 253 with Core, Game, CurrentClient, View do begin 253 254 MapRect := Map.CalculatePixelRect; 254 Factor := FloatPoint( (DestRect.Right - DestRect.Left) / (MapRect.Right - MapRect.Left),255 (DestRect.Bottom - DestRect.Top) / (MapRect.Bottom - MapRect.Top));255 Factor := FloatPoint(DestRect.Size.X / MapRect.Size.X, 256 DestRect.Size.Y / MapRect.Size.Y); 256 257 if Factor.X < Factor.Y then NewZoom := Factor.X 257 258 else NewZoom := Factor.Y; … … 342 343 if Button = mbLeft then begin 343 344 if Assigned(Core.CurrentClient) then begin 344 StartMousePoint := Point(X, Y);345 StartViewPoint := Core.CurrentClient.View.SourceRect. TopLeft;345 StartMousePoint := TPoint.Create(X, Y); 346 StartViewPoint := Core.CurrentClient.View.SourceRect.P1; 346 347 MoveActive := True; 347 348 end; … … 366 367 (Abs(StartMousePoint.Y - Y) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) then 367 368 with Core.Game.CurrentPlayer, Core.CurrentClient do begin 368 View.SourceRect := Bounds(Trunc(StartViewPoint.X + (StartMousePoint.X - X) / View.Zoom), 369 Trunc(StartViewPoint.Y + (StartMousePoint.Y - Y) / View.Zoom), 370 View.SourceRect.Right - View.SourceRect.Left, 371 View.SourceRect.Bottom - View.SourceRect.Top); 369 View.SourceRect := TRect.CreateBounds(TPoint.Create(Trunc(StartViewPoint.X + (StartMousePoint.X - X) / View.Zoom), 370 Trunc(StartViewPoint.Y + (StartMousePoint.Y - Y) / View.Zoom)), 371 View.SourceRect.Size); 372 372 Redraw; 373 373 end; … … 375 375 OldCell := Core.CurrentClient.View.FocusedCell; 376 376 with Core.Game do 377 Cell := Map.PosToCell(Core.CurrentClient.View.CanvasToCellPos( Point(X, Y)), Core.CurrentClient.View );377 Cell := Map.PosToCell(Core.CurrentClient.View.CanvasToCellPos(TPoint.Create(X, Y)), Core.CurrentClient.View ); 378 378 if Assigned(Cell) then begin 379 379 Core.CurrentClient.View.FocusedCell := Cell; … … 384 384 StatusBar1.Panels[0].Text := ''; 385 385 end; 386 CellPos := Core.CurrentClient.View.CanvasToCellPos( Point(X, Y));386 CellPos := Core.CurrentClient.View.CanvasToCellPos(TPoint.Create(X, Y)); 387 387 StatusBar1.Panels[2].Text := 'CellPos: ' + IntToStr(CellPos.X) + ', ' + IntToStr(CellPos.Y); 388 388 if Cell <> OldCell then Redraw; … … 396 396 (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin 397 397 if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) then begin 398 Core.CurrentClient.View.SelectCell( Point(X, Y), Core.Game.CurrentPlayer, Shift);398 Core.CurrentClient.View.SelectCell(TPoint.Create(X, Y), Core.Game.CurrentPlayer, Shift); 399 399 Redraw; 400 400 end;
Note:
See TracChangeset
for help on using the changeset viewer.