Changeset 184 for trunk/Forms


Ignore:
Timestamp:
Jul 4, 2018, 2:05:48 PM (6 years ago)
Author:
chronos
Message:
  • Added: New menu action Tools - Document check which shows a form for checking acronyms in text documents.
  • Added: Remember dimensions of Import, Export and Settings forms.
Location:
trunk/Forms
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormAcronyms.pas

    r174 r184  
    5050    procedure ListViewSort1Filter(ListViewSort: TListViewSort);
    5151  private
     52    FAcronyms: TAcronyms;
    5253    MeaningCount: Integer;
    5354    procedure FilterList(List: TListObject);
     55    procedure SetAcronyms(AValue: TAcronyms);
    5456    procedure UpdateAcronymsList;
    5557  public
    5658    FocusAcronym: TAcronymMeaning;
     59    property Acronyms: TAcronyms read FAcronyms write SetAcronyms;
    5760    procedure UpdateInterface;
    5861  end;
     
    147150    if FormAcronym.ShowModal = mrOk then begin
    148151      FormAcronym.Save(TempEntry);
    149       Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     152      Meaning := Acronyms.Db.AddAcronym(TempEntry.Name, TempEntry.Meaning);
    150153      Meaning.Description := TempEntry.Description;
    151154      Meaning.Categories.AssignFromStrings(TempEntry.Categories);
     
    156159          TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
    157160
    158       Core.AcronymDb.Update;
     161      Acronyms.Db.Update;
    159162      UpdateAcronymsList;
    160163      UpdateInterface;
     
    193196        not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin
    194197          // TODO: Update item inplace if possible
    195           Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));
    196           Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
     198          Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));
     199          Meaning := Acronyms.Db.AddAcronym(TempEntry.Name, TempEntry.Meaning);
    197200          Meaning.Description := TempEntry.Description;
    198201          Meaning.Categories.AssignFromStrings(TempEntry.Categories);
     
    202205            if TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.IndexOf(Meaning) = -1 then
    203206              TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning);
    204           Core.AcronymDb.Update;
     207          Acronyms.Db.Update;
    205208          UpdateAcronymsList;
    206209          UpdateInterface;
     
    222225    if MessageDlg(SRemoveAcronym, SRemoveAcronymQuery,
    223226    TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin
    224       Core.AcronymDb.BeginUpdate;
     227      Acronyms.Db.BeginUpdate;
    225228      for I := ListViewAcronyms.Items.Count - 1 downto 0 do
    226229        if ListViewAcronyms.Items[I].Selected then begin
    227230          ListViewAcronyms.Items[I].Selected := False;
    228           Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));
     231          Acronyms.Db.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));
    229232        end;
    230233      UpdateAcronymsList;
    231234      UpdateInterface;
    232       Core.AcronymDb.EndUpdate;
     235      Acronyms.Db.EndUpdate;
    233236    end;
    234237  end;
     
    287290procedure TFormAcronyms.ListViewSort1Filter(ListViewSort: TListViewSort);
    288291begin
    289   Core.AcronymDb.Acronyms.Sort(AcronymComparer);
    290   Core.AcronymDb.AssignToList(ListViewSort1.List);
     292  Acronyms.Db.Acronyms.Sort(AcronymComparer);
     293  Acronyms.Db.AssignToList(ListViewSort1.List);
    291294  MeaningCount := ListViewSort1.List.Count;
    292295  FilterList(ListViewSort1.List);
     
    322325end;
    323326
     327procedure TFormAcronyms.SetAcronyms(AValue: TAcronyms);
     328begin
     329  if FAcronyms = AValue then Exit;
     330  FAcronyms := AValue;
     331end;
     332
    324333procedure TFormAcronyms.UpdateAcronymsList;
    325334begin
     
    332341procedure TFormAcronyms.UpdateInterface;
    333342begin
    334   ARemove.Enabled := Assigned(Core.AcronymDb) and Assigned(ListViewAcronyms.Selected);
    335   AModify.Enabled := Assigned(Core.AcronymDb) and Assigned(ListViewAcronyms.Selected);
    336   AAdd.Enabled := Assigned(Core.AcronymDb);
     343  ARemove.Enabled := Assigned(FAcronyms) and Assigned(ListViewAcronyms.Selected);
     344  AModify.Enabled := Assigned(FAcronyms) and Assigned(ListViewAcronyms.Selected);
     345  AAdd.Enabled := Assigned(FAcronyms);
    337346  ASelectAll.Enabled := True;
    338347end;
  • trunk/Forms/UFormExport.lfm

    r174 r184  
    88  ClientWidth = 850
    99  DesignTimePPI = 120
     10  OnClose = FormClose
    1011  OnCreate = FormCreate
     12  OnShow = FormShow
    1113  Position = poScreenCenter
    12   LCLVersion = '1.8.0.6'
     14  LCLVersion = '1.8.2.0'
    1315  object ButtonProcess: TButton
    1416    Left = 18
  • trunk/Forms/UFormExport.pas

    r174 r184  
    2121    procedure ButtonProcessClick(Sender: TObject);
    2222    procedure ButtonSaveToFileClick(Sender: TObject);
     23    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2324    procedure FormCreate(Sender: TObject);
     25    procedure FormShow(Sender: TObject);
    2426  private
    2527    ItemCount: Integer;
     
    5860end;
    5961
     62procedure TFormExport.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     63begin
     64  Core.PersistentForm1.Save(Self);
     65end;
     66
    6067procedure TFormExport.FormCreate(Sender: TObject);
    6168begin
    6269  Core.CoolTranslator1.TranslateComponentRecursive(Self);
    6370  Core.ThemeManager.UseTheme(Self);
     71end;
     72
     73procedure TFormExport.FormShow(Sender: TObject);
     74begin
     75  Core.PersistentForm1.Load(Self);
    6476end;
    6577
  • trunk/Forms/UFormImport.lfm

    r174 r184  
    88  ClientWidth = 652
    99  DesignTimePPI = 120
     10  OnClose = FormClose
    1011  OnCreate = FormCreate
     12  OnShow = FormShow
    1113  Position = poScreenCenter
    12   LCLVersion = '1.8.0.6'
     14  LCLVersion = '1.8.2.0'
    1315  object ButtonProcess: TButton
    1416    Left = 16
  • trunk/Forms/UFormImport.pas

    r174 r184  
    2222    procedure ButtonProcessClick(Sender: TObject);
    2323    procedure ButtonLoadFromFileClick(Sender: TObject);
     24    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2425    procedure FormCreate(Sender: TObject);
     26    procedure FormShow(Sender: TObject);
    2527  private
    2628    procedure ImportMediaWiki;
     
    6062end;
    6163
     64procedure TFormImport.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     65begin
     66  Core.PersistentForm1.Save(Self);
     67end;
     68
    6269procedure TFormImport.FormCreate(Sender: TObject);
    6370begin
    6471  Core.CoolTranslator1.TranslateComponentRecursive(Self);
    6572  Core.ThemeManager.UseTheme(Self);
     73end;
     74
     75procedure TFormImport.FormShow(Sender: TObject);
     76begin
     77  Core.PersistentForm1.Load(Self);
    6678end;
    6779
  • trunk/Forms/UFormMain.lfm

    r176 r184  
    1515  OnHide = FormHide
    1616  OnShow = FormShow
    17   LCLVersion = '1.8.0.6'
     17  LCLVersion = '1.8.2.0'
    1818  object PanelMain: TPanel
    1919    Left = 0
     
    416416      OnExecute = AManageAcronymExecute
    417417    end
     418    object ADocumentCheck: TAction
     419      Caption = 'Document check'
     420      OnExecute = ADocumentCheckExecute
     421    end
    418422  end
    419423  object MainMenu1: TMainMenu
     
    488492      object MenuItem23: TMenuItem
    489493        Action = AProcessImports
     494      end
     495      object MenuItem3: TMenuItem
     496        Action = ADocumentCheck
     497      end
     498      object MenuItem2: TMenuItem
     499        Caption = '-'
    490500      end
    491501      object MenuItem18: TMenuItem
  • trunk/Forms/UFormMain.pas

    r180 r184  
    1616
    1717  TFormMain = class(TForm)
     18    ADocumentCheck: TAction;
    1819    AFilterEnabledCategories: TAction;
    1920    AManageAcronym: TAction;
     
    4849    MainMenu1: TMainMenu;
    4950    MenuItem1: TMenuItem;
     51    MenuItem2: TMenuItem;
     52    MenuItem3: TMenuItem;
    5053    MenuItemShowItemsWithoutFilter: TMenuItem;
    5154    MenuItemStatusBar: TMenuItem;
     
    98101    ToolButton8: TToolButton;
    99102    ToolButton9: TToolButton;
     103    procedure ADocumentCheckExecute(Sender: TObject);
    100104    procedure AExitExecute(Sender: TObject);
    101105    procedure AExportExecute(Sender: TObject);
     
    175179uses
    176180  UFormImport, UFormSettings, UFormCategories, UFormAcronyms, UFormExport,
    177   UFormImportSources, UFormAbout, UFormImportFormats, UCore;
     181  UFormImportSources, UFormAbout, UFormImportFormats, UCore, UFormCheck;
    178182
    179183resourcestring
     
    240244begin
    241245  Close;
     246end;
     247
     248procedure TFormMain.ADocumentCheckExecute(Sender: TObject);
     249begin
     250  FormCheck := TFormCheck.Create(Self);
     251  try
     252    FormCheck.LoadConfig;
     253    FormCheck.ShowModal;
     254    FormCheck.SaveConfig;
     255  finally
     256    FreeAndNil(FormCheck);
     257  end;
    242258end;
    243259
     
    365381    if Assigned(ListViewAcronyms.Selected) then
    366382      FormAcronyms.FocusAcronym := ListViewAcronyms.Selected.Data;
     383    FormAcronyms.Acronyms := Core.AcronymDb.Acronyms;
    367384    FormAcronyms.ShowModal;
    368385    UpdateAcronymsList;
     
    429446  FormAcronyms := TFormAcronyms.Create(Self);
    430447  try
     448    FormAcronyms.Acronyms := Core.AcronymDb.Acronyms;
    431449    FormAcronyms.ShowModal;
    432450    UpdateAcronymsList;
  • trunk/Forms/UFormSettings.lfm

    r174 r184  
    1010  Constraints.MinWidth = 389
    1111  DesignTimePPI = 120
     12  OnClose = FormClose
    1213  OnCreate = FormCreate
    1314  OnShow = FormShow
    1415  Position = poScreenCenter
    15   LCLVersion = '1.8.0.6'
     16  LCLVersion = '1.8.2.0'
    1617  object ComboBoxLanguage: TComboBox
    1718    Left = 152
  • trunk/Forms/UFormSettings.pas

    r174 r184  
    3131    procedure CheckBoxAutomaticDPIChange(Sender: TObject);
    3232    procedure CheckBoxStartOnLogonChange(Sender: TObject);
     33    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3334    procedure FormCreate(Sender: TObject);
    3435    procedure FormShow(Sender: TObject);
     
    5556procedure TFormSettings.FormShow(Sender: TObject);
    5657begin
     58  Core.PersistentForm1.Load(Self);
    5759end;
    5860
     
    6971begin
    7072  UpdateInterface;
     73end;
     74
     75procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction
     76  );
     77begin
     78  Core.PersistentForm1.Save(Self);
    7179end;
    7280
Note: See TracChangeset for help on using the changeset viewer.