Changeset 317 for trunk/Forms/FormMain.pas
- Timestamp:
- Jun 21, 2024, 12:44:53 PM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormMain.pas
r316 r317 1 unit UFormMain;1 unit FormMain; 2 2 3 3 interface … … 5 5 uses 6 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 7 UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM; 7 Game, LCLType, Menus, ActnList, ComCtrls, DateUtils, XMLConf, DOM, FormClient, 8 FormKeyShortcuts, FormPlayersStats, FormUnitMoves, FormCharts, FormEx; 8 9 9 10 const … … 15 16 { TFormMain } 16 17 17 TFormMain = class(TForm )18 TFormMain = class(TFormEx) 18 19 AUnitShapeVisible: TAction; 19 20 AMapGridVisible: TAction; … … 93 94 procedure UpdateClientForms; 94 95 public 96 FormClient: TFormClient; 97 FormKeyShortcuts: TFormKeyShortcuts; 98 FormPlayersStats: TFormPlayersStats; 99 FormUnitMoves: TFormUnitMoves; 100 FormCharts: TFormCharts; 95 101 procedure LoadConfig(Config: TXmlConfig; Path: string); 96 102 procedure SaveConfig(Config: TXmlConfig; Path: string); … … 98 104 end; 99 105 100 var101 FormMain: TFormMain;102 103 106 104 107 implementation 105 108 106 109 uses 107 UCore, UFormClient;110 Core; 108 111 109 112 resourcestring … … 124 127 begin 125 128 NewCaption := 'xTactics'; 126 if Assigned(Core.Game.CurrentPlayer) then 127 NewCaption := Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' + IntToStr(Core.Game.TurnCounter) + ' - ' + NewCaption; 129 if Assigned(Core.Core.Game.CurrentPlayer) then 130 NewCaption := Core.Core.Game.CurrentPlayer.Name + ' - ' + STurn + ' ' + 131 IntToStr(Core.Core.Game.TurnCounter) + ' - ' + NewCaption; 128 132 Caption := NewCaption; 129 133 end; … … 150 154 begin 151 155 if AToolBarBigIcons.Checked then begin 152 ToolBar1.Images := Core. ImageListLarge;153 ToolBar1.ButtonWidth := Core. ImageListLarge.Width + 7;154 ToolBar1.ButtonHeight := Core. ImageListLarge.Height + 6;155 ToolBar1.Width := Core. ImageListLarge.Width + 10;156 ToolBar1.Height := Core. ImageListLarge.Height + 10;156 ToolBar1.Images := Core.Core.ImageListLarge; 157 ToolBar1.ButtonWidth := Core.Core.ImageListLarge.Width + 7; 158 ToolBar1.ButtonHeight := Core.Core.ImageListLarge.Height + 6; 159 ToolBar1.Width := Core.Core.ImageListLarge.Width + 10; 160 ToolBar1.Height := Core.Core.ImageListLarge.Height + 10; 157 161 end else begin 158 ToolBar1.Images := Core. ImageListSmall;159 ToolBar1.ButtonWidth := Core. ImageListSmall.Width + 7;160 ToolBar1.ButtonHeight := Core. ImageListSmall.Height + 6;161 ToolBar1.Width := Core. ImageListSmall.Width + 10;162 ToolBar1.Height := Core. ImageListSmall.Height + 10;162 ToolBar1.Images := Core.Core.ImageListSmall; 163 ToolBar1.ButtonWidth := Core.Core.ImageListSmall.Width + 7; 164 ToolBar1.ButtonHeight := Core.Core.ImageListSmall.Height + 6; 165 ToolBar1.Width := Core.Core.ImageListSmall.Width + 10; 166 ToolBar1.Height := Core.Core.ImageListSmall.Height + 10; 163 167 end; 164 168 ToolBar1.Visible := AToolBarVisible.Checked; … … 227 231 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 228 232 begin 229 Core.Game.Running := False; 230 Core.PersistentForm.Save(Self); 231 SaveConfig(Core.XMLConfig1, 'FormMain'); 232 Core.CellGridVisible := AMapGridVisible.Checked; 233 Core.UnitShapeVisible := AUnitShapeVisible.Checked; 234 Core.Done; 233 Core.Core.Game.Running := False; 234 SaveConfig(Core.Core.XMLConfig1, 'FormMain'); 235 Core.Core.CellGridVisible := AMapGridVisible.Checked; 236 Core.Core.UnitShapeVisible := AUnitShapeVisible.Checked; 237 Core.Core.Done; 235 238 end; 236 239 237 240 procedure TFormMain.FormDestroy(Sender: TObject); 238 241 begin 239 F ormClient.Free;242 FreeAndNil(FormClient); 240 243 end; 241 244 242 245 procedure TFormMain.ApplicationStart(Ptr: IntPtr); 243 246 begin 244 Core. ReopenGameOnInit;247 Core.Core.ReopenGameOnInit; 245 248 end; 246 249 … … 255 258 FormClient.AStatusBarVisible.Checked := AStatusBarVisible.Checked; 256 259 FormClient.AStatusBarVisible.Update; 257 Core.C ellGridVisible := AMapGridVisible.Checked;258 Core. UnitShapeVisible := AUnitShapeVisible.Checked;260 Core.Core.CellGridVisible := AMapGridVisible.Checked; 261 Core.Core.UnitShapeVisible := AUnitShapeVisible.Checked; 259 262 if Assigned(FormClient.Client) then begin 260 FormClient.Client.CellGridVisible := Core.C ellGridVisible;261 FormClient.Client.UnitShapeVisible := Core. UnitShapeVisible;263 FormClient.Client.CellGridVisible := Core.Core.CellGridVisible; 264 FormClient.Client.UnitShapeVisible := Core.Core.UnitShapeVisible; 262 265 end; 263 266 FormClient.Redraw; 264 for I := 0 to Core. FormClients.Count - 1 do begin265 Core. FormClients[I].AToolBarBigIcons.Checked := AToolBarBigIcons.Checked;266 Core. FormClients[I].AToolBarBigIcons.Update;267 Core. FormClients[I].AToolBarVisible.Checked := AToolBarVisible.Checked;268 Core. FormClients[I].AToolBarVisible.Update;269 Core. FormClients[I].AStatusBarVisible.Checked := AStatusBarVisible.Checked;270 Core. FormClients[I].AStatusBarVisible.Update;271 if Assigned(Core. FormClients[I].Client) then begin272 Core. FormClients[I].Client.CellGridVisible :=Core.CellGridVisible;273 Core. FormClients[I].Client.UnitShapeVisible :=Core.UnitShapeVisible;267 for I := 0 to Core.Core.FormClients.Count - 1 do begin 268 Core.Core.FormClients[I].AToolBarBigIcons.Checked := AToolBarBigIcons.Checked; 269 Core.Core.FormClients[I].AToolBarBigIcons.Update; 270 Core.Core.FormClients[I].AToolBarVisible.Checked := AToolBarVisible.Checked; 271 Core.Core.FormClients[I].AToolBarVisible.Update; 272 Core.Core.FormClients[I].AStatusBarVisible.Checked := AStatusBarVisible.Checked; 273 Core.Core.FormClients[I].AStatusBarVisible.Update; 274 if Assigned(Core.Core.FormClients[I].Client) then begin 275 Core.Core.FormClients[I].Client.CellGridVisible := Core.Core.CellGridVisible; 276 Core.Core.FormClients[I].Client.UnitShapeVisible := Core.Core.UnitShapeVisible; 274 277 end; 275 Core. FormClients[I].Redraw;278 Core.Core.FormClients[I].Redraw; 276 279 end; 277 280 end; … … 280 283 begin 281 284 if not FormShown then begin 282 Core.LoadConfig; 283 AMapGridVisible.Checked := Core.CellGridVisible; 284 AUnitShapeVisible.Checked := Core.UnitShapeVisible; 285 Core.ScaleDPI; 286 Core.PersistentForm.Load(Self); 287 FullScreen := Core.PersistentForm.FormFullScreen; 288 Core.ThemeManager1.UseTheme(Self); 289 Core.Init; 290 LoadConfig(Core.XMLConfig1, 'FormMain'); 285 AMapGridVisible.Checked := Core.Core.CellGridVisible; 286 AUnitShapeVisible.Checked := Core.Core.UnitShapeVisible; 287 Core.Core.ScaleDPI; 288 FullScreen := Core.Core.PersistentForm1.FormFullScreen; 289 Core.Core.Init; 290 LoadConfig(Core.Core.XMLConfig1, 'FormMain'); 291 291 ReloadView; 292 292 FormClient.Show;
Note:
See TracChangeset
for help on using the changeset viewer.