Changeset 86 for trunk/Forms
- Timestamp:
- Aug 8, 2016, 1:41:25 PM (8 years ago)
- Location:
- trunk/Forms
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormAcronyms.pas
r85 r86 63 63 64 64 uses 65 U FormMain, UFormAcronym;65 UCore, UFormMain, UFormAcronym; 66 66 67 67 resourcestring … … 126 126 if FormAcronym.ShowModal = mrOk then begin 127 127 FormAcronym.Save(TempEntry); 128 Meaning := FormMain.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);128 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 129 129 Meaning.Description := TempEntry.Description; 130 130 Meaning.Categories.AssignFromStrings(TempEntry.Categories); … … 161 161 not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin 162 162 // TODO: Update item inplace if possible 163 FormMain.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));164 Meaning := FormMain.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);163 Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data)); 164 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 165 165 Meaning.Description := TempEntry.Description; 166 166 Meaning.Categories.AssignFromStrings(TempEntry.Categories); … … 186 186 if ListViewAcronyms.Items[I].Selected then begin 187 187 ListViewAcronyms.Items[I].Selected := False; 188 FormMain.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));188 Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data)); 189 189 end; 190 190 UpdateAcronymsList; … … 231 231 procedure TFormAcronyms.ListViewSort1Filter(ListViewSort: TListViewSort); 232 232 begin 233 FormMain.AcronymDb.Acronyms.Sort(AcronymComparer);234 FormMain.AcronymDb.AssignToList(ListViewSort1.List);233 Core.AcronymDb.Acronyms.Sort(AcronymComparer); 234 Core.AcronymDb.AssignToList(ListViewSort1.List); 235 235 MeaningCount := ListViewSort1.List.Count; 236 236 FilterList(ListViewSort1.List); … … 276 276 procedure TFormAcronyms.UpdateInterface; 277 277 begin 278 ARemove.Enabled := Assigned( FormMain.AcronymDb) and Assigned(ListViewAcronyms.Selected);279 AModify.Enabled := Assigned( FormMain.AcronymDb) and Assigned(ListViewAcronyms.Selected);280 AAdd.Enabled := Assigned( FormMain.AcronymDb);278 ARemove.Enabled := Assigned(Core.AcronymDb) and Assigned(ListViewAcronyms.Selected); 279 AModify.Enabled := Assigned(Core.AcronymDb) and Assigned(ListViewAcronyms.Selected); 280 AAdd.Enabled := Assigned(Core.AcronymDb); 281 281 ASelectAll.Enabled := True; 282 282 end; -
trunk/Forms/UFormCategories.pas
r85 r86 53 53 54 54 uses 55 U FormMain;55 UCore; 56 56 57 57 resourcestring … … 75 75 S := InputBox(SCategory, SCategoryQuery, ''); 76 76 if S <> '' then begin 77 if not Assigned( FormMain.AcronymDb.Categories.SearchByName(S)) then begin;78 TAcronymCategory( FormMain.AcronymDb.Categories[FormMain.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S;79 FormMain.AcronymDb.Modified := True;77 if not Assigned(Core.AcronymDb.Categories.SearchByName(S)) then begin; 78 TAcronymCategory(Core.AcronymDb.Categories[Core.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S; 79 Core.AcronymDb.Modified := True; 80 80 UpdateList; 81 81 end else ShowMessage(Format(SCategoryAlreadyExists, [S])); … … 90 90 S := InputBox(SCategory, SCategoryQuery, ListViewCategories.Selected.Caption); 91 91 if S <> ListViewCategories.Selected.Caption then begin 92 if not Assigned( FormMain.AcronymDb.Categories.SearchByName(S)) then begin;92 if not Assigned(Core.AcronymDb.Categories.SearchByName(S)) then begin; 93 93 TAcronymCategory(ListViewCategories.Selected.Data).Name := S; 94 FormMain.AcronymDb.Modified := True;94 Core.AcronymDb.Modified := True; 95 95 UpdateList; 96 96 end else ShowMessage(Format(SCategoryAlreadyExists, [S])); … … 124 124 procedure TFormCategories.ListViewCategoriesData(Sender: TObject; Item: TListItem); 125 125 begin 126 if Item.Index < FormMain.AcronymDb.Categories.Count then127 with TAcronymCategory( FormMain.AcronymDb.Categories[Item.Index]) do begin126 if Item.Index < Core.AcronymDb.Categories.Count then 127 with TAcronymCategory(Core.AcronymDb.Categories[Item.Index]) do begin 128 128 Item.Caption := Name; 129 Item.Data := FormMain.AcronymDb.Categories[Item.Index];129 Item.Data := Core.AcronymDb.Categories[Item.Index]; 130 130 Item.SubItems.Add(IntToStr(AcronymMeanings.Count)); 131 131 end; … … 151 151 procedure TFormCategories.UpdateList; 152 152 begin 153 ListViewCategories.Items.Count := FormMain.AcronymDb.Categories.Count;153 ListViewCategories.Items.Count := Core.AcronymDb.Categories.Count; 154 154 ListViewCategories.Refresh; 155 155 UpdateInterface; -
trunk/Forms/UFormCategorySelect.pas
r33 r86 39 39 40 40 uses 41 U FormMain;41 UCore; 42 42 43 43 { TFormCategorySelect } … … 62 62 I: Integer; 63 63 begin 64 with FormMain.AcronymDb do begin64 with Core.AcronymDb do begin 65 65 ListBox1.Sorted := False; 66 66 while ListBox1.Items.Count < Categories.Count do -
trunk/Forms/UFormImport.pas
r23 r86 37 37 38 38 uses 39 U FormMain;39 UCore; 40 40 41 41 resourcestring … … 79 79 AcronymMeaning := Trim(Copy(Line, 2, Length(Line))); 80 80 if (AcronymName <> '') and (AcronymMeaning <> '') then begin 81 Acronym := FormMain.AcronymDb.Acronyms.SearchByName(AcronymName);81 Acronym := Core.AcronymDb.Acronyms.SearchByName(AcronymName); 82 82 if not Assigned(Acronym) then begin 83 83 Acronym := TAcronym.Create; 84 84 Acronym.Name := AcronymName; 85 FormMain.AcronymDb.Acronyms.Add(Acronym);85 Core.AcronymDb.Acronyms.Add(Acronym); 86 86 end; 87 87 Meaning := Acronym.Meanings.SearchByName(AcronymMeaning); … … 96 96 end; 97 97 end; 98 if AddedCount > 0 then FormMain.AcronymDb.Modified := True;98 if AddedCount > 0 then Core.AcronymDb.Modified := True; 99 99 ShowMessage(Format(SImportedNewAcronyms, [AddedCount])); 100 100 end; … … 125 125 else AcronymDescription := ''; 126 126 if (AcronymName <> '') and (AcronymDescription <> '') then begin 127 Acronym := FormMain.AcronymDb.Acronyms.SearchByName(AcronymName);127 Acronym := Core.AcronymDb.Acronyms.SearchByName(AcronymName); 128 128 if not Assigned(Acronym) then begin 129 129 Acronym := TAcronym.Create; 130 130 Acronym.Name := AcronymName; 131 FormMain.AcronymDb.Acronyms.Add(Acronym);131 Core.AcronymDb.Acronyms.Add(Acronym); 132 132 end; 133 133 Meaning := Acronym.Meanings.SearchByName(AcronymDescription); … … 143 143 end; 144 144 Columns.Free; 145 if AddedCount > 0 then FormMain.AcronymDb.Modified := True;145 if AddedCount > 0 then Core.AcronymDb.Modified := True; 146 146 ShowMessage(Format(SImportedNewAcronyms, [AddedCount])); 147 147 end; -
trunk/Forms/UFormImportFormats.pas
r85 r86 53 53 54 54 uses 55 U FormMain, UFormImportFormat;55 UCore, UFormImportFormat; 56 56 57 57 resourcestring … … 118 118 ImportFormats.Add(NewImportFormat); 119 119 NewImportFormat := nil; 120 FormMain.AcronymDb.Modified := True;120 Core.AcronymDb.Modified := True; 121 121 UpdateList; 122 122 end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name])); … … 138 138 if not Assigned(ImportFormats.SearchByName(NewImportFormat.Name)) then begin; 139 139 TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat); 140 FormMain.AcronymDb.Modified := True;140 Core.AcronymDb.Modified := True; 141 141 UpdateList; 142 142 end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name])); 143 143 end else begin 144 144 TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat); 145 FormMain.AcronymDb.Modified := True;145 Core.AcronymDb.Modified := True; 146 146 UpdateList; 147 147 end; -
trunk/Forms/UFormImportSource.pas
r84 r86 61 61 62 62 uses 63 U FormMain, UFormImportFormat, UFormCategorySelect;63 UCore, UFormImportFormat, UFormCategorySelect; 64 64 65 65 { TFormImportSource } … … 76 76 FormImportFormat.Save(NewImportFormat); 77 77 TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]).Assign(NewImportFormat); 78 FormMain.AcronymDb.Modified := True;78 Core.AcronymDb.Modified := True; 79 79 ComboBox1.Items.Strings[ComboBox1.ItemIndex] := NewImportFormat.Name; 80 80 end; … … 130 130 EditName.Text := ImportSource.Name; 131 131 EditURL.Text := ImportSource.URL; 132 while ComboBox1.Items.Count > FormMain.AcronymDb.ImportFormats.Count do132 while ComboBox1.Items.Count > Core.AcronymDb.ImportFormats.Count do 133 133 ComboBox1.Items.Delete(ComboBox1.Items.Count - 1); 134 while ComboBox1.Items.Count < FormMain.AcronymDb.ImportFormats.Count do134 while ComboBox1.Items.Count < Core.AcronymDb.ImportFormats.Count do 135 135 ComboBox1.Items.Add(''); 136 for I := 0 to FormMain.AcronymDb.ImportFormats.Count - 1 do begin137 ComboBox1.Items[I] := TImportFormat( FormMain.AcronymDb.ImportFormats[I]).Name;138 ComboBox1.Items.Objects[I] := FormMain.AcronymDb.ImportFormats[I];136 for I := 0 to Core.AcronymDb.ImportFormats.Count - 1 do begin 137 ComboBox1.Items[I] := TImportFormat(Core.AcronymDb.ImportFormats[I]).Name; 138 ComboBox1.Items.Objects[I] := Core.AcronymDb.ImportFormats[I]; 139 139 end; 140 140 ComboBox1.ItemIndex := ComboBox1.Items.IndexOfObject(ImportSource.Format); -
trunk/Forms/UFormImportSources.pas
r85 r86 75 75 76 76 uses 77 U FormMain, UFormImportSource;77 UCore, UFormMain, UFormImportSource; 78 78 79 79 resourcestring … … 193 193 ImportSources.Add(NewImportSource); 194 194 NewImportSource := nil; 195 FormMain.AcronymDb.Modified := True;195 Core.AcronymDb.Modified := True; 196 196 UpdateList; 197 197 end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name])); … … 233 233 if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin; 234 234 TImportSource(ListView1.Selected.Data).Assign(NewImportSource); 235 FormMain.AcronymDb.Modified := True;235 Core.AcronymDb.Modified := True; 236 236 UpdateList; 237 237 end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name])); 238 238 end else begin 239 239 TImportSource(ListView1.Selected.Data).Assign(NewImportSource); 240 FormMain.AcronymDb.Modified := True;240 Core.AcronymDb.Modified := True; 241 241 UpdateList; 242 242 end; … … 249 249 begin 250 250 if Assigned(ListView1.Selected) then begin 251 FormMain.AcronymDb.AddedCount := 0;251 Core.AcronymDb.AddedCount := 0; 252 252 JobProgressView1.AddJob(SProcessSelectedSource, ProcessImportJob); 253 253 JobProgressView1.Start; 254 ShowMessage(Format(SAddedCount, [TImportSource(ListView1.Selected.Data).ItemCount, FormMain.AcronymDb.AddedCount])); 254 ShowMessage(Format(SAddedCount, [TImportSource(ListView1.Selected.Data).ItemCount, 255 Core.AcronymDb.AddedCount])); 255 256 end; 256 257 end; -
trunk/Forms/UFormMain.pas
r83 r86 120 120 procedure TrayIcon1Click(Sender: TObject); 121 121 private 122 InitializeStarted: Boolean;123 InitializeFinished: Boolean;124 FAlwaysOnTop: Boolean;125 122 RegistryContext: TRegistryContext; 126 123 ProjectClosed: Boolean; 127 124 ImportTotalItemCount: Integer; 128 function FindFirstNonOption: string;129 procedure ProjectOpen(FileName: string);130 procedure Initialize;131 125 procedure ProcessImportsJob(Job: TJob); 132 procedure SetAlwaysOnTop(AValue: Boolean);133 126 procedure FilterList(List: TListObject); 134 127 procedure OpenRecentClick(Sender: TObject); 128 public 129 procedure LoadConfig; 130 procedure SaveConfig; 135 131 procedure UpdateAcronymsList; 136 132 procedure UpdateInterface; 137 procedure LoadConfig; 138 procedure SaveConfig; 139 public 140 AcronymDb: TAcronymDb; 141 StartOnLogon: Boolean; 142 StartMinimizedToTray: Boolean; 133 procedure ProjectOpen(FileName: string); 143 134 function CompareStrings(Strings1, Strings2: TStrings): Boolean; 144 property AlwaysOnTop: Boolean read FAlwaysOnTop write SetAlwaysOnTop;145 135 end; 146 136 … … 159 149 uses 160 150 UFormImport, UFormSettings, UFormCategories, UFormAcronyms, 161 UFormImportSources, UFormAbout, UFormImportFormats ;151 UFormImportSources, UFormAbout, UFormImportFormats, UCore; 162 152 163 153 resourcestring … … 171 161 DefaultRegKey = '\Software\Chronosoft\Acronym Decoder'; 172 162 RegistryRunKey = '\Software\Microsoft\Windows\CurrentVersion\Run'; 173 ExampleFile = 'Example acronyms.adp';174 163 175 164 { TFormMain } … … 179 168 I: Integer; 180 169 begin 181 AcronymDb := TAcronymDb.Create;182 InitializeStarted := False;183 InitializeFinished := False;184 170 for I := 0 to ToolBar1.ButtonCount - 1 do 185 171 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption; … … 193 179 procedure TFormMain.FormHide(Sender: TObject); 194 180 begin 195 if InitializeFinished then PersistentForm1.Save(Self);181 if Core.InitializeFinished then PersistentForm1.Save(Self); 196 182 end; 197 183 … … 199 185 begin 200 186 PersistentForm1.Save(Self); 201 SaveConfig;187 Core.SaveConfig; 202 188 end; 203 189 … … 219 205 begin 220 206 DoClose := False; 221 if Assigned( AcronymDb) then begin222 if AcronymDb.Modified then begin207 if Assigned(Core.AcronymDb) then begin 208 if Core.AcronymDb.Modified then begin 223 209 ModalResult := MessageDlg(SAppExit, SAppExitQuery, 224 210 mtConfirmation, [mbYes, mbNo, mbCancel], 0); … … 233 219 end; 234 220 if DoClose then begin 235 FreeAndNil( AcronymDb);221 FreeAndNil(Core.AcronymDb); 236 222 UpdateAcronymsList; 237 223 UpdateInterface; … … 244 230 AFileClose.Execute; 245 231 if ProjectClosed then begin 246 AcronymDb := TAcronymDb.Create;247 AcronymDb.FileName := DefaultFileName;248 AcronymDb.Acronyms.Clear;232 Core.AcronymDb := TAcronymDb.Create; 233 Core.AcronymDb.FileName := DefaultFileName; 234 Core.AcronymDb.Acronyms.Clear; 249 235 UpdateAcronymsList; 250 236 UpdateInterface; … … 255 241 begin 256 242 OpenDialog1.DefaultExt := ProjectExt; 257 if Assigned( AcronymDb) then258 OpenDialog1.FileName := AcronymDb.FileName;243 if Assigned(Core.AcronymDb) then 244 OpenDialog1.FileName := Core.AcronymDb.FileName; 259 245 if OpenDialog1.Execute then begin 260 246 ProjectOpen(OpenDialog1.FileName); … … 265 251 begin 266 252 SaveDialog1.DefaultExt := ProjectExt; 267 SaveDialog1.FileName := AcronymDb.FileName;253 SaveDialog1.FileName := Core.AcronymDb.FileName; 268 254 if SaveDialog1.Execute then begin 269 AcronymDb.SaveToFile(SaveDialog1.FileName);255 Core.AcronymDb.SaveToFile(SaveDialog1.FileName); 270 256 LastOpenedList1.AddItem(SaveDialog1.FileName); 271 257 UpdateInterface; … … 275 261 procedure TFormMain.AFileSaveExecute(Sender: TObject); 276 262 begin 277 if FileExists( AcronymDb.FileName) then begin278 AcronymDb.SaveToFile(AcronymDb.FileName);279 LastOpenedList1.AddItem( AcronymDb.FileName);263 if FileExists(Core.AcronymDb.FileName) then begin 264 Core.AcronymDb.SaveToFile(Core.AcronymDb.FileName); 265 LastOpenedList1.AddItem(Core.AcronymDb.FileName); 280 266 UpdateInterface; 281 267 end else AFileSaveAs.Execute; … … 292 278 begin 293 279 ImportTotalItemCount := 0; 294 AcronymDb.AddedCount := 0;280 Core.AcronymDb.AddedCount := 0; 295 281 JobProgressView1.AddJob(SProcessImportSources, ProcessImportsJob); 296 282 JobProgressView1.Start; 297 ShowMessage(Format(SAddedCount, [ImportTotalItemCount, AcronymDb.AddedCount]));283 ShowMessage(Format(SAddedCount, [ImportTotalItemCount, Core.AcronymDb.AddedCount])); 298 284 UpdateAcronymsList; 299 285 UpdateInterface; … … 304 290 I: Integer; 305 291 begin 306 for I := 0 to AcronymDb.ImportSources.Count - 1 do307 with TImportSource( AcronymDb.ImportSources[I]) do292 for I := 0 to Core.AcronymDb.ImportSources.Count - 1 do 293 with TImportSource(Core.AcronymDb.ImportSources[I]) do 308 294 if Enabled then begin 309 295 Process; 310 296 ImportTotalItemCount := ImportTotalItemCount + ItemCount; 311 Job.Progress.Max := AcronymDb.ImportSources.Count;297 Job.Progress.Max := Core.AcronymDb.ImportSources.Count; 312 298 Job.Progress.Value := I; 313 299 if Job.Terminate then Break; … … 320 306 if FormSettings.ShowModal = mrOk then begin 321 307 FormSettings.Save; 322 SaveConfig;308 Core.SaveConfig; 323 309 end; 324 310 end; … … 338 324 procedure TFormMain.AShowCategoriesExecute(Sender: TObject); 339 325 begin 340 FormCategories.Categories := AcronymDb.Categories;326 FormCategories.Categories := Core.AcronymDb.Categories; 341 327 FormCategories.ShowModal; 342 328 UpdateAcronymsList; … … 352 338 procedure TFormMain.AShowImportFormatsExecute(Sender: TObject); 353 339 begin 354 FormImportFormats.ImportFormats := AcronymDb.ImportFormats;340 FormImportFormats.ImportFormats := Core.AcronymDb.ImportFormats; 355 341 FormImportFormats.ShowModal; 356 342 UpdateInterface; … … 359 345 procedure TFormMain.AShowImportSourcesExecute(Sender: TObject); 360 346 begin 361 FormImportSources.ImportSources := AcronymDb.ImportSources;347 FormImportSources.ImportSources := Core.AcronymDb.ImportSources; 362 348 FormImportSources.ShowModal; 363 349 UpdateAcronymsList; … … 377 363 procedure TFormMain.FormDestroy(Sender: TObject); 378 364 begin 379 FreeAndNil(AcronymDb);380 365 end; 381 366 382 367 procedure TFormMain.FormShow(Sender: TObject); 383 368 begin 384 Initialize;369 Core.Initialize; 385 370 386 371 if Visible then begin … … 442 427 procedure TFormMain.ListViewSort1Filter(ListViewSort: TListViewSort); 443 428 begin 444 AcronymDb.AssignToList(ListViewSort1.List);429 Core.AcronymDb.AssignToList(ListViewSort1.List); 445 430 FilterList(ListViewSort1.List); 446 431 end; … … 456 441 if not Visible then AShow.Execute 457 442 else Hide; 458 end;459 460 function TFormMain.FindFirstNonOption: string;461 var462 S: string;463 I: Integer;464 begin465 Result := '';466 for I := 1 to Application.ParamCount do begin467 S := Application.Params[I];468 if S[1] = Application.OptionChar then Continue;469 Result := S;470 Break;471 end;472 443 end; 473 444 … … 478 449 try 479 450 AFileNew.Execute; 480 AcronymDb.LoadFromFile(FileName);451 Core.AcronymDb.LoadFromFile(FileName); 481 452 LastOpenedList1.AddItem(FileName); 482 453 finally … … 484 455 UpdateInterface; 485 456 end; 486 end;487 end;488 489 procedure TFormMain.Initialize;490 var491 FileNameOption: string;492 begin493 if not InitializeStarted then begin494 InitializeStarted := True;495 LoadConfig;496 497 {$IFDEF 0}498 if Application.HasOption('h', 'help') then begin499 WriteLn('AcronymDecoder <project file>');500 WriteLn(' -t --tray Start minimized in system tray');501 WriteLn(' -h --help Show this help');502 Application.Terminate;503 Exit;504 end;505 {$ENDIF}506 507 if Application.HasOption('t', 'tray') then begin508 Visible := False;509 end;510 511 FileNameOption := FindFirstNonOption;512 if FileNameOption <> '' then begin513 // Open file specified as command line parameter514 AcronymDB.LoadFromFile(FileNameOption);515 LastOpenedList1.AddItem(OpenDialog1.FileName);516 end else517 if (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then begin518 // Open last opened file519 AcronymDB.LoadFromFile(LastOpenedList1.Items[0])520 end else begin521 // Open default database with examples if no item is in recent openned history522 FileNameOption := ExtractFileDir(Application.ExeName) + DirectorySeparator + ExampleFile;523 {$IFDEF Linux}524 // If installed in Linux system then use installation directory for po files525 if Application.ExeName = '/usr/bin/' + ExtractFileNameOnly(Application.ExeName) then526 FileNameOption := '/usr/share/' + ExtractFileNameOnly(Application.ExeName) + '/Examples/' + ExampleFile;527 {$ENDIF}528 ProjectOpen(FileNameOption);529 end;530 UpdateAcronymsList;531 ListViewFilter1.UpdateFromListView(ListViewAcronyms);532 InitializeFinished := True;533 457 end; 534 458 end; … … 545 469 Exit; 546 470 end; 547 end;548 549 procedure TFormMain.SetAlwaysOnTop(AValue: Boolean);550 begin551 if FAlwaysOnTop = AValue then Exit;552 FAlwaysOnTop := AValue;553 if FAlwaysOnTop then FormStyle := fsSystemStayOnTop554 else FormStyle := fsNormal;555 471 end; 556 472 … … 598 514 if ProjectClosed then begin 599 515 AFileNew.Execute; 600 AcronymDb.LoadFromFile(TMenuItem(Sender).Caption);516 Core.AcronymDb.LoadFromFile(TMenuItem(Sender).Caption); 601 517 LastOpenedList1.AddItem(TMenuItem(Sender).Caption); 602 518 UpdateAcronymsList; … … 607 523 procedure TFormMain.UpdateAcronymsList; 608 524 begin 609 if Assigned( AcronymDb) then begin525 if Assigned(Core.AcronymDb) then begin 610 526 ListViewSort1.Refresh; 611 527 end else begin … … 620 536 Title: string; 621 537 begin 622 ListViewAcronyms.Enabled := Assigned( AcronymDb);623 AFileClose.Enabled := Assigned( AcronymDb);624 AFileSave.Enabled := Assigned( AcronymDb) andAcronymDb.Modified;625 AFileSaveAs.Enabled := Assigned( AcronymDb);626 AManualImport.Enabled := Assigned( AcronymDb);627 AProcessImports.Enabled := Assigned( AcronymDb);628 AShowCategories.Enabled := Assigned( AcronymDb);629 AShowAcronyms.Enabled := Assigned( AcronymDb);630 AShowCategories.Enabled := Assigned( AcronymDb);631 AShowImportSources.Enabled := Assigned( AcronymDb);632 AShowImportFormats.Enabled := Assigned( AcronymDb);538 ListViewAcronyms.Enabled := Assigned(Core.AcronymDb); 539 AFileClose.Enabled := Assigned(Core.AcronymDb); 540 AFileSave.Enabled := Assigned(Core.AcronymDb) and Core.AcronymDb.Modified; 541 AFileSaveAs.Enabled := Assigned(Core.AcronymDb); 542 AManualImport.Enabled := Assigned(Core.AcronymDb); 543 AProcessImports.Enabled := Assigned(Core.AcronymDb); 544 AShowCategories.Enabled := Assigned(Core.AcronymDb); 545 AShowAcronyms.Enabled := Assigned(Core.AcronymDb); 546 AShowCategories.Enabled := Assigned(Core.AcronymDb); 547 AShowImportSources.Enabled := Assigned(Core.AcronymDb); 548 AShowImportFormats.Enabled := Assigned(Core.AcronymDb); 633 549 ToolBar1.Visible := MenuItemToolbar.Checked; 634 550 635 551 Title := Application.Title; 636 if Assigned( AcronymDb) and (ExtractFileName(AcronymDb.FileName) <> '') then637 if Assigned( AcronymDb) then Title := Title + ' - ' + ExtractFileName(AcronymDb.FileName);638 if Assigned( AcronymDb) andAcronymDb.Modified then Title := Title + ' (' + SModified + ')';552 if Assigned(Core.AcronymDb) and (ExtractFileName(Core.AcronymDb.FileName) <> '') then 553 if Assigned(Core.AcronymDb) then Title := Title + ' - ' + ExtractFileName(Core.AcronymDb.FileName); 554 if Assigned(Core.AcronymDb) and Core.AcronymDb.Modified then Title := Title + ' (' + SModified + ')'; 639 555 Caption := Title; 640 556 end; … … 660 576 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')) 661 577 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(''); 662 AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False);663 StartMinimizedToTray := ReadBoolWithDefault('StartMinimizedToTray', False);578 Core.AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False); 579 Core.StartMinimizedToTray := ReadBoolWithDefault('StartMinimizedToTray', False); 664 580 CheckBoxExactMath.Checked := ReadBoolWithDefault('ExactMatch', False); 665 581 MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True); … … 672 588 RootKey := HKEY_CURRENT_USER; 673 589 OpenKey(RegistryRunKey, True); 674 StartOnLogon := ValueExists('Acronym Decoder');590 Core.StartOnLogon := ValueExists('Acronym Decoder'); 675 591 finally 676 592 Free; … … 690 606 WriteString('LanguageCode', CoolTranslator1.Language.Code) 691 607 else DeleteValue('LanguageCode'); 692 WriteBool('AlwaysOnTop', AlwaysOnTop);693 WriteBool('StartMinimizedToTray', StartMinimizedToTray);608 WriteBool('AlwaysOnTop', Core.AlwaysOnTop); 609 WriteBool('StartMinimizedToTray', Core.StartMinimizedToTray); 694 610 WriteBool('ExactMatch', CheckBoxExactMath.Checked); 695 611 WriteBool('ToolBarVisible', MenuItemToolbar.Checked); … … 702 618 RootKey := HKEY_CURRENT_USER; 703 619 OpenKey(RegistryRunKey, True); 704 if StartOnLogon then begin705 if StartMinimizedToTray then WriteString('Acronym Decoder', Application.ExeName + ' ' + Application.OptionChar + 't')620 if Core.StartOnLogon then begin 621 if Core.StartMinimizedToTray then WriteString('Acronym Decoder', Application.ExeName + ' ' + Application.OptionChar + 't') 706 622 else WriteString('Acronym Decoder', Application.ExeName) 707 623 end else DeleteValue('Acronym Decoder'); -
trunk/Forms/UFormSettings.pas
r75 r86 40 40 41 41 uses 42 UFormMain ;42 UFormMain, UCore; 43 43 44 44 { TFormSettings } … … 64 64 procedure TFormSettings.Load; 65 65 begin 66 CheckBoxAlwaysOnTop.Checked := FormMain.AlwaysOnTop;67 CheckBoxStartOnLogon.Checked := FormMain.StartOnLogon;68 CheckBoxStartMinimizedToTray.Checked := FormMain.StartMinimizedToTray;66 CheckBoxAlwaysOnTop.Checked := Core.AlwaysOnTop; 67 CheckBoxStartOnLogon.Checked := Core.StartOnLogon; 68 CheckBoxStartMinimizedToTray.Checked := Core.StartMinimizedToTray; 69 69 UpdateInterface; 70 70 end; … … 72 72 procedure TFormSettings.Save; 73 73 begin 74 FormMain.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;75 FormMain.StartOnLogon := CheckBoxStartOnLogon.Checked;76 FormMain.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked;74 Core.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked; 75 Core.StartOnLogon := CheckBoxStartOnLogon.Checked; 76 Core.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked; 77 77 end; 78 78
Note:
See TracChangeset
for help on using the changeset viewer.