Changeset 75 for trunk/Forms/UFormNew.pas
- Timestamp:
- Oct 4, 2014, 11:33:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.pas
r74 r75 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, Spin, ExtCtrls, ActnList, UGame;9 ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame; 10 10 11 11 type … … 18 18 APlayerModify: TAction; 19 19 ActionList1: TActionList; 20 ButtonImageBrowse: TButton; 20 21 ButtonCancel: TButton; 21 22 ButtonOk: TButton; … … 23 24 ButtonPlayerModify: TButton; 24 25 ButtonPlayerRemove: TButton; 26 CheckBoxCity: TCheckBox; 25 27 CheckBoxSymetricMap: TCheckBox; 26 CheckBoxCity: TCheckBox;27 28 CheckBoxVoid: TCheckBox; 28 29 ComboBoxGridType: TComboBox; 30 ComboBoxMapShape: TComboBox; 29 31 ComboBoxWinObjective: TComboBox; 32 EditImageFile: TEdit; 30 33 Label1: TLabel; 31 34 Label2: TLabel; … … 35 38 Label6: TLabel; 36 39 Label7: TLabel; 40 Label8: TLabel; 41 Label9: TLabel; 37 42 ListView1: TListView; 38 Panel1: TPanel; 39 Panel2: TPanel; 43 MenuItem1: TMenuItem; 44 MenuItem2: TMenuItem; 45 MenuItem3: TMenuItem; 46 OpenPictureDialog1: TOpenPictureDialog; 47 PageControl1: TPageControl; 48 PopupMenu1: TPopupMenu; 40 49 RadioGroupGrowAmount: TRadioGroup; 41 50 RadioGroupGrowCells: TRadioGroup; … … 46 55 SpinEditVoidPercent: TSpinEdit; 47 56 Splitter1: TSplitter; 57 TabSheet1: TTabSheet; 58 TabSheet2: TTabSheet; 59 TabSheet3: TTabSheet; 48 60 TrackBarSizeX: TTrackBar; 49 61 TrackBarSizeY: TTrackBar; … … 51 63 procedure APlayerModifyExecute(Sender: TObject); 52 64 procedure APlayerRemoveExecute(Sender: TObject); 65 procedure ButtonImageBrowseClick(Sender: TObject); 53 66 procedure CheckBoxCityChange(Sender: TObject); 54 67 procedure CheckBoxVoidChange(Sender: TObject); 68 procedure ComboBoxMapShapeChange(Sender: TObject); 55 69 procedure FormCreate(Sender: TObject); 56 70 procedure FormDestroy(Sender: TObject); … … 103 117 SGrowAmountByOne = 'By one'; 104 118 SGrowAmountBySquareRoot = 'By square root'; 105 119 SRectangular = 'Rectangular'; 120 SFromImageFile = 'From image file'; 106 121 107 122 { TFormNew } … … 185 200 ItemIndex := LastIndex; 186 201 end; 202 with ComboBoxMapShape do begin 203 LastIndex := ItemIndex; 204 Clear; 205 Items.Add(SRectangular); 206 Items.Add(SFromImageFile); 207 ItemIndex := LastIndex; 208 end; 187 209 with RadioGroupGrowCells do begin 188 210 LastIndex := ItemIndex; … … 209 231 ButtonPlayerAdd.Enabled := Players.Count < MaxPlayerCount; 210 232 APlayerModify.Enabled := Assigned(ListView1.Selected); 233 EditImageFile.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage); 234 ButtonImageBrowse.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage); 211 235 Translate; 212 236 end; … … 242 266 begin 243 267 SpinEditVoidPercent.Enabled := CheckBoxVoid.Checked; 268 end; 269 270 procedure TFormNew.ComboBoxMapShapeChange(Sender: TObject); 271 begin 272 ReloadView; 244 273 end; 245 274 … … 260 289 Players.Remove(ListView1.Selected.Data); 261 290 ReloadView; 291 end; 292 end; 293 294 procedure TFormNew.ButtonImageBrowseClick(Sender: TObject); 295 begin 296 OpenPictureDialog1.FileName := EditImageFile.Text; 297 if OpenPictureDialog1.Execute then begin 298 EditImageFile.Text := OpenPictureDialog1.FileName; 262 299 end; 263 300 end; … … 309 346 ComboBoxWinObjective.ItemIndex := Integer(Game.WinObjective); 310 347 SpinEditNeutralUnits.Value := Game.MaxNeutralUnits; 348 ComboBoxMapShape.ItemIndex := Integer(Game.Map.Shape); 349 EditImageFile.Text := Game.MapImageFileName; 311 350 end; 312 351 … … 334 373 Game.WinObjective := TWinObjective(ComboBoxWinObjective.ItemIndex); 335 374 Game.MaxNeutralUnits := SpinEditNeutralUnits.Value; 375 Game.Map.Shape := TMapShape(ComboBoxMapShape.ItemIndex); 376 Game.MapImageFileName := EditImageFile.Text; 336 377 end; 337 378
Note:
See TracChangeset
for help on using the changeset viewer.