close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

Changeset 170 for trunk/Forms


Ignore:
Timestamp:
Nov 23, 2017, 5:02:49 PM (7 years ago)
Author:
chronos
Message:
  • Modified: UGeometry unit rewritten to use generics and define own TPoint and TRect types.
Location:
trunk/Forms
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormCharts.lfm

    r145 r170  
    99  OnClose = FormClose
    1010  OnShow = FormShow
    11   LCLVersion = '1.8.0.4'
     11  LCLVersion = '1.6.4.0'
    1212  object Chart1: TChart
    1313    Left = 8
     
    3535  object ComboBox1: TComboBox
    3636    Left = 24
    37     Height = 36
     37    Height = 28
    3838    Top = 8
    3939    Width = 392
    40     ItemHeight = 0
     40    ItemHeight = 20
    4141    ItemIndex = 0
    4242    Items.Strings = (
  • trunk/Forms/UFormMain.lfm

    r157 r170  
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 587
     7  ClientHeight = 596
    88  ClientWidth = 775
    99  Menu = MainMenu1
     
    1313  OnKeyUp = FormKeyUp
    1414  OnShow = FormShow
    15   LCLVersion = '1.8.0.4'
     15  LCLVersion = '1.6.4.0'
    1616  WindowState = wsMaximized
    1717  object StatusBar1: TStatusBar
    1818    Left = 0
    19     Height = 30
    20     Top = 557
     19    Height = 28
     20    Top = 568
    2121    Width = 775
    2222    Panels = <   
     
    3434  object ToolBar1: TToolBar
    3535    Left = 0
    36     Height = 557
     36    Height = 568
    3737    Top = 0
    3838    Width = 32
     
    7272    object ToolButton6: TToolButton
    7373      Left = 1
    74       Top = 170
     74      Top = 194
    7575      Action = AZoomIn
    7676    end
    7777    object ToolButton7: TToolButton
    7878      Left = 1
    79       Top = 202
     79      Top = 226
    8080      Action = AZoomOut
    8181    end
    8282    object ToolButton8: TToolButton
    8383      Left = 1
    84       Top = 234
     84      Top = 258
    8585      Action = AZoomAll
    8686    end
    8787    object ToolButton9: TToolButton
    8888      Left = 1
     89      Height = 32
    8990      Top = 162
    9091      Width = 32
     
    9394    object ToolButton10: TToolButton
    9495      Left = 1
    95       Top = 266
     96      Height = 32
     97      Top = 290
    9698      Width = 32
    9799      Style = tbsSeparator
     
    99101    object ToolButton11: TToolButton
    100102      Left = 1
    101       Top = 274
     103      Top = 322
    102104      Action = Core.AGameLoad
    103105    end
    104106    object ToolButton12: TToolButton
    105107      Left = 1
    106       Top = 306
     108      Top = 354
    107109      Action = Core.AGameSave
    108110    end
    109111    object ToolButton13: TToolButton
    110112      Left = 1
    111       Top = 338
     113      Top = 386
    112114      Action = Core.AExit
    113115    end
     
    115117  object PaintBox1: TPaintBox
    116118    Left = 32
    117     Height = 557
     119    Height = 568
    118120    Top = 0
    119121    Width = 743
  • trunk/Forms/UFormMain.pas

    r158 r170  
    77uses
    88  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;
    1011
    1112const
     
    137138  if Assigned(Core.CurrentClient) then
    138139  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));
    140141    if csOpaque in PaintBox1.ControlStyle then begin
    141142      TempBitmap.SetSize(PaintBox1.Width, PaintBox1.Height);
     
    166167  if Assigned(Core.CurrentClient) then
    167168  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));
    169170  Redraw;
    170171end;
     
    252253  with Core, Game, CurrentClient, View do begin
    253254    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);
    256257    if Factor.X < Factor.Y then NewZoom := Factor.X
    257258      else NewZoom := Factor.Y;
     
    342343  if Button = mbLeft then begin
    343344    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;
    346347      MoveActive := True;
    347348    end;
     
    366367    (Abs(StartMousePoint.Y - Y) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) then
    367368    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);
    372372      Redraw;
    373373    end;
     
    375375    OldCell := Core.CurrentClient.View.FocusedCell;
    376376    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 );
    378378    if Assigned(Cell) then begin
    379379      Core.CurrentClient.View.FocusedCell := Cell;
     
    384384      StatusBar1.Panels[0].Text := '';
    385385    end;
    386     CellPos := Core.CurrentClient.View.CanvasToCellPos(Point(X, Y));
     386    CellPos := Core.CurrentClient.View.CanvasToCellPos(TPoint.Create(X, Y));
    387387    StatusBar1.Panels[2].Text := 'CellPos: ' + IntToStr(CellPos.X) + ', ' + IntToStr(CellPos.Y);
    388388    if Cell <> OldCell then Redraw;
     
    396396  (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin
    397397    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);
    399399      Redraw;
    400400    end;
  • trunk/Forms/UFormNew.pas

    r167 r170  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame;
     9  ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame, UGeometry;
    1010
    1111type
     
    363363  Game.CityEnabled := CheckBoxCity.Checked;
    364364  Game.CityPercentage := SpinEditCityPercent.Value;
    365   Game.Map.Size := Point(SpinEditMapSizeX.Value, SpinEditMapSizeY.Value);
     365  Game.Map.Size := TPoint.Create(SpinEditMapSizeX.Value, SpinEditMapSizeY.Value);
    366366  Game.GrowAmount := TGrowAmount(RadioGroupGrowAmount.ItemIndex);
    367367  Game.GrowCells := TGrowCells(RadioGroupGrowCells.ItemIndex);
Note: See TracChangeset for help on using the changeset viewer.