Changeset 43 for trunk/Forms/UNewGameForm.pas
- Timestamp:
- Apr 19, 2019, 11:25:56 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UNewGameForm.pas
r41 r43 17 17 ButtonCancel: TButton; 18 18 ColorButton1: TColorButton; 19 ColorButton2: TColorButton; 19 20 EditUp: TEdit; 20 21 EditDown: TEdit; … … 32 33 Label7: TLabel; 33 34 Label8: TLabel; 35 Label9: TLabel; 34 36 ListView1: TListView; 35 37 procedure ColorButton1ColorChanged(Sender: TObject); 38 procedure ColorButton2ColorChanged(Sender: TObject); 36 39 procedure EditDownChange(Sender: TObject); 37 40 procedure EditDownKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState … … 54 57 procedure ListView1Change(Sender: TObject; Item: TListItem; 55 58 Change: TItemChange); 59 procedure ListView1CustomDrawSubItem(Sender: TCustomListView; 60 Item: TListItem; SubItem: Integer; State: TCustomDrawState; 61 var DefaultDraw: Boolean); 56 62 procedure ListView1Data(Sender: TObject; Item: TListItem); 57 63 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; … … 61 67 procedure ReloadList; 62 68 public 69 procedure UpdateInterface; 63 70 procedure LoadData(Engine: TEngine); 64 71 procedure SaveData(Engine: TEngine); … … 73 80 {$R *.lfm} 74 81 82 uses 83 UMainForm; 84 75 85 { TNewGameForm } 76 86 … … 80 90 if Change = ctState then 81 91 TPlayer(Item.Data).Enabled := Item.Checked; 92 end; 93 94 procedure TNewGameForm.ListView1CustomDrawSubItem(Sender: TCustomListView; 95 Item: TListItem; SubItem: Integer; State: TCustomDrawState; 96 var DefaultDraw: Boolean); 97 begin 98 if SubItem = 1 then 99 with ListView1.Canvas do begin 100 Brush.Color := TPlayer(Item.Data).Color1; 101 Brush.Style := bsSolid; 102 FillRect(Item.DisplayRectSubItem(1, drBounds)); 103 end; 82 104 end; 83 105 … … 87 109 with TPlayer(Players[Item.Index]) do begin 88 110 Item.Caption := Name; 89 Item.SubItems.Add( IntToHex(Color, 6));111 Item.SubItems.Add(''); 90 112 Item.SubItems.Add(''); 91 113 Item.Checked := Enabled; … … 100 122 with TPlayer(Item.Data) do begin 101 123 EditName.Text := Name; 102 ColorButton1.ButtonColor := Color; 124 ColorButton1.ButtonColor := Color1; 125 ColorButton2.ButtonColor := Color2; 103 126 EditDown.Text := IntToStr(Keys.Down); 104 127 EditUp.Text := IntToStr(Keys.Up); … … 107 130 EditShoot.Text := IntToStr(Keys.Shoot); 108 131 end; 132 UpdateInterface; 109 133 end; 110 134 … … 115 139 end; 116 140 141 procedure TNewGameForm.UpdateInterface; 142 begin 143 EditUp.Enabled := Assigned(ListView1.Selected); 144 EditDown.Enabled := Assigned(ListView1.Selected); 145 EditLeft.Enabled := Assigned(ListView1.Selected); 146 EditRight.Enabled := Assigned(ListView1.Selected); 147 EditShoot.Enabled := Assigned(ListView1.Selected); 148 EditName.Enabled := Assigned(ListView1.Selected); 149 ColorButton1.Enabled := Assigned(ListView1.Selected); 150 ColorButton2.Enabled := Assigned(ListView1.Selected); 151 end; 152 117 153 procedure TNewGameForm.LoadData(Engine: TEngine); 118 154 begin … … 129 165 if Assigned(ListView1.Selected) then 130 166 with TPlayer(ListView1.Selected.Data) do begin 131 Color := ColorButton1.ButtonColor; 167 Color1 := ColorButton1.ButtonColor; 168 ReloadList; 169 end; 170 end; 171 172 procedure TNewGameForm.ColorButton2ColorChanged(Sender: TObject); 173 begin 174 if Assigned(ListView1.Selected) then 175 with TPlayer(ListView1.Selected.Data) do begin 176 Color2 := ColorButton2.ButtonColor; 132 177 ReloadList; 133 178 end; … … 230 275 procedure TNewGameForm.FormCreate(Sender: TObject); 231 276 begin 232 Players := TPlayers.Create 277 MainForm.CoolTranslator1.TranslateComponentRecursive(Self); 278 Players := TPlayers.Create; 233 279 end; 234 280 … … 241 287 begin 242 288 ReloadList; 289 UpdateInterface; 243 290 end; 244 291
Note:
See TracChangeset
for help on using the changeset viewer.