Ignore:
Timestamp:
Jan 20, 2025, 11:38:55 AM (42 hours ago)
Author:
chronos
Message:
  • Modified: Do not reference global Core object if possible.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormCategories.pas

    r219 r227  
    5151    procedure ListViewSort1Filter(ListViewSort: TListViewSort);
    5252  public
     53    AcronymDb: TAcronymDb;
    5354    Categories: TAcronymCategories;
    5455    procedure UpdateList;
     
    6061
    6162{$R *.lfm}
    62 
    63 uses
    64   Core;
    6563
    6664resourcestring
     
    7674begin
    7775  UpdateList;
    78   Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI);
     76  ScaleDPI.ScaleControl(ToolBar1, ScaleDPI.DesignDPI);
    7977end;
    8078
     
    8482  if Assigned(Item) and (Change = ctState) then begin
    8583    TAcronymCategory(Item.Data).Enabled := Item.Checked;
    86     Core.Core.AcronymDb.Modified := True;
     84    AcronymDb.Modified := True;
    8785  end;
    8886end;
     
    9492  S := InputBox(SCategory, SCategoryQuery, '');
    9593  if S <> '' then begin
    96     if not Assigned(Core.Core.AcronymDb.Categories.SearchByName(S)) then begin;
    97       TAcronymCategory(Core.Core.AcronymDb.Categories[Core.Core.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S;
    98       Core.Core.AcronymDb.Modified := True;
    99       Core.Core.AcronymDb.Update;
     94    if not Assigned(AcronymDb.Categories.SearchByName(S)) then begin;
     95      TAcronymCategory(AcronymDb.Categories[AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S;
     96      AcronymDb.Modified := True;
     97      AcronymDb.Update;
    10098      UpdateList;
    10199    end else ShowMessage(Format(SCategoryAlreadyExists, [S]));
     
    110108  if ListViewCategories.Items[I].Selected then begin
    111109    TAcronymCategory(ListViewCategories.Items[I].Data).Enabled := False;
    112     Core.Core.AcronymDb.Modified := True;
     110    AcronymDb.Modified := True;
    113111  end;
    114112  UpdateList;
     
    122120  if ListViewCategories.Items[I].Selected then begin
    123121    TAcronymCategory(ListViewCategories.Items[I].Data).Enabled := True;
    124     Core.Core.AcronymDb.Modified := True;
     122    AcronymDb.Modified := True;
    125123  end;
    126124  UpdateList;
     
    134132    S := InputBox(SCategory, SCategoryQuery, ListViewCategories.Selected.Caption);
    135133    if S <> ListViewCategories.Selected.Caption then begin
    136       if not Assigned(Core.Core.AcronymDb.Categories.SearchByName(S)) then begin;
     134      if not Assigned(AcronymDb.Categories.SearchByName(S)) then begin;
    137135        TAcronymCategory(ListViewCategories.Selected.Data).Name := S;
    138         Core.Core.AcronymDb.Modified := True;
    139         Core.Core.AcronymDb.Update;
     136        AcronymDb.Modified := True;
     137        AcronymDb.Update;
    140138        UpdateList;
    141139      end else ShowMessage(Format(SCategoryAlreadyExists, [S]));
     
    221219procedure TFormCategories.ListViewSort1Filter(ListViewSort: TListViewSort);
    222220begin
    223   Core.Core.AcronymDb.Categories.AssignToList(ListViewSort1.List);
     221  AcronymDb.Categories.AssignToList(ListViewSort1.List);
    224222end;
    225223
     
    227225begin
    228226  ListViewSort1.Refresh;
    229   ListViewCategories.Items.Count := Core.Core.AcronymDb.Categories.Count;
     227  ListViewCategories.Items.Count := AcronymDb.Categories.Count;
    230228  ListViewCategories.Refresh;
    231229  UpdateInterface;
Note: See TracChangeset for help on using the changeset viewer.