Changes in trunk/Forms/UFormMain.pas [20:30]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Forms/UFormMain.pas ¶
r20 r30 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, 9 ComCtrls, StdCtrls, ExtCtrls, ActnList, UAcronym, UPersistentForm, Contnrs,9 ComCtrls, StdCtrls, ExtCtrls, ActnList, UAcronym, UPersistentForm, 10 10 URegistry, ULastOpenedList, UListViewSort, UCoolTranslator, Registry, 11 11 SpecializedList, LazUTF8; … … 16 16 17 17 TFormMain = class(TForm) 18 AProcessImports: TAction; 19 AShowImportFormats: TAction; 20 AShowAbout: TAction; 18 21 AShowImportSources: TAction; 19 22 AShowAcronyms: TAction; … … 51 54 MenuItem21: TMenuItem; 52 55 MenuItem22: TMenuItem; 56 MenuItem23: TMenuItem; 57 MenuItem24: TMenuItem; 58 MenuItemToolbar: TMenuItem; 53 59 MenuItem4: TMenuItem; 60 MenuItem5: TMenuItem; 61 MenuItem6: TMenuItem; 62 MenuItem7: TMenuItem; 54 63 MenuItemOpenRecent: TMenuItem; 55 64 MenuItem2: TMenuItem; … … 58 67 MenuItem9: TMenuItem; 59 68 OpenDialog1: TOpenDialog; 69 Panel1: TPanel; 60 70 PersistentForm1: TPersistentForm; 61 71 PopupMenuTryIcon: TPopupMenu; 62 72 SaveDialog1: TSaveDialog; 73 ToolBar1: TToolBar; 74 ToolButton1: TToolButton; 75 ToolButton2: TToolButton; 76 ToolButton3: TToolButton; 77 ToolButton4: TToolButton; 78 ToolButton5: TToolButton; 79 ToolButton6: TToolButton; 80 ToolButton7: TToolButton; 81 ToolButton8: TToolButton; 63 82 TrayIcon1: TTrayIcon; 64 83 procedure AExitExecute(Sender: TObject); … … 69 88 procedure AFileSaveExecute(Sender: TObject); 70 89 procedure AImportExecute(Sender: TObject); 90 procedure AProcessImportsExecute(Sender: TObject); 71 91 procedure ASettingsExecute(Sender: TObject); 92 procedure AShowAboutExecute(Sender: TObject); 72 93 procedure AShowAcronymsExecute(Sender: TObject); 73 94 procedure AShowCategoriesExecute(Sender: TObject); 74 95 procedure AShowExecute(Sender: TObject); 96 procedure AShowImportFormatsExecute(Sender: TObject); 75 97 procedure AShowImportSourcesExecute(Sender: TObject); 76 98 procedure CheckBoxExactMathChange(Sender: TObject); 77 99 procedure EditSearchChange(Sender: TObject); 100 procedure FormShow(Sender: TObject); 78 101 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 79 102 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); 80 103 procedure FormCreate(Sender: TObject); 81 104 procedure FormDestroy(Sender: TObject); 82 procedure FormShow(Sender: TObject);83 105 procedure LastOpenedList1Change(Sender: TObject); 84 106 procedure ListViewAcronymsData(Sender: TObject; Item: TListItem); … … 88 110 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 89 111 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 112 procedure MenuItemToolbarClick(Sender: TObject); 90 113 procedure TrayIcon1Click(Sender: TObject); 91 114 private … … 109 132 FormMain: TFormMain; 110 133 134 resourcestring 135 SAddedCount = 'Imported %d acronyms'; 136 137 111 138 implementation 112 139 … … 114 141 115 142 uses 116 UFormImport, UForm Acronym, UFormSettings, UFormCategories, UFormAcronyms,117 UFormImportSource , UFormImportSources;143 UFormImport, UFormSettings, UFormCategories, UFormAcronyms, 144 UFormImportSources, UFormAbout, UFormImportFormats; 118 145 119 146 resourcestring … … 239 266 end; 240 267 268 procedure TFormMain.AProcessImportsExecute(Sender: TObject); 269 var 270 I: Integer; 271 TotalItemCount: Integer; 272 begin 273 TotalItemCount := 0; 274 for I := 0 to AcronymDb.ImportSources.Count - 1 do 275 with TImportSource(AcronymDb.ImportSources[I]) do 276 if Enabled then begin 277 Process; 278 TotalItemCount := TotalItemCount + ItemCount; 279 end; 280 ShowMessage(Format(SAddedCount, [TotalItemCount])); 281 UpdateAcronymsList; 282 UpdateInterface; 283 end; 284 241 285 procedure TFormMain.ASettingsExecute(Sender: TObject); 242 286 begin … … 246 290 end; 247 291 292 procedure TFormMain.AShowAboutExecute(Sender: TObject); 293 begin 294 FormAbout.ShowModal; 295 end; 296 248 297 procedure TFormMain.AShowAcronymsExecute(Sender: TObject); 249 298 begin 250 299 FormAcronyms.ShowModal; 300 UpdateInterface; 251 301 end; 252 302 … … 264 314 end; 265 315 316 procedure TFormMain.AShowImportFormatsExecute(Sender: TObject); 317 begin 318 FormImportFormats.ImportFormats := AcronymDb.ImportFormats; 319 FormImportFormats.ShowModal; 320 UpdateInterface; 321 end; 322 266 323 procedure TFormMain.AShowImportSourcesExecute(Sender: TObject); 267 324 begin … … 286 343 PersistentForm1.Load(Self); 287 344 288 if (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then 345 if ParamCount > 0 then begin 346 AcronymDB.LoadFromFile(ParamStr(1)); 347 LastOpenedList1.AddItem(OpenDialog1.FileName); 348 end else 349 if (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then 289 350 AcronymDB.LoadFromFile(LastOpenedList1.Items[0]); 290 351 UpdateAcronymsList; … … 339 400 AcronymDb.AssignToList(ListViewSort1.List); 340 401 FilterList(ListViewSort1.List); 402 end; 403 404 procedure TFormMain.MenuItemToolbarClick(Sender: TObject); 405 begin 406 MenuItemToolbar.Checked := not MenuItemToolbar.Checked; 407 UpdateInterface; 341 408 end; 342 409 … … 436 503 AShowAcronyms.Enabled := Assigned(AcronymDb); 437 504 AShowImportSources.Enabled := Assigned(AcronymDb); 505 ToolBar1.Visible := MenuItemToolbar.Checked; 438 506 439 507 Title := Application.Title; … … 458 526 AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False); 459 527 CheckBoxExactMath.Checked := ReadBoolWithDefault('ExactMatch', False); 528 MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True); 460 529 finally 461 530 Free; … … 476 545 WriteBool('AlwaysOnTop', AlwaysOnTop); 477 546 WriteBool('ExactMatch', CheckBoxExactMath.Checked); 547 WriteBool('ToolBarVisible', MenuItemToolbar.Checked); 478 548 finally 479 549 Free;
Note:
See TracChangeset
for help on using the changeset viewer.