source: tags/1.3.0/Forms/UFormMain.pas

Last change on this file was 91, checked in by chronos, 8 years ago
  • Modified: Updated version number for next release.
File size: 19.7 KB
Line 
1unit UFormMain;
2
3{$mode delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
9 ComCtrls, StdCtrls, ExtCtrls, ActnList, Grids, UAcronym, UPersistentForm,
10 URegistry, ULastOpenedList, UListViewSort, UJobProgressView, UCoolTranslator,
11 Registry, SpecializedList, LazUTF8, LazFileUtils;
12
13type
14
15 { TFormMain }
16
17 TFormMain = class(TForm)
18 AExport: TAction;
19 AProcessImports: TAction;
20 AShowImportFormats: TAction;
21 AShowAbout: TAction;
22 AShowImportSources: TAction;
23 AShowAcronyms: TAction;
24 AShowCategories: TAction;
25 ASettings: TAction;
26 AFileSaveAs: TAction;
27 AFileClose: TAction;
28 AFileSave: TAction;
29 AFileNew: TAction;
30 AFileOpen: TAction;
31 AImport: TAction;
32 AShow: TAction;
33 AExit: TAction;
34 ActionList1: TActionList;
35 CheckBoxExactMath: TCheckBox;
36 CoolTranslator1: TCoolTranslator;
37 ImageList1: TImageList;
38 JobProgressView1: TJobProgressView;
39 LastOpenedList1: TLastOpenedList;
40 ListViewAcronyms: TListView;
41 ListViewFilter1: TListViewFilter;
42 ListViewSort1: TListViewSort;
43 MainMenu1: TMainMenu;
44 MenuItem1: TMenuItem;
45 MenuItem10: TMenuItem;
46 MenuItem11: TMenuItem;
47 MenuItem12: TMenuItem;
48 MenuItem13: TMenuItem;
49 MenuItem14: TMenuItem;
50 MenuItem15: TMenuItem;
51 MenuItem16: TMenuItem;
52 MenuItem17: TMenuItem;
53 MenuItem18: TMenuItem;
54 MenuItem19: TMenuItem;
55 MenuItem20: TMenuItem;
56 MenuItem21: TMenuItem;
57 MenuItem22: TMenuItem;
58 MenuItem23: TMenuItem;
59 MenuItem24: TMenuItem;
60 MenuItem25: TMenuItem;
61 MenuItemToolbar: TMenuItem;
62 MenuItem4: TMenuItem;
63 MenuItem5: TMenuItem;
64 MenuItem6: TMenuItem;
65 MenuItem7: TMenuItem;
66 MenuItemOpenRecent: TMenuItem;
67 MenuItem2: TMenuItem;
68 MenuItem3: TMenuItem;
69 MenuItem8: TMenuItem;
70 MenuItem9: TMenuItem;
71 OpenDialog1: TOpenDialog;
72 Panel1: TPanel;
73 PersistentForm1: TPersistentForm;
74 PopupMenuOpenRecent: TPopupMenu;
75 PopupMenuTryIcon: TPopupMenu;
76 SaveDialog1: TSaveDialog;
77 ToolBar1: TToolBar;
78 ToolButton1: TToolButton;
79 ToolButton10: TToolButton;
80 ToolButton11: TToolButton;
81 ToolButton12: TToolButton;
82 ToolButton2: TToolButton;
83 ToolButton3: TToolButton;
84 ToolButton4: TToolButton;
85 ToolButton5: TToolButton;
86 ToolButton6: TToolButton;
87 ToolButton7: TToolButton;
88 ToolButton8: TToolButton;
89 ToolButton9: TToolButton;
90 TrayIcon1: TTrayIcon;
91 procedure AExitExecute(Sender: TObject);
92 procedure AExportExecute(Sender: TObject);
93 procedure AFileCloseExecute(Sender: TObject);
94 procedure AFileNewExecute(Sender: TObject);
95 procedure AFileOpenExecute(Sender: TObject);
96 procedure AFileSaveAsExecute(Sender: TObject);
97 procedure AFileSaveExecute(Sender: TObject);
98 procedure AImportExecute(Sender: TObject);
99 procedure AProcessImportsExecute(Sender: TObject);
100 procedure ASettingsExecute(Sender: TObject);
101 procedure AShowAboutExecute(Sender: TObject);
102 procedure AShowAcronymsExecute(Sender: TObject);
103 procedure AShowCategoriesExecute(Sender: TObject);
104 procedure AShowExecute(Sender: TObject);
105 procedure AShowImportFormatsExecute(Sender: TObject);
106 procedure AShowImportSourcesExecute(Sender: TObject);
107 procedure CheckBoxExactMathChange(Sender: TObject);
108 procedure CoolTranslator1Translate(Sender: TObject);
109 procedure EditSearchChange(Sender: TObject);
110 procedure FormHide(Sender: TObject);
111 procedure FormShow(Sender: TObject);
112 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
113 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
114 procedure FormCreate(Sender: TObject);
115 procedure FormDestroy(Sender: TObject);
116 procedure LastOpenedList1Change(Sender: TObject);
117 procedure ListViewAcronymsData(Sender: TObject; Item: TListItem);
118 procedure ListViewAcronymsResize(Sender: TObject);
119 procedure ListViewAcronymsSelectItem(Sender: TObject; Item: TListItem;
120 Selected: Boolean);
121 procedure ListViewFilter1Change(Sender: TObject);
122 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer;
123 procedure ListViewSort1Filter(ListViewSort: TListViewSort);
124 procedure MenuItemToolbarClick(Sender: TObject);
125 procedure TrayIcon1Click(Sender: TObject);
126 private
127 RegistryContext: TRegistryContext;
128 ProjectClosed: Boolean;
129 ImportTotalItemCount: Integer;
130 procedure ProcessImportsJob(Job: TJob);
131 procedure FilterList(List: TListObject);
132 procedure OpenRecentClick(Sender: TObject);
133 public
134 procedure LoadConfig;
135 procedure SaveConfig;
136 procedure UpdateAcronymsList;
137 procedure UpdateInterface;
138 procedure ProjectOpen(FileName: string);
139 function CompareStrings(Strings1, Strings2: TStrings): Boolean;
140 end;
141
142var
143 FormMain: TFormMain;
144
145resourcestring
146 SAddedCount = 'Imported %d acronyms. Added %d new.';
147 SProcessImportSources = 'Process import sources';
148
149
150implementation
151
152{$R *.lfm}
153
154uses
155 UFormImport, UFormSettings, UFormCategories, UFormAcronyms, UFormExport,
156 UFormImportSources, UFormAbout, UFormImportFormats, UCore;
157
158resourcestring
159 SModified = 'modified';
160 SAppExit = 'Application exit';
161 SAppExitQuery = 'Acronyms were modified. Do you want to save them to file before exit?';
162
163const
164 ProjectExt = '.adp';
165 DefaultFileName = 'Acronyms' + ProjectExt;
166 DefaultRegKey = '\Software\Chronosoft\Acronym Decoder';
167 RegistryRunKey = '\Software\Microsoft\Windows\CurrentVersion\Run';
168
169{ TFormMain }
170
171procedure TFormMain.FormCreate(Sender: TObject);
172var
173 I: Integer;
174begin
175 for I := 0 to ToolBar1.ButtonCount - 1 do
176 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption;
177end;
178
179procedure TFormMain.EditSearchChange(Sender: TObject);
180begin
181 UpdateAcronymsList;
182end;
183
184procedure TFormMain.FormHide(Sender: TObject);
185begin
186 if Core.InitializeFinished then PersistentForm1.Save(Self);
187end;
188
189procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
190begin
191 PersistentForm1.Save(Self);
192 Core.SaveConfig;
193end;
194
195procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
196begin
197 ProjectClosed := True;
198 AFileClose.Execute;
199 CanClose := ProjectClosed;
200end;
201
202procedure TFormMain.AExitExecute(Sender: TObject);
203begin
204 Close;
205end;
206
207procedure TFormMain.AExportExecute(Sender: TObject);
208begin
209 FormExport.ShowModal;
210end;
211
212procedure TFormMain.AFileCloseExecute(Sender: TObject);
213var
214 ModalResult: TModalResult;
215 DoClose: Boolean;
216begin
217 DoClose := False;
218 if Assigned(Core.AcronymDb) then begin
219 if Core.AcronymDb.Modified then begin
220 ModalResult := MessageDlg(SAppExit, SAppExitQuery,
221 mtConfirmation, [mbYes, mbNo, mbCancel], 0);
222 if ModalResult = mrYes then begin
223 AFileSave.Execute;
224 DoClose := True;
225 end
226 else if ModalResult = mrNo then begin
227 DoClose := True;
228 end else ProjectClosed := False;
229 end else DoClose := True;
230 end;
231 if DoClose then begin
232 FreeAndNil(Core.AcronymDb);
233 UpdateAcronymsList;
234 UpdateInterface;
235 ProjectClosed := True;
236 end;
237end;
238
239procedure TFormMain.AFileNewExecute(Sender: TObject);
240begin
241 AFileClose.Execute;
242 if ProjectClosed then begin
243 Core.AcronymDb := TAcronymDb.Create;
244 Core.AcronymDb.FileName := DefaultFileName;
245 Core.AcronymDb.Acronyms.Clear;
246 UpdateAcronymsList;
247 UpdateInterface;
248 end;
249end;
250
251procedure TFormMain.AFileOpenExecute(Sender: TObject);
252begin
253 OpenDialog1.DefaultExt := ProjectExt;
254 if Assigned(Core.AcronymDb) then
255 OpenDialog1.FileName := Core.AcronymDb.FileName;
256 if OpenDialog1.Execute then begin
257 ProjectOpen(OpenDialog1.FileName);
258 end;
259end;
260
261procedure TFormMain.AFileSaveAsExecute(Sender: TObject);
262begin
263 SaveDialog1.DefaultExt := ProjectExt;
264 SaveDialog1.FileName := Core.AcronymDb.FileName;
265 if SaveDialog1.Execute then begin
266 Core.AcronymDb.SaveToFile(SaveDialog1.FileName);
267 LastOpenedList1.AddItem(SaveDialog1.FileName);
268 UpdateInterface;
269 end;
270end;
271
272procedure TFormMain.AFileSaveExecute(Sender: TObject);
273begin
274 if FileExists(Core.AcronymDb.FileName) then begin
275 Core.AcronymDb.SaveToFile(Core.AcronymDb.FileName);
276 LastOpenedList1.AddItem(Core.AcronymDb.FileName);
277 UpdateInterface;
278 end else AFileSaveAs.Execute;
279end;
280
281procedure TFormMain.AImportExecute(Sender: TObject);
282begin
283 FormImport.ShowModal;
284 UpdateAcronymsList;
285 UpdateInterface;
286end;
287
288procedure TFormMain.AProcessImportsExecute(Sender: TObject);
289begin
290 ImportTotalItemCount := 0;
291 Core.AcronymDb.AddedCount := 0;
292 JobProgressView1.AddJob(SProcessImportSources, ProcessImportsJob);
293 JobProgressView1.Start;
294 ShowMessage(Format(SAddedCount, [ImportTotalItemCount, Core.AcronymDb.AddedCount]));
295 UpdateAcronymsList;
296 UpdateInterface;
297end;
298
299procedure TFormMain.ProcessImportsJob(Job: TJob);
300var
301 I: Integer;
302begin
303 for I := 0 to Core.AcronymDb.ImportSources.Count - 1 do
304 with TImportSource(Core.AcronymDb.ImportSources[I]) do
305 if Enabled then begin
306 Process;
307 ImportTotalItemCount := ImportTotalItemCount + ItemCount;
308 Job.Progress.Max := Core.AcronymDb.ImportSources.Count;
309 Job.Progress.Value := I;
310 if Job.Terminate then Break;
311 end;
312end;
313
314procedure TFormMain.ASettingsExecute(Sender: TObject);
315begin
316 FormSettings.Load;
317 if FormSettings.ShowModal = mrOk then begin
318 FormSettings.Save;
319 Core.SaveConfig;
320 end;
321end;
322
323procedure TFormMain.AShowAboutExecute(Sender: TObject);
324begin
325 FormAbout.ShowModal;
326end;
327
328procedure TFormMain.AShowAcronymsExecute(Sender: TObject);
329begin
330 FormAcronyms.ShowModal;
331 UpdateAcronymsList;
332 UpdateInterface;
333end;
334
335procedure TFormMain.AShowCategoriesExecute(Sender: TObject);
336begin
337 FormCategories.Categories := Core.AcronymDb.Categories;
338 FormCategories.ShowModal;
339 UpdateAcronymsList;
340 UpdateInterface;
341end;
342
343procedure TFormMain.AShowExecute(Sender: TObject);
344begin
345 Show;
346 BringToFront;
347end;
348
349procedure TFormMain.AShowImportFormatsExecute(Sender: TObject);
350begin
351 FormImportFormats.ImportFormats := Core.AcronymDb.ImportFormats;
352 FormImportFormats.ShowModal;
353 UpdateInterface;
354end;
355
356procedure TFormMain.AShowImportSourcesExecute(Sender: TObject);
357begin
358 FormImportSources.ImportSources := Core.AcronymDb.ImportSources;
359 FormImportSources.ShowModal;
360 UpdateAcronymsList;
361 UpdateInterface;
362end;
363
364procedure TFormMain.CheckBoxExactMathChange(Sender: TObject);
365begin
366 UpdateAcronymsList;
367end;
368
369procedure TFormMain.CoolTranslator1Translate(Sender: TObject);
370begin
371 UAcronym.Translate;
372end;
373
374procedure TFormMain.FormDestroy(Sender: TObject);
375begin
376end;
377
378procedure TFormMain.FormShow(Sender: TObject);
379begin
380 Core.Initialize;
381
382 if Visible then begin
383 PersistentForm1.Load(Self);
384 UpdateInterface;
385 ListViewFilter1.StringGrid.Col := 1;
386 ListViewFilter1.StringGrid.Col := 0;
387 ListViewFilter1.StringGrid.Row := 0;
388 ListViewFilter1.StringGrid.SetFocus;
389 end;
390end;
391
392procedure TFormMain.LastOpenedList1Change(Sender: TObject);
393begin
394 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, OpenRecentClick);
395 LastOpenedList1.LoadToMenuItem(PopupMenuOpenRecent.Items, OpenRecentClick);
396end;
397
398procedure TFormMain.ListViewAcronymsData(Sender: TObject; Item: TListItem);
399begin
400 if Item.Index < ListViewSort1.List.Count then
401 with TAcronymMeaning(ListViewSort1.List[Item.Index]) do begin
402 Item.Caption := Acronym.Name;
403 Item.Data := TAcronymMeaning(ListViewSort1.List[Item.Index]);
404 Item.SubItems.Add(Name);
405 Item.SubItems.Add(Categories.GetString);
406 end;
407end;
408
409procedure TFormMain.ListViewAcronymsResize(Sender: TObject);
410begin
411 ListViewFilter1.UpdateFromListView(ListViewAcronyms);
412end;
413
414procedure TFormMain.ListViewAcronymsSelectItem(Sender: TObject;
415 Item: TListItem; Selected: Boolean);
416begin
417 UpdateInterface;
418end;
419
420procedure TFormMain.ListViewFilter1Change(Sender: TObject);
421begin
422 UpdateAcronymsList;
423end;
424
425function TFormMain.ListViewSort1CompareItem(Item1, Item2: TObject): Integer;
426begin
427 Result := 0;
428 if Assigned(Item1) and Assigned(Item2) and (ListViewSort1.Order <> soNone) then begin
429 with ListViewSort1 do
430 case Column of
431 0: Result := CompareString(TAcronymMeaning(Item1).Acronym.Name, TAcronymMeaning(Item2).Acronym.Name);
432 1: Result := CompareString(TAcronymMeaning(Item1).Name, TAcronymMeaning(Item2).Name);
433 2: Result := CompareString(TAcronymMeaning(Item1).Categories.GetString, TAcronymMeaning(Item2).Categories.GetString);
434 end;
435 if ListViewSort1.Order = soDown then Result := -Result;
436 end else Result := 0;
437end;
438
439procedure TFormMain.ListViewSort1Filter(ListViewSort: TListViewSort);
440begin
441 Core.AcronymDb.AssignToList(ListViewSort1.List);
442 FilterList(ListViewSort1.List);
443end;
444
445procedure TFormMain.MenuItemToolbarClick(Sender: TObject);
446begin
447 MenuItemToolbar.Checked := not MenuItemToolbar.Checked;
448 UpdateInterface;
449end;
450
451procedure TFormMain.TrayIcon1Click(Sender: TObject);
452begin
453 if not Visible then AShow.Execute
454 else Hide;
455end;
456
457procedure TFormMain.ProjectOpen(FileName: string);
458begin
459 AFileClose.Execute;
460 if ProjectClosed then begin
461 try
462 AFileNew.Execute;
463 Core.AcronymDb.LoadFromFile(FileName);
464 LastOpenedList1.AddItem(FileName);
465 finally
466 UpdateAcronymsList;
467 UpdateInterface;
468 end;
469 end;
470end;
471
472function TFormMain.CompareStrings(Strings1, Strings2: TStrings): Boolean;
473var
474 I: Integer;
475begin
476 Result := Strings1.Count = Strings2.Count;
477 if not Result then Exit;
478 for I := 0 to Strings1.Count - 1 do
479 if (Strings1[I] <> Strings2[I]) or (Strings1.Objects[I] <> Strings2.Objects[I]) then begin
480 Result := False;
481 Exit;
482 end;
483end;
484
485procedure TFormMain.FilterList(List: TListObject);
486var
487 I: Integer;
488 FoundCount: Integer;
489 EnteredCount: Integer;
490begin
491 EnteredCount := ListViewFilter1.TextEnteredCount;
492 for I := List.Count - 1 downto 0 do begin
493 if List.Items[I] is TAcronymMeaning then begin
494 with TAcronymMeaning(List.Items[I]) do begin
495 with ListViewFilter1 do
496 if Visible and (EnteredCount > 0) then begin
497 FoundCount := 0;
498 if CheckBoxExactMath.Checked then begin
499 if TextEnteredColumn(0) and (StringGrid.Cells[0, 0] =
500 TAcronymMeaning(List.Items[I]).Acronym.Name) then Inc(FoundCount);
501 if TextEnteredColumn(1) and (StringGrid.Cells[1, 0] =
502 TAcronymMeaning(List.Items[I]).Name) then Inc(FoundCount);
503 if TextEnteredColumn(2) and (StringGrid.Cells[2, 0] =
504 TAcronymMeaning(List.Items[I]).Categories.GetString) then Inc(FoundCount);
505 end else begin
506 if Pos(UTF8LowerCase(StringGrid.Cells[0, 0]),
507 UTF8LowerCase(TAcronymMeaning(List.Items[I]).Acronym.Name)) > 0 then Inc(FoundCount);
508 if Pos(UTF8LowerCase(StringGrid.Cells[1, 0]),
509 UTF8LowerCase(TAcronymMeaning(List.Items[I]).Name)) > 0 then Inc(FoundCount);
510 if Pos(UTF8LowerCase(StringGrid.Cells[2, 0]),
511 UTF8LowerCase(TAcronymMeaning(List.Items[I]).Categories.GetString)) > 0 then Inc(FoundCount);
512 end;
513 if FoundCount <> EnteredCount then List.Delete(I);
514 end else List.Delete(I);
515 end;
516 end else
517 if TAcronymMeaning(List.Items[I]) is TAcronymMeaning then begin
518 List.Delete(I);
519 end;
520 end;
521end;
522
523procedure TFormMain.OpenRecentClick(Sender: TObject);
524begin
525 AFileClose.Execute;
526 if ProjectClosed then begin
527 AFileNew.Execute;
528 Core.AcronymDb.LoadFromFile(TMenuItem(Sender).Caption);
529 LastOpenedList1.AddItem(TMenuItem(Sender).Caption);
530 UpdateAcronymsList;
531 UpdateInterface;
532 end;
533end;
534
535procedure TFormMain.UpdateAcronymsList;
536begin
537 if Assigned(Core.AcronymDb) then begin
538 ListViewSort1.Refresh;
539 end else begin
540 ListViewSort1.List.Clear;
541 ListViewAcronyms.Items.Count := 0;
542 ListViewAcronyms.Refresh;
543 end;
544end;
545
546procedure TFormMain.UpdateInterface;
547var
548 Title: string;
549begin
550 ListViewAcronyms.Enabled := Assigned(Core.AcronymDb);
551 AFileClose.Enabled := Assigned(Core.AcronymDb);
552 AFileSave.Enabled := Assigned(Core.AcronymDb) and Core.AcronymDb.Modified;
553 AFileSaveAs.Enabled := Assigned(Core.AcronymDb);
554 AImport.Enabled := Assigned(Core.AcronymDb);
555 AExport.Enabled := Assigned(Core.AcronymDb);
556 AProcessImports.Enabled := Assigned(Core.AcronymDb);
557 AShowCategories.Enabled := Assigned(Core.AcronymDb);
558 AShowAcronyms.Enabled := Assigned(Core.AcronymDb);
559 AShowCategories.Enabled := Assigned(Core.AcronymDb);
560 AShowImportSources.Enabled := Assigned(Core.AcronymDb);
561 AShowImportFormats.Enabled := Assigned(Core.AcronymDb);
562 ToolBar1.Visible := MenuItemToolbar.Checked;
563
564 Title := Application.Title;
565 if Assigned(Core.AcronymDb) and (ExtractFileName(Core.AcronymDb.FileName) <> '') then
566 if Assigned(Core.AcronymDb) then Title := Title + ' - ' + ExtractFileName(Core.AcronymDb.FileName);
567 if Assigned(Core.AcronymDb) and Core.AcronymDb.Modified then Title := Title + ' (' + SModified + ')';
568 Caption := Title;
569end;
570
571procedure TFormMain.LoadConfig;
572begin
573 RegistryContext := RegContext(HKEY_CURRENT_USER, DefaultRegKey);
574 PersistentForm1.RegistryContext := RegistryContext;
575 RegistryContext := RegContext(HKEY_CURRENT_USER, DefaultRegKey + '\RecentFiles');
576 LastOpenedList1.LoadFromRegistry(RegistryContext);
577
578 {$IFDEF Linux}
579 // If installed in Linux system then use installation directory for po files
580 if Application.ExeName = '/usr/bin/' + ExtractFileNameOnly(Application.ExeName) then
581 CoolTranslator1.POFilesFolder := '/usr/share/' + ExtractFileNameOnly(Application.ExeName) + '/languages';
582 {$ENDIF}
583
584 with TRegistryEx.Create do
585 try
586 RootKey := HKEY_CURRENT_USER;
587 OpenKey(DefaultRegKey, True);
588 if ValueExists('LanguageCode') then
589 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
590 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
591 Core.AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False);
592 Core.StartMinimizedToTray := ReadBoolWithDefault('StartMinimizedToTray', False);
593 CheckBoxExactMath.Checked := ReadBoolWithDefault('ExactMatch', False);
594 MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True);
595 finally
596 Free;
597 end;
598
599 with TRegistryEx.Create do
600 try
601 RootKey := HKEY_CURRENT_USER;
602 OpenKey(RegistryRunKey, True);
603 Core.StartOnLogon := ValueExists('Acronym Decoder');
604 finally
605 Free;
606 end;
607end;
608
609procedure TFormMain.SaveConfig;
610begin
611 RegistryContext := RegContext(HKEY_CURRENT_USER, DefaultRegKey + '\RecentFiles');
612 LastOpenedList1.SaveToRegistry(RegistryContext);
613
614 with TRegistryEx.Create do
615 try
616 RootKey := HKEY_CURRENT_USER;
617 OpenKey(DefaultRegKey, True);
618 if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
619 WriteString('LanguageCode', CoolTranslator1.Language.Code)
620 else DeleteValue('LanguageCode');
621 WriteBool('AlwaysOnTop', Core.AlwaysOnTop);
622 WriteBool('StartMinimizedToTray', Core.StartMinimizedToTray);
623 WriteBool('ExactMatch', CheckBoxExactMath.Checked);
624 WriteBool('ToolBarVisible', MenuItemToolbar.Checked);
625 finally
626 Free;
627 end;
628
629 with TRegistryEx.Create do
630 try
631 RootKey := HKEY_CURRENT_USER;
632 OpenKey(RegistryRunKey, True);
633 if Core.StartOnLogon then begin
634 if Core.StartMinimizedToTray then WriteString('Acronym Decoder', Application.ExeName + ' ' + Application.OptionChar + 't')
635 else WriteString('Acronym Decoder', Application.ExeName)
636 end else DeleteValue('Acronym Decoder');
637 finally
638 Free;
639 end;
640end;
641
642end.
643
Note: See TracBrowser for help on using the repository browser.