Changeset 279
- Timestamp:
- Feb 14, 2019, 10:52:04 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.lfm
r276 r279 21 21 Top = 60 22 22 Width = 806 23 ActivePage = TabSheet Rules23 ActivePage = TabSheetPlayers 24 24 Align = alClient 25 25 BorderSpacing.Around = 4 26 TabIndex = 326 TabIndex = 1 27 27 TabOrder = 0 28 28 OnChange = PageControl1Change … … 163 163 object Panel2: TPanel 164 164 Left = 0 165 Height = 652165 Height = 596 166 166 Top = 0 167 167 Width = 796 168 168 Align = alClient 169 169 BevelOuter = bvNone 170 ClientHeight = 652171 ClientWidth = 796172 170 TabOrder = 0 173 object ListViewPlayers: TListView174 Left = 4175 Height = 602176 Top = 4177 Width = 788178 Align = alTop179 Anchors = [akTop, akLeft, akRight, akBottom]180 BorderSpacing.Around = 4181 Columns = <182 item183 Caption = 'Name'184 Width = 200185 end186 item187 Caption = 'Type'188 Width = 100189 end190 item191 Caption = 'Color'192 Width = 100193 end194 item195 Caption = 'Start units'196 Width = 790197 end>198 MultiSelect = True199 OwnerData = True200 PopupMenu = PopupMenuPlayers201 ReadOnly = True202 RowSelect = True203 TabOrder = 0204 ViewStyle = vsReport205 OnCustomDrawSubItem = ListViewPlayersCustomDrawSubItem206 OnData = ListViewPlayersData207 OnDblClick = ListViewPlayersDblClick208 OnKeyPress = ListViewPlayersKeyPress209 OnKeyUp = ListViewPlayersKeyUp210 OnSelectItem = ListViewPlayersSelectItem211 end212 object ButtonPlayerAdd: TButton213 Left = 16214 Height = 25215 Top = 614216 Width = 83217 Action = APlayerAdd218 Anchors = [akLeft, akBottom]219 TabOrder = 1220 end221 object ButtonPlayerModify: TButton222 Left = 120223 Height = 25224 Top = 614225 Width = 83226 Action = APlayerModify227 Anchors = [akLeft, akBottom]228 TabOrder = 2229 end230 object ButtonPlayerRemove: TButton231 Left = 224232 Height = 25233 Top = 614234 Width = 83235 Action = APlayerRemove236 Anchors = [akLeft, akBottom]237 TabOrder = 3238 end239 171 end 240 172 end … … 587 519 object ComboBoxWinObjective: TComboBox 588 520 Left = 224 589 Height = 38521 Height = 42 590 522 Top = 244 591 523 Width = 328 … … 765 697 object ComboBoxGameSystem: TComboBox 766 698 Left = 176 767 Height = 4 3699 Height = 42 768 700 Top = 9 769 701 Width = 254 … … 786 718 left = 864 787 719 top = 216 788 object APlayerModify: TAction789 Caption = 'Modify'790 OnExecute = APlayerModifyExecute791 end792 object APlayerAdd: TAction793 Caption = 'Add'794 OnExecute = APlayerAddExecute795 end796 object APlayerRemove: TAction797 Caption = 'Remove'798 OnExecute = APlayerRemoveExecute799 end800 720 object AServerAdd: TAction 801 721 Caption = 'Add' … … 814 734 left = 864 815 735 top = 360 816 end817 object PopupMenuPlayers: TPopupMenu818 left = 864819 top = 288820 object MenuItem1: TMenuItem821 Action = APlayerAdd822 end823 object MenuItem2: TMenuItem824 Action = APlayerModify825 Default = True826 end827 object MenuItem3: TMenuItem828 Action = APlayerRemove829 end830 736 end 831 737 object PopupMenuServers: TPopupMenu -
trunk/Forms/UFormNew.pas
r276 r279 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame, UGeometry, UPlayer, 10 UGameServer, UServerList, UMap ;10 UGameServer, UServerList, UMap, UFormPlayers; 11 11 12 12 type … … 16 16 TFormNew = class(TForm) 17 17 ActionList1: TActionList; 18 APlayerAdd: TAction;19 APlayerModify: TAction;20 APlayerRemove: TAction;21 18 AServerAdd: TAction; 22 19 AServerModify: TAction; … … 30 27 ButtonImageBrowse: TButton; 31 28 ButtonOk: TButton; 32 ButtonPlayerAdd: TButton;33 ButtonPlayerModify: TButton;34 ButtonPlayerRemove: TButton;35 29 CheckBoxBridges: TCheckBox; 36 30 CheckBoxCity: TCheckBox; … … 62 56 Label8: TLabel; 63 57 Label9: TLabel; 64 ListViewPlayers: TListView;65 58 ListViewServers: TListView; 66 MenuItem1: TMenuItem;67 MenuItem2: TMenuItem;68 MenuItem3: TMenuItem;69 59 MenuItem4: TMenuItem; 70 60 MenuItem5: TMenuItem; … … 80 70 PanelButtons: TPanel; 81 71 PanelChat: TPanel; 82 PopupMenuPlayers: TPopupMenu;83 72 PopupMenuServers: TPopupMenu; 84 73 RadioButtonModeLocal: TRadioButton; … … 111 100 TrackBarSizeX: TTrackBar; 112 101 TrackBarSizeY: TTrackBar; 113 procedure APlayerAddExecute(Sender: TObject);114 procedure APlayerModifyExecute(Sender: TObject);115 procedure APlayerRemoveExecute(Sender: TObject);116 102 procedure AServerAddExecute(Sender: TObject); 117 103 procedure AServerModifyExecute(Sender: TObject); … … 134 120 procedure FormShow(Sender: TObject); 135 121 procedure Image1Resize(Sender: TObject); 136 procedure ListViewPlayersCustomDrawSubItem(Sender: TCustomListView;137 Item: TListItem; SubItem: Integer; State: TCustomDrawState;138 var DefaultDraw: Boolean);139 procedure ListViewPlayersData(Sender: TObject; Item: TListItem);140 procedure ListViewPlayersDblClick(Sender: TObject);141 procedure ListViewPlayersKeyPress(Sender: TObject; var Key: char);142 procedure ListViewPlayersKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState143 );144 procedure ListViewPlayersSelectItem(Sender: TObject; Item: TListItem;145 Selected: Boolean);146 122 procedure ListViewServersData(Sender: TObject; Item: TListItem); 147 123 procedure ListViewServersKeyPress(Sender: TObject; var Key: char); … … 166 142 MapPreviewRedrawPending: Boolean; 167 143 NewRandSeed: Cardinal; 144 FormPlayers: TFormPlayers; 168 145 procedure LoadGame(Game: TGame); 169 146 procedure SaveGame(Game: TGame); … … 216 193 { TFormNew } 217 194 218 procedure TFormNew.ListViewPlayersData(Sender: TObject; Item: TListItem);219 begin220 if (Item.Index >= 0) and (Item.Index < Players.Count) then221 with Players[Item.Index] do begin222 Item.Caption := Name;223 Item.Data := Players[Item.Index];224 Item.SubItems.Add(PlayerModeText[Mode]);225 Item.SubItems.Add(''); // Do not show color text226 Item.SubItems.Add(IntToStr(StartUnits));227 end;228 end;229 230 procedure TFormNew.ListViewPlayersDblClick(Sender: TObject);231 begin232 APlayerModify.Execute;233 end;234 235 procedure TFormNew.ListViewPlayersKeyPress(Sender: TObject; var Key: char);236 begin237 if (Key = #13) then APlayerModify.Execute;238 end;239 240 procedure TFormNew.ListViewPlayersKeyUp(Sender: TObject; var Key: Word;241 Shift: TShiftState);242 begin243 if Key = 45 then APlayerAdd.Execute;244 if Key = 46 then APlayerRemove.Execute;245 end;246 247 procedure TFormNew.ListViewPlayersSelectItem(Sender: TObject; Item: TListItem;248 Selected: Boolean);249 begin250 ReloadView;251 end;252 253 195 procedure TFormNew.ListViewServersData(Sender: TObject; Item: TListItem); 254 196 begin … … 339 281 procedure TFormNew.LoadGame(Game: TGame); 340 282 begin 341 Players.Assign(Game.Players);283 FormPlayers.Players.Assign(Game.Players); 342 284 with Game do begin 343 285 CheckBoxSymetricMap.Checked := SymetricMap; … … 370 312 procedure TFormNew.SaveGame(Game: TGame); 371 313 begin 372 Game.Players.Assign( Players);314 Game.Players.Assign(FormPlayers.Players); 373 315 with Game do begin 374 316 StoredRandSeed := NewRandSeed; … … 510 452 procedure TFormNew.ReloadView; 511 453 begin 512 ListViewPlayers.Items.Count := Players.Count;513 ListViewPlayers.Refresh;514 454 ListViewServers.Items.Count := ServerList.Items.Count; 515 455 ListViewServers.Refresh; … … 522 462 WinObjective: TWinObjective; 523 463 begin 524 APlayerRemove.Enabled := Assigned(ListViewPlayers.Selected) and (Players.Count > MinPlayerCount);525 APlayerAdd.Enabled := Players.Count < MaxPlayerCount;526 APlayerModify.Enabled := Assigned(ListViewPlayers.Selected);527 464 EditImageFile.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage); 528 465 ButtonImageBrowse.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage); … … 566 503 end; 567 504 568 procedure TFormNew.ListViewPlayersCustomDrawSubItem(Sender: TCustomListView;569 Item: TListItem; SubItem: Integer; State: TCustomDrawState;570 var DefaultDraw: Boolean);571 begin572 if SubItem = 2 then573 with ListViewPlayers.Canvas do begin574 Brush.Color := TPlayer(Item.Data).Color;575 Brush.Style := bsSolid;576 FillRect(Item.DisplayRectSubItem(2, drBounds));577 end;578 end;579 580 505 procedure TFormNew.FormCreate(Sender: TObject); 581 506 begin 582 507 GamePreview := TGame.Create; 583 Players := TPlayers.Create;584 508 ServerList := TServerList.Create; 585 509 FormChat := TFormChat.Create(nil); … … 587 511 FormChat.Align := alClient; 588 512 FormChat.Show; 513 Players := TPlayers.Create; 514 FormPlayers := TFormPlayers.Create(nil); 515 FormPlayers.MinItemCount := MinPlayerCount; 516 FormPlayers.MaxItemCount := MaxPlayerCount; 517 FormPlayers.Players := Players; 518 FormPlayers.ManualDock(Panel2, nil, alClient); 519 FormPlayers.Align := alClient; 520 FormPlayers.Visible := True; 589 521 Translate; 590 522 end; … … 636 568 begin 637 569 Core.PersistentForm.Save(Self); 638 end;639 640 procedure TFormNew.APlayerModifyExecute(Sender: TObject);641 begin642 FormPlayer := TFormPlayer.Create(nil);643 try644 if Assigned(ListViewPlayers.Selected) then begin645 FormPlayer.Load(TPlayer(ListViewPlayers.Selected.Data));646 if FormPlayer.ShowModal = mrOk then begin647 FormPlayer.Save(TPlayer(ListViewPlayers.Selected.Data));648 ReloadView;649 end;650 end;651 finally652 FormPlayer.Free;653 end;654 end;655 656 procedure TFormNew.APlayerRemoveExecute(Sender: TObject);657 var658 I: Integer;659 begin660 for I := ListViewPlayers.Items.Count - 1 downto 0 do661 if ListViewPlayers.Items[I].Selected then begin662 Players.Remove(ListViewPlayers.Items[I].Data);663 if Players.Count <= MinPlayerCount then Break;664 end;665 ReloadView;666 570 end; 667 571 … … 740 644 end; 741 645 742 procedure TFormNew.APlayerAddExecute(Sender: TObject);743 var744 NewPlayer: TPlayer;745 begin746 if Players.Count <= (MaxPlayerCount - 1) then begin747 NewPlayer := TPlayer.Create;748 NewPlayer.Id := Players.GetNewId;749 NewPlayer.Name := SPlayer + ' ' + IntToStr(NewPlayer.Id);750 NewPlayer.Color := PlayerColors[Players.Count];751 NewPlayer.Mode := pmComputer;752 NewPlayer.Agressivity := caMedium;753 Players.Add(NewPlayer);754 ReloadView;755 end;756 end;757 758 646 procedure TFormNew.FormDestroy(Sender: TObject); 759 647 begin 760 648 FreeAndNil(ServerList); 649 FreeAndNil(FormChat); 761 650 FreeAndNil(Players); 762 FreeAndNil(Form Chat);651 FreeAndNil(FormPlayers); 763 652 FreeAndNil(GamePreview); 764 653 end; -
trunk/Forms/UFormPlayer.lfm
r188 r279 9 9 Constraints.MinHeight = 344 10 10 Constraints.MinWidth = 522 11 DesignTimePPI = 144 11 12 OnClose = FormClose 12 13 OnCreate = FormCreate 13 14 OnShow = FormShow 14 15 Position = poMainFormCenter 15 LCLVersion = '1.8. 0.4'16 LCLVersion = '1.8.4.0' 16 17 object Label1: TLabel 17 18 Left = 24 … … 24 25 object EditName: TEdit 25 26 Left = 168 26 Height = 3627 Height = 43 27 28 Top = 27 28 29 Width = 339 … … 53 54 object ComboBoxMode: TComboBox 54 55 Left = 168 55 Height = 3 656 Height = 38 56 57 Top = 72 57 58 Width = 339 … … 86 87 object ColorBox1: TColorBox 87 88 Left = 168 88 Height = 4 089 Height = 42 89 90 Top = 120 90 91 Width = 339 … … 104 105 object ComboBoxAgressivity: TComboBox 105 106 Left = 168 106 Height = 4 0107 Height = 42 107 108 Top = 168 108 109 Width = 339 … … 122 123 Height = 30 123 124 Top = 208 124 Width = 10 7125 Width = 109 125 126 Caption = 'Defensive' 126 127 TabOrder = 6 … … 136 137 object SpinEditStartUnits: TSpinEdit 137 138 Left = 224 138 Height = 36139 Height = 43 139 140 Top = 240 140 141 Width = 112 -
trunk/Forms/UFormPlayer.pas
r243 r279 36 36 procedure Translate; 37 37 procedure UpdateInterface; 38 procedure Load (Player: TPlayer);39 procedure Save (Player: TPlayer);38 procedure LoadData(Player: TPlayer); 39 procedure SaveData(Player: TPlayer); 40 40 end; 41 41 … … 110 110 end; 111 111 112 procedure TFormPlayer.Load (Player: TPlayer);112 procedure TFormPlayer.LoadData(Player: TPlayer); 113 113 begin 114 114 EditName.Text := Player.Name; … … 121 121 end; 122 122 123 procedure TFormPlayer.Save (Player: TPlayer);123 procedure TFormPlayer.SaveData(Player: TPlayer); 124 124 begin 125 125 Player.Name := EditName.Text; -
trunk/Languages/xtactics.cs.po
r277 r279 443 443 msgstr " " 444 444 445 #: tformnew.aplayeradd.caption446 #| msgid "Add player"447 msgctxt "tformnew.aplayeradd.caption"448 msgid "Add"449 msgstr "Přidat"450 451 #: tformnew.aplayermodify.caption452 msgctxt "tformnew.aplayermodify.caption"453 msgid "Modify"454 msgstr "Upravit"455 456 #: tformnew.aplayerremove.caption457 #| msgid "Remove player"458 msgctxt "tformnew.aplayerremove.caption"459 msgid "Remove"460 msgstr "Odstranit"461 462 445 #: tformnew.aserveradd.caption 463 446 msgctxt "tformnew.aserveradd.caption" … … 598 581 msgstr "Soubor obrázku:" 599 582 600 #: tformnew.listviewplayers.columns[0].caption601 msgctxt "tformnew.listviewplayers.columns[0].caption"602 msgid "Name"603 msgstr "Jméno"604 605 #: tformnew.listviewplayers.columns[1].caption606 msgctxt "tformnew.listviewplayers.columns[1].caption"607 msgid "Type"608 msgstr "Typ"609 610 #: tformnew.listviewplayers.columns[2].caption611 msgctxt "tformnew.listviewplayers.columns[2].caption"612 msgid "Color"613 msgstr "Barva"614 615 #: tformnew.listviewplayers.columns[3].caption616 msgctxt "tformnew.listviewplayers.columns[3].caption"617 msgid "Start units"618 msgstr "Počátečních jednotek"619 620 583 #: tformnew.listviewservers.columns[0].caption 621 584 msgctxt "tformnew.listviewservers.columns[0].caption" … … 714 677 msgid "Start units:" 715 678 msgstr "Počátečních jednotek:" 679 680 #: tformplayers.aadd.caption 681 #, fuzzy 682 msgctxt "tformplayers.aadd.caption" 683 msgid "Add" 684 msgstr "Přidat" 685 686 #: tformplayers.aclone.caption 687 #, fuzzy 688 msgctxt "tformplayers.aclone.caption" 689 msgid "Clone" 690 msgstr "Klonovat" 691 692 #: tformplayers.amodify.caption 693 #, fuzzy 694 msgctxt "tformplayers.amodify.caption" 695 msgid "Modify" 696 msgstr "Upravit" 697 698 #: tformplayers.aremove.caption 699 #, fuzzy 700 msgctxt "tformplayers.aremove.caption" 701 msgid "Remove" 702 msgstr "Odstranit" 703 704 #: tformplayers.aselectall.caption 705 #, fuzzy 706 msgctxt "tformplayers.aselectall.caption" 707 msgid "Select all" 708 msgstr "Vybrat vše" 709 710 #: tformplayers.caption 711 #, fuzzy 712 msgctxt "tformplayers.caption" 713 msgid "Players" 714 msgstr "Hráči" 715 716 #: tformplayers.listview1.columns[0].caption 717 #, fuzzy 718 msgctxt "tformplayers.listview1.columns[0].caption" 719 msgid "Name" 720 msgstr "Jméno" 721 722 #: tformplayers.listview1.columns[1].caption 723 #, fuzzy 724 msgctxt "tformplayers.listview1.columns[1].caption" 725 msgid "Type" 726 msgstr "Typ" 727 728 #: tformplayers.listview1.columns[2].caption 729 #, fuzzy 730 msgctxt "tformplayers.listview1.columns[2].caption" 731 msgid "Color" 732 msgstr "Barva" 733 734 #: tformplayers.listview1.columns[3].caption 735 #, fuzzy 736 msgctxt "tformplayers.listview1.columns[3].caption" 737 msgid "Start units" 738 msgstr "Počátečních jednotek" 716 739 717 740 #: tformplayersstats.aspectate.caption … … 1193 1216 msgstr "Člověk" 1194 1217 1218 #: uformplayers.sremoveitems 1219 #, fuzzy 1220 msgctxt "uformplayers.sremoveitems" 1221 msgid "Remove items" 1222 msgstr "Odstranit položky" 1223 1224 #: uformplayers.sremoveitemsquery 1225 #, fuzzy 1226 msgctxt "uformplayers.sremoveitemsquery" 1227 msgid "Do you want to remove selected items?" 1228 msgstr "Opravdu chcete odstranit vybrané položky?" 1229 1195 1230 #: uformunitkinds.snewunitkind 1196 1231 msgid "New unit kind" -
trunk/Languages/xtactics.po
r277 r279 432 432 msgstr "" 433 433 434 #: tformnew.aplayeradd.caption435 msgctxt "tformnew.aplayeradd.caption"436 msgid "Add"437 msgstr ""438 439 #: tformnew.aplayermodify.caption440 msgctxt "tformnew.aplayermodify.caption"441 msgid "Modify"442 msgstr ""443 444 #: tformnew.aplayerremove.caption445 msgctxt "tformnew.aplayerremove.caption"446 msgid "Remove"447 msgstr ""448 449 434 #: tformnew.aserveradd.caption 450 435 msgctxt "tformnew.aserveradd.caption" … … 583 568 msgstr "" 584 569 585 #: tformnew.listviewplayers.columns[0].caption586 msgctxt "tformnew.listviewplayers.columns[0].caption"587 msgid "Name"588 msgstr ""589 590 #: tformnew.listviewplayers.columns[1].caption591 msgctxt "tformnew.listviewplayers.columns[1].caption"592 msgid "Type"593 msgstr ""594 595 #: tformnew.listviewplayers.columns[2].caption596 msgctxt "tformnew.listviewplayers.columns[2].caption"597 msgid "Color"598 msgstr ""599 600 #: tformnew.listviewplayers.columns[3].caption601 msgctxt "tformnew.listviewplayers.columns[3].caption"602 msgid "Start units"603 msgstr ""604 605 570 #: tformnew.listviewservers.columns[0].caption 606 571 msgctxt "tformnew.listviewservers.columns[0].caption" … … 698 663 #: tformplayer.label5.caption 699 664 msgid "Start units:" 665 msgstr "" 666 667 #: tformplayers.aadd.caption 668 msgctxt "tformplayers.aadd.caption" 669 msgid "Add" 670 msgstr "" 671 672 #: tformplayers.aclone.caption 673 msgctxt "tformplayers.aclone.caption" 674 msgid "Clone" 675 msgstr "" 676 677 #: tformplayers.amodify.caption 678 msgctxt "tformplayers.amodify.caption" 679 msgid "Modify" 680 msgstr "" 681 682 #: tformplayers.aremove.caption 683 msgctxt "tformplayers.aremove.caption" 684 msgid "Remove" 685 msgstr "" 686 687 #: tformplayers.aselectall.caption 688 msgctxt "tformplayers.aselectall.caption" 689 msgid "Select all" 690 msgstr "" 691 692 #: tformplayers.caption 693 msgctxt "tformplayers.caption" 694 msgid "Players" 695 msgstr "" 696 697 #: tformplayers.listview1.columns[0].caption 698 msgctxt "tformplayers.listview1.columns[0].caption" 699 msgid "Name" 700 msgstr "" 701 702 #: tformplayers.listview1.columns[1].caption 703 msgid "Type" 704 msgstr "" 705 706 #: tformplayers.listview1.columns[2].caption 707 msgid "Color" 708 msgstr "" 709 710 #: tformplayers.listview1.columns[3].caption 711 msgid "Start units" 700 712 msgstr "" 701 713 … … 1161 1173 msgstr "" 1162 1174 1175 #: uformplayers.sremoveitems 1176 msgctxt "uformplayers.sremoveitems" 1177 msgid "Remove items" 1178 msgstr "" 1179 1180 #: uformplayers.sremoveitemsquery 1181 msgctxt "uformplayers.sremoveitemsquery" 1182 msgid "Do you want to remove selected items?" 1183 msgstr "" 1184 1163 1185 #: uformunitkinds.snewunitkind 1164 1186 msgid "New unit kind" -
trunk/xtactics.lpi
r278 r279 109 109 </Item7> 110 110 </RequiredPackages> 111 <Units Count="4 0">111 <Units Count="41"> 112 112 <Unit0> 113 113 <Filename Value="xtactics.lpr"/> … … 327 327 <ResourceBaseClass Value="Form"/> 328 328 </Unit39> 329 <Unit40> 330 <Filename Value="Forms/UFormPlayers.pas"/> 331 <IsPartOfProject Value="True"/> 332 <ComponentName Value="FormPlayers"/> 333 <HasResources Value="True"/> 334 <ResourceBaseClass Value="Form"/> 335 </Unit40> 329 336 </Units> 330 337 </ProjectOptions> -
trunk/xtactics.lpr
r277 r279 11 11 CoolTranslator, TemplateGenerics 12 12 { you can add units after this }, 13 SysUtils, UFormMain, CoolStreaming , UFormUnitKind;13 SysUtils, UFormMain, CoolStreaming; 14 14 15 15 {$R *.res}
Note:
See TracChangeset
for help on using the changeset viewer.