Changeset 151 for trunk/UCore.pas


Ignore:
Timestamp:
Oct 16, 2017, 2:31:46 PM (7 years ago)
Author:
chronos
Message:
  • Added: Option to disable auto reopen last file on start.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r148 r151  
    4444    StartOnLogon: Boolean;
    4545    StartMinimizedToTray: Boolean;
     46    ReopenLastFileOnStart: Boolean;
    4647    InitializeStarted: Boolean;
    4748    InitializeFinished: Boolean;
     
    107108var
    108109  FileNameOption: string;
     110  ExampleFileName: string;
    109111begin
    110112  if not InitializeStarted then begin
     
    126128    end;
    127129
     130    ExampleFileName := ExtractFileDir(Application.ExeName) + DirectorySeparator + ExampleFile;
    128131    FileNameOption := FindFirstNonOption;
    129132    if FileNameOption <> '' then begin
     
    131134      FormMain.ProjectOpen(FileNameOption);
    132135    end else
    133     if (FormMain.LastOpenedList1.Items.Count > 0) and FileExists(FormMain.LastOpenedList1.Items[0]) then begin
     136    if ReopenLastFileOnStart and (FormMain.LastOpenedList1.Items.Count > 0) and
     137      FileExists(FormMain.LastOpenedList1.Items[0]) then begin
    134138      // Open last opened file
    135139      FormMain.ProjectOpen(FormMain.LastOpenedList1.Items[0])
    136     end else begin
     140    end else
     141    if FileExists(ExampleFileName) then begin
    137142      // Open default database with examples if no item is in recent openned history
    138143      FileNameOption := ExtractFileDir(Application.ExeName) + DirectorySeparator + ExampleFile;
     
    143148      {$ENDIF}
    144149      FormMain.ProjectOpen(FileNameOption);
     150    end else begin
     151      // Create empty file
     152      FormMain.AFileNew.Execute;
    145153    end;
    146154
     
    164172    ScaleDPI1.DPI := Point(ReadIntegerWithDefault('DPIX', 96), ReadIntegerWithDefault('DPIY', 96));
    165173    ScaleDPI1.AutoDetect := ReadBoolWithDefault('DPIAuto', True);
     174    if ValueExists('LanguageCode') then
     175      CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
     176      else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
     177    AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False);
     178    StartMinimizedToTray := ReadBoolWithDefault('StartMinimizedToTray', False);
     179    ReopenLastFileOnStart := ReadBoolWithDefault('ReopenLastFileOnStart', True);
    166180  finally
    167181    Free;
     
    180194    WriteInteger('DPIY', ScaleDPI1.DPI.Y);
    181195    WriteBool('DPIAuto', ScaleDPI1.AutoDetect);
     196    if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
     197      WriteString('LanguageCode', CoolTranslator1.Language.Code)
     198      else DeleteValue('LanguageCode');
     199    WriteBool('AlwaysOnTop', AlwaysOnTop);
     200    WriteBool('StartMinimizedToTray', StartMinimizedToTray);
     201    WriteBool('ReopenLastFileOnStart', ReopenLastFileOnStart);
    182202  finally
    183203    Free;
Note: See TracChangeset for help on using the changeset viewer.