- Timestamp:
- Feb 6, 2017, 12:59:59 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormAcronyms.pas
r146 r148 156 156 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 157 157 158 Core.AcronymDb.Update; 158 159 UpdateAcronymsList; 159 160 UpdateInterface; … … 201 202 if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then 202 203 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 203 204 Core.AcronymDb.Update; 204 205 UpdateAcronymsList; 205 206 UpdateInterface; … … 221 222 if MessageDlg(SRemoveAcronym, SRemoveAcronymQuery, 222 223 TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin 224 Core.AcronymDb.BeginUpdate; 223 225 for I := ListViewAcronyms.Items.Count - 1 downto 0 do 224 226 if ListViewAcronyms.Items[I].Selected then begin … … 228 230 UpdateAcronymsList; 229 231 UpdateInterface; 232 Core.AcronymDb.EndUpdate; 230 233 end; 231 234 end; -
trunk/Forms/UFormCategories.pas
r145 r148 105 105 TAcronymCategory(Core.AcronymDb.Categories[Core.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S; 106 106 Core.AcronymDb.Modified := True; 107 Core.AcronymDb.Update; 107 108 UpdateList; 108 109 end else ShowMessage(Format(SCategoryAlreadyExists, [S])); … … 144 145 TAcronymCategory(ListViewCategories.Selected.Data).Name := S; 145 146 Core.AcronymDb.Modified := True; 147 Core.AcronymDb.Update; 146 148 UpdateList; 147 149 end else ShowMessage(Format(SCategoryAlreadyExists, [S])); … … 157 159 if MessageDlg(SRemoveCategory, SRemoveCategoryQuery, 158 160 TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin 161 Categories.Db.BeginUpdate; 159 162 for I := ListViewCategories.Items.Count - 1 downto 0 do 160 163 if ListViewCategories.Items[I].Selected then 161 164 Categories.Remove(ListViewCategories.Items[I].Data); 165 Categories.Db.EndUpdate; 162 166 UpdateList; 163 167 end; -
trunk/Forms/UFormMain.pas
r147 r148 134 134 ProjectClosed: Boolean; 135 135 ImportTotalItemCount: Integer; 136 procedure AcronymDbUpdate(Sender: TObject); 136 137 function FilterCell(Text1, Text2: string): Boolean; 137 138 procedure ProcessImportsJob(Job: TJob); … … 258 259 begin 259 260 AFileClose.Execute; 260 if ProjectClosedthen begin261 if not Assigned(Core.AcronymDb) then begin 261 262 Core.AcronymDb := TAcronymDb.Create; 262 263 Core.AcronymDb.FileName := DefaultFileName; 263 264 Core.AcronymDb.Acronyms.Clear; 265 Core.AcronymDb.OnUpdate.Add(AcronymDbUpdate); 264 266 UpdateAcronymsList; 265 267 UpdateInterface; … … 533 535 end; 534 536 537 procedure TFormMain.AcronymDbUpdate(Sender: TObject); 538 begin 539 UpdateAcronymsList; 540 end; 541 535 542 function TFormMain.FilterCell(Text1, Text2: string): Boolean; 536 543 begin … … 547 554 begin 548 555 AFileClose.Execute; 549 if ProjectClosedthen begin556 if not Assigned(Core.AcronymDb) then begin 550 557 try 551 558 AFileNew.Execute; … … 604 611 begin 605 612 AFileClose.Execute; 606 if ProjectClosedthen begin613 if not Assigned(Core.AcronymDb) then begin 607 614 AFileNew.Execute; 608 615 Core.AcronymDb.LoadFromFile(TMenuItem(Sender).Caption); -
trunk/Languages/AcronymDecoder.cs.po
r146 r148 919 919 msgid "Process import sources" 920 920 msgstr "Zpracovat zdroje importu" 921 -
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 -
trunk/UCore.pas
r142 r148 73 73 procedure TCore.DataModuleCreate(Sender: TObject); 74 74 begin 75 AcronymDb := TAcronymDb.Create;75 AcronymDb := nil; 76 76 InitializeStarted := False; 77 77 InitializeFinished := False; … … 129 129 if FileNameOption <> '' then begin 130 130 // Open file specified as command line parameter 131 AcronymDB.LoadFromFile(FileNameOption); 132 FormMain.LastOpenedList1.AddItem(FileNameOption); 131 FormMain.ProjectOpen(FileNameOption); 133 132 end else 134 133 if (FormMain.LastOpenedList1.Items.Count > 0) and FileExists(FormMain.LastOpenedList1.Items[0]) then begin 135 134 // Open last opened file 136 AcronymDB.LoadFromFile(FormMain.LastOpenedList1.Items[0])135 FormMain.ProjectOpen(FormMain.LastOpenedList1.Items[0]) 137 136 end else begin 138 137 // Open default database with examples if no item is in recent openned history
Note:
See TracChangeset
for help on using the changeset viewer.