Ignore:
Timestamp:
Jul 4, 2018, 2:05:48 PM (6 years ago)
Author:
chronos
Message:
  • Added: New menu action Tools - Document check which shows a form for checking acronyms in text documents.
  • Added: Remember dimensions of Import, Export and Settings forms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormAcronyms.pas

    r174 r184  
    5050    procedure ListViewSort1Filter(ListViewSort: TListViewSort);
    5151  private
     52    FAcronyms: TAcronyms;
    5253    MeaningCount: Integer;
    5354    procedure FilterList(List: TListObject);
     55    procedure SetAcronyms(AValue: TAcronyms);
    5456    procedure UpdateAcronymsList;
    5557  public
    5658    FocusAcronym: TAcronymMeaning;
     59    property Acronyms: TAcronyms read FAcronyms write SetAcronyms;
    5760    procedure UpdateInterface;
    5861  end;
     
    147150    if FormAcronym.ShowModal = mrOk then begin
    148151      FormAcronym.Save(TempEntry);
    149       Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     152      Meaning := Acronyms.Db.AddAcronym(TempEntry.Name, TempEntry.Meaning);
    150153      Meaning.Description := TempEntry.Description;
    151154      Meaning.Categories.AssignFromStrings(TempEntry.Categories);
     
    156159          TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
    157160
    158       Core.AcronymDb.Update;
     161      Acronyms.Db.Update;
    159162      UpdateAcronymsList;
    160163      UpdateInterface;
     
    193196        not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin
    194197          // TODO: Update item inplace if possible
    195           Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));
    196           Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     198          Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));
     199          Meaning := Acronyms.Db.AddAcronym(TempEntry.Name, TempEntry.Meaning);
    197200          Meaning.Description := TempEntry.Description;
    198201          Meaning.Categories.AssignFromStrings(TempEntry.Categories);
     
    202205            if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then
    203206              TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
    204           Core.AcronymDb.Update;
     207          Acronyms.Db.Update;
    205208          UpdateAcronymsList;
    206209          UpdateInterface;
     
    222225    if MessageDlg(SRemoveAcronym, SRemoveAcronymQuery,
    223226    TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin
    224       Core.AcronymDb.BeginUpdate;
     227      Acronyms.Db.BeginUpdate;
    225228      for I := ListViewAcronyms.Items.Count - 1 downto 0 do
    226229        if ListViewAcronyms.Items[I].Selected then begin
    227230          ListViewAcronyms.Items[I].Selected := False;
    228           Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));
     231          Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));
    229232        end;
    230233      UpdateAcronymsList;
    231234      UpdateInterface;
    232       Core.AcronymDb.EndUpdate;
     235      Acronyms.Db.EndUpdate;
    233236    end;
    234237  end;
     
    287290procedure TFormAcronyms.ListViewSort1Filter(ListViewSort: TListViewSort);
    288291begin
    289   Core.AcronymDb.Acronyms.Sort(AcronymComparer);
    290   Core.AcronymDb.AssignToList(ListViewSort1.List);
     292  Acronyms.Db.Acronyms.Sort(AcronymComparer);
     293  Acronyms.Db.AssignToList(ListViewSort1.List);
    291294  MeaningCount := ListViewSort1.List.Count;
    292295  FilterList(ListViewSort1.List);
     
    322325end;
    323326
     327procedure TFormAcronyms.SetAcronyms(AValue: TAcronyms);
     328begin
     329  if FAcronyms = AValue then Exit;
     330  FAcronyms := AValue;
     331end;
     332
    324333procedure TFormAcronyms.UpdateAcronymsList;
    325334begin
     
    332341procedure TFormAcronyms.UpdateInterface;
    333342begin
    334   ARemove.Enabled := Assigned(Core.AcronymDb) and Assigned(ListViewAcronyms.Selected);
    335   AModify.Enabled := Assigned(Core.AcronymDb) and Assigned(ListViewAcronyms.Selected);
    336   AAdd.Enabled := Assigned(Core.AcronymDb);
     343  ARemove.Enabled := Assigned(FAcronyms) and Assigned(ListViewAcronyms.Selected);
     344  AModify.Enabled := Assigned(FAcronyms) and Assigned(ListViewAcronyms.Selected);
     345  AAdd.Enabled := Assigned(FAcronyms);
    337346  ASelectAll.Enabled := True;
    338347end;
Note: See TracChangeset for help on using the changeset viewer.