Changeset 227 for trunk


Ignore:
Timestamp:
Jan 20, 2025, 11:38:55 AM (45 hours ago)
Author:
chronos
Message:
  • Modified: Do not reference global Core object if possible.
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/AcronymDecoder.lpr

    r219 r227  
    66  {$ENDIF}
    77  Interfaces, // this includes the LCL widgetset
    8   Forms, Acronym, Common, SysUtils,
    9   FormMain, Core, FormCheck
     8  Forms, Acronym, Common, SysUtils, Core, FormCheck
    109  { you can add units after this };
    1110
     
    2423  {$ENDIF}
    2524
    26   Application.Title:='Acronym Decoder';
     25  Application.Title := 'Acronym Decoder';
    2726  RequireDerivedFormResource := True;
    2827  Application.Initialize;
  • trunk/Core.lfm

    r220 r227  
    1919    Left = 438
    2020    Top = 234
    21   end
    22   object JobProgressView1: TJobProgressView
    23     OwnerDraw = False
    24     ShowDelay = 0
    25     AutoClose = False
    26     Left = 438
    27     Top = 408
    2821  end
    2922  object ScaleDPI1: TScaleDPI
  • trunk/Core.pas

    r225 r227  
    1818    ImageListSmall: TImageList;
    1919    ImageListLarge: TImageList;
    20     JobProgressView1: TJobProgressView;
    2120    MenuItem1: TMenuItem;
    2221    MenuItem19: TMenuItem;
     
    5352    procedure SaveConfig;
    5453    procedure ScaleDPI;
    55     function CompareStrings(Strings1, Strings2: TStrings): Boolean;
    5654    property AlwaysOnTop: Boolean read FAlwaysOnTop write SetAlwaysOnTop;
    5755  end;
     
    10098  FreeAndNil(StoredDimension);
    10199  FreeAndNil(AcronymDb);
    102 end;
    103 
    104 function TCore.CompareStrings(Strings1, Strings2: TStrings): Boolean;
    105 var
    106   I: Integer;
    107 begin
    108   Result := Strings1.Count = Strings2.Count;
    109   if not Result then Exit;
    110   for I := 0 to Strings1.Count - 1 do
    111     if (Strings1[I] <> Strings2[I]) or (Strings1.Objects[I] <> Strings2.Objects[I]) then begin
    112       Result := False;
    113       Exit;
    114     end;
    115100end;
    116101
  • trunk/Forms/FormAcronym.pas

    r221 r227  
    4141    procedure UpdateInterface;
    4242  public
     43    AcronymDb: TAcronymDb;
    4344    procedure Load(Entry: TAcronymEntry);
    4445    procedure Save(Entry: TAcronymEntry);
     
    6263  FormCategorySelect := TFormCategorySelect.Create(Self);
    6364  try
     65    FormCategorySelect.AcronymDb := AcronymDb;
    6466    FormCategorySelect.Load(ListBoxCategories.Items);
    6567    if FormCategorySelect.ShowModal = mrOk then begin
  • trunk/Forms/FormAcronyms.pas

    r219 r227  
    5050    FAcronyms: TAcronyms;
    5151    MeaningCount: Integer;
     52    function CompareStrings(Strings1, Strings2: TStrings): Boolean;
    5253    function AcronymComparer(constref Item1, Item2: TAcronym): Integer;
    5354    procedure FilterList(List: TObjectList<TObject>);
     
    5556    procedure UpdateAcronymsList;
    5657  public
     58    AcronymDb: TAcronymDb;
    5759    FocusAcronym: TAcronymMeaning;
    5860    property Acronyms: TAcronyms read FAcronyms write SetAcronyms;
     
    6668
    6769uses
    68   Core, FormAcronym;
     70  FormAcronym;
    6971
    7072resourcestring
     
    116118  ListViewFilter1.UpdateFromListView(ListViewAcronyms);
    117119  UpdateAcronymsList;
    118   Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI);
     120  ScaleDPI.ScaleControl(ToolBar1, ScaleDPI.DesignDPI);
    119121
    120122  // Focus line with acronym
     
    131133end;
    132134
     135function TFormAcronyms.CompareStrings(Strings1, Strings2: TStrings): Boolean;
     136var
     137  I: Integer;
     138begin
     139  Result := Strings1.Count = Strings2.Count;
     140  if not Result then Exit;
     141  for I := 0 to Strings1.Count - 1 do
     142    if (Strings1[I] <> Strings2[I]) or (Strings1.Objects[I] <> Strings2.Objects[I]) then begin
     143      Result := False;
     144      Exit;
     145    end;
     146end;
     147
    133148procedure TFormAcronyms.AAddExecute(Sender: TObject);
    134149var
     
    144159  FormAcronym := TFormAcronym.Create(Self);
    145160  try
     161    FormAcronym.AcronymDb := AcronymDb;
    146162    FormAcronym.Load(TempEntry);
    147163    if FormAcronym.ShowModal = mrOk then begin
     
    186202    FormAcronym := TFormAcronym.Create(Self);
    187203    try
     204      FormAcronym.AcronymDb := AcronymDb;
    188205      FormAcronym.Load(TempEntry);
    189206      if FormAcronym.ShowModal = mrOk then begin
     
    192209        (TempEntry.Meaning <> Name) or
    193210        (TempEntry.Description <> Description) or
    194         not Core.Core.CompareStrings(TempEntry.Categories, TempCategories) then begin
     211        not CompareStrings(TempEntry.Categories, TempCategories) then begin
    195212          // TODO: Update item inplace if possible
    196213          Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));
     
    201218          // Update reverse references
    202219          for I := 0 to Meaning.Categories.Count - 1 do
    203             if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then
    204               TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
     220            if Meaning.Categories.Items[I].AcronymMeanings.IndexOf(Meaning) = -1 then
     221              Meaning.Categories.Items[I].AcronymMeanings.Add(Meaning);
    205222          Acronyms.Db.Update;
    206223          UpdateAcronymsList;
  • 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;
  • trunk/Forms/FormCategorySelect.pas

    r221 r227  
    1818    procedure ListBox1KeyPress(Sender: TObject; var Key: char);
    1919  public
     20    AcronymDb: TAcronymDb;
    2021    procedure Load(RemoveItems: TStrings);
    2122  end;
     
    3031
    3132{$R *.lfm}
    32 
    33 uses
    34   Core;
    3533
    3634{ TFormCategorySelect }
     
    5149  I: Integer;
    5250begin
    53   with Core.Core.AcronymDb do begin
     51  with AcronymDb do begin
    5452    ListBox1.Sorted := False;
    5553    while ListBox1.Items.Count < Categories.Count do
  • trunk/Forms/FormCheck.lfm

    r221 r227  
    223223    object MenuItemGoTo: TMenuItem
    224224      Action = AGoToLocation
    225       OnClick = MenuItemGoToClick
    226225    end
    227226    object MenuItem1: TMenuItem
  • trunk/Forms/FormCheck.pas

    r221 r227  
    6767    procedure FormShow(Sender: TObject);
    6868    procedure ListViewReportData(Sender: TObject; Item: TListItem);
    69     procedure MenuItemGoToClick(Sender: TObject);
    7069  private
    7170    AcronymDbSummary: TAcronymDb;
     
    8988    procedure ReloadReport;
    9089  public
     90    AcronymDb: TAcronymDb;
    9191    ReportItems: TReportItems;
    9292    procedure UpdateInterface;
    93     procedure LoadConfig;
    94     procedure SaveConfig;
     93    procedure LoadConfig(RegistryContext: TRegistryContext);
     94    procedure SaveConfig(RegistryContext: TRegistryContext);
    9595  end;
    9696
     
    104104
    105105uses
    106   FormAcronyms, Core;
     106  FormAcronyms;
    107107
    108108resourcestring
     
    227227end;
    228228
    229 procedure TFormCheck.MenuItemGoToClick(Sender: TObject);
    230 begin
    231 
    232 end;
    233 
    234229procedure TFormCheck.ButtonAcronymsContentClick(Sender: TObject);
    235230var
     
    238233  FormAcronyms := TFormAcronyms.Create(Self);
    239234  try
     235    FormAcronyms.AcronymDb := AcronymDb;
    240236    FormAcronyms.Acronyms := AcronymDbContent.Acronyms;
    241237    FormAcronyms.Caption := SContentAcronyms;
     
    252248  FormAcronyms := TFormAcronyms.Create(Self);
    253249  try
     250    FormAcronyms.AcronymDb := AcronymDb;
    254251    FormAcronyms.Acronyms := AcronymDbSummary.Acronyms;
    255252    FormAcronyms.Caption := SSummaryAcronyms;
     
    706703end;
    707704
    708 procedure TFormCheck.LoadConfig;
     705procedure TFormCheck.LoadConfig(RegistryContext: TRegistryContext);
    709706begin
    710707  with TRegistryEx.Create do
    711708  try
    712     RootKey := RegistryRootHKEY[Core.Core.ApplicationInfo1.RegistryRoot];
    713     OpenKey(Core.Core.ApplicationInfo1.RegistryKey, True);
     709    RootKey := RegistryContext.RootKey;
     710    OpenKey(RegistryContext.Key, True);
    714711    EditSummaryStart.Text := ReadStringWithDefault('SummaryStart', 'ACRONYMS AND ABBREVIATIONS');
    715712    EditSummaryEnd.Text := ReadStringWithDefault('SummaryEnd', 'Appendix');
     
    721718end;
    722719
    723 procedure TFormCheck.SaveConfig;
     720procedure TFormCheck.SaveConfig(RegistryContext: TRegistryContext);
    724721begin
    725722  with TRegistryEx.Create do
    726723  try
    727     RootKey := RegistryRootHKEY[Core.Core.ApplicationInfo1.RegistryRoot];
    728     OpenKey(Core.Core.ApplicationInfo1.RegistryKey, True);
     724    RootKey := RegistryContext.RootKey;
     725    OpenKey(RegistryContext.Key, True);
    729726    WriteString('SummaryStart', EditSummaryStart.Text);
    730727    WriteString('SummaryEnd', EditSummaryEnd.Text);
  • trunk/Forms/FormExport.lfm

    r221 r227  
    6767    Top = 149
    6868  end
     69  object JobProgressView1: TJobProgressView
     70    OwnerDraw = False
     71    ShowDelay = 0
     72    AutoClose = True
     73    Left = 472
     74    Top = 256
     75  end
    6976end
  • trunk/Forms/FormExport.pas

    r221 r227  
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    7   JobProgressView, FormEx;
     7  JobProgressView, FormEx, Acronym;
    88
    99type
     
    1515    ButtonSaveToFile: TButton;
    1616    ComboBoxDataFormat: TComboBox;
     17    JobProgressView1: TJobProgressView;
    1718    Label1: TLabel;
    1819    Memo1: TMemo;
     
    2627    procedure JobExportMediaWiki(Job: TJob);
    2728    procedure JobExportMediaWikiTable(Job: TJob);
     29  public
     30    AcronymDb: TAcronymDb;
    2831  end;
    2932
     
    3235
    3336{$R *.lfm}
    34 
    35 uses
    36   Core, Acronym;
    3737
    3838resourcestring
     
    5757  J: Integer;
    5858begin
    59   Job.Progress.Max := Core.Core.AcronymDb.Acronyms.Count;
     59  Job.Progress.Max := AcronymDb.Acronyms.Count;
    6060  ItemCount := 0;
    6161  Content := '';
    62   for I := 0 to Core.Core.AcronymDb.Acronyms.Count - 1 do
    63   with Core.Core.AcronymDb.Acronyms[I] do begin
     62  for I := 0 to AcronymDb.Acronyms.Count - 1 do
     63  with AcronymDb.Acronyms[I] do begin
    6464    for J := 0 to Meanings.Count - 1 do
    6565    with Meanings[J] do begin
     
    7777  J: Integer;
    7878begin
    79   Job.Progress.Max := Core.Core.AcronymDb.Acronyms.Count;
     79  Job.Progress.Max := AcronymDb.Acronyms.Count;
    8080  ItemCount := 0;
    8181  Content := '';
    82   for I := 0 to Core.Core.AcronymDb.Acronyms.Count - 1 do
    83   with Core.Core.AcronymDb.Acronyms[I] do begin
     82  for I := 0 to AcronymDb.Acronyms.Count - 1 do
     83  with AcronymDb.Acronyms[I] do begin
    8484    Content := Content + '; ' + Name + LineEnding;
    8585    for J := 0 to Meanings.Count - 1 do
     
    9898  J: Integer;
    9999begin
    100   Job.Progress.Max := Core.Core.AcronymDb.Acronyms.Count;
     100  Job.Progress.Max := AcronymDb.Acronyms.Count;
    101101  ItemCount := 0;
    102102  Content := '{| class="wikitable sortable"' + LineEnding +
    103103    '! Name !! Meaning !! Description !! Categories' + LineEnding;
    104   for I := 0 to Core.Core.AcronymDb.Acronyms.Count - 1 do
    105   with Core.Core.AcronymDb.Acronyms[I] do begin
     104  for I := 0 to AcronymDb.Acronyms.Count - 1 do
     105  with AcronymDb.Acronyms[I] do begin
    106106    for J := 0 to Meanings.Count - 1 do
    107107    with Meanings[J] do begin
     
    120120begin
    121121  if ComboBoxDataFormat.ItemIndex = 0 then
    122     Core.Core.JobProgressView1.AddJob(SExporting, JobExportCSV);
     122    JobProgressView1.AddJob(SExporting, JobExportCSV);
    123123  if ComboBoxDataFormat.ItemIndex = 1 then
    124     Core.Core.JobProgressView1.AddJob(SExporting, JobExportMediaWiki);
     124    JobProgressView1.AddJob(SExporting, JobExportMediaWiki);
    125125  if ComboBoxDataFormat.ItemIndex = 2 then
    126     Core.Core.JobProgressView1.AddJob(SExporting, JobExportMediaWikiTable);
    127   Core.Core.JobProgressView1.Start;
     126    JobProgressView1.AddJob(SExporting, JobExportMediaWikiTable);
     127  JobProgressView1.Start;
    128128  Memo1.Lines.Text := Content;
    129129  ShowMessage(Format(SExportedAcronyms, [ItemCount]));
  • trunk/Forms/FormImport.pas

    r219 r227  
    2323    procedure ImportMediaWiki;
    2424    procedure ImportCSV;
     25  public
     26    AcronymDb: TAcronymDb;
    2527  end;
    2628
     
    2931
    3032{$R *.lfm}
    31 
    32 uses
    33   Core;
    3433
    3534resourcestring
     
    7574      AcronymMeaning := Trim(Copy(Line, 2, Length(Line)));
    7675      if (AcronymName <> '') and (AcronymMeaning <> '') then begin
    77         Acronym := Core.Core.AcronymDb.Acronyms.SearchByName(AcronymName);
     76        Acronym := AcronymDb.Acronyms.SearchByName(AcronymName);
    7877        if not Assigned(Acronym) then begin
    7978          Acronym := TAcronym.Create;
    8079          Acronym.Name := AcronymName;
    81           Core.Core.AcronymDb.Acronyms.Add(Acronym);
     80          AcronymDb.Acronyms.Add(Acronym);
    8281        end;
    8382        Meaning := Acronym.Meanings.SearchByName(AcronymMeaning);
     
    9291    end;
    9392  end;
    94   if AddedCount > 0 then Core.Core.AcronymDb.Modified := True;
     93  if AddedCount > 0 then AcronymDb.Modified := True;
    9594  ShowMessage(Format(SImportedNewAcronyms, [AddedCount]));
    9695end;
     
    121120      else AcronymDescription := '';
    122121    if (AcronymName <> '') and (AcronymDescription <> '') then begin
    123       Acronym := Core.Core.AcronymDb.Acronyms.SearchByName(AcronymName);
     122      Acronym := AcronymDb.Acronyms.SearchByName(AcronymName);
    124123      if not Assigned(Acronym) then begin
    125124        Acronym := TAcronym.Create;
    126125        Acronym.Name := AcronymName;
    127         Core.Core.AcronymDb.Acronyms.Add(Acronym);
     126        AcronymDb.Acronyms.Add(Acronym);
    128127      end;
    129128      Meaning := Acronym.Meanings.SearchByName(AcronymDescription);
     
    139138  end;
    140139  Columns.Free;
    141   if AddedCount > 0 then Core.Core.AcronymDb.Modified := True;
     140  if AddedCount > 0 then AcronymDb.Modified := True;
    142141  ShowMessage(Format(SImportedNewAcronyms, [AddedCount]));
    143142end;
  • trunk/Forms/FormImportFormat.pas

    r221 r227  
    6060
    6161uses
    62   Core, FormImportPattern;
     62  FormImportPattern;
    6363
    6464{$R *.lfm}
  • trunk/Forms/FormImportFormats.pas

    r219 r227  
    3636      Selected: Boolean);
    3737  public
     38    AcronymDb: TAcronymDb;
    3839    ImportFormats: TImportFormats;
    3940    procedure UpdateList;
     
    4748
    4849uses
    49   Core, FormImportFormat;
     50  FormImportFormat;
    5051
    5152resourcestring
     
    9899begin
    99100  UpdateList;
    100   Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI);
     101  ScaleDPI.ScaleControl(ToolBar1, ScaleDPI.DesignDPI);
    101102end;
    102103
     
    116117        ImportFormats.Add(NewImportFormat);
    117118        NewImportFormat := nil;
    118         Core.Core.AcronymDb.Modified := True;
     119        AcronymDb.Modified := True;
    119120        UpdateList;
    120121      end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name]));
     
    142143          if not Assigned(ImportFormats.SearchByName(NewImportFormat.Name)) then begin;
    143144            TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat);
    144             Core.Core.AcronymDb.Modified := True;
     145            AcronymDb.Modified := True;
    145146            UpdateList;
    146147          end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name]));
    147148        end else begin
    148149          TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat);
    149           Core.Core.AcronymDb.Modified := True;
     150          AcronymDb.Modified := True;
    150151          UpdateList;
    151152        end;
  • trunk/Forms/FormImportSource.pas

    r221 r227  
    4444    procedure FormShow(Sender: TObject);
    4545  public
     46    AcronymDb: TAcronymDb;
    4647    procedure UpdateInterface;
    4748    procedure Load(ImportSource: TImportSource);
     
    5556
    5657uses
    57   Core, FormImportFormat, FormCategorySelect;
     58  FormImportFormat, FormCategorySelect;
    5859
    5960{ TFormImportSource }
     
    7374        FormImportFormat.Save(NewImportFormat);
    7475        TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]).Assign(NewImportFormat);
    75         Core.Core.AcronymDb.Modified := True;
     76        AcronymDb.Modified := True;
    7677        ComboBox1.Items.Strings[ComboBox1.ItemIndex] := NewImportFormat.Name;
    7778      end;
     
    100101  FormCategorySelect := TFormCategorySelect.Create(Self);
    101102  try
     103    FormCategorySelect.AcronymDb := AcronymDb;
    102104    FormCategorySelect.Load(ListBox1.Items);
    103105    if FormCategorySelect.ShowModal = mrOk then begin
     
    136138  EditName.Text := ImportSource.Name;
    137139  EditURL.Text := ImportSource.URL;
    138   while ComboBox1.Items.Count > Core.Core.AcronymDb.ImportFormats.Count do
     140  while ComboBox1.Items.Count > AcronymDb.ImportFormats.Count do
    139141    ComboBox1.Items.Delete(ComboBox1.Items.Count - 1);
    140   while ComboBox1.Items.Count < Core.Core.AcronymDb.ImportFormats.Count do
     142  while ComboBox1.Items.Count < AcronymDb.ImportFormats.Count do
    141143    ComboBox1.Items.Add('');
    142   for I := 0 to Core.Core.AcronymDb.ImportFormats.Count - 1 do begin
    143     ComboBox1.Items[I] := TImportFormat(Core.Core.AcronymDb.ImportFormats[I]).Name;
    144     ComboBox1.Items.Objects[I] := Core.Core.AcronymDb.ImportFormats[I];
     144  for I := 0 to AcronymDb.ImportFormats.Count - 1 do begin
     145    ComboBox1.Items[I] := TImportFormat(AcronymDb.ImportFormats[I]).Name;
     146    ComboBox1.Items.Objects[I] := AcronymDb.ImportFormats[I];
    145147  end;
    146148  ComboBox1.ItemIndex := ComboBox1.Items.IndexOfObject(ImportSource.Format);
  • trunk/Forms/FormImportSources.lfm

    r221 r227  
    163163    OwnerDraw = False
    164164    ShowDelay = 0
    165     AutoClose = False
     165    AutoClose = True
    166166    Left = 359
    167167    Top = 143
  • 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;
  • trunk/Forms/FormMain.lfm

    r220 r227  
    11object FormMain: TFormMain
    22  Left = 417
    3   Height = 679
     3  Height = 645
    44  Top = 453
    55  Width = 1106
    66  Caption = 'Acronym Decoder'
    7   ClientHeight = 679
     7  ClientHeight = 645
    88  ClientWidth = 1106
    99  DesignTimePPI = 144
     
    1919  object PanelMain: TPanel
    2020    Left = 0
    21     Height = 570
     21    Height = 536
    2222    Top = 81
    2323    Width = 1106
    2424    Align = alClient
    2525    BevelOuter = bvNone
    26     ClientHeight = 570
     26    ClientHeight = 536
    2727    ClientWidth = 1106
    2828    ParentFont = False
     
    3838    object ListViewAcronyms: TListView
    3939      Left = 5
    40       Height = 514
     40      Height = 480
    4141      Top = 50
    4242      Width = 1095
     
    318318    Left = 0
    319319    Height = 28
    320     Top = 651
     320    Top = 617
    321321    Width = 1106
    322322    Panels = <   
     
    640640    end
    641641  end
     642  object JobProgressView1: TJobProgressView
     643    OwnerDraw = False
     644    ShowDelay = 0
     645    AutoClose = True
     646    Left = 708
     647    Top = 464
     648  end
    642649end
  • trunk/Forms/FormMain.pas

    r225 r227  
    4646    CheckBoxCaseSensitive: TCheckBox;
    4747    CoolBar1: TCoolBar;
     48    JobProgressView1: TJobProgressView;
    4849    LastOpenedList1: TLastOpenedList;
    4950    ListViewAcronyms: TListView;
     
    272273  FormCheck := TFormCheck.Create(Self);
    273274  try
    274     FormCheck.LoadConfig;
     275    FormCheck.LoadConfig(TRegistryContext.Create(Core.Core.ApplicationInfo1.RegistryRoot,
     276      Core.Core.ApplicationInfo1.RegistryKey));
    275277    FormCheck.ShowModal;
    276     FormCheck.SaveConfig;
     278    FormCheck.SaveConfig(TRegistryContext.Create(Core.Core.ApplicationInfo1.RegistryRoot,
     279      Core.Core.ApplicationInfo1.RegistryKey));
    277280  finally
    278281    FreeAndNil(FormCheck);
     
    286289  FormExport := TFormExport.Create(Self);
    287290  try
     291    FormExport.AcronymDb := Core.Core.AcronymDb;
    288292    FormExport.ShowModal;
    289293  finally
     
    322326begin
    323327  AFileClose.Execute;
    324   if not Assigned(Core.Core.AcronymDb)  then begin
     328  if not Assigned(Core.Core.AcronymDb) then begin
    325329    Core.Core.AcronymDb := TAcronymDb.Create;
    326330    Core.Core.AcronymDb.FileName := DefaultFileName;
     
    406410  FormImport := TFormImport.Create(Self);
    407411  try
     412    FormImport.AcronymDb := Core.Core.AcronymDb;
    408413    FormImport.ShowModal;
    409414    UpdateAcronymsList;
     
    422427    if Assigned(ListViewAcronyms.Selected) then
    423428      FormAcronyms.FocusAcronym := ListViewAcronyms.Selected.Data;
     429    FormAcronyms.AcronymDb := Core.Core.AcronymDb;
    424430    FormAcronyms.Acronyms := Core.Core.AcronymDb.Acronyms;
    425431    FormAcronyms.ShowModal;
     
    435441  ImportTotalItemCount := 0;
    436442  Core.Core.AcronymDb.AddedCount := 0;
    437   Core.Core.JobProgressView1.AddJob(SProcessImportSources, ProcessImportsJob);
    438   Core.Core.JobProgressView1.Start;
     443  JobProgressView1.AddJob(SProcessImportSources, ProcessImportsJob);
     444  JobProgressView1.Start;
    439445  ShowMessage(Format(SAddedCount, [ImportTotalItemCount, Core.Core.AcronymDb.AddedCount]));
    440446  UpdateAcronymsList;
     
    493499  FormAcronyms := TFormAcronyms.Create(Self);
    494500  try
     501    FormAcronyms.AcronymDb := Core.Core.AcronymDb;
    495502    FormAcronyms.Acronyms := Core.Core.AcronymDb.Acronyms;
    496503    FormAcronyms.ShowModal;
     
    508515  FormCategories := TFormCategories.Create(Self);
    509516  try
     517    FormCategories.AcronymDb := Core.Core.AcronymDb;
    510518    FormCategories.Categories := Core.Core.AcronymDb.Categories;
    511519    FormCategories.ShowModal;
     
    529537  FormImportFormats := TFormImportFormats.Create(Self);
    530538  try
     539    FormImportFormats.AcronymDb := Core.Core.AcronymDb;
    531540    FormImportFormats.ImportFormats := Core.Core.AcronymDb.ImportFormats;
    532541    FormImportFormats.ShowModal;
     
    544553  try
    545554    FormImportSources.ImportSources := Core.Core.AcronymDb.ImportSources;
     555    FormImportSources.AcronymDb := Core.Core.AcronymDb;
    546556    FormImportSources.ShowModal;
    547557    UpdateAcronymsList;
Note: See TracChangeset for help on using the changeset viewer.