Ignore:
Timestamp:
Jul 19, 2024, 11:24:06 PM (2 months ago)
Author:
chronos
Message:
  • Fixed: Full screen mode switching on Windows.
  • Modified: Updated Common package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormMain.pas

    r103 r107  
    44
    55uses
    6   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, LCLType,
     6  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, LCLType, FormEx,
    77  Dialogs, ExtCtrls, ComCtrls, Menus, ActnList, Engine, Platform, Math,
    88  DateUtils, GraphType, PersistentForm, ApplicationInfo, Translator,
     
    1313  { TFormMain }
    1414
    15   TFormMain = class(TForm)
     15  TFormMain = class(TFormEx)
    1616    AAbout: TAction;
    1717    AShowRawImageDesc: TAction;
     
    4141    procedure AShowMapExecute(Sender: TObject);
    4242    procedure AShowRawImageDescExecute(Sender: TObject);
    43     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    4443    procedure FormCreate(Sender: TObject);
    4544    procedure FormDestroy(Sender: TObject);
     
    5352    StartTime: TDateTime;
    5453    Drawing: Boolean;
    55     FullScreenEnabled: Boolean;
    5654    procedure LoadConfig;
    5755    procedure SaveConfig;
    5856    procedure UpdateInterface;
    5957  public
    60     PersistentForm: TPersistentForm;
    6158    Engine: TEngine;
    6259    FormNewGame: TFormNewGame;
     
    145142begin
    146143  {$IFDEF LCLQT5}
    147   MenuItem1.Visible := not FullScreenEnabled;
    148   MenuItem4.Visible := not FullScreenEnabled;
    149   MenuItem7.Visible := not FullScreenEnabled;
     144  MenuItem1.Visible := not FullScreen;
     145  MenuItem4.Visible := not FullScreen;
     146  MenuItem7.Visible := not FullScreen;
    150147  {$ELSE}
    151   if FullScreenEnabled then Menu := nil
     148  if FullScreen then Menu := nil
    152149    else Menu := MainMenu1;
    153150  {$ENDIF}
    154151  {$IFDEF DEBUG}
    155   StatusBar1.Visible := not FullScreenEnabled;
     152  StatusBar1.Visible := not FullScreen;
    156153  AShowMap.Visible := True;
    157154  ANewGame.Visible := True;
     
    178175
    179176  Image1.ControlStyle := Image1.ControlStyle + [csOpaque];
    180   FullScreenEnabled := True;
    181 
    182   PersistentForm := TPersistentForm.Create(nil);
    183   PersistentForm.RegistryContext := TRegistryContext.Create(Core.Core.ApplicationInfo.RegistryRoot,
    184     Core.Core.ApplicationInfo.RegistryKey);
     177  FullScreen := True;
    185178
    186179  Application.OnDeactivate := FormDeactivate;
     
    214207procedure TFormMain.AFullScreenExecute(Sender: TObject);
    215208begin
    216   FullScreenEnabled := not FullScreenEnabled;
    217   PersistentForm.SetFullScreen(FullScreenEnabled);
     209  FullScreen := not FullScreen;
     210  TFormEx.PersistentForm.Load(Self);
     211  TFormEx.PersistentForm.SetFullScreen(FullScreen);
    218212  UpdateInterface;
    219213end;
     
    244238end;
    245239
    246 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    247 begin
    248   PersistentForm.Save(Self);
    249 end;
    250 
    251240procedure TFormMain.AExitExecute(Sender: TObject);
    252241begin
     
    282271procedure TFormMain.FormShow(Sender: TObject);
    283272begin
    284   PersistentForm.RegistryContext := Core.Core.ApplicationInfo.GetRegistryContext;
    285   PersistentForm.Load(Self, False, True);
    286   FullScreenEnabled := PersistentForm.FormFullScreen;
    287   //PersistentForm.SetFullScreen(FullScreenEnabled);
    288273  UpdateInterface;
    289274end;
Note: See TracChangeset for help on using the changeset viewer.