Changeset 149 for trunk/Core.pas
- Timestamp:
- Jun 5, 2023, 8:45:38 PM (18 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.pas
r148 r149 1 unit UCore;1 unit Core; 2 2 3 3 interface … … 69 69 procedure TranslatorTranslate(Sender: TObject); 70 70 private 71 FOnDataFileChange: TNotifyEvent; 72 FOnLastOpenedListChange: TNotifyEvent; 71 73 InitializeStarted: Boolean; 72 74 InitializeFinished: Boolean; … … 76 78 ProfilePhotoFileName: string; 77 79 RecentFileRegistryContext: TRegistryContext; 80 FormMain: TForm; 78 81 procedure FileModified(Sender: TObject); 79 82 function FindFirstNonOption: string; … … 83 86 procedure DoError(Text: string; Line: Integer); 84 87 procedure AddItemToLastOpenedList(FileName: string); 88 procedure DoDataFileChange; 85 89 public 86 90 DefaultDataFileClass: TDataFileClass; … … 104 108 procedure Initialize; 105 109 procedure UpdateInterface; 110 property OnDataFileChange: TNotifyEvent read FOnDataFileChange 111 write FOnDataFileChange; 112 property OnLastOpenedListChange: TNotifyEvent read FOnLastOpenedListChange 113 write FOnLastOpenedListChange; 106 114 end; 107 115 … … 115 123 116 124 uses 117 UFormMain, UFormSettings, UFormContacts, UFormFindDuplicity, TestCase,118 UFormGenerate, UFormError, UFormFind, UFormTest, UFormSource, UFormCompare,119 UTestCases, UVCardFile;125 FormMain, FormSettings, FormFindDuplicity, TestCase, 126 FormGenerate, FormError, FormFind, FormTest, FormSource, FormCompare, 127 TestCases, VCardFile; 120 128 121 129 resourcestring … … 133 141 procedure TCore.AExitExecute(Sender: TObject); 134 142 begin 135 FormMain.Close;143 Application.Terminate; 136 144 end; 137 145 … … 257 265 Contacts := TVCardFile(DataFile).VCard.Contacts; 258 266 ShowModal; 259 FormContacts.ReloadList; 260 FormMain.UpdateInterface; 267 DoDataFileChange; 261 268 finally 262 269 Free; … … 270 277 Contacts := TVCardFile(DataFile).VCard.Contacts; 271 278 ShowModal; 272 FormContacts.ReloadList; 273 FormMain.UpdateInterface; 279 DoDataFileChange; 274 280 finally 275 281 Free; … … 283 289 Contacts := TVCardFile(DataFile).VCard.Contacts; 284 290 if ShowModal = mrOk then begin 285 FormContacts.ReloadList;286 FormContacts.UpdateInterface;287 291 DataFile.Modified := True; 288 FormMain.UpdateInterface;292 DoDataFileChange; 289 293 end; 290 294 finally … … 317 321 if ShowModal = mrOK then begin 318 322 SaveData; 319 ThemeManager1.UseTheme(FormMain);320 ThemeManager1.UseTheme(FormContacts);323 //ThemeManager1.UseTheme(FormMain); 324 //ThemeManager1.UseTheme(FormContacts); 321 325 end; 322 326 finally … … 435 439 RecentFileRegistryContext := TRegistryContext.Create(ApplicationInfo1.RegistryRoot, 436 440 ApplicationInfo1.RegistryKey + '\RecentFiles'); 441 442 FormMain := TFormMain.Create(nil); 443 FormMain.Show; 437 444 end; 438 445 … … 443 450 if Assigned(ProfileImage) then 444 451 FreeAndNil(ProfileImage); 452 FreeAndNil(FormMain); 445 453 end; 446 454 447 455 procedure TCore.LastOpenedList1Change(Sender: TObject); 448 456 begin 449 LastOpenedList1.LoadToMenuItem(FormMain.MenuItemFileOpenRecent, AFileOpenRecentExecute);450 LastOpenedList1.LoadToMenuItem(FormMain.PopupMenuOpenRecent.Items, AFileOpenRecentExecute);457 if Assigned(FOnLastOpenedListChange) then 458 FOnLastOpenedListChange(Self); 451 459 end; 452 460 … … 462 470 463 471 procedure TCore.FileOpen(FileName: string); 472 var 473 FormError: TFormError; 464 474 begin 465 475 if FileExists(FileName) then begin … … 519 529 begin 520 530 UpdateInterface; 521 FormMain.UpdateInterface; 522 if Assigned(FormContacts) then begin 523 if Assigned(DataFile) then 524 FormContacts.Contacts := TVCardFile(DataFile).VCard.Contacts 525 else FormContacts.Contacts := nil; 526 FormContacts.ReloadList; 527 FormContacts.UpdateInterface; 528 end; 531 DoDataFileChange; 529 532 end; 530 533 … … 543 546 ThemeManager1.Theme := ThemeManager1.Themes.FindByName(ReadStringWithDefault('Theme', 'System')) 544 547 else ThemeManager1.Theme := ThemeManager1.Themes.FindByName('System'); 545 FormMain.MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True);546 548 ReopenLastFileOnStart := ReadBoolWithDefault('ReopenLastFileOnStart', True); 547 549 LastContactTabIndex := ReadIntegerWithDefault('LastContactTabIndex', 0); … … 571 573 WriteString('Theme', ThemeManager1.Theme.Name) 572 574 else DeleteValue('Theme'); 573 WriteBool('ToolBarVisible', FormMain.MenuItemToolbar.Checked);574 575 WriteBool('ReopenLastFileOnStart', ReopenLastFileOnStart); 575 576 WriteInteger('LastContactTabIndex', LastContactTabIndex); … … 600 601 SaveToRegistry(RecentFileRegistryContext); 601 602 end; 603 end; 604 605 procedure TCore.DoDataFileChange; 606 begin 607 if Assigned(FOnDataFileChange) then 608 FOnDataFileChange(Self); 602 609 end; 603 610
Note:
See TracChangeset
for help on using the changeset viewer.