Changeset 145 for trunk/UAcronym.pas
- Timestamp:
- Jan 24, 2017, 1:55:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UAcronym.pas
r113 r145 75 75 AcronymMeanings: TAcronymMeanings; 76 76 ImportSources: TImportSources; 77 Enabled: Boolean; 77 78 procedure SaveToNode(Node: TDOMNode); 78 79 procedure LoadFromNode(Node: TDOMNode); … … 96 97 procedure AssignFromStrings(Strings: TStrings); 97 98 procedure AddFromStrings(Strings: TStrings); 99 procedure AssignToList(List: TListObject); 98 100 function GetString: string; 99 101 procedure UpdateLinkImportSources(Item: TImportSource); 100 102 procedure UpdateLinkAcronymMeanings(Item: TAcronymMeaning); 103 function IsAnyEnabled: Boolean; 101 104 end; 102 105 … … 230 233 procedure RemoveMeaning(Meaning: TAcronymMeaning); 231 234 procedure RemoveAcronym(AcronymName, MeaningName: string); 232 procedure AssignToList(List: TListObject );235 procedure AssignToList(List: TListObject; EnabledCategoryOnly: Boolean = False); 233 236 end; 234 237 … … 1300 1303 end; 1301 1304 1305 procedure TAcronymCategories.AssignToList(List: TListObject); 1306 var 1307 I: Integer; 1308 begin 1309 List.Clear; 1310 for I := 0 to Count - 1 do 1311 List.Add(TAcronymCategory(Items[I])) 1312 end; 1313 1302 1314 function TAcronymCategories.GetString: string; 1303 1315 var … … 1328 1340 end; 1329 1341 1342 function TAcronymCategories.IsAnyEnabled: Boolean; 1343 var 1344 I: Integer; 1345 begin 1346 Result := False; 1347 for I := 0 to Count - 1 do 1348 if TAcronymCategory(Items[I]).Enabled then begin 1349 Result := True; 1350 Break; 1351 end; 1352 end; 1330 1353 1331 1354 { TAcronym } … … 1371 1394 WriteString(Node, 'Name', Name); 1372 1395 WriteInteger(Node, 'Id', Id); 1396 WriteBoolean(Node, 'Enabled', Enabled); 1373 1397 end; 1374 1398 … … 1377 1401 Name := ReadString(Node, 'Name', ''); 1378 1402 Id := ReadInteger(Node, 'Id', 0); 1403 Enabled := ReadBoolean(Node, 'Enabled', True); 1379 1404 end; 1380 1405 1381 1406 constructor TAcronymCategory.Create; 1382 1407 begin 1408 Id := 0; 1409 Name := ''; 1410 Enabled := True; 1383 1411 AcronymMeanings := TAcronymMeanings.Create(False); 1384 1412 ImportSources := TImportSources.Create(False); … … 1657 1685 end; 1658 1686 1659 procedure TAcronymDb.AssignToList(List: TListObject );1687 procedure TAcronymDb.AssignToList(List: TListObject; EnabledCategoryOnly: Boolean = False); 1660 1688 var 1661 1689 I: Integer; … … 1666 1694 with TAcronym(Acronyms[I]) do begin 1667 1695 for J := 0 to Meanings.Count - 1 do 1668 with TAcronymMeaning(Meanings[J]) do begin 1669 List.Add(TAcronymMeaning(Meanings[J])) 1696 with TAcronymMeaning(Meanings[J]) do 1697 if not EnabledCategoryOnly or (EnabledCategoryOnly and Categories.IsAnyEnabled) then begin 1698 List.Add(TAcronymMeaning(Meanings[J])); 1670 1699 end; 1671 1700 end;
Note:
See TracChangeset
for help on using the changeset viewer.