Changeset 66 for trunk/LocalPlayer


Ignore:
Timestamp:
Jan 14, 2017, 12:37:47 PM (8 years ago)
Author:
chronos
Message:
Location:
trunk/LocalPlayer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/LocalPlayer.pas

    r38 r66  
    2525    FormsCreated := true;
    2626    BaseWin.CreateOffscreen;
     27    // TODO: Changing application name in runtime will cause change of Linux XML registry file path
    2728//    Application.MainForm := MainScreen;
    2829    Application.CreateForm(TMainScreen, MainScreen);
    29     MainScreen.HandleNeeded; // Force to call CreateParams method
    3030    Application.CreateForm(TCityDlg, CityDlg);
    3131    Application.CreateForm(TModalSelectDlg, ModalSelectDlg);
  • trunk/LocalPlayer/Term.lfm

    r49 r66  
    2929  OnShow = FormShow
    3030  Position = poDefault
    31   LCLVersion = '1.6.0.4'
     31  LCLVersion = '1.6.2.0'
    3232  WindowState = wsMaximized
    3333  object UnitBtn: TButtonB
  • trunk/LocalPlayer/Term.pas

    r64 r66  
    33633363
    33643364procedure TMainScreen.CreateParams(var p: TCreateParams);
     3365begin
     3366  inherited;
     3367
     3368  if FullScreen then
     3369  begin
     3370    p.Style := $87000000;
     3371    BorderStyle := bsNone;
     3372    BorderIcons := [];
     3373  end;
     3374end;
     3375
     3376procedure TMainScreen.FormCreate(Sender: TObject);
    33653377var
    33663378  DefaultOptionChecked: integer;
    33673379  Reg: TRegistry;
    3368   doinit: boolean;
    3369 begin
    3370   inherited;
    3371 
    3372   // define which menu settings to save
     3380  i, j: integer;
     3381begin
     3382   // define which menu settings to save
    33733383  SaveOption[0] := mAlEffectiveMovesOnly.Tag;
    33743384  SaveOption[1] := mEnMoves.Tag;
     
    33973407
    33983408  Reg := TRegistry.Create;
    3399   doinit := true;
    3400   if Reg.KeyExists('SOFTWARE\cevo\RegVer9') then
    3401     with Reg do
    3402     begin
    3403       doinit := false;
    3404       OpenKey('SOFTWARE\cevo\RegVer9', false);
    3405       if ValueExists('TileWidth') then
    3406         xxt := ReadInteger('TileWidth') div 2
    3407       else
    3408         xxt := 48;
    3409       if ValueExists('TileHeight') then
    3410         yyt := ReadInteger('TileHeight') div 2
    3411       else
    3412         yyt := 24;
    3413       if ValueExists('OptionChecked') then
    3414         OptionChecked := ReadInteger('OptionChecked')
    3415       else
    3416         OptionChecked := DefaultOptionChecked;
    3417       if ValueExists('MapOptionChecked') then
    3418         MapOptionChecked := ReadInteger('MapOptionChecked')
    3419       else
    3420         MapOptionChecked := 1 shl moCityNames;
    3421       if ValueExists('CityMapMask') then
    3422         CityRepMask := Cardinal(ReadInteger('CityReport'))
    3423       else
    3424         CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and
     3409  with Reg do
     3410  try
     3411    OpenKey('SOFTWARE\cevo\RegVer9', false);
     3412    if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2
     3413      else xxt := 48;
     3414    if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 2
     3415      else yyt := 24;
     3416    if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')
     3417      else OptionChecked := DefaultOptionChecked;
     3418    if ValueExists('MapOptionChecked') then MapOptionChecked := ReadInteger('MapOptionChecked')
     3419      else MapOptionChecked := 1 shl moCityNames;
     3420    if ValueExists('CityReport') then CityRepMask := Cardinal(ReadInteger('CityReport'))
     3421      else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and
    34253422          not chCaptured);
    3426       CloseKey;
    3427       if OptionChecked and (7 shl 16) = 0 then
    3428         OptionChecked := OptionChecked or (1 shl 16);
     3423    CloseKey;
     3424    if OptionChecked and (7 shl 16) = 0 then
     3425      OptionChecked := OptionChecked or (1 shl 16);
    34293426      // old regver with no scrolling
    3430     end;
    3431   Reg.free;
     3427  finally
     3428    Free;
     3429  end;
    34323430
    34333431  if FullScreen then
     
    34443442  else
    34453443    SoundMode := smOn;
    3446 end;
    3447 
    3448 procedure TMainScreen.FormCreate(Sender: TObject);
    3449 var
    3450   i, j: integer;
    3451 begin
     3444
    34523445  sb := TPVScrollbar.Create;
    34533446{$IFDEF WINDOWS}{ TODO }
     
    34643457        for j := 0 to nSaveOption - 1 do
    34653458          if Components[i].Tag and $FF = SaveOption[j] then
    3466             TMenuItem(Components[i]).Checked := 1 shl j and OptionChecked <> 0;
     3459            TMenuItem(Components[i]).Checked := ((1 shl j) and OptionChecked) <> 0;
    34673460      end
    34683461      else if Components[i] is TButtonBase then
     
    79997992
    80007993  Reg := TRegistry.Create;
    8001   Reg.OpenKey('SOFTWARE\cevo\RegVer9', true);
    8002   Reg.WriteInteger('TileWidth', xxt * 2);
    8003   Reg.WriteInteger('TileHeight', yyt * 2);
    8004   Reg.WriteInteger('OptionChecked', OptionChecked);
    8005   Reg.WriteInteger('MapOptionChecked', MapOptionChecked);
    8006   Reg.WriteInteger('CityReport', integer(CityRepMask));
    8007   Reg.CloseKey;
    8008   Reg.free;
     7994  with Reg do
     7995  try
     7996    OpenKey('SOFTWARE\cevo\RegVer9', true);
     7997    WriteInteger('TileWidth', xxt * 2);
     7998    WriteInteger('TileHeight', yyt * 2);
     7999    WriteInteger('OptionChecked', OptionChecked);
     8000    WriteInteger('MapOptionChecked', MapOptionChecked);
     8001    WriteInteger('CityReport', integer(CityRepMask));
     8002    CloseKey;
     8003  finally
     8004    Free;
     8005  end;
    80098006end;
    80108007
Note: See TracChangeset for help on using the changeset viewer.