Changeset 195


Ignore:
Timestamp:
May 15, 2018, 4:30:54 PM (6 years ago)
Author:
chronos
Message:
  • Added: Settings option to automatically reopen last saved game on application start.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormSettings.lfm

    r145 r195  
    1010  Constraints.MinHeight = 327
    1111  Constraints.MinWidth = 554
     12  DesignTimePPI = 120
    1213  OnCreate = FormCreate
    1314  OnShow = FormShow
    1415  Position = poMainFormCenter
    15   LCLVersion = '1.8.0.4'
     16  LCLVersion = '1.8.2.0'
    1617  object ButtonOk: TButton
    1718    Left = 444
     
    4748    object TabSheetGeneral: TTabSheet
    4849      Caption = 'General'
    49       ClientHeight = 220
    50       ClientWidth = 540
     50      ClientHeight = 231
     51      ClientWidth = 538
    5152      object Label2: TLabel
    52         Left = 27
    53         Height = 26
     53        Left = 20
     54        Height = 20
    5455        Top = 78
    55         Width = 150
     56        Width = 116
    5657        Caption = 'Animation speed:'
    5758        ParentColor = False
     
    5960      object SpinEditAnimSpeed: TSpinEdit
    6061        Left = 232
    61         Height = 36
     62        Height = 28
    6263        Top = 72
    6364        Width = 122
     
    6667      object Label3: TLabel
    6768        Left = 368
    68         Height = 26
     69        Height = 20
    6970        Top = 82
    70         Width = 15
     71        Width = 12
    7172        Caption = '%'
    7273        ParentColor = False
    7374      end
    7475      object CheckBoxAutoSaveTurn: TCheckBox
    75         Left = 8
     76        Left = 20
    7677        Height = 27
    7778        Top = 112
    78         Width = 586
     79        Width = 584
    7980        Anchors = [akTop, akLeft, akRight]
    8081        AutoSize = False
     
    8485      object Label1: TLabel
    8586        Left = 20
    86         Height = 26
     87        Height = 20
    8788        Top = 26
    88         Width = 88
     89        Width = 68
    8990        Caption = 'Language:'
    9091        ParentColor = False
     
    9293      object ComboBoxLanguage: TComboBox
    9394        Left = 178
    94         Height = 40
     95        Height = 28
    9596        Top = 24
    9697        Width = 196
    97         ItemHeight = 0
     98        ItemHeight = 20
    9899        Style = csDropDownList
    99100        TabOrder = 2
     101      end
     102      object CheckBoxReopenLastFile: TCheckBox
     103        Left = 20
     104        Height = 24
     105        Top = 152
     106        Width = 198
     107        Caption = 'Reopen last game on start'
     108        TabOrder = 3
    100109      end
    101110    end
  • trunk/Forms/UFormSettings.pas

    r145 r195  
    1616    ButtonOk: TButton;
    1717    ButtonCancel: TButton;
     18    CheckBoxReopenLastFile: TCheckBox;
    1819    CheckBoxAutoSaveTurn: TCheckBox;
    1920    CheckBox2: TCheckBox;
     
    8586  SpinEditY.Value := Core.ScaleDPI1.DPI.Y;
    8687  CheckBoxAutoSaveTurn.Checked := Core.AutoSaveEnabled;
     88  CheckBoxReopenLastFile.Checked := Core.ReopenLastFile;
    8789end;
    8890
     
    9698  Core.ScaleDPI1.DPI := Point(SpinEditX.Value, SpinEditY.Value);
    9799  Core.AutoSaveEnabled := CheckBoxAutoSaveTurn.Checked;
     100  Core.ReopenLastFile := CheckBoxReopenLastFile.Checked;
    98101end;
    99102
  • trunk/Languages/xtactics.cs.po

    r194 r195  
    591591msgid "Developer mode"
    592592msgstr "Vývojářský režim"
     593
     594#: tformsettings.checkboxreopenlastfile.caption
     595msgid "Reopen last game on start"
     596msgstr "Znovuotevřít poslední hru při startu"
    593597
    594598#: tformsettings.label1.caption
  • trunk/Languages/xtactics.po

    r194 r195  
    575575#: tformsettings.checkboxdevelmode.caption
    576576msgid "Developer mode"
     577msgstr ""
     578
     579#: tformsettings.checkboxreopenlastfile.caption
     580msgid "Reopen last game on start"
    577581msgstr ""
    578582
  • trunk/Packages/CoolTranslator/UCoolTranslator.pas

    r143 r195  
    295295  Result := FPOFilesFolder;
    296296  if Copy(Result, 1, 1) <> DirectorySeparator then
    297     Result := ExtractFileDir(UTF8Encode(Application.ExeName)) +
     297    Result := ExtractFileDir(Application.ExeName) +
    298298      DirectorySeparator + Result;
    299299end;
  • trunk/UCore.pas

    r193 r195  
    6363    StoredDimension: TControlDimension;
    6464    RegistryContext: TRegistryContext;
     65    GameLoaded: Boolean;
    6566    procedure LoadRecentExecute(Sender: TObject);
    6667    procedure ProcessComputerTurns;
     
    8788    AnimationSpeed: Integer;
    8889    AutoSaveEnabled: Boolean;
     90    ReopenLastFile: Boolean;
    8991    FormClients: TFPGObjectList<TFormClient>;
    9092    Clients: TClients;
     
    163165  AnimationSpeed := XMLConfig1.GetValue('AnimationSpeed', 50);
    164166  AutoSaveEnabled := XMLConfig1.GetValue('AutoSave', True);
     167  ReopenLastFile := XMLConfig1.GetValue('ReopenLastFile', True);
    165168  CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(String(XMLConfig1.GetValue('Language', '')));
    166169  ScaleDPI1.DPI := Point(XMLConfig1.GetValue('DPIX', 96), XMLConfig1.GetValue('DPIY', 96));
     
    175178  XMLConfig1.SetValue('AnimationSpeed', AnimationSpeed);
    176179  XMLConfig1.SetValue('AutoSave', AutoSaveEnabled);
     180  XMLConfig1.SetValue('ReopenLastFile', ReopenLastFile);
    177181  XMLConfig1.SetValue('DPIX', ScaleDPI1.DPI.X);
    178182  XMLConfig1.SetValue('DPIY', ScaleDPI1.DPI.Y);
     
    186190  // Command line parameter handling
    187191  if (ParamCount > 0) then begin
    188     FileName := UTF8Encode(ParamStr(1));
     192    FileName := ParamStr(1);
    189193    if FileExists(FileName) then LoadGame(FileName);
    190194  end;
     
    294298      FormNew.Save(Server);
    295299      StartNewGame;
     300      GameLoaded := False;
    296301    end;
    297302  finally
     
    419424  NewClient: TClient;
    420425begin
     426  GameLoaded := True;
     427
    421428  Game.LoadFromFile(FileName);
    422429  Server.InitClients;
     
    541548
    542549    CommandLineParams;
     550    if not GameLoaded and ReopenLastFile and (LastOpenedList1.Items.Count > 0) then
     551      LoadGame(LastOpenedList1.Items[0]);
    543552    ScaleDPI;
    544553
Note: See TracChangeset for help on using the changeset viewer.