Changeset 288 for trunk


Ignore:
Timestamp:
Mar 24, 2019, 10:52:35 PM (6 years ago)
Author:
chronos
Message:
  • Modified: More forms use data item property instead Load/Save methods.
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNation.lfm

    r283 r288  
    88  ClientWidth = 480
    99  DesignTimePPI = 144
    10   LCLVersion = '1.8.4.0'
     10  LCLVersion = '2.0.0.4'
    1111  object LabelName: TLabel
    1212    Left = 20
     
    4848    Caption = 'OK'
    4949    ModalResult = 1
     50    OnClick = ButtonOkClick
    5051    TabOrder = 2
    5152  end
  • trunk/Forms/UFormNation.pas

    r284 r288  
    2020    LabelName: TLabel;
    2121    LabelHealth: TLabel;
     22    procedure ButtonOkClick(Sender: TObject);
    2223  private
    23 
    24   public
     24    FNation: TNation;
    2525    procedure Load(Nation: TNation);
    2626    procedure Save(Nation: TNation);
     27    procedure SetNation(AValue: TNation);
     28  public
     29    property Nation: TNation read FNation write SetNation;
    2730  end;
    2831
     
    3639
    3740{ TFormNation }
     41
     42procedure TFormNation.ButtonOkClick(Sender: TObject);
     43begin
     44  Save(FNation);
     45end;
    3846
    3947procedure TFormNation.Load(Nation: TNation);
     
    5058end;
    5159
     60procedure TFormNation.SetNation(AValue: TNation);
     61begin
     62  if FNation = AValue then Exit;
     63  FNation := AValue;
     64  if Assigned(FNation) then Load(FNation);
     65end;
     66
    5267end.
    5368
  • trunk/Forms/UFormNations.lfm

    r284 r288  
    1111  OnCreate = FormCreate
    1212  OnShow = FormShow
    13   LCLVersion = '1.8.4.0'
     13  LCLVersion = '2.0.0.4'
    1414  object ListView1: TListView
    1515    Left = 0
  • trunk/Forms/UFormNations.pas

    r284 r288  
    102102    FormNation := TFormNation.Create(Self);
    103103    try
    104       FormNation.Load(TempEntry);
     104      FormNation.Nation := TempEntry;
    105105      if FormNation.ShowModal = mrOk then begin
    106         FormNation.Save(TempEntry);
    107106        TNation(ListView1.Selected.Data).Assign(TempEntry);
    108107        UpdateList;
     
    124123  try
    125124    TempEntry.Name := SNewUnitKind;
    126     FormNation.Load(TempEntry);
     125    FormNation.Nation := TempEntry;
    127126    if FormNation.ShowModal = mrOk then begin
    128       FormNation.Save(TempEntry);
    129127      Nations.Add(TempEntry);
    130128      TempEntry := nil;
     
    149147    try
    150148      TempEntry.Name := Nations.GetNextAvailableName(TempEntry.Name);
    151       FormNation.Load(TempEntry);
     149      FormNation.Nation := TempEntry;
    152150      if FormNation.ShowModal = mrOk then begin
    153         FormNation.Save(TempEntry);
    154151        Nations.Add(TempEntry);
    155152        TempEntry := nil;
  • trunk/Forms/UFormNew.pas

    r287 r288  
    600600procedure TFormNew.AServerAddExecute(Sender: TObject);
    601601var
    602   NewServer: TServerInfo;
     602  NewServerInfo: TServerInfo;
    603603begin
    604604  FormServer := TFormServer.Create(nil);
    605   NewServer := TServerInfo.Create;
    606   FormServer.Load(NewServer);
     605  NewServerInfo := TServerInfo.Create;
     606  FormServer.ServerInfo := NewServerInfo;
    607607  if FormServer.ShowModal = mrOK then begin
    608     FormServer.Save(NewServer);
    609     ServerList.Items.Add(NewServer);
     608    ServerList.Items.Add(NewServerInfo);
    610609    ReloadView;
    611   end else NewServer.Free;
     610  end else NewServerInfo.Free;
    612611  FormServer.Free;
    613612end;
     
    615614procedure TFormNew.AServerModifyExecute(Sender: TObject);
    616615var
    617   Server: TServerInfo;
     616  ServerInfo: TServerInfo;
    618617begin
    619618  FormServer := TFormServer.Create(nil);
    620   Server := TServerInfo(ListViewServers.Selected.Data);
    621   FormServer.Load(Server);
     619  ServerInfo := TServerInfo(ListViewServers.Selected.Data);
     620  FormServer.ServerInfo := ServerInfo;
    622621  if FormServer.ShowModal = mrOK then begin
    623     FormServer.Save(Server);
    624622    ReloadView;
    625623  end;
  • trunk/Forms/UFormPlayer.lfm

    r282 r288  
    1414  OnShow = FormShow
    1515  Position = poMainFormCenter
    16   LCLVersion = '1.8.4.0'
     16  LCLVersion = '2.0.0.4'
    1717  object Label1: TLabel
    1818    Left = 24
     
    5050    Default = True
    5151    ModalResult = 1
     52    OnClick = ButtonOkClick
    5253    TabOrder = 2
    5354  end
  • trunk/Forms/UFormPlayer.pas

    r282 r288  
    2929    Label6: TLabel;
    3030    SpinEditStartUnits: TSpinEdit;
     31    procedure ButtonOkClick(Sender: TObject);
    3132    procedure ComboBoxModeChange(Sender: TObject);
    3233    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    3435    procedure FormShow(Sender: TObject);
    3536  private
    36     { private declarations }
     37    FPlayer: TPlayer;
     38    procedure LoadData(Player: TPlayer);
     39    procedure SaveData(Player: TPlayer);
     40    procedure SetPlayer(AValue: TPlayer);
    3741  public
    3842    procedure Translate;
    3943    procedure UpdateInterface;
    40     procedure LoadData(Player: TPlayer);
    41     procedure SaveData(Player: TPlayer);
     44    property Player: TPlayer read FPlayer write SetPlayer;
    4245  end;
    4346
     
    6467begin
    6568  UpdateInterface;
     69end;
     70
     71procedure TFormPlayer.ButtonOkClick(Sender: TObject);
     72begin
     73  SaveData(FPlayer);
    6674end;
    6775
     
    149157end;
    150158
     159procedure TFormPlayer.SetPlayer(AValue: TPlayer);
     160begin
     161  if FPlayer = AValue then Exit;
     162  FPlayer := AValue;
     163  if Assigned(FPlayer) then LoadData(FPlayer);
     164end;
     165
    151166end.
    152167
  • trunk/Forms/UFormPlayers.pas

    r284 r288  
    106106    FormPlayer := TFormPlayer.Create(Self);
    107107    try
    108       FormPlayer.LoadData(TempEntry);
     108      FormPlayer.Player := TempEntry;
    109109      if FormPlayer.ShowModal = mrOk then begin
    110         FormPlayer.SaveData(TempEntry);
    111110        TPlayer(ListView1.Selected.Data).Assign(TempEntry);
    112111        UpdateList;
     
    136135    TempEntry.Agressivity := caMedium;
    137136    TempEntry.Game := Players.Game;
    138     FormPlayer.LoadData(TempEntry);
     137    FormPlayer.Player := TempEntry;
    139138    if FormPlayer.ShowModal = mrOk then begin
    140       FormPlayer.SaveData(TempEntry);
    141139      Players.Add(TempEntry);
    142140      TempEntry := nil;
  • trunk/Forms/UFormServer.lfm

    r243 r288  
    11object FormServer: TFormServer
    22  Left = 691
    3   Height = 210
     3  Height = 252
    44  Top = 389
    5   Width = 403
     5  Width = 484
    66  Caption = 'Server'
    7   ClientHeight = 210
    8   ClientWidth = 403
    9   DesignTimePPI = 120
     7  ClientHeight = 252
     8  ClientWidth = 484
     9  DesignTimePPI = 144
    1010  OnShow = FormShow
    11   LCLVersion = '1.8.2.0'
     11  LCLVersion = '2.0.0.4'
    1212  object Label1: TLabel
    13     Left = 10
    14     Height = 20
    15     Top = 20
    16     Width = 43
     13    Left = 12
     14    Height = 26
     15    Top = 24
     16    Width = 56
    1717    Caption = 'Name:'
    1818    ParentColor = False
     19    ParentFont = False
    1920  end
    2021  object EditName: TEdit
    21     Left = 136
    22     Height = 28
    23     Top = 14
    24     Width = 234
     22    Left = 163
     23    Height = 43
     24    Top = 17
     25    Width = 281
     26    ParentFont = False
    2527    TabOrder = 0
    2628  end
    2729  object Label2: TLabel
    28     Left = 8
    29     Height = 20
    30     Top = 54
    31     Width = 56
     30    Left = 12
     31    Height = 26
     32    Top = 72
     33    Width = 74
    3234    Caption = 'Address:'
    3335    ParentColor = False
     36    ParentFont = False
    3437  end
    3538  object EditAddress: TEdit
    36     Left = 134
    37     Height = 28
    38     Top = 48
    39     Width = 236
     39    Left = 163
     40    Height = 43
     41    Top = 64
     42    Width = 283
     43    ParentFont = False
    4044    TabOrder = 1
    4145  end
    4246  object Label3: TLabel
    43     Left = 8
    44     Height = 20
    45     Top = 86
    46     Width = 30
     47    Left = 12
     48    Height = 26
     49    Top = 120
     50    Width = 41
    4751    Caption = 'Port:'
    4852    ParentColor = False
     53    ParentFont = False
    4954  end
    5055  object SpinEdit1: TSpinEdit
    51     Left = 136
    52     Height = 28
    53     Top = 80
    54     Width = 97
     56    Left = 163
     57    Height = 43
     58    Top = 112
     59    Width = 116
    5560    MaxValue = 65535
     61    ParentFont = False
    5662    TabOrder = 2
    5763  end
    5864  object ButtonCancel: TButton
    59     Left = 240
    60     Height = 31
    61     Top = 155
    62     Width = 94
     65    Left = 288
     66    Height = 37
     67    Top = 186
     68    Width = 113
    6369    Caption = 'Cancel'
    6470    ModalResult = 2
     71    ParentFont = False
    6572    TabOrder = 3
    6673  end
    6774  object ButtonOk: TButton
    68     Left = 80
    69     Height = 31
    70     Top = 155
    71     Width = 94
     75    Left = 96
     76    Height = 37
     77    Top = 186
     78    Width = 113
    7279    Caption = 'OK'
    7380    ModalResult = 1
     81    OnClick = ButtonOkClick
     82    ParentFont = False
    7483    TabOrder = 4
    7584  end
  • trunk/Forms/UFormServer.pas

    r243 r288  
    2222    Label3: TLabel;
    2323    SpinEdit1: TSpinEdit;
     24    procedure ButtonOkClick(Sender: TObject);
    2425    procedure FormShow(Sender: TObject);
    2526  private
    26 
    27   public
     27    FServerInfo: TServerInfo;
     28    procedure SetServerInfo(AValue: TServerInfo);
    2829    procedure Load(Server: TServerInfo);
    2930    procedure Save(Server: TServerInfo);
     31  public
     32    property ServerInfo: TServerInfo read FServerInfo write SetServerInfo;
    3033  end;
    3134
     
    4750end;
    4851
     52procedure TFormServer.ButtonOkClick(Sender: TObject);
     53begin
     54  Save(FServerInfo);
     55end;
     56
     57procedure TFormServer.SetServerInfo(AValue: TServerInfo);
     58begin
     59  if FServerInfo = AValue then Exit;
     60  FServerInfo := AValue;
     61  if Assigned(FServerInfo) then Load(FServerInfo);
     62end;
     63
    4964procedure TFormServer.Load(Server: TServerInfo);
    5065begin
  • trunk/Languages/xtactics.cs.po

    r286 r288  
    796796msgid "Units"
    797797msgstr "Jednotky"
     798
     799#: tformserver.buttoncancel.caption
     800msgctxt "tformserver.buttoncancel.caption"
     801msgid "Cancel"
     802msgstr "Zrušit"
     803
     804#: tformserver.buttonok.caption
     805msgctxt "tformserver.buttonok.caption"
     806msgid "OK"
     807msgstr "OK"
     808
     809#: tformserver.caption
     810msgid "Server"
     811msgstr "Server"
     812
     813#: tformserver.label1.caption
     814msgctxt "tformserver.label1.caption"
     815msgid "Name:"
     816msgstr "Jméno:"
     817
     818#: tformserver.label2.caption
     819msgctxt "tformserver.label2.caption"
     820msgid "Address:"
     821msgstr "Adresa:"
     822
     823#: tformserver.label3.caption
     824msgctxt "tformserver.label3.caption"
     825msgid "Port:"
     826msgstr "Port:"
    798827
    799828#: tformsettings.buttoncancel.caption
  • trunk/Languages/xtactics.po

    r286 r288  
    781781msgctxt "tformplayersstats.listview1.columns[5].caption"
    782782msgid "Units"
     783msgstr ""
     784
     785#: tformserver.buttoncancel.caption
     786msgctxt "tformserver.buttoncancel.caption"
     787msgid "Cancel"
     788msgstr ""
     789
     790#: tformserver.buttonok.caption
     791msgctxt "tformserver.buttonok.caption"
     792msgid "OK"
     793msgstr ""
     794
     795#: tformserver.caption
     796msgid "Server"
     797msgstr ""
     798
     799#: tformserver.label1.caption
     800msgctxt "tformserver.label1.caption"
     801msgid "Name:"
     802msgstr ""
     803
     804#: tformserver.label2.caption
     805msgctxt "tformserver.label2.caption"
     806msgid "Address:"
     807msgstr ""
     808
     809#: tformserver.label3.caption
     810msgctxt "tformserver.label3.caption"
     811msgid "Port:"
    783812msgstr ""
    784813
Note: See TracChangeset for help on using the changeset viewer.