Changeset 184 for trunk/Forms/UFormAcronyms.pas
- Timestamp:
- Jul 4, 2018, 2:05:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormAcronyms.pas
r174 r184 50 50 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 51 51 private 52 FAcronyms: TAcronyms; 52 53 MeaningCount: Integer; 53 54 procedure FilterList(List: TListObject); 55 procedure SetAcronyms(AValue: TAcronyms); 54 56 procedure UpdateAcronymsList; 55 57 public 56 58 FocusAcronym: TAcronymMeaning; 59 property Acronyms: TAcronyms read FAcronyms write SetAcronyms; 57 60 procedure UpdateInterface; 58 61 end; … … 147 150 if FormAcronym.ShowModal = mrOk then begin 148 151 FormAcronym.Save(TempEntry); 149 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);152 Meaning := Acronyms.Db.AddAcronym(TempEntry.Name, TempEntry.Meaning); 150 153 Meaning.Description := TempEntry.Description; 151 154 Meaning.Categories.AssignFromStrings(TempEntry.Categories); … … 156 159 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 157 160 158 Core.AcronymDb.Update;161 Acronyms.Db.Update; 159 162 UpdateAcronymsList; 160 163 UpdateInterface; … … 193 196 not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin 194 197 // 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); 197 200 Meaning.Description := TempEntry.Description; 198 201 Meaning.Categories.AssignFromStrings(TempEntry.Categories); … … 202 205 if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then 203 206 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 204 Core.AcronymDb.Update;207 Acronyms.Db.Update; 205 208 UpdateAcronymsList; 206 209 UpdateInterface; … … 222 225 if MessageDlg(SRemoveAcronym, SRemoveAcronymQuery, 223 226 TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin 224 Core.AcronymDb.BeginUpdate;227 Acronyms.Db.BeginUpdate; 225 228 for I := ListViewAcronyms.Items.Count - 1 downto 0 do 226 229 if ListViewAcronyms.Items[I].Selected then begin 227 230 ListViewAcronyms.Items[I].Selected := False; 228 Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));231 Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data)); 229 232 end; 230 233 UpdateAcronymsList; 231 234 UpdateInterface; 232 Core.AcronymDb.EndUpdate;235 Acronyms.Db.EndUpdate; 233 236 end; 234 237 end; … … 287 290 procedure TFormAcronyms.ListViewSort1Filter(ListViewSort: TListViewSort); 288 291 begin 289 Core.AcronymDb.Acronyms.Sort(AcronymComparer);290 Core.AcronymDb.AssignToList(ListViewSort1.List);292 Acronyms.Db.Acronyms.Sort(AcronymComparer); 293 Acronyms.Db.AssignToList(ListViewSort1.List); 291 294 MeaningCount := ListViewSort1.List.Count; 292 295 FilterList(ListViewSort1.List); … … 322 325 end; 323 326 327 procedure TFormAcronyms.SetAcronyms(AValue: TAcronyms); 328 begin 329 if FAcronyms = AValue then Exit; 330 FAcronyms := AValue; 331 end; 332 324 333 procedure TFormAcronyms.UpdateAcronymsList; 325 334 begin … … 332 341 procedure TFormAcronyms.UpdateInterface; 333 342 begin 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); 337 346 ASelectAll.Enabled := True; 338 347 end;
Note:
See TracChangeset
for help on using the changeset viewer.