Ignore:
Timestamp:
Jan 17, 2025, 9:39:06 PM (4 days ago)
Author:
chronos
Message:
  • Added: Key shortcuts form.
  • Added: Action to switch to fullscreen mode.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormMain.pas

    r219 r220  
    77  ComCtrls, StdCtrls, ExtCtrls, ActnList, Grids, Acronym, PersistentForm,
    88  RegistryEx, LastOpenedList, ListViewSort, JobProgressView, FormAbout,
    9   Registry, Generics.Collections, LazUTF8, LazFileUtils, FormEx;
     9  Registry, Generics.Collections, LazUTF8, LazFileUtils, FormEx,
     10  FormKeyShortcuts;
    1011
    1112type
     
    1415
    1516  TFormMain = class(TFormEx)
     17    AFullScreen: TAction;
     18    AShowKeyShortCuts: TAction;
    1619    AFilterShowItemsWithoutFilter: TAction;
    1720    ADocumentCheck: TAction;
     
    5356    MenuItem26: TMenuItem;
    5457    MenuItem27: TMenuItem;
     58    MenuItem28: TMenuItem;
     59    MenuItem29: TMenuItem;
    5560    N1: TMenuItem;
    5661    MenuItem3: TMenuItem;
     
    117122    procedure AFilterSameLengthExecute(Sender: TObject);
    118123    procedure AFilterShowItemsWithoutFilterExecute(Sender: TObject);
     124    procedure AFullScreenExecute(Sender: TObject);
    119125    procedure AHideExecute(Sender: TObject);
    120126    procedure AImportExecute(Sender: TObject);
     
    129135    procedure AShowImportSourcesExecute(Sender: TObject);
    130136    procedure EditSearchChange(Sender: TObject);
     137    procedure FormDestroy(Sender: TObject);
    131138    procedure FormHide(Sender: TObject);
    132139    procedure FormResize(Sender: TObject);
     
    147154    procedure MenuItemStatusBarClick(Sender: TObject);
    148155    procedure MenuItemToolbarClick(Sender: TObject);
     156    procedure AShowKeyShortcutsExecute(Sender: TObject);
    149157  private
     158    FullScreen: Boolean;
    150159    RegistryContext: TRegistryContext;
    151160    ProjectClosed: Boolean;
    152161    ImportTotalItemCount: Integer;
     162    FormKeyShortcuts: TFormKeyShortcuts;
    153163    procedure AcronymDbUpdate(Sender: TObject);
    154164    function FilterCell(Text1, Text2: string): Boolean;
     
    165175  end;
    166176
     177const
     178  ProjectExt = '.adp';
     179
    167180resourcestring
    168181  SAddedCount = 'Imported %d acronyms. Added %d new.';
     
    170183  SAcronymsCount = 'Acronyms count: %d';
    171184  SMeaningsCount = 'Meanings count: %d';
    172   SFileFilter = 'Acronym Decoder project (.adp)|*.adp|All files|*.*';
     185  SFileFilter = 'Acronym Decoder project (' + ProjectExt + ')|*' + ProjectExt + '|All files|*.*';
    173186
    174187
     
    187200
    188201const
    189   ProjectExt = '.adp';
    190202  DefaultFileName = 'Acronyms' + ProjectExt;
    191203  RegistryRunKey = '\Software\Microsoft\Windows\CurrentVersion\Run';
     
    220232begin
    221233  UpdateAcronymsList;
     234end;
     235
     236procedure TFormMain.FormDestroy(Sender: TObject);
     237begin
     238  if Assigned(FormKeyShortcuts) then FreeAndNil(FormKeyShortcuts);
    222239end;
    223240
     
    371388end;
    372389
     390procedure TFormMain.AFullScreenExecute(Sender: TObject);
     391begin
     392  FullScreen := not FullScreen;
     393  TFormEx.PersistentForm.Form := Self;
     394  TFormEx.PersistentForm.SetFullScreen(FullScreen);
     395  UpdateInterface;
     396end;
     397
    373398procedure TFormMain.AHideExecute(Sender: TObject);
    374399begin
     
    530555procedure TFormMain.FormShow(Sender: TObject);
    531556begin
     557  FullScreen := Core.Core.PersistentForm1.FormFullScreen;
    532558  Core.Core.Initialize;
    533559
     
    594620    if ListViewSort1.Order = soDown then Result := -Result;
    595621  end else Result := 0;
     622end;
     623
     624procedure TFormMain.AShowKeyShortcutsExecute(Sender: TObject);
     625begin
     626  if not Assigned(FormKeyShortcuts) then
     627    FormKeyShortcuts := TFormKeyShortcuts.Create(nil);
     628  with FormKeyShortcuts do begin
     629    Images := Core.Core.ImageListSmall;
     630    SourceComponents.Clear;
     631    SourceComponents.Add(Self);
     632    Show;
     633  end;
    596634end;
    597635
     
    708746  Title: string;
    709747begin
     748  AFullscreen.Checked := FullScreen;
    710749  ListViewAcronyms.Enabled := Assigned(Core.Core.AcronymDb);
    711750  AFileClose.Enabled := Assigned(Core.Core.AcronymDb);
Note: See TracChangeset for help on using the changeset viewer.