Ignore:
Timestamp:
Jan 17, 2025, 9:05:54 PM (4 days ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
  • Modified: Remove U prefix from unit names.
  • Modified: Use Gneeric.Collections instead of fgl.
  • Modified: Do not use global form variables.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormImport.pas

    r218 r219  
    1 unit UFormImport;
    2 
    3 {$mode delphi}{$H+}
     1unit FormImport;
    42
    53interface
     
    75uses
    86  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   UAcronym;
     7  Acronym, FormEx;
    108
    119type
     
    1311  { TFormImport }
    1412
    15   TFormImport = class(TForm)
     13  TFormImport = class(TFormEx)
    1614    ButtonLoadFromFile: TButton;
    1715    ButtonProcess: TButton;
     
    2220    procedure ButtonProcessClick(Sender: TObject);
    2321    procedure ButtonLoadFromFileClick(Sender: TObject);
    24     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    25     procedure FormCreate(Sender: TObject);
    26     procedure FormShow(Sender: TObject);
    2722  private
    2823    procedure ImportMediaWiki;
    2924    procedure ImportCSV;
    30   public
    31     { public declarations }
    3225  end;
    3326
    34 var
    35   FormImport: TFormImport;
    3627
    3728implementation
     
    4031
    4132uses
    42   UCore;
     33  Core;
    4334
    4435resourcestring
    4536  SImportedNewAcronyms = 'Imported %d new acronyms.';
    46 
    4737
    4838{ TFormImport }
     
    6050  if OpenDialog1.Execute then
    6151    Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
    62 end;
    63 
    64 procedure TFormImport.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    65 begin
    66   Core.PersistentForm1.Save(Self);
    67 end;
    68 
    69 procedure TFormImport.FormCreate(Sender: TObject);
    70 begin
    71   Core.Translator.TranslateComponentRecursive(Self);
    72   Core.ThemeManager.UseTheme(Self);
    73 end;
    74 
    75 procedure TFormImport.FormShow(Sender: TObject);
    76 begin
    77   Core.PersistentForm1.Load(Self);
    7852end;
    7953
     
    10175      AcronymMeaning := Trim(Copy(Line, 2, Length(Line)));
    10276      if (AcronymName <> '') and (AcronymMeaning <> '') then begin
    103         Acronym := Core.AcronymDb.Acronyms.SearchByName(AcronymName);
     77        Acronym := Core.Core.AcronymDb.Acronyms.SearchByName(AcronymName);
    10478        if not Assigned(Acronym) then begin
    10579          Acronym := TAcronym.Create;
    10680          Acronym.Name := AcronymName;
    107           Core.AcronymDb.Acronyms.Add(Acronym);
     81          Core.Core.AcronymDb.Acronyms.Add(Acronym);
    10882        end;
    10983        Meaning := Acronym.Meanings.SearchByName(AcronymMeaning);
     
    11892    end;
    11993  end;
    120   if AddedCount > 0 then Core.AcronymDb.Modified := True;
     94  if AddedCount > 0 then Core.Core.AcronymDb.Modified := True;
    12195  ShowMessage(Format(SImportedNewAcronyms, [AddedCount]));
    12296end;
     
    147121      else AcronymDescription := '';
    148122    if (AcronymName <> '') and (AcronymDescription <> '') then begin
    149       Acronym := Core.AcronymDb.Acronyms.SearchByName(AcronymName);
     123      Acronym := Core.Core.AcronymDb.Acronyms.SearchByName(AcronymName);
    150124      if not Assigned(Acronym) then begin
    151125        Acronym := TAcronym.Create;
    152126        Acronym.Name := AcronymName;
    153         Core.AcronymDb.Acronyms.Add(Acronym);
     127        Core.Core.AcronymDb.Acronyms.Add(Acronym);
    154128      end;
    155129      Meaning := Acronym.Meanings.SearchByName(AcronymDescription);
     
    165139  end;
    166140  Columns.Free;
    167   if AddedCount > 0 then Core.AcronymDb.Modified := True;
     141  if AddedCount > 0 then Core.Core.AcronymDb.Modified := True;
    168142  ShowMessage(Format(SImportedNewAcronyms, [AddedCount]));
    169143end;
Note: See TracChangeset for help on using the changeset viewer.