Changeset 219 for trunk/Forms/FormAcronyms.pas
- Timestamp:
- Jan 17, 2025, 9:05:54 PM (4 days ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormAcronyms.pas
r218 r219 1 unit UFormAcronyms; 2 3 {$mode delphi} 1 unit FormAcronyms; 4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 Menus, ActnList, UListViewSort, UAcronym, LazUTF8, fgl; 7 Menus, ActnList, ListViewSort, Acronym, LazUTF8, Generics.Collections, 8 Generics.Defaults, FormEx; 10 9 11 10 type … … 13 12 { TFormAcronyms } 14 13 15 TFormAcronyms = class(TForm )14 TFormAcronyms = class(TFormEx) 16 15 AAdd: TAction; 17 16 ASelectAll: TAction; … … 36 35 procedure ARemoveExecute(Sender: TObject); 37 36 procedure ASelectAllExecute(Sender: TObject); 38 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);39 37 procedure FormCreate(Sender: TObject); 40 38 procedure FormShow(Sender: TObject); … … 52 50 FAcronyms: TAcronyms; 53 51 MeaningCount: Integer; 54 procedure FilterList(List: TFPGObjectList<TObject>); 52 function AcronymComparer(constref Item1, Item2: TAcronym): Integer; 53 procedure FilterList(List: TObjectList<TObject>); 55 54 procedure SetAcronyms(AValue: TAcronyms); 56 55 procedure UpdateAcronymsList; … … 61 60 end; 62 61 63 var64 FormAcronyms: TFormAcronyms;65 62 66 63 implementation … … 69 66 70 67 uses 71 UCore, UFormMain, UFormAcronym;68 Core, FormAcronym; 72 69 73 70 resourcestring … … 117 114 I: Integer; 118 115 begin 119 Core.PersistentForm1.Load(Self);120 116 ListViewFilter1.UpdateFromListView(ListViewAcronyms); 121 117 UpdateAcronymsList; 122 Core. ScaleDPI1.ScaleControl(ToolBar1,Core.ScaleDPI1.DesignDPI);118 Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI); 123 119 124 120 // Focus line with acronym … … 140 136 Meaning: TAcronymMeaning; 141 137 I: Integer; 138 FormAcronym: TFormAcronym; 142 139 begin 143 140 TempEntry := TAcronymEntry.Create; … … 175 172 Meaning: TAcronymMeaning; 176 173 I: Integer; 174 FormAcronym: TFormAcronym; 177 175 begin 178 176 if Assigned(ListViewAcronyms.Selected) then … … 194 192 (TempEntry.Meaning <> Name) or 195 193 (TempEntry.Description <> Description) or 196 not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin194 not Core.Core.CompareStrings(TempEntry.Categories, TempCategories) then begin 197 195 // TODO: Update item inplace if possible 198 196 Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data)); … … 246 244 end; 247 245 248 procedure TFormAcronyms.FormClose(Sender: TObject; var CloseAction: TCloseAction249 );250 begin251 Core.PersistentForm1.Save(Self);252 end;253 254 246 procedure TFormAcronyms.FormCreate(Sender: TObject); 255 247 var … … 258 250 FocusAcronym := nil; 259 251 MeaningCount := 0; 260 Core.Translator.TranslateComponentRecursive(Self);261 Core.ThemeManager.UseTheme(Self);262 252 for I := 0 to ToolBar1.ButtonCount - 1 do 263 253 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption; … … 288 278 end; 289 279 280 function TFormAcronyms.AcronymComparer(constref Item1, Item2: TAcronym): Integer; 281 begin 282 Result := CompareStr(TAcronym(Item1).Name, TAcronym(Item2).Name); 283 end; 284 290 285 procedure TFormAcronyms.ListViewSort1Filter(ListViewSort: TListViewSort); 291 286 begin 292 Acronyms.Db.Acronyms.Sort( AcronymComparer);287 Acronyms.Db.Acronyms.Sort(TComparer<TAcronym>.Construct(AcronymComparer)); 293 288 Acronyms.Db.AssignToList(ListViewSort1.List); 294 289 MeaningCount := ListViewSort1.List.Count; … … 296 291 end; 297 292 298 procedure TFormAcronyms.FilterList(List: T FPGObjectList<TObject>);293 procedure TFormAcronyms.FilterList(List: TObjectList<TObject>); 299 294 var 300 295 I: Integer;
Note:
See TracChangeset
for help on using the changeset viewer.