Changeset 207 for trunk/UCore.pas


Ignore:
Timestamp:
May 22, 2018, 9:43:29 AM (6 years ago)
Author:
chronos
Message:
  • Fixed: Keep correctly main form dimensions in non-maximized state. Scaling DPI was affecting its size and position.
  • Added: Remember last opened tab in New game form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r206 r207  
    6767    RegistryContext: TRegistryContext;
    6868    GameLoaded: Boolean;
     69    FormNewTabIndex: Integer;
    6970    procedure LoadRecentExecute(Sender: TObject);
    7071    procedure StartNewGame;
     
    7576    procedure GameNewTurnExecute(Sender: TObject);
    7677    procedure AutoSave;
    77     procedure LoadConfig;
    78     procedure SaveConfig;
    7978    procedure CommandLineParams;
    80     procedure ScaleDPI;
    8179    procedure SelectClient;
    8280    procedure LoadGame(FileName: string);
     
    9694    LocalClients: TClients;
    9795    ServerList: TServerList;
     96    procedure LoadConfig;
     97    procedure SaveConfig;
    9898    procedure Spectate(Player: TPlayer);
    9999    procedure UpdateActions;
     100    procedure ScaleDPI;
    100101    procedure Init;
    101102    procedure Done;
     
    127128  SPlayersNotInitialized = 'Not all players were initialized with start cell. Needed %d, initialized %d. Change map parameters to have more terrain cells.';
    128129  SFileDialogFilter = 'xTactics games (.xtg)|*.xtg|All files|*.*';
     130  SMissingServerClientForPlayer = 'Server client for current player not found.';
    129131
    130132
     
    190192  ScaleDPI1.DPI := Point(XMLConfig1.GetValue('DPIX', 96), XMLConfig1.GetValue('DPIY', 96));
    191193  ScaleDPI1.AutoDetect := XMLConfig1.GetValue('DPIAuto', True);
     194  FormNewTabIndex := XMLConfig1.GetValue('FormNewTabIndex', 0);
    192195end;
    193196
     
    203206  XMLConfig1.SetValue('DPIY', ScaleDPI1.DPI.Y);
    204207  XMLConfig1.SetValue('DPIAuto', ScaleDPI1.AutoDetect);
     208  XMLConfig1.SetValue('FormNewTabIndex', FormNewTabIndex);
    205209end;
    206210
     
    297301  try
    298302    FormNew.Load(Server);
     303    FormNew.PageControl1.TabIndex := FormNewTabIndex;
    299304    if FormNew.ShowModal = mrOk then begin
    300305      FormNew.Save(Server);
     
    303308      GameLoaded := False;
    304309    end;
     310    FormNewTabIndex := FormNew.PageControl1.TabIndex;
    305311  finally
    306312    FormNew.Free;
     
    488494  ServerClient := Server.Clients.SearchByPlayer(Game.CurrentPlayer);
    489495  if Assigned(ServerClient) then ServerClient.TurnStart
    490     else raise Exception.Create('Server client for current player not found.');
     496    else raise Exception.Create(SMissingServerClientForPlayer);
    491497end;
    492498
     
    573579  if Game.Players.GetAliveCount = Game.Players.Count then Game.Running := True
    574580    else ShowMessage(Format(SPlayersNotInitialized, [Game.Players.Count, Game.Players.GetAliveCount]));
     581  FormClient.AZoomAll.Execute;
    575582  RedrawClients;
    576583  UpdateOtherForms;
     
    578585  ServerClient := Server.Clients.SearchByPlayer(Game.CurrentPlayer);
    579586  if Assigned(ServerClient) then ServerClient.TurnStart
    580     else raise Exception.Create('Server client for current player not found.');
     587    else raise Exception.Create(SMissingServerClientForPlayer);
    581588end;
    582589
     
    616623    GameSettings.Players[1].Name := SPlayer + ' 2';
    617624
    618     LoadConfig;
    619625    GameSettings.LoadConfig(XMLConfig1, 'Game');
    620626    Server.LoadConfig(XMLConfig1, 'Server');
     
    624630    if not GameLoaded and ReopenLastFile and (LastOpenedList1.Items.Count > 0) then
    625631      LoadGame(LastOpenedList1.Items[0]);
    626     ScaleDPI;
    627632    FormClientActions;
    628633
Note: See TracChangeset for help on using the changeset viewer.