Changeset 115 for trunk/UCore.pas


Ignore:
Timestamp:
Feb 15, 2022, 3:46:22 PM (3 years ago)
Author:
chronos
Message:
  • Added: New tool action View source to show source code for loaded contacts. Source text can be edited and saved back. The editor shows line numbers and use color highlighting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r103 r115  
    1717    AAbout: TAction;
    1818    AboutDialog1: TAboutDialog;
     19    AViewSource: TAction;
    1920    ATest: TAction;
    2021    AFind: TAction;
     
    5960    procedure ASettingsExecute(Sender: TObject);
    6061    procedure ATestExecute(Sender: TObject);
     62    procedure AViewSourceExecute(Sender: TObject);
    6163    procedure DataModuleCreate(Sender: TObject);
    6264    procedure DataModuleDestroy(Sender: TObject);
     
    106108uses
    107109  UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity,
    108   UFormGenerate, UFormError, UFormFind, UFormTest;
     110  UFormGenerate, UFormError, UFormFind, UFormTest, UFormSource;
    109111
    110112resourcestring
     
    274276  try
    275277    ShowModal;
     278  finally
     279    Free;
     280  end;
     281end;
     282
     283procedure TCore.AViewSourceExecute(Sender: TObject);
     284begin
     285  with TFormSource.Create(nil) do
     286  try
     287    Source := TContactsFile(DataFile).AsString;
     288    if ShowModal = mrOk then begin
     289      TContactsFile(DataFile).AsString := Source;
     290      UpdateFile;
     291    end;
    276292  finally
    277293    Free;
Note: See TracChangeset for help on using the changeset viewer.