Changeset 33 for trunk


Ignore:
Timestamp:
Jul 13, 2016, 2:51:53 PM (8 years ago)
Author:
chronos
Message:
  • Added: Now import sources have categories which are merged to new imported acronym meanings.
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/AcronymDecoder.lpi

    r31 r33  
    124124        <Filename Value="Forms\UFormImport.pas"/>
    125125        <IsPartOfProject Value="True"/>
    126         <HasResources Value="True"/>
     126        <ComponentName Value="FormImport"/>
     127        <HasResources Value="True"/>
     128        <ResourceBaseClass Value="Form"/>
    127129      </Unit5>
    128130      <Unit6>
  • trunk/Forms/UFormAcronym.lfm

    r17 r33  
    122122  end
    123123  object ActionList1: TActionList
     124    Images = FormMain.ImageList1
    124125    left = 361
    125126    top = 240
    126127    object ACategoryRemove: TAction
    127128      Caption = 'Remove'
     129      ImageIndex = 4
    128130      OnExecute = ACategoryRemoveExecute
    129131    end
    130132    object ACategoryAdd: TAction
    131133      Caption = 'Add'
     134      ImageIndex = 0
    132135      OnExecute = ACategoryAddExecute
    133136    end
    134137  end
    135138  object PopupMenuCategory: TPopupMenu
     139    Images = FormMain.ImageList1
    136140    left = 192
    137141    top = 244
     142    object MenuItem2: TMenuItem
     143      Action = ACategoryAdd
     144    end
     145    object MenuItem1: TMenuItem
     146      Action = ACategoryRemove
     147    end
    138148  end
    139149end
  • trunk/Forms/UFormAcronym.pas

    r16 r33  
    2929    ListBox1: TListBox;
    3030    MemoDescription: TMemo;
     31    MenuItem1: TMenuItem;
     32    MenuItem2: TMenuItem;
    3133    PopupMenuCategory: TPopupMenu;
    3234    procedure ACategoryAddExecute(Sender: TObject);
     
    5254uses
    5355  UFormMain, UFormCategorySelect;
    54 
    55 resourcestring
    56   SCategory = 'Category';
    57   SRemoveCategory = 'Remove categories';
    58   SRemoveCategoryQuery = 'Do you really want to remove selected categories?';
    5956
    6057{ TFormAcronym }
  • trunk/Forms/UFormCategorySelect.lfm

    r13 r33  
    88  ClientWidth = 794
    99  OnShow = FormShow
    10   LCLVersion = '1.7'
     10  LCLVersion = '1.6.0.4'
    1111  object ListBox1: TListBox
    1212    Left = 16
     
    1717    ItemHeight = 0
    1818    MultiSelect = True
     19    OnDblClick = ListBox1DblClick
     20    OnKeyPress = ListBox1KeyPress
    1921    ScrollWidth = 762
    2022    TabOrder = 0
    21     TopIndex = -1
    2223  end
    2324  object ButtonOk: TButton
  • trunk/Forms/UFormCategorySelect.pas

    r13 r33  
    1818    ListBox1: TListBox;
    1919    procedure FormShow(Sender: TObject);
     20    procedure ListBox1DblClick(Sender: TObject);
     21    procedure ListBox1KeyPress(Sender: TObject; var Key: char);
    2022  private
    2123    { private declarations }
     
    2628var
    2729  FormCategorySelect: TFormCategorySelect;
     30
     31resourcestring
     32  SCategory = 'Category';
     33  SRemoveCategory = 'Remove categories';
     34  SRemoveCategoryQuery = 'Do you really want to remove selected categories?';
    2835
    2936implementation
     
    3845procedure TFormCategorySelect.FormShow(Sender: TObject);
    3946begin
     47end;
     48
     49procedure TFormCategorySelect.ListBox1DblClick(Sender: TObject);
     50begin
     51  ButtonOk.Click;
     52end;
     53
     54procedure TFormCategorySelect.ListBox1KeyPress(Sender: TObject; var Key: char);
     55begin
     56  if Key = #13 then ButtonOk.Click;
    4057end;
    4158
  • trunk/Forms/UFormImportSource.lfm

    r29 r33  
    11object FormImportSource: TFormImportSource
    2   Left = 506
    3   Height = 282
    4   Top = 363
    5   Width = 507
     2  Left = 492
     3  Height = 403
     4  Top = 313
     5  Width = 604
    66  Caption = 'Import source'
    7   ClientHeight = 282
    8   ClientWidth = 507
     7  ClientHeight = 403
     8  ClientWidth = 604
     9  OnShow = FormShow
    910  LCLVersion = '1.6.0.4'
    1011  object EditName: TEdit
    11     Left = 160
     12    Left = 135
    1213    Height = 28
    1314    Top = 10
    14     Width = 340
     15    Width = 455
    1516    Anchors = [akTop, akLeft, akRight]
    1617    TabOrder = 0
     
    2526  end
    2627  object Label2: TLabel
    27     Left = 8
     28    Left = 10
    2829    Height = 20
    29     Top = 48
     30    Top = 49
    3031    Width = 78
    3132    Caption = 'Source URL:'
     
    3334  end
    3435  object EditURL: TEdit
    35     Left = 160
     36    Left = 135
    3637    Height = 28
    3738    Top = 49
    38     Width = 340
     39    Width = 455
    3940    Anchors = [akTop, akLeft, akRight]
    4041    TabOrder = 1
    4142  end
    4243  object ButtonOk: TButton
    43     Left = 412
     44    Left = 515
    4445    Height = 25
    45     Top = 244
     46    Top = 365
    4647    Width = 75
    4748    Anchors = [akRight, akBottom]
     
    5152  end
    5253  object ButtonCancel: TButton
    53     Left = 316
     54    Left = 413
    5455    Height = 25
    55     Top = 244
     56    Top = 365
    5657    Width = 75
    5758    Anchors = [akRight, akBottom]
     
    6162  end
    6263  object Label3: TLabel
    63     Left = 11
     64    Left = 10
    6465    Height = 20
    6566    Top = 96
     
    6970  end
    7071  object ComboBox1: TComboBox
    71     Left = 160
     72    Left = 135
    7273    Height = 28
    7374    Top = 91
    74     Width = 212
     75    Width = 334
    7576    Anchors = [akTop, akLeft, akRight]
    7677    ItemHeight = 20
     
    7980  end
    8081  object ButtonShowFormat: TButton
    81     Left = 380
     82    Left = 477
    8283    Height = 25
    8384    Top = 91
    84     Width = 120
     85    Width = 112
    8586    Anchors = [akTop, akRight]
    8687    Caption = 'Configure'
     
    8990  end
    9091  object CheckBoxEnabled: TCheckBox
    91     Left = 11
     92    Left = 10
    9293    Height = 24
    93     Top = 136
     94    Top = 128
    9495    Width = 78
    9596    Caption = 'Enabled'
    9697    TabOrder = 6
    9798  end
     99  object Label4: TLabel
     100    Left = 10
     101    Height = 20
     102    Top = 160
     103    Width = 74
     104    Caption = 'Categories:'
     105    ParentColor = False
     106  end
     107  object ListBox1: TListBox
     108    Left = 135
     109    Height = 141
     110    Top = 160
     111    Width = 455
     112    Anchors = [akTop, akLeft, akRight]
     113    ItemHeight = 0
     114    MultiSelect = True
     115    PopupMenu = PopupMenuCategory
     116    ScrollWidth = 358
     117    TabOrder = 7
     118  end
     119  object Button1: TButton
     120    Left = 135
     121    Height = 25
     122    Top = 312
     123    Width = 75
     124    Action = ACategoryAdd
     125    TabOrder = 8
     126  end
     127  object Button2: TButton
     128    Left = 231
     129    Height = 25
     130    Top = 312
     131    Width = 75
     132    Action = ACategoryRemove
     133    TabOrder = 9
     134  end
     135  object Bevel1: TBevel
     136    Left = 10
     137    Height = 2
     138    Top = 352
     139    Width = 580
     140    Anchors = [akLeft, akBottom]
     141  end
     142  object ActionList1: TActionList
     143    Images = FormMain.ImageList1
     144    left = 384
     145    top = 208
     146    object ACategoryRemove: TAction
     147      Caption = 'Remove'
     148      ImageIndex = 4
     149      OnExecute = ACategoryRemoveExecute
     150    end
     151    object ACategoryAdd: TAction
     152      Caption = 'Add'
     153      ImageIndex = 0
     154      OnExecute = ACategoryAddExecute
     155    end
     156  end
     157  object PopupMenuCategory: TPopupMenu
     158    Images = FormMain.ImageList1
     159    left = 208
     160    top = 208
     161    object MenuItem2: TMenuItem
     162      Action = ACategoryAdd
     163    end
     164    object MenuItem1: TMenuItem
     165      Action = ACategoryRemove
     166    end
     167  end
    98168end
  • trunk/Forms/UFormImportSource.lrt

    r29 r33  
    77TFORMIMPORTSOURCE.BUTTONSHOWFORMAT.CAPTION=Configure
    88TFORMIMPORTSOURCE.CHECKBOXENABLED.CAPTION=Enabled
     9TFORMIMPORTSOURCE.LABEL4.CAPTION=Categories:
     10TFORMIMPORTSOURCE.ACATEGORYREMOVE.CAPTION=Remove
     11TFORMIMPORTSOURCE.ACATEGORYADD.CAPTION=Add
  • trunk/Forms/UFormImportSource.pas

    r29 r33  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   UAcronym;
     9  ActnList, Menus, ExtCtrls, UAcronym;
    1010
    1111type
     
    1414
    1515  TFormImportSource = class(TForm)
     16    ACategoryAdd: TAction;
     17    ACategoryRemove: TAction;
     18    ActionList1: TActionList;
     19    Bevel1: TBevel;
     20    Button1: TButton;
     21    Button2: TButton;
    1622    ButtonShowFormat: TButton;
    1723    ButtonOk: TButton;
     
    2430    Label2: TLabel;
    2531    Label3: TLabel;
     32    Label4: TLabel;
     33    ListBox1: TListBox;
     34    MenuItem1: TMenuItem;
     35    MenuItem2: TMenuItem;
     36    PopupMenuCategory: TPopupMenu;
     37    procedure ACategoryAddExecute(Sender: TObject);
     38    procedure ACategoryRemoveExecute(Sender: TObject);
    2639    procedure ButtonShowFormatClick(Sender: TObject);
     40    procedure FormShow(Sender: TObject);
    2741  private
    2842    { private declarations }
    2943  public
     44    procedure UpdateInterface;
    3045    procedure Load(ImportSource: TImportSource);
    3146    procedure Save(ImportSource: TImportSource);
     
    4055
    4156uses
    42   UFormMain, UFormImportFormat;
     57  UFormMain, UFormImportFormat, UFormCategorySelect;
    4358
    4459{ TFormImportSource }
     
    6277end;
    6378
     79procedure TFormImportSource.FormShow(Sender: TObject);
     80begin
     81  UpdateInterface;
     82end;
     83
     84procedure TFormImportSource.UpdateInterface;
     85begin
     86  ACategoryRemove.Enabled := ListBox1.ItemIndex <> -1;
     87end;
     88
     89procedure TFormImportSource.ACategoryAddExecute(Sender: TObject);
     90var
     91  I: Integer;
     92begin
     93  FormCategorySelect.Load(ListBox1.Items);
     94  if FormCategorySelect.ShowModal = mrOk then begin
     95    for I := 0 to FormCategorySelect.ListBox1.Count - 1 do
     96      if FormCategorySelect.ListBox1.Selected[I] then begin
     97        ListBox1.Items.AddObject(FormCategorySelect.ListBox1.Items[I], FormCategorySelect.ListBox1.Items.Objects[I]);
     98      end;
     99  end;
     100end;
     101
     102procedure TFormImportSource.ACategoryRemoveExecute(Sender: TObject);
     103var
     104  I: Integer;
     105begin
     106  if MessageDlg(SRemoveCategory, SRemoveCategoryQuery,
     107  TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin
     108    for I := ListBox1.Items.Count - 1 downto 0 do
     109    if ListBox1.Selected[I] then
     110      ListBox1.Items.Delete(I);
     111    UpdateInterface;
     112  end;
     113end;
     114
    64115procedure TFormImportSource.Load(ImportSource: TImportSource);
    65116var
     
    80131    ComboBox1.ItemIndex := 0;
    81132  CheckBoxEnabled.Checked := ImportSource.Enabled;
     133  ImportSource.Categories.AssignToStrings(ListBox1.Items);
    82134end;
    83135
     
    88140  ImportSource.Format := TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]);
    89141  ImportSource.Enabled := CheckBoxEnabled.Checked;
     142  ImportSource.Categories.AssignFromStrings(ListBox1.Items);
    90143end;
    91144
  • trunk/Forms/UFormImportSources.lfm

    r30 r33  
    33  Height = 414
    44  Top = 327
    5   Width = 591
     5  Width = 812
    66  Caption = 'Import sources'
    77  ClientHeight = 414
    8   ClientWidth = 591
     8  ClientWidth = 812
    99  OnShow = FormShow
    1010  LCLVersion = '1.6.0.4'
     
    1313    Height = 398
    1414    Top = 8
    15     Width = 577
     15    Width = 798
    1616    Anchors = [akTop, akLeft, akRight, akBottom]
    1717    Checkboxes = True
     
    2323      item
    2424        Caption = 'URL'
    25         Width = 407
     25        Width = 250
     26      end   
     27      item
     28        Caption = 'Count'
     29        Width = 70
     30      end   
     31      item
     32        Caption = 'Categories'
     33        Width = 200
    2634      end>
    2735    MultiSelect = True
     
    6068    object AProcess: TAction
    6169      Caption = 'Process'
     70      ImageIndex = 5
    6271      OnExecute = AProcessExecute
    6372    end
     
    6978    object MenuItem1: TMenuItem
    7079      Action = AAdd
     80      Bitmap.Data = {
     81        36040000424D3604000000000000360000002800000010000000100000000100
     82        2000000000000004000064000000640000000000000000000000000000000000
     83        0000000000000000000000000000000000000000000000000000000000000000
     84        0000000000000000000000000000000000000000000000000000000000000000
     85        000000000000000000000000000000000000D4D4D4FFB2B2B2FFB2B2B2FFD4D4
     86        D4FF000000000000000000000000000000000000000000000000000000000000
     87        0000000000000000000000000000709B70FF004A00FF004800FF4E764EFFB2B2
     88        B2FF000000000000000000000000000000000000000000000000000000000000
     89        0000000000000000000000000000004E00FF00C800FF00C400FF004800FFB2B2
     90        B2FF000000000000000000000000000000000000000000000000000000000000
     91        0000000000000000000000000000005000FF00CA00FF00C600FF004A00FFB2B2
     92        B2FF000000000000000000000000000000000000000000000000000000000000
     93        0000000000000000000000000000005300FF00CE00FF00CA00FF004C00FFB2B2
     94        B2FF00000000000000000000000000000000000000000000000000000000D4D4
     95        D4FFB2B2B2FFB2B2B2FFB2B2B2FF005400FF00D200FF00CE00FF004E00FFB2B2
     96        B2FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2B2FFD4D4D4FF0000000070A670FF005E
     97        00FF005C00FF005A00FF005800FF005600FF00D600FF00D000FF005000FF004E
     98        00FF004C00FF004A00FF004A00FF4E764EFFB2B2B2FF00000000006200FF8CFE
     99        8CFF00EA00FF00E600FF00E200FF00DE00FF00DA00FF00D400FF00D000FF00CC
     100        00FF00C800FF00C400FF00C200FF004800FFB2B2B2FF00000000006400FFECFF
     101        ECFF8CFE8CFF8CFE8CFF8CFE8CFF8CFE8CFF00DE00FF00D900FF00D400FF00D0
     102        00FF00CC00FF00C800FF00C400FF004A00FFD4D4D4FF0000000070A970FF0064
     103        00FF006400FF006200FF006000FF006000FF8CFE8CFF00DD00FF005800FF0056
     104        00FF005400FF005300FF005000FF709C70FF0000000000000000000000000000
     105        0000000000000000000000000000006000FF8CFE8CFF00E000FF005A00FFB2B2
     106        B2FF000000000000000000000000000000000000000000000000000000000000
     107        0000000000000000000000000000006200FF8CFE8CFF00E500FF005C00FFB2B2
     108        B2FF000000000000000000000000000000000000000000000000000000000000
     109        0000000000000000000000000000006400FF8CFE8CFF00E800FF005E00FFB2B2
     110        B2FF000000000000000000000000000000000000000000000000000000000000
     111        0000000000000000000000000000006400FFECFFECFF8CFE8CFF006000FFD4D4
     112        D4FF000000000000000000000000000000000000000000000000000000000000
     113        000000000000000000000000000070A970FF006400FF006200FF70A670FF0000
     114        0000000000000000000000000000000000000000000000000000
     115      }
    71116    end
    72117    object MenuItem2: TMenuItem
    73118      Action = AModify
     119      Bitmap.Data = {
     120        36040000424D3604000000000000360000002800000010000000100000000100
     121        2000000000000004000064000000640000000000000000000000986B37FF976A
     122        36FF966935FF966734FF956633FF946532FF946531FF936430FF92622FFF9261
     123        2EFF91602DFF90602CFF905F2BFF8F5D2AFF8E5C29FF8D5B28FF996C38FFF8F7
     124        F6FFF8F7F5FFF7F6F5FFF6F6F4FFF6F5F3FFF5F5F3FFF5F4F2FFF4F3F1FFF4F3
     125        F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F0EEFFF1F0EDFF8E5D29FF996D3AFFF9F8
     126        F7FF959594FF878787FF9B9A9AFFF7F6F4FFF6F5F3FFF6F5F3FFF5F4F2FFF4F3
     127        F1FFF4F3F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F1EEFF8F5E2AFF9A6E3BFFF9F9
     128        F8FF7C7C7CFFC4C4C4FF878787FFF7F6F5FF7A7A7AFF787878FF747474FF7171
     129        70FF6D6D6CFF696968FF656565FF616161FFF2F1EFFF905F2BFF9B6F3CFFFAF9
     130        F8FFBEBEBDFF929292FFBCBCBBFFF8F7F6FFF7F7F5FFF7F6F4FFF6F5F4FFF6F5
     131        F3FFF5F4F2FFF5F4F2FFF4F3F1FFF4F2F0FFF3F2F0FF91602DFF9C703DFFFAFA
     132        F9FFFAF9F9FFF9F9F8FFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6F5FFF6F5
     133        F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FFF4F3F0FF92612EFF9D723EFFFBFB
     134        FAFF9F9F9EFF7F7F7FFFAEAEADFFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6
     135        F5FFF6F6F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FF92622FFF9D7340FFFCFB
     136        FBFF818181FFC4C4C4FF8F8F8FFFFAF9F8FF7B7B7AFF797979FF757574FF7271
     137        71FF6D6D6DFF696969FF666665FF626261FFF5F4F2FF936430FF9E7441FFFCFC
     138        FCFFB5B5B5FF848484FFBEBDBDFFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FFF8F8
     139        F6FFF8F7F5FFF7F6F5FFF7F6F4FFF6F5F3FFF6F5F3FF946531FF9F7542FFFDFD
     140        FCFFFCFCFCFFFCFCFBFFFBFBFAFFFBFAFAFFFAFAF9FFFAF9F8FFF9F9F8FFF9F8
     141        F7FFF8F8F6FFF8F7F6FFF7F6F5FFF7F6F4FFF6F5F4FF956633FFA07643FFFEFD
     142        FDFF8C8C8CFF525252FFA4A4A4FFFBFBFAFFFBFBFAFFFAFAF9FFFAF9F8FFF9F9
     143        F8FFF9F8F7FFF8F8F6FFF8F7F6FFF7F7F5FFF7F6F4FF966734FFA17844FFFEFE
     144        FEFF5F5F5FFF949494FF535353FFFCFCFBFF7B7B7BFF797979FF757575FF7272
     145        72FF6E6E6EFF6A6A69FF666666FF626262FFF7F7F5FF966935FFA17946FFFFFF
     146        FFFF878787FF5D5D5DFFA0A0A0FFFDFCFCFFFCFCFBFFFCFBFBFFFBFBFAFFFBFA
     147        F9FFFAFAF9FFFAF9F8FFF9F8F7FFF8F8F7FFF8F7F6FF976A36FFA27A47FFFFFF
     148        FFFFFFFFFFFFFEFEFEFFFEFEFEFFFDFDFDFFFDFDFCFFFCFCFBFFFCFBFBFFFBFB
     149        FAFFFBFAF9FFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FF986B37FFA37B48FFBEA2
     150        7FFFBEA17EFFBDA17DFFBDA07CFFBD9F7CFFBC9F7BFFBB9E7AFFBB9D7AFFBB9D
     151        79FFBA9C78FFB99B78FFB99A77FFB89A76FFB89975FF996C39FFA37B48FFA37B
     152        48FFA27A47FFA27946FFA17845FFA07744FFA07643FF9F7542FF9E7441FF9E73
     153        40FF9D723FFF9C713EFF9C703DFF9B6F3CFF9A6E3BFF9A6D3AFF
     154      }
    74155    end
    75156    object MenuItem3: TMenuItem
    76157      Action = ARemove
     158      Bitmap.Data = {
     159        36040000424D3604000000000000360000002800000010000000100000000100
     160        2000000000000004000064000000640000000000000000000000000000000000
     161        0000000000000000000000000000000000000000000000000000000000000000
     162        0000000000000000000000000000000000000000000000000000000000000000
     163        000000000000DCDCDCFFB2B2B2FFDCDCDCFF0000000000000000000000000000
     164        000000000000DCDCDCFFB2B2B2FFDCDCDCFF0000000000000000000000000000
     165        00007979A8FF000067FF626291FFB2B2B2FFDCDCDCFF00000000000000000000
     166        00007979A8FF000050FF626291FFB2B2B2FFDCDCDCFF00000000000000008C8C
     167        BBFF00006EFF0035FFFF000068FF626291FFB2B2B2FFDCDCDCFF000000007979
     168        A8FF000054FF0015FFFF000050FF626291FFB2B2B2FF00000000000000000000
     169        72FF619BFFFF003AFFFF0035FFFF000067FF626291FFB2B2B2FF7979A8FF0000
     170        59FF001BFFFF0018FFFF0015FFFF000050FFDCDCDCFF00000000000000008C8C
     171        BBFF000075FF619BFFFF003AFFFF0035FFFF000067FF626291FF000061FF0023
     172        FFFF001FFFFF001BFFFF000054FF7979A8FF0000000000000000000000000000
     173        00008C8CBBFF000075FF619BFFFF003AFFFF0035FFFF000067FF002CFFFF0027
     174        FFFF0023FFFF000059FF7979A8FF000000000000000000000000000000000000
     175        0000000000008C8CBBFF000075FF619BFFFF003AFFFF0035FFFF0030FFFF002B
     176        FFFF000061FF7979A8FF00000000000000000000000000000000000000000000
     177        000000000000000000007979A8FF000075FF003EFFFF003AFFFF0035FFFF0000
     178        68FF626291FFB2B2B2FFDCDCDCFF000000000000000000000000000000000000
     179        0000000000007979A8FF00007CFF0047FFFF0042FFFF003EFFFF003AFFFF0035
     180        FFFF000068FF626291FFB2B2B2FFDCDCDCFF0000000000000000000000000000
     181        00007979A8FF000082FF004EFFFF004BFFFF0047FFFF000075FF619BFFFF003A
     182        FFFF0035FFFF000068FF626291FFB2B2B2FFDCDCDCFF00000000000000008C8C
     183        BBFF000086FF0054FFFF0052FFFF004EFFFF00007CFF7979A8FF000075FF619B
     184        FFFF003AFFFF0035FFFF000067FF626291FFB2B2B2FF00000000000000000000
     185        88FF619BFFFF0057FFFF0054FFFF000082FF7979A8FF000000008C8CBBFF0000
     186        75FF619BFFFF003AFFFF0035FFFF000068FFDCDCDCFF00000000000000008C8C
     187        BBFF000088FF619BFFFF000086FF7979A8FF0000000000000000000000008C8C
     188        BBFF000075FF619BFFFF00006EFF7979A8FF0000000000000000000000000000
     189        00008C8CBBFF000088FF8C8CBBFF000000000000000000000000000000000000
     190        00008C8CBBFF000075FF8C8CBBFF000000000000000000000000000000000000
     191        0000000000000000000000000000000000000000000000000000000000000000
     192        0000000000000000000000000000000000000000000000000000
     193      }
    77194    end
    78195    object MenuItem4: TMenuItem
  • trunk/Forms/UFormImportSources.lrt

    r28 r33  
    22TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[0].CAPTION=Name
    33TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[1].CAPTION=URL
     4TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[2].CAPTION=Count
     5TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[3].CAPTION=Categories
    46TFORMIMPORTSOURCES.AADD.CAPTION=Add
    57TFORMIMPORTSOURCES.AREMOVE.CAPTION=Remove
  • trunk/Forms/UFormImportSources.pas

    r29 r33  
    6767    Item.Data := ImportSources[Item.Index];
    6868    Item.SubItems.Add(URL);
     69    Item.SubItems.Add(IntToStr(ItemCount));
     70    Item.SubItems.Add(Categories.GetString);
    6971    Item.Checked := Enabled;
    7072  end;
  • trunk/Forms/UFormMain.lfm

    r31 r33  
    44244424    end
    44254425    object MenuItem3: TMenuItem
    4426       Action = AImport
     4426      Action = AManualImport
    44274427    end
    44284428    object MenuItem19: TMenuItem
     
    45184518      OnExecute = AShowExecute
    45194519    end
    4520     object AImport: TAction
    4521       Caption = 'Import'
    4522       OnExecute = AImportExecute
     4520    object AManualImport: TAction
     4521      Caption = 'Manual import'
     4522      OnExecute = AManualImportExecute
    45234523    end
    45244524    object AFileOpen: TAction
     
    50055005      Caption = 'Tools'
    50065006      object MenuItem17: TMenuItem
    5007         Action = AImport
     5007        Action = AManualImport
    50085008      end
    50095009      object MenuItem23: TMenuItem
  • trunk/Forms/UFormMain.lrt

    r30 r33  
    88TFORMMAIN.AEXIT.CAPTION=Exit
    99TFORMMAIN.ASHOW.CAPTION=Show
    10 TFORMMAIN.AIMPORT.CAPTION=Import
     10TFORMMAIN.AMANUALIMPORT.CAPTION=Manual import
    1111TFORMMAIN.AFILEOPEN.CAPTION=Open
    1212TFORMMAIN.AFILENEW.CAPTION=New
  • trunk/Forms/UFormMain.pas

    r31 r33  
    2828    AFileNew: TAction;
    2929    AFileOpen: TAction;
    30     AImport: TAction;
     30    AManualImport: TAction;
    3131    AShow: TAction;
    3232    AExit: TAction;
     
    8787    procedure AFileSaveAsExecute(Sender: TObject);
    8888    procedure AFileSaveExecute(Sender: TObject);
    89     procedure AImportExecute(Sender: TObject);
     89    procedure AManualImportExecute(Sender: TObject);
    9090    procedure AProcessImportsExecute(Sender: TObject);
    9191    procedure ASettingsExecute(Sender: TObject);
     
    259259end;
    260260
    261 procedure TFormMain.AImportExecute(Sender: TObject);
     261procedure TFormMain.AManualImportExecute(Sender: TObject);
    262262begin
    263263  FormImport.ShowModal;
     
    503503  AFileSave.Enabled := Assigned(AcronymDb) and AcronymDb.Modified;
    504504  AFileSaveAs.Enabled := Assigned(AcronymDb);
    505   AImport.Enabled := Assigned(AcronymDb);
     505  AManualImport.Enabled := Assigned(AcronymDb);
    506506  AShowCategories.Enabled := Assigned(AcronymDb);
    507507  AShowAcronyms.Enabled := Assigned(AcronymDb);
  • trunk/Languages/AcronymDecoder.cs.po

    r31 r33  
    7979
    8080#: tformacronym.label4.caption
     81msgctxt "tformacronym.label4.caption"
    8182msgid "Categories:"
    8283msgstr "Kategorie:"
     
    107108
    108109#: tformacronyms.listviewacronyms.columns[0].caption
     110#, fuzzy
     111#| msgid "Name"
    109112msgctxt "tformacronyms.listviewacronyms.columns[0].caption"
     113msgid "Id"
     114msgstr "Název"
     115
     116#: tformacronyms.listviewacronyms.columns[1].caption
     117#, fuzzy
     118#| msgid "Description"
     119msgctxt "tformacronyms.listviewacronyms.columns[1].caption"
    110120msgid "Name"
    111 msgstr "Název"
    112 
    113 #: tformacronyms.listviewacronyms.columns[1].caption
    114 msgctxt "tformacronyms.listviewacronyms.columns[1].caption"
     121msgstr "Popis"
     122
     123#: tformacronyms.listviewacronyms.columns[2].caption
     124#, fuzzy
     125#| msgid "Categories"
     126msgctxt "tformacronyms.listviewacronyms.columns[2].caption"
    115127msgid "Description"
    116 msgstr "Popis"
    117 
    118 #: tformacronyms.listviewacronyms.columns[2].caption
    119 msgctxt "tformacronyms.listviewacronyms.columns[2].caption"
     128msgstr "Kategorie"
     129
     130#: tformacronyms.listviewacronyms.columns[3].caption
     131#, fuzzy
     132msgctxt "tformacronyms.listviewacronyms.columns[3].caption"
    120133msgid "Categories"
    121134msgstr "Kategorie"
     
    332345msgstr "Koncový řetězec"
    333346
     347#: tformimportsource.acategoryadd.caption
     348#, fuzzy
     349msgctxt "tformimportsource.acategoryadd.caption"
     350msgid "Add"
     351msgstr "Přidat"
     352
     353#: tformimportsource.acategoryremove.caption
     354#, fuzzy
     355msgctxt "tformimportsource.acategoryremove.caption"
     356msgid "Remove"
     357msgstr "Odebrat"
     358
    334359#: tformimportsource.buttoncancel.caption
    335360msgctxt "tformimportsource.buttoncancel.caption"
     
    369394msgstr "Formát dat:"
    370395
     396#: tformimportsource.label4.caption
     397#, fuzzy
     398msgctxt "tformimportsource.label4.caption"
     399msgid "Categories:"
     400msgstr "Kategorie:"
     401
    371402#: tformimportsources.aadd.caption
    372403msgctxt "tformimportsources.aadd.caption"
     
    403434msgstr "URL"
    404435
     436#: tformimportsources.listview1.columns[2].caption
     437msgid "Count"
     438msgstr ""
     439
     440#: tformimportsources.listview1.columns[3].caption
     441#, fuzzy
     442msgctxt "tformimportsources.listview1.columns[3].caption"
     443msgid "Categories"
     444msgstr "Kategorie"
     445
    405446#: tformmain.aexit.caption
    406447msgid "Exit"
     
    428469msgstr "Uložit jako..."
    429470
    430 #: tformmain.aimport.caption
    431 msgctxt "tformmain.aimport.caption"
    432 msgid "Import"
    433 msgstr "Importovat"
     471#: tformmain.amanualimport.caption
     472msgid "Manual import"
     473msgstr ""
    434474
    435475#: tformmain.aprocessimports.caption
     
    624664msgstr "Opravdu chcete odebrat vybrabé kategorie?"
    625665
     666#: uformcategoryselect.scategory
     667#, fuzzy
     668msgctxt "uformcategoryselect.scategory"
     669msgid "Category"
     670msgstr "Kategorie"
     671
     672#: uformcategoryselect.sremovecategory
     673#, fuzzy
     674msgctxt "uformcategoryselect.sremovecategory"
     675msgid "Remove categories"
     676msgstr "Odebrat kategorie"
     677
     678#: uformcategoryselect.sremovecategoryquery
     679#, fuzzy
     680msgctxt "uformcategoryselect.sremovecategoryquery"
     681msgid "Do you really want to remove selected categories?"
     682msgstr "Opravdu chcete odebrat vybrabé kategorie?"
     683
    626684#: uformimport.simportednewacronyms
    627685msgid "Imported %d new acronyms."
  • trunk/Languages/AcronymDecoder.po

    r31 r33  
    6969
    7070#: tformacronym.label4.caption
     71msgctxt "tformacronym.label4.caption"
    7172msgid "Categories:"
    7273msgstr ""
     
    9899#: tformacronyms.listviewacronyms.columns[0].caption
    99100msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[0].CAPTION"
    100 msgid "Name"
     101msgid "Id"
    101102msgstr ""
    102103
    103104#: tformacronyms.listviewacronyms.columns[1].caption
    104105msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[1].CAPTION"
    105 msgid "Description"
     106msgid "Name"
    106107msgstr ""
    107108
    108109#: tformacronyms.listviewacronyms.columns[2].caption
    109110msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[2].CAPTION"
     111msgid "Description"
     112msgstr ""
     113
     114#: tformacronyms.listviewacronyms.columns[3].caption
     115msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[3].CAPTION"
    110116msgid "Categories"
    111117msgstr ""
     
    315321msgstr ""
    316322
     323#: tformimportsource.acategoryadd.caption
     324msgctxt "TFORMIMPORTSOURCE.ACATEGORYADD.CAPTION"
     325msgid "Add"
     326msgstr ""
     327
     328#: tformimportsource.acategoryremove.caption
     329msgctxt "TFORMIMPORTSOURCE.ACATEGORYREMOVE.CAPTION"
     330msgid "Remove"
     331msgstr ""
     332
    317333#: tformimportsource.buttoncancel.caption
    318334msgctxt "TFORMIMPORTSOURCE.BUTTONCANCEL.CAPTION"
     
    352368msgstr ""
    353369
     370#: tformimportsource.label4.caption
     371msgctxt "TFORMIMPORTSOURCE.LABEL4.CAPTION"
     372msgid "Categories:"
     373msgstr ""
     374
    354375#: tformimportsources.aadd.caption
    355376msgctxt "TFORMIMPORTSOURCES.AADD.CAPTION"
     
    386407msgstr ""
    387408
     409#: tformimportsources.listview1.columns[2].caption
     410msgid "Count"
     411msgstr ""
     412
     413#: tformimportsources.listview1.columns[3].caption
     414msgctxt "TFORMIMPORTSOURCES.LISTVIEW1.COLUMNS[3].CAPTION"
     415msgid "Categories"
     416msgstr ""
     417
    388418#: tformmain.aexit.caption
    389419msgid "Exit"
     
    411441msgstr ""
    412442
    413 #: tformmain.aimport.caption
    414 msgctxt "tformmain.aimport.caption"
    415 msgid "Import"
     443#: tformmain.amanualimport.caption
     444msgid "Manual import"
    416445msgstr ""
    417446
     
    606635msgstr ""
    607636
     637#: uformcategoryselect.scategory
     638msgctxt "uformcategoryselect.scategory"
     639msgid "Category"
     640msgstr ""
     641
     642#: uformcategoryselect.sremovecategory
     643msgctxt "uformcategoryselect.sremovecategory"
     644msgid "Remove categories"
     645msgstr ""
     646
     647#: uformcategoryselect.sremovecategoryquery
     648msgctxt "uformcategoryselect.sremovecategoryquery"
     649msgid "Do you really want to remove selected categories?"
     650msgstr ""
     651
    608652#: uformimport.simportednewacronyms
    609653msgid "Imported %d new acronyms."
  • trunk/UAcronym.pas

    r31 r33  
    5050
    5151  TAcronymMeaning = class
     52    Id: Integer;
    5253    Name: string;
    5354    Description: string;
     
    6566
    6667  TAcronymMeanings = class(TObjectList)
     68  public
    6769    Acronym: TAcronym;
     70    procedure UpdateIds;
    6871    procedure SaveToNode(Node: TDOMNode);
    6972    procedure LoadFromNode(Node: TDOMNode);
     
    8790
    8891  TAcronymCategories = class(TObjectList)
     92    Db: TAcronymDb;
    8993    procedure UpdateIds;
    9094    procedure SaveToNode(Node: TDOMNode);
    9195    procedure LoadFromNode(Node: TDOMNode);
     96    procedure SaveRefToNode(Node: TDOMNode);
     97    procedure LoadRefFromNode(Node: TDOMNode);
    9298    function SearchByName(Name: string): TAcronymCategory;
    9399    function SearchById(Id: Integer): TAcronymCategory;
     
    173179    Sources: TImportSources;
    174180    ItemCount: Integer;
     181    Categories: TAcronymCategories;
    175182    function DownloadHTTP(URL: string; Stream: TStream): Boolean;
    176183    procedure Process;
     
    660667                  AddedAcronym := Sources.AcronymDb.AddAcronym(NewAcronym.Name, NewAcronym.Meaning);
    661668                  AddedAcronym.Description := NewAcronym.Description;
     669                  AddedAcronym.Categories.Assign(Categories, laOr);
    662670                  Inc(ItemCount);
    663671                end;
     
    692700  LastTime := Source.LastTime;
    693701  ItemCount := Source.ItemCount;
     702  Categories.Assign(Source.Categories);
    694703end;
    695704
    696705procedure TImportSource.SaveToNode(Node: TDOMNode);
     706var
     707  NewNode: TDOMNode;
    697708begin
    698709  WriteString(Node, 'Name', Name);
     
    701712    else WriteInteger(Node, 'ImportFormat', -1);
    702713  WriteBoolean(Node, 'Enabled', Enabled);
     714  WriteInteger(Node, 'ItemCount', ItemCount);
     715
     716  NewNode := Node.OwnerDocument.CreateElement('Categories');
     717  Node.AppendChild(NewNode);
     718  Categories.SaveRefToNode(NewNode);
    703719end;
    704720
    705721procedure TImportSource.LoadFromNode(Node: TDOMNode);
     722var
     723  Node2: TDOMNode;
    706724begin
    707725  Name := ReadString(Node, 'Name', '');
     
    709727  Format := Sources.AcronymDb.ImportFormats.SearchById(ReadInteger(Node, 'ImportFormat', -1));
    710728  Enabled := ReadBoolean(Node, 'Enabled', True);
     729  ItemCount := ReadInteger(Node, 'ItemCount', 0);
     730
     731  Categories.Db := Sources.AcronymDb;
     732  Node2 := Node.FindNode('Categories');
     733  if Assigned(Node2) then
     734    Categories.LoadRefFromNode(Node2);
    711735end;
    712736
     
    715739  Format := nil;
    716740  Enabled := True;
     741  Categories := TAcronymCategories.Create;
     742  Categories.OwnsObjects := False;
    717743end;
    718744
    719745destructor TImportSource.Destroy;
    720 begin
    721   inherited Destroy;
    722 end;
    723 
    724 { TAcronymEntry }
    725 
    726 constructor TAcronymEntry.Create;
    727 begin
    728   Categories := TStringList.Create;
    729 end;
    730 
    731 destructor TAcronymEntry.Destroy;
    732746begin
    733747  FreeAndNil(Categories);
     
    735749end;
    736750
     751{ TAcronymEntry }
     752
     753constructor TAcronymEntry.Create;
     754begin
     755  Categories := TStringList.Create;
     756end;
     757
     758destructor TAcronymEntry.Destroy;
     759begin
     760  FreeAndNil(Categories);
     761  inherited Destroy;
     762end;
     763
    737764{ TAcronymMeanings }
    738765
     766procedure TAcronymMeanings.UpdateIds;
     767var
     768  LastId: Integer;
     769  I: Integer;
     770begin
     771  // Get highest used ID
     772  LastId := 0;
     773  for I := 0 to Count - 1 do begin
     774    if TAcronymCategory(Items[I]).Id > LastId then LastId := TAcronymCategory(Items[I]).Id;
     775  end;
     776  // Add ID to new items without ID
     777  for I := 0 to Count - 1 do begin
     778    if TAcronymCategory(Items[I]).Id = 0 then begin
     779      Inc(LastId);
     780      TAcronymCategory(Items[I]).Id := LastId;
     781    end;
     782  end;
     783end;
     784
    739785procedure TAcronymMeanings.SaveToNode(Node: TDOMNode);
    740786var
     
    742788  NewNode2: TDOMNode;
    743789begin
     790  UpdateIds;
    744791  for I := 0 to Count - 1 do
    745792  with TAcronymMeaning(Items[I]) do begin
     
    764811    Node2 := Node2.NextSibling;
    765812  end;
     813  UpdateIds;
    766814end;
    767815
     
    788836var
    789837  NewNode: TDOMNode;
    790   NewNode2: TDOMNode;
    791   I: Integer;
    792838begin
    793839  WriteString(Node, 'Name', Name);
     
    797843  NewNode := Node.OwnerDocument.CreateElement('Categories');
    798844  Node.AppendChild(NewNode);
    799   for I := 0 to Categories.Count - 1 do begin
    800     NewNode2 := NewNode.OwnerDocument.CreateElement('Category');
    801     NewNode.AppendChild(NewNode2);
    802     WriteInteger(NewNode2, 'Id', TAcronymCategory(Categories[I]).Id);
    803   end;
     845  Categories.SaveRefToNode(NewNode);
    804846end;
    805847
     
    807849var
    808850  Node2: TDOMNode;
    809   Node3: TDOMNode;
    810   Category: TAcronymCategory;
    811   Id: Integer;
     851  I: Integer;
    812852begin
    813853  Name := ReadString(Node, 'Name', '');
     
    815855  Language := ReadString(Node, 'Language', '');
    816856
    817   Node3 := Node.FindNode('Categories');
    818   if Assigned(Node3) then begin
    819     Node2 := Node3.FirstChild;
    820     while Assigned(Node2) and (Node2.NodeName = 'Category') do begin
    821       Id := ReadInteger(Node2, 'Id', 0);
    822       Category := Acronym.Db.Categories.SearchById(Id);
    823       if Assigned(Category) then begin
    824         Categories.Add(Category);
    825         Category.AcronymMeanings.Add(Self);
    826       end;
    827       Node2 := Node2.NextSibling;
    828     end;
     857  Categories.Db := Acronym.Db;
     858  Node2 := Node.FindNode('Categories');
     859  if Assigned(Node2) then begin
     860    Categories.LoadRefFromNode(Node2);
     861
     862    // Add reverse references
     863    for I := 0 to Categories.Count - 1 do
     864      TAcronymCategory(Categories[I]).AcronymMeanings.Add(Self);
    829865  end;
    830866end;
     
    839875  I: Integer;
    840876begin
     877  if Assigned(Acronym) then
     878    Acronym.Meanings.Remove(Self);
    841879  for I := 0 to Categories.Count - 1 do
    842880    TAcronymCategory(Categories[I]).AcronymMeanings.Remove(Self);
     
    942980  end;
    943981  UpdateIds;
     982end;
     983
     984procedure TAcronymCategories.SaveRefToNode(Node: TDOMNode);
     985var
     986  I: Integer;
     987  NewNode: TDOMNode;
     988begin
     989  for I := 0 to Count - 1 do begin
     990    NewNode := Node.OwnerDocument.CreateElement('Category');
     991    Node.AppendChild(NewNode);
     992    WriteInteger(NewNode, 'Id', TAcronymCategory(Items[I]).Id);
     993  end;
     994end;
     995
     996procedure TAcronymCategories.LoadRefFromNode(Node: TDOMNode);
     997var
     998  Node2: TDOMNode;
     999  Id: Integer;
     1000  Category: TAcronymCategory;
     1001begin
     1002  Node2 := Node.FirstChild;
     1003  while Assigned(Node2) and (Node2.NodeName = 'Category') do begin
     1004    Id := ReadInteger(Node2, 'Id', 0);
     1005    Category := Db.Categories.SearchById(Id);
     1006    if Assigned(Category) then begin
     1007      Add(Category);
     1008    end;
     1009    Node2 := Node2.NextSibling;
     1010  end;
    9441011end;
    9451012
Note: See TracChangeset for help on using the changeset viewer.