Changeset 275 for trunk/Forms/UFormNew.pas
- Timestamp:
- Feb 3, 2019, 11:28:03 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.pas
r274 r275 25 25 Button2: TButton; 26 26 Button3: TButton; 27 ButtonGameSystems: TButton; 27 28 ButtonRandomize: TButton; 28 29 ButtonCancel: TButton; … … 41 42 CheckBoxUnitsMoveImmediately: TCheckBox; 42 43 CheckBoxVoid: TCheckBox; 44 ComboBoxGameSystem: TComboBox; 43 45 ComboBoxGridType: TComboBox; 44 46 ComboBoxMapShape: TComboBox; … … 54 56 Label14: TLabel; 55 57 Label15: TLabel; 58 Label16: TLabel; 56 59 Label2: TLabel; 57 60 Label3: TLabel; … … 117 120 procedure AServerModifyExecute(Sender: TObject); 118 121 procedure AServerRemoveExecute(Sender: TObject); 122 procedure ButtonGameSystemsClick(Sender: TObject); 119 123 procedure ButtonImageBrowseClick(Sender: TObject); 120 124 procedure ButtonRandomizeClick(Sender: TObject); … … 169 173 procedure MapPreviewPaint; 170 174 procedure MapPreviewRedraw; 175 procedure ReloadGameSystemsMenu; 171 176 public 172 177 procedure Translate; … … 186 191 187 192 uses 188 UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient; 193 UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient, 194 UFormGameSystems; 189 195 190 196 resourcestring … … 403 409 end; 404 410 411 procedure TFormNew.ReloadGameSystemsMenu; 412 var 413 I: Integer; 414 LastSystem: Pointer; 415 begin 416 if ComboBoxGameSystem.ItemIndex <> -1 then 417 LastSystem := ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex] 418 else LastSystem := nil; 419 ComboBoxGameSystem.Items.BeginUpdate; 420 try 421 while ComboBoxGameSystem.Items.Count > Core.GameSystems.Count do 422 ComboBoxGameSystem.Items.Delete(ComboBoxGameSystem.Items.Count - 1); 423 while ComboBoxGameSystem.Items.Count < Core.GameSystems.Count do 424 ComboBoxGameSystem.Items.Add(''); 425 for I := 0 to Core.GameSystems.Count - 1 do begin 426 ComboBoxGameSystem.Items[I] := Core.GameSystems[I].Name; 427 ComboBoxGameSystem.Items.Objects[I] := Core.GameSystems[I]; 428 end; 429 if Assigned(LastSystem) then 430 ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOfObject(LastSystem); 431 if (ComboBoxGameSystem.ItemIndex = -1) and (ComboBoxGameSystem.Items.Count > 0) then 432 ComboBoxGameSystem.ItemIndex := 0; 433 finally 434 ComboBoxGameSystem.Items.EndUpdate; 435 end; 436 end; 437 405 438 procedure TFormNew.MapPreviewPaint; 406 439 var … … 525 558 Core.PersistentForm.Load(Self); 526 559 Core.ThemeManager1.UseTheme(Self); 560 ReloadGameSystemsMenu; 527 561 ReloadView; 528 562 //Height := Trunc(1.5 * Height); … … 678 712 ServerList.Items.Delete(I); 679 713 ReloadView; 714 end; 715 end; 716 717 procedure TFormNew.ButtonGameSystemsClick(Sender: TObject); 718 begin 719 FormGameSystems := TFormGameSystems.Create(nil); 720 try 721 FormGameSystems.GameSystems := Core.GameSystems; 722 FormGameSystems.ShowModal; 723 ReloadGameSystemsMenu; 724 finally 725 FreeAndNil(FormGameSystems); 680 726 end; 681 727 end;
Note:
See TracChangeset
for help on using the changeset viewer.