Changeset 230 for trunk/Forms
- Timestamp:
- Jan 24, 2025, 11:42:58 PM (4 weeks ago)
- Location:
- trunk/Forms
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormAcronyms.lfm
r221 r230 8 8 ClientWidth = 888 9 9 DesignTimePPI = 144 10 OnActivate = FormActivate 10 11 OnCreate = FormCreate 11 12 OnShow = FormShow … … 138 139 end 139 140 object PopupMenuAcronym: TPopupMenu 141 Images = Core.ImageListSmall 140 142 Left = 298 141 143 Top = 355 -
trunk/Forms/FormAcronyms.pas
r227 r230 35 35 procedure ARemoveExecute(Sender: TObject); 36 36 procedure ASelectAllExecute(Sender: TObject); 37 procedure FormActivate(Sender: TObject); 37 38 procedure FormCreate(Sender: TObject); 38 39 procedure FormShow(Sender: TObject); … … 103 104 procedure TFormAcronyms.ListViewAcronymsResize(Sender: TObject); 104 105 begin 105 //ListViewFilter1.UpdateFromListView(ListViewAcronyms);106 ListViewFilter1.UpdateFromListView(ListViewAcronyms); 106 107 end; 107 108 … … 116 117 I: Integer; 117 118 begin 118 ListViewFilter1.UpdateFromListView(ListViewAcronyms);119 119 UpdateAcronymsList; 120 120 ScaleDPI.ScaleControl(ToolBar1, ScaleDPI.DesignDPI); … … 166 166 Meaning.Description := TempEntry.Description; 167 167 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 168 169 // Update reverse references170 for I := 0 to Meaning.Categories.Count - 1 do171 if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then172 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);173 168 174 169 Acronyms.Db.Update; … … 216 211 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 217 212 218 // Update reverse references219 for I := 0 to Meaning.Categories.Count - 1 do220 if Meaning.Categories.Items[I].AcronymMeanings.IndexOf(Meaning) = -1 then221 Meaning.Categories.Items[I].AcronymMeanings.Add(Meaning);222 213 Acronyms.Db.Update; 223 214 UpdateAcronymsList; … … 259 250 for I := 0 to ListViewAcronyms.Items.Count - 1 do 260 251 ListViewAcronyms.Items[I].Selected := True; 252 end; 253 254 procedure TFormAcronyms.FormActivate(Sender: TObject); 255 begin 256 ListViewFilter1.UpdateFromListView(ListViewAcronyms); 261 257 end; 262 258 -
trunk/Forms/FormCategories.lfm
r221 r230 26 26 end 27 27 item 28 Caption = ' Used count'28 Caption = 'Acronym meanings' 29 29 Width = 556 30 end 31 item 32 Caption = 'Import sources' 30 33 end> 31 34 MultiSelect = True … … 69 72 end 70 73 object ActionList1: TActionList 74 Images = Core.ImageListSmall 71 75 Left = 456 72 76 Top = 235 … … 104 108 end 105 109 object PopupMenuCategory: TPopupMenu 110 Images = Core.ImageListSmall 106 111 Left = 143 107 112 Top = 230 -
trunk/Forms/FormCategories.lrj
r219 r230 2 2 {"hash":6979891,"name":"tformcategories.caption","sourcebytes":[65,99,114,111,110,121,109,32,99,97,116,101,103,111,114,105,101,115],"value":"Acronym categories"}, 3 3 {"hash":346165,"name":"tformcategories.listviewcategories.columns[0].caption","sourcebytes":[78,97,109,101],"value":"Name"}, 4 {"hash":107848676,"name":"tformcategories.listviewcategories.columns[1].caption","sourcebytes":[85,115,101,100,32,99,111,117,110,116],"value":"Used count"}, 4 {"hash":222267715,"name":"tformcategories.listviewcategories.columns[1].caption","sourcebytes":[65,99,114,111,110,121,109,32,109,101,97,110,105,110,103,115],"value":"Acronym meanings"}, 5 {"hash":236591795,"name":"tformcategories.listviewcategories.columns[2].caption","sourcebytes":[73,109,112,111,114,116,32,115,111,117,114,99,101,115],"value":"Import sources"}, 5 6 {"hash":18340,"name":"tformcategories.aadd.caption","sourcebytes":[65,100,100],"value":"Add"}, 6 7 {"hash":93079237,"name":"tformcategories.aremove.caption","sourcebytes":[82,101,109,111,118,101],"value":"Remove"}, -
trunk/Forms/FormCategories.pas
r227 r230 181 181 Item.Caption := Name; 182 182 Item.Data := ListViewSort1.List[Item.Index]; 183 Item.SubItems.Add(IntToStr(AcronymMeanings.Count)); 183 Item.SubItems.Add(IntToStr(GetAcronymMeaningsCount)); 184 Item.SubItems.Add(IntToStr(GetImportSourcesCount)); 184 185 Item.Checked := Enabled; 185 186 end; … … 211 212 case Column of 212 213 0: Result := CompareString(TAcronymCategory(Item1).Name, TAcronymCategory(Item2).Name); 213 1: Result := CompareInteger(TAcronymCategory(Item1).AcronymMeanings.Count, TAcronymCategory(Item2).AcronymMeanings.Count); 214 1: Result := CompareInteger(TAcronymCategory(Item1).GetAcronymMeaningsCount, 215 TAcronymCategory(Item2).GetAcronymMeaningsCount); 216 2: Result := CompareInteger(TAcronymCategory(Item1).GetImportSourcesCount, 217 TAcronymCategory(Item2).GetImportSourcesCount); 214 218 end; 215 219 if ListViewSort1.Order = soDown then Result := -Result; -
trunk/Forms/FormCategorySelect.pas
r227 r230 16 16 ListBox1: TListBox; 17 17 procedure ListBox1DblClick(Sender: TObject); 18 procedure ListBox1KeyPress(Sender: TObject; var Key: char);18 procedure ListBox1KeyPress(Sender: TObject; var Key: Char); 19 19 public 20 20 AcronymDb: TAcronymDb; … … 39 39 end; 40 40 41 procedure TFormCategorySelect.ListBox1KeyPress(Sender: TObject; var Key: char);41 procedure TFormCategorySelect.ListBox1KeyPress(Sender: TObject; var Key: Char); 42 42 begin 43 43 if Key = #13 then ButtonOk.Click; -
trunk/Forms/FormImportFormats.lfm
r221 r230 65 65 end 66 66 object ActionList1: TActionList 67 Images = Core.ImageListSmall 67 68 Left = 612 68 69 Top = 336 … … 87 88 end 88 89 object PopupMenuImportSource: TPopupMenu 90 Images = Core.ImageListSmall 89 91 Left = 221 90 92 Top = 330 -
trunk/Forms/FormImportSources.lfm
r227 r230 8 8 ClientWidth = 974 9 9 DesignTimePPI = 144 10 OnActivate = FormActivate 10 11 OnCreate = FormCreate 11 12 OnShow = FormShow … … 43 44 Action = AProcess 44 45 end 46 object ToolButton5: TToolButton 47 Left = 141 48 Top = 2 49 Action = APreview 50 end 45 51 end 46 52 object ListView1: TListView … … 73 79 item 74 80 Caption = 'Date' 75 Width = 145 81 Width = 120 82 end 83 item 84 Caption = 'Format' 85 Width = 150 76 86 end> 77 87 MultiSelect = True … … 101 111 end 102 112 object ActionList1: TActionList 113 Images = Core.ImageListSmall 103 114 Left = 490 104 115 Top = 269 … … 134 145 OnExecute = ADisableExecute 135 146 end 147 object APreview: TAction 148 Caption = 'Preview' 149 ImageIndex = 13 150 OnExecute = APreviewExecute 151 end 136 152 end 137 153 object PopupMenuImportSource: TPopupMenu 154 Images = Core.ImageListSmall 138 155 Left = 176 139 156 Top = 264 … … 149 166 object MenuItem4: TMenuItem 150 167 Action = AProcess 168 end 169 object MenuItem8: TMenuItem 170 Action = APreview 151 171 end 152 172 object MenuItem7: TMenuItem -
trunk/Forms/FormImportSources.lrj
r219 r230 7 7 {"hash":4877396,"name":"tformimportsources.listview1.columns[3].caption","sourcebytes":[67,111,117,110,116],"value":"Count"}, 8 8 {"hash":305317,"name":"tformimportsources.listview1.columns[4].caption","sourcebytes":[68,97,116,101],"value":"Date"}, 9 {"hash":81171332,"name":"tformimportsources.listview1.columns[5].caption","sourcebytes":[70,111,114,109,97,116],"value":"Format"}, 9 10 {"hash":18340,"name":"tformimportsources.aadd.caption","sourcebytes":[65,100,100],"value":"Add"}, 10 11 {"hash":93079237,"name":"tformimportsources.aremove.caption","sourcebytes":[82,101,109,111,118,101],"value":"Remove"}, … … 12 13 {"hash":127245555,"name":"tformimportsources.aprocess.caption","sourcebytes":[80,114,111,99,101,115,115],"value":"Process"}, 13 14 {"hash":79984933,"name":"tformimportsources.aenable.caption","sourcebytes":[69,110,97,98,108,101],"value":"Enable"}, 14 {"hash":185170277,"name":"tformimportsources.adisable.caption","sourcebytes":[68,105,115,97,98,108,101],"value":"Disable"} 15 {"hash":185170277,"name":"tformimportsources.adisable.caption","sourcebytes":[68,105,115,97,98,108,101],"value":"Disable"}, 16 {"hash":126668695,"name":"tformimportsources.apreview.caption","sourcebytes":[80,114,101,118,105,101,119],"value":"Preview"} 15 17 ]} -
trunk/Forms/FormImportSources.pas
r227 r230 14 14 TFormImportSources = class(TFormEx) 15 15 AAdd: TAction; 16 APreview: TAction; 16 17 AEnable: TAction; 17 18 ADisable: TAction; … … 31 32 MenuItem6: TMenuItem; 32 33 MenuItem7: TMenuItem; 34 MenuItem8: TMenuItem; 33 35 PopupMenuImportSource: TPopupMenu; 34 36 ToolBar1: TToolBar; … … 37 39 ToolButton3: TToolButton; 38 40 ToolButton4: TToolButton; 41 ToolButton5: TToolButton; 39 42 procedure AAddExecute(Sender: TObject); 40 43 procedure ADisableExecute(Sender: TObject); 41 44 procedure AEnableExecute(Sender: TObject); 42 45 procedure AModifyExecute(Sender: TObject); 46 procedure APreviewExecute(Sender: TObject); 43 47 procedure AProcessExecute(Sender: TObject); 44 48 procedure ARemoveExecute(Sender: TObject); 49 procedure FormActivate(Sender: TObject); 45 50 procedure FormCreate(Sender: TObject); 46 51 procedure FormShow(Sender: TObject); … … 58 63 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 59 64 private 65 PreviewAcronymDb: TAcronymDb; 60 66 procedure ProcessImportJob(Job: TJob); 67 procedure PreviewImportJob(Job: TJob); 61 68 procedure FilterList(List: TObjectList<TObject>); 62 69 public … … 73 80 74 81 uses 75 FormMain, FormImportSource ;82 FormMain, FormImportSource, FormAcronyms; 76 83 77 84 resourcestring … … 80 87 SImportSourceAlreadyExists = 'Import source %s already exists!'; 81 88 SProcessSelectedSource = 'Process selected import source'; 89 SPreviewSelectedSource = 'Preview selected import source'; 82 90 83 91 … … 96 104 Item.SubItems.Add(DateToStr(LastImportTime)) 97 105 else Item.SubItems.Add(''); 106 Item.SubItems.Add(Format.Name); 98 107 Item.Checked := Enabled; 99 108 end; … … 133 142 function TFormImportSources.ListViewSort1CompareItem(Item1, Item2: TObject 134 143 ): Integer; 135 begin 144 var 145 ImportSource1, ImportSource2: TImportSource; 146 begin 147 ImportSource1 := TImportSource(Item1); 148 ImportSource2 := TImportSource(Item2); 136 149 Result := 0; 137 150 if Assigned(Item1) and Assigned(Item2) and (ListViewSort1.Order <> soNone) then begin 138 151 with ListViewSort1 do 139 152 case Column of 140 0: Result := CompareString(TImportSource(Item1).Name, TImportSource(Item2).Name); 141 1: Result := CompareString(TImportSource(Item1).URL, TImportSource(Item2).URL); 142 2: Result := CompareString(TImportSource(Item1).Categories.GetString, TImportSource(Item2).Categories.GetString); 143 3: Result := CompareInteger(TImportSource(Item1).ItemCount, TImportSource(Item2).ItemCount); 144 4: Result := CompareTime(TImportSource(Item1).LastImportTime, TImportSource(Item2).LastImportTime); 153 0: Result := CompareString(ImportSource1.Name, ImportSource2.Name); 154 1: Result := CompareString(ImportSource1.URL, ImportSource2.URL); 155 2: Result := CompareString(ImportSource1.Categories.GetString, ImportSource2.Categories.GetString); 156 3: Result := CompareInteger(ImportSource1.ItemCount, ImportSource2.ItemCount); 157 4: Result := CompareTime(ImportSource1.LastImportTime, ImportSource2.LastImportTime); 158 5: Result := CompareString(ImportSource1.Format.Name, ImportSource2.Format.Name); 145 159 end; 146 160 if ListViewSort1.Order = soDown then Result := -Result; … … 164 178 ARemove.Enabled := Assigned(ListView1.Selected); 165 179 AModify.Enabled := Assigned(ListView1.Selected); 180 AProcess.Enabled := Assigned(ListView1.Selected); 181 APreview.Enabled := Assigned(ListView1.Selected); 166 182 end; 167 183 … … 185 201 NewImportSource: TImportSource; 186 202 FormImportSource: TFormImportSource; 187 I: Integer;188 203 begin 189 204 NewImportSource := TImportSource.Create; … … 197 212 if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin; 198 213 ImportSources.Add(NewImportSource); 199 200 // Update reverse references201 for I := 0 to NewImportSource.Categories.Count - 1 do202 if NewImportSource.Categories.Items[I].ImportSources.IndexOf(NewImportSource) = -1 then203 NewImportSource.Categories.Items[I].ImportSources.Add(NewImportSource);204 214 205 215 NewImportSource := nil; … … 262 272 end; 263 273 264 // Update reverse references265 TImportSource(ListView1.Selected.Data).Categories.UpdateLinkImportSources(TImportSource(ListView1.Selected.Data));266 267 274 UpdateList; 268 275 end; … … 270 277 finally 271 278 FreeAndNil(FormImportSource); 279 end; 280 end; 281 end; 282 283 procedure TFormImportSources.APreviewExecute(Sender: TObject); 284 var 285 FormAcronyms: TFormAcronyms; 286 begin 287 if Assigned(ListView1.Selected) then begin 288 PreviewAcronymDb := TAcronymDb.Create; 289 try 290 JobProgressView1.AddJob(SPreviewSelectedSource, PreviewImportJob); 291 JobProgressView1.Start; 292 FormAcronyms := TFormAcronyms.Create(nil); 293 try 294 FormAcronyms.AcronymDb := PreviewAcronymDb; 295 FormAcronyms.Acronyms := PreviewAcronymDb.Acronyms; 296 FormAcronyms.ShowModal; 297 finally 298 FormAcronyms.Free; 299 end; 300 finally 301 FreeAndNil(PreviewAcronymDb); 272 302 end; 273 303 end; … … 287 317 procedure TFormImportSources.ProcessImportJob(Job: TJob); 288 318 begin 289 TImportSource(ListView1.Selected.Data).Process; 319 TImportSource(ListView1.Selected.Data).Process(AcronymDb); 320 end; 321 322 procedure TFormImportSources.PreviewImportJob(Job: TJob); 323 begin 324 TImportSource(ListView1.Selected.Data).Process(PreviewAcronymDb); 290 325 end; 291 326 … … 313 348 if Pos(UTF8LowerCase(StringGrid.Cells[4, 0]), 314 349 UTF8LowerCase(DateTimeToStr(TImportSource(List.Items[I]).LastImportTime))) > 0 then Inc(FoundCount); 350 if Pos(UTF8LowerCase(StringGrid.Cells[5, 0]), 351 UTF8LowerCase(TImportSource(List.Items[I]).Format.Name)) > 0 then Inc(FoundCount); 315 352 if FoundCount <> EnteredCount then List.Delete(I); 316 353 end; … … 338 375 end; 339 376 377 procedure TFormImportSources.FormActivate(Sender: TObject); 378 begin 379 ListViewFilter1.UpdateFromListView(ListView1); 380 end; 381 340 382 procedure TFormImportSources.FormCreate(Sender: TObject); 341 383 var -
trunk/Forms/FormMain.lfm
r227 r230 9 9 DesignTimePPI = 144 10 10 Menu = MainMenu1 11 OnActivate = FormActivate 11 12 OnClose = FormClose 12 13 OnCloseQuery = FormCloseQuery -
trunk/Forms/FormMain.pas
r227 r230 136 136 procedure AShowImportSourcesExecute(Sender: TObject); 137 137 procedure EditSearchChange(Sender: TObject); 138 procedure FormActivate(Sender: TObject); 138 139 procedure FormDestroy(Sender: TObject); 139 140 procedure FormHide(Sender: TObject); … … 234 235 end; 235 236 237 procedure TFormMain.FormActivate(Sender: TObject); 238 begin 239 ListViewFilter1.UpdateFromListView(ListViewAcronyms); 240 end; 241 236 242 procedure TFormMain.FormDestroy(Sender: TObject); 237 243 begin … … 455 461 with Core.Core.AcronymDb.ImportSources[I] do 456 462 if Enabled then begin 457 Process ;463 Process(Core.Core.AcronymDb); 458 464 ImportTotalItemCount := ImportTotalItemCount + ItemCount; 459 465 Job.Progress.Max := Core.Core.AcronymDb.ImportSources.Count; … … 568 574 569 575 if Visible then begin 570 ListViewFilter1.UpdateFromListView(ListViewAcronyms);571 576 UpdateInterface; 572 577 ListViewFilter1.StringGrid.Col := 1; … … 575 580 ListViewFilter1.StringGrid.SetFocus; 576 581 end; 577 Core.Core.ScaleDPI1.ScaleControl(CoolBar1, Core.Core.ScaleDPI1.DesignDPI);582 ScaleDPI.ScaleControl(CoolBar1, ScaleDPI.DesignDPI); 578 583 CoolBar1.AutosizeBands; 579 584 end;
Note:
See TracChangeset
for help on using the changeset viewer.