- Timestamp:
- Jun 19, 2017, 10:06:50 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r128 r132 1 1 object FormMain: TFormMain 2 Left = 7842 Left = 577 3 3 Height = 621 4 Top = 4354 Top = 309 5 5 Width = 775 6 6 Caption = 'xTactics' 7 ClientHeight = 5 897 ClientHeight = 596 8 8 ClientWidth = 775 9 9 Menu = MainMenu1 10 OnActivate = FormActivate11 10 OnClose = FormClose 12 11 OnCreate = FormCreate … … 14 13 OnKeyUp = FormKeyUp 15 14 OnShow = FormShow 16 LCLVersion = '1.6. 4.0'15 LCLVersion = '1.6.2.0' 17 16 WindowState = wsMaximized 18 17 object StatusBar1: TStatusBar 19 18 Left = 0 20 19 Height = 28 21 Top = 56 120 Top = 568 22 21 Width = 775 23 22 Panels = < … … 35 34 object ToolBar1: TToolBar 36 35 Left = 0 37 Height = 56 136 Height = 568 38 37 Top = 0 39 38 Width = 80 … … 118 117 object PaintBox1: TPaintBox 119 118 Left = 80 120 Height = 56 1119 Height = 568 121 120 Top = 0 122 121 Width = 695 -
trunk/Forms/UFormMain.pas
r128 r132 75 75 procedure AZoomInExecute(Sender: TObject); 76 76 procedure AZoomOutExecute(Sender: TObject); 77 procedure FormActivate(Sender: TObject);78 77 procedure FormShow(Sender: TObject); 79 78 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 242 241 end; 243 242 244 procedure TFormMain.FormActivate(Sender: TObject);245 begin246 if not Core.Initialized then begin247 Core.Init;248 end;249 end;250 251 243 procedure TFormMain.AZoomAllExecute(Sender: TObject); 252 244 var … … 313 305 begin 314 306 Core.Game.Running := False; 307 Core.PersistentForm.Save(Self); 315 308 SaveConfig(Core.XMLConfig1, 'FormMain'); 316 Core. PersistentForm.Save(Self);309 Core.XMLConfig1.Flush; 317 310 end; 318 311 … … 334 327 procedure TFormMain.FormShow(Sender: TObject); 335 328 begin 336 Core. XMLConfig1.Filename := 'Config.xml';329 Core.Init; 337 330 LoadConfig(Core.XMLConfig1, 'FormMain'); 338 Core.PersistentForm.Load(Self, True);331 Core.PersistentForm.Load(Self, wsMaximized); 339 332 ReloadView; 340 333 Redraw; -
trunk/Packages/Common/UPersistentForm.pas
r116 r132 26 26 FormWindowState: TWindowState; 27 27 Form: TForm; 28 DefaultFormWindowState: TWindowState; 28 29 procedure LoadFromRegistry(RegistryContext: TRegistryContext); 29 30 procedure SaveToRegistry(RegistryContext: TRegistryContext); 30 31 function CheckEntireVisible(Rect: TRect): TRect; 31 32 function CheckPartVisible(Rect: TRect; Part: Integer): TRect; 32 procedure Load(Form: TForm; Default Maximized: Boolean = False);33 procedure Load(Form: TForm; DefaultFormWindowState: TWindowState = wsNormal); 33 34 procedure Save(Form: TForm); 34 35 constructor Create(AOwner: TComponent); override; … … 56 57 I: Integer; 57 58 WinControl: TWinControl; 58 Count: Integer;59 59 begin 60 60 if Control is TListView then begin … … 135 135 + FormRestoredSize.Top; 136 136 // Other state 137 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer( wsNormal)));137 FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(DefaultFormWindowState))); 138 138 finally 139 139 Free; … … 216 216 end; 217 217 218 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False); 219 var 220 LoadDefaults: Boolean; 218 procedure TPersistentForm.Load(Form: TForm; DefaultFormWindowState: TWindowState = wsNormal); 221 219 begin 222 220 Self.Form := Form; 221 Self.DefaultFormWindowState := DefaultFormWindowState; 222 223 223 // Set default 224 224 FormNormalSize := Bounds((Screen.Width - Form.Width) div 2, … … 230 230 231 231 if not EqualRect(FormNormalSize, FormRestoredSize) or 232 ( LoadDefaults and DefaultMaximized) then begin232 (FormWindowState = wsMaximized) then begin 233 233 // Restore to maximized state 234 234 Form.WindowState := wsNormal; -
trunk/UCore.pas
r130 r132 224 224 FormNew.Show; 225 225 FormNew.Hide; 226 for I := 0 to Screen.FormCount - 1 do begin 226 for I := 0 to Screen.FormCount - 1 do 227 if (Screen.Forms[I].WindowState = wsNormal) or 228 (Screen.Forms[I].WindowState = wsMinimized) then begin 227 229 StoreDimensions(Screen.Forms[I], StoredDimension); 228 230 ScaleDimensions(Screen.Forms[I], StoredDimension); … … 436 438 procedure TCore.Init; 437 439 begin 438 {$IFDEF Linux} 439 // If installed in Linux system then use installation directory for po files 440 if Application.ExeName = '/usr/bin/xtactics' then 441 CoolTranslator1.POFilesFolder := '/usr/share/xtactics/languages'; 442 {$ENDIF} 443 FInitialized := True; 444 445 LoadConfig; 446 Game.LoadConfig(XMLConfig1, 'Game'); 447 448 // Update translated default player names 449 TPlayer(Game.Players[0]).Name := SPlayer + ' 1'; 450 TPlayer(Game.Players[1]).Name := SPlayer + ' 2'; 451 452 CommandLineParams; 453 ScaleDPI; 454 455 if Game.FileName = '' then StartNewGame; 440 if not Core.Initialized then begin 441 {$IFDEF Linux} 442 // If installed in Linux system then use installation directory for po files 443 if Application.ExeName = '/usr/bin/xtactics' then 444 CoolTranslator1.POFilesFolder := '/usr/share/xtactics/languages'; 445 {$ENDIF} 446 FInitialized := True; 447 448 LoadConfig; 449 Game.LoadConfig(XMLConfig1, 'Game'); 450 451 // Update translated default player names 452 TPlayer(Game.Players[0]).Name := SPlayer + ' 1'; 453 TPlayer(Game.Players[1]).Name := SPlayer + ' 2'; 454 455 CommandLineParams; 456 ScaleDPI; 457 458 if Game.FileName = '' then StartNewGame; 459 end; 456 460 end; 457 461 -
trunk/xtactics.lpi
r128 r132 2 2 <CONFIG> 3 3 <ProjectOptions> 4 <Version Value=" 10"/>4 <Version Value="9"/> 5 5 <General> 6 6 <SessionStorage Value="InProjectDir"/> … … 279 279 <StackChecks Value="True"/> 280 280 </Checks> 281 <VerifyObjMethodCallValidity Value="True"/>282 281 </CodeGeneration> 283 282 <Linking>
Note:
See TracChangeset
for help on using the changeset viewer.