Changeset 148 for trunk/Forms


Ignore:
Timestamp:
Feb 6, 2017, 12:59:59 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Update filtered acronyms in main window if they were changed in acronyms and categories window.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormAcronyms.pas

    r146 r148  
    156156          TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
    157157
     158      Core.AcronymDb.Update;
    158159      UpdateAcronymsList;
    159160      UpdateInterface;
     
    201202            if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then
    202203              TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
    203 
     204          Core.AcronymDb.Update;
    204205          UpdateAcronymsList;
    205206          UpdateInterface;
     
    221222    if MessageDlg(SRemoveAcronym, SRemoveAcronymQuery,
    222223    TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin
     224      Core.AcronymDb.BeginUpdate;
    223225      for I := ListViewAcronyms.Items.Count - 1 downto 0 do
    224226        if ListViewAcronyms.Items[I].Selected then begin
     
    228230      UpdateAcronymsList;
    229231      UpdateInterface;
     232      Core.AcronymDb.EndUpdate;
    230233    end;
    231234  end;
  • trunk/Forms/UFormCategories.pas

    r145 r148  
    105105      TAcronymCategory(Core.AcronymDb.Categories[Core.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S;
    106106      Core.AcronymDb.Modified := True;
     107      Core.AcronymDb.Update;
    107108      UpdateList;
    108109    end else ShowMessage(Format(SCategoryAlreadyExists, [S]));
     
    144145        TAcronymCategory(ListViewCategories.Selected.Data).Name := S;
    145146        Core.AcronymDb.Modified := True;
     147        Core.AcronymDb.Update;
    146148        UpdateList;
    147149      end else ShowMessage(Format(SCategoryAlreadyExists, [S]));
     
    157159    if MessageDlg(SRemoveCategory, SRemoveCategoryQuery,
    158160    TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin
     161      Categories.Db.BeginUpdate;
    159162      for I := ListViewCategories.Items.Count - 1 downto 0 do
    160163      if ListViewCategories.Items[I].Selected then
    161164        Categories.Remove(ListViewCategories.Items[I].Data);
     165      Categories.Db.EndUpdate;
    162166      UpdateList;
    163167    end;
  • trunk/Forms/UFormMain.pas

    r147 r148  
    134134    ProjectClosed: Boolean;
    135135    ImportTotalItemCount: Integer;
     136    procedure AcronymDbUpdate(Sender: TObject);
    136137    function FilterCell(Text1, Text2: string): Boolean;
    137138    procedure ProcessImportsJob(Job: TJob);
     
    258259begin
    259260  AFileClose.Execute;
    260   if ProjectClosed  then begin
     261  if not Assigned(Core.AcronymDb)  then begin
    261262    Core.AcronymDb := TAcronymDb.Create;
    262263    Core.AcronymDb.FileName := DefaultFileName;
    263264    Core.AcronymDb.Acronyms.Clear;
     265    Core.AcronymDb.OnUpdate.Add(AcronymDbUpdate);
    264266    UpdateAcronymsList;
    265267    UpdateInterface;
     
    533535end;
    534536
     537procedure TFormMain.AcronymDbUpdate(Sender: TObject);
     538begin
     539  UpdateAcronymsList;
     540end;
     541
    535542function TFormMain.FilterCell(Text1, Text2: string): Boolean;
    536543begin
     
    547554begin
    548555  AFileClose.Execute;
    549   if ProjectClosed then begin
     556  if not Assigned(Core.AcronymDb) then begin
    550557    try
    551558      AFileNew.Execute;
     
    604611begin
    605612  AFileClose.Execute;
    606   if ProjectClosed then begin
     613  if not Assigned(Core.AcronymDb) then begin
    607614    AFileNew.Execute;
    608615    Core.AcronymDb.LoadFromFile(TMenuItem(Sender).Caption);
Note: See TracChangeset for help on using the changeset viewer.