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/FormImportSources.pas

    r221 r227  
    6262  public
    6363    ImportSources: TImportSources;
     64    AcronymDb: TAcronymDb;
    6465    procedure UpdateList;
    6566    procedure UpdateInterface;
     
    7273
    7374uses
    74   Core, FormMain, FormImportSource;
     75  FormMain, FormImportSource;
    7576
    7677resourcestring
     
    168169begin
    169170  UpdateList;
    170   Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI);
     171  ScaleDPI.ScaleControl(ToolBar1, ScaleDPI.DesignDPI);
    171172end;
    172173
     
    176177  if Assigned(Item) and (Change = ctState) then begin
    177178    TImportSource(Item.Data).Enabled := Item.Checked;
    178     Core.Core.AcronymDb.Modified := True;
     179    AcronymDb.Modified := True;
    179180  end;
    180181end;
     
    190191  FormImportSource := TFormImportSource.Create(Self);
    191192  try
     193    FormImportSource.AcronymDb := AcronymDb;
    192194    FormImportSource.Load(NewImportSource);
    193195    if FormImportSource.ShowModal = mrOk then begin
     
    198200        // Update reverse references
    199201        for I := 0 to NewImportSource.Categories.Count - 1 do
    200           if TAcronymCategory(NewImportSource.Categories.Items[I]).ImportSources.IndexOf(NewImportSource) = -1 then
    201             TAcronymCategory(NewImportSource.Categories.Items[I]).ImportSources.Add(NewImportSource);
     202          if NewImportSource.Categories.Items[I].ImportSources.IndexOf(NewImportSource) = -1 then
     203            NewImportSource.Categories.Items[I].ImportSources.Add(NewImportSource);
    202204
    203205        NewImportSource := nil;
    204         Core.Core.AcronymDb.Modified := True;
     206        AcronymDb.Modified := True;
    205207        UpdateList;
    206208      end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name]));
     
    219221  if ListView1.Items[I].Selected then begin
    220222    TImportSource(ListView1.Items[I].Data).Enabled := False;
    221     Core.Core.AcronymDb.Modified := True;
     223    AcronymDb.Modified := True;
    222224  end;
    223225  UpdateList;
     
    231233  if ListView1.Items[I].Selected then begin
    232234    TImportSource(ListView1.Items[I].Data).Enabled := True;
    233     Core.Core.AcronymDb.Modified := True;
     235    AcronymDb.Modified := True;
    234236  end;
    235237  UpdateList;
     
    246248    FormImportSource := TFormImportSource.Create(Self);
    247249    try
     250      FormImportSource.AcronymDb := AcronymDb;
    248251      FormImportSource.Load(NewImportSource);
    249252      if FormImportSource.ShowModal = mrOk then begin
     
    252255          if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin;
    253256            TImportSource(ListView1.Selected.Data).Assign(NewImportSource);
    254             Core.Core.AcronymDb.Modified := True;
     257            AcronymDb.Modified := True;
    255258          end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name]));
    256259        end else begin
    257260          TImportSource(ListView1.Selected.Data).Assign(NewImportSource);
    258           Core.Core.AcronymDb.Modified := True;
     261          AcronymDb.Modified := True;
    259262        end;
    260263
     
    274277begin
    275278  if Assigned(ListView1.Selected) then begin
    276     Core.Core.AcronymDb.AddedCount := 0;
     279    AcronymDb.AddedCount := 0;
    277280    JobProgressView1.AddJob(SProcessSelectedSource, ProcessImportJob);
    278281    JobProgressView1.Start;
    279282    ShowMessage(Format(SAddedCount, [TImportSource(ListView1.Selected.Data).ItemCount,
    280       Core.Core.AcronymDb.AddedCount]));
     283      AcronymDb.AddedCount]));
    281284  end;
    282285end;
Note: See TracChangeset for help on using the changeset viewer.