Changeset 148 for trunk/UAcronym.pas
- Timestamp:
- Feb 6, 2017, 12:59:59 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UAcronym.pas
r145 r148 7 7 uses 8 8 Classes, SysUtils, Contnrs, XMLRead, XMLWrite, DOM, UXMLUtils, 9 SpecializedList, fphttpclient2, Dialogs, odbcconn, sqldb, LazUTF8; 9 SpecializedList, fphttpclient2, Dialogs, odbcconn, sqldb, LazUTF8, 10 fgl; 10 11 11 12 type … … 216 217 217 218 TAcronymDb = class 219 private 220 FUpdateCount: Integer; 221 public 218 222 FileName: string; 219 223 Acronyms: TAcronyms; … … 223 227 Modified: Boolean; 224 228 AddedCount: Integer; 229 OnUpdate: TFPGList<TNotifyEvent>; 225 230 constructor Create; 226 231 destructor Destroy; override; … … 234 239 procedure RemoveAcronym(AcronymName, MeaningName: string); 235 240 procedure AssignToList(List: TListObject; EnabledCategoryOnly: Boolean = False); 241 procedure BeginUpdate; 242 procedure EndUpdate; 243 procedure Update; 236 244 end; 237 245 … … 1436 1444 ImportSources.AcronymDb := Self; 1437 1445 ImportFormats := TImportFormats.Create; 1446 FUpdateCount := 0; 1447 OnUpdate := TFPGList<TNotifyEvent>.Create; 1438 1448 end; 1439 1449 1440 1450 destructor TAcronymDb.Destroy; 1441 1451 begin 1452 FreeAndNil(OnUpdate); 1442 1453 FreeAndNil(ImportFormats); 1443 1454 FreeAndNil(ImportSources); … … 1701 1712 end; 1702 1713 1714 procedure TAcronymDb.BeginUpdate; 1715 begin 1716 Inc(FUpdateCount); 1717 end; 1718 1719 procedure TAcronymDb.EndUpdate; 1720 begin 1721 if FUpdateCount > 0 then Dec(FUpdateCount); 1722 if FupdateCount = 0 then Update; 1723 end; 1724 1725 procedure TAcronymDb.Update; 1726 var 1727 I: Integer; 1728 begin 1729 for I := 0 to OnUpdate.Count - 1 do 1730 OnUpdate[I](Self); 1731 end; 1732 1703 1733 end. 1704 1734
Note:
See TracChangeset
for help on using the changeset viewer.