Changeset 14
- Timestamp:
- Apr 28, 2016, 10:56:31 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AcronymDecoder.lpi
r13 r14 92 92 </Item5> 93 93 </RequiredPackages> 94 <Units Count=" 7">94 <Units Count="8"> 95 95 <Unit0> 96 96 <Filename Value="AcronymDecoder.lpr"/> … … 135 135 <ResourceBaseClass Value="Form"/> 136 136 </Unit6> 137 <Unit7> 138 <Filename Value="Forms\UFormCategories.pas"/> 139 <IsPartOfProject Value="True"/> 140 <ComponentName Value="FormCategories"/> 141 <ResourceBaseClass Value="Form"/> 142 </Unit7> 137 143 </Units> 138 144 </ProjectOptions> -
trunk/AcronymDecoder.lpr
r13 r14 9 9 Interfaces, // this includes the LCL widgetset 10 10 Forms, UFormMain, UAcronym, synapse, UFormImport, Common, SysUtils, TemplateGenerics, 11 UFormAcronym, CoolTranslator, UFormSettings, UFormCategorySelect 11 UFormAcronym, CoolTranslator, UFormSettings, UFormCategorySelect, 12 UFormCategories 12 13 { you can add units after this }; 13 14 … … 35 36 Application.CreateForm(TFormSettings, FormSettings); 36 37 Application.CreateForm(TFormCategorySelect, FormCategorySelect); 38 Application.CreateForm(TFormCategories, FormCategories); 37 39 Application.Run; 38 40 end. -
trunk/Example acronyms.adp
r7 r14 1 ACL,"Access Control List", 2 AJAX,"Asynchronous JavaScript and XML", 3 AP,"Access Point", 1 ACL,"Access Control List",Chat;Internet 2 AJAX,"Asynchronous JavaScript and XML",Chat 3 AP,"Access Point",Internet 4 4 API,"Application Programming Interface", 5 5 AS,"Autonomous System", -
trunk/Languages/AcronymDecoder.cs.po
r13 r14 52 52 msgstr "Kategorie:" 53 53 54 #: tformcategories.aadd.caption 55 #, fuzzy 56 msgctxt "tformcategories.aadd.caption" 57 msgid "Add" 58 msgstr "Přidat" 59 60 #: tformcategories.amodify.caption 61 #, fuzzy 62 msgctxt "tformcategories.amodify.caption" 63 msgid "Modify" 64 msgstr "Upravit" 65 66 #: tformcategories.aremove.caption 67 #, fuzzy 68 msgctxt "tformcategories.aremove.caption" 69 msgid "Remove" 70 msgstr "Odebrat" 71 72 #: tformcategories.caption 73 msgid "Acronym categories" 74 msgstr "" 75 76 #: tformcategories.listviewcategories.columns[0].caption 77 #, fuzzy 78 msgctxt "tformcategories.listviewcategories.columns[0].caption" 79 msgid "Name" 80 msgstr "Název" 81 82 #: tformcategories.listviewcategories.columns[1].caption 83 msgctxt "tformcategories.listviewcategories.columns[1].caption" 84 msgid "Used count" 85 msgstr "" 86 54 87 #: tformcategoryselect.buttoncancel.caption 55 88 msgctxt "tformcategoryselect.buttoncancel.caption" … … 92 125 93 126 #: tformmain.aacronymmodify.caption 127 msgctxt "tformmain.aacronymmodify.caption" 94 128 msgid "Modify" 95 129 msgstr "Upravit" … … 142 176 msgstr "Ukázat" 143 177 178 #: tformmain.ashowcategories.caption 179 msgctxt "tformmain.ashowcategories.caption" 180 msgid "Categories" 181 msgstr "" 182 144 183 #: tformmain.caption 145 184 msgid "Acronym Decoder" … … 147 186 148 187 #: tformmain.listviewacronyms.columns[0].caption 188 msgctxt "tformmain.listviewacronyms.columns[0].caption" 149 189 msgid "Name" 150 190 msgstr "Název" … … 155 195 156 196 #: tformmain.listviewacronyms.columns[2].caption 157 msgid "Contexts" 197 #, fuzzy 198 #| msgid "Contexts" 199 msgctxt "tformmain.listviewacronyms.columns[2].caption" 200 msgid "Categories" 158 201 msgstr "Kontexty" 159 202 … … 165 208 msgid "Tools" 166 209 msgstr "Nástroje" 210 211 #: tformmain.menuitem20.caption 212 msgid "View" 213 msgstr "" 167 214 168 215 #: tformmain.menuitem8.caption … … 198 245 199 246 #: uformacronym.scategory 247 msgctxt "uformacronym.scategory" 200 248 msgid "Category" 201 249 msgstr "Kategorie" … … 209 257 msgstr "Opravdu chcete odebrat vybrané kategorie?" 210 258 259 #: uformcategories.scategory 260 #, fuzzy 261 msgctxt "uformcategories.scategory" 262 msgid "Category" 263 msgstr "Kategorie" 264 265 #: uformcategories.scategoryalreadyexists 266 msgid "Category %s already exists!" 267 msgstr "" 268 269 #: uformcategories.scategoryquery 270 msgid "Enter name of category" 271 msgstr "" 272 273 #: uformcategories.sremovecategory 274 msgid "Remove category" 275 msgstr "" 276 277 #: uformcategories.sremovecategoryquery 278 msgid "Do you really want to remove category?" 279 msgstr "" 280 211 281 #: uformimport.simportednewacronyms 212 282 msgid "Imported %d new acronyms." -
trunk/Languages/AcronymDecoder.po
r13 r14 42 42 msgstr "" 43 43 44 #: tformcategories.aadd.caption 45 msgctxt "TFORMCATEGORIES.AADD.CAPTION" 46 msgid "Add" 47 msgstr "" 48 49 #: tformcategories.amodify.caption 50 msgctxt "TFORMCATEGORIES.AMODIFY.CAPTION" 51 msgid "Modify" 52 msgstr "" 53 54 #: tformcategories.aremove.caption 55 msgctxt "TFORMCATEGORIES.AREMOVE.CAPTION" 56 msgid "Remove" 57 msgstr "" 58 59 #: tformcategories.caption 60 msgid "Acronym categories" 61 msgstr "" 62 63 #: tformcategories.listviewcategories.columns[0].caption 64 msgctxt "TFORMCATEGORIES.LISTVIEWCATEGORIES.COLUMNS[0].CAPTION" 65 msgid "Name" 66 msgstr "" 67 68 #: tformcategories.listviewcategories.columns[1].caption 69 msgctxt "TFORMCATEGORIES.LISTVIEWCATEGORIES.COLUMNS[1].CAPTION" 70 msgid "Used count" 71 msgstr "" 72 44 73 #: tformcategoryselect.buttoncancel.caption 45 74 msgctxt "TFORMCATEGORYSELECT.BUTTONCANCEL.CAPTION" … … 82 111 83 112 #: tformmain.aacronymmodify.caption 113 msgctxt "tformmain.aacronymmodify.caption" 84 114 msgid "Modify" 85 115 msgstr "" … … 132 162 msgstr "" 133 163 164 #: tformmain.ashowcategories.caption 165 msgctxt "tformmain.ashowcategories.caption" 166 msgid "Categories" 167 msgstr "" 168 134 169 #: tformmain.caption 135 170 msgid "Acronym Decoder" … … 137 172 138 173 #: tformmain.listviewacronyms.columns[0].caption 174 msgctxt "tformmain.listviewacronyms.columns[0].caption" 139 175 msgid "Name" 140 176 msgstr "" … … 145 181 146 182 #: tformmain.listviewacronyms.columns[2].caption 147 msgid "Contexts" 183 msgctxt "tformmain.listviewacronyms.columns[2].caption" 184 msgid "Categories" 148 185 msgstr "" 149 186 … … 154 191 #: tformmain.menuitem16.caption 155 192 msgid "Tools" 193 msgstr "" 194 195 #: tformmain.menuitem20.caption 196 msgid "View" 156 197 msgstr "" 157 198 … … 188 229 189 230 #: uformacronym.scategory 231 msgctxt "uformacronym.scategory" 190 232 msgid "Category" 191 233 msgstr "" … … 199 241 msgstr "" 200 242 243 #: uformcategories.scategory 244 msgctxt "uformcategories.scategory" 245 msgid "Category" 246 msgstr "" 247 248 #: uformcategories.scategoryalreadyexists 249 msgid "Category %s already exists!" 250 msgstr "" 251 252 #: uformcategories.scategoryquery 253 msgid "Enter name of category" 254 msgstr "" 255 256 #: uformcategories.sremovecategory 257 msgid "Remove category" 258 msgstr "" 259 260 #: uformcategories.sremovecategoryquery 261 msgid "Do you really want to remove category?" 262 msgstr "" 263 201 264 #: uformimport.simportednewacronyms 202 265 msgid "Imported %d new acronyms." -
trunk/UAcronym.pas
r13 r14 15 15 Name: string; 16 16 URL: string; 17 end; 18 19 TAcronymSources = class(TObjectList) 20 17 21 end; 18 22 … … 57 61 TAcronymCategory = class 58 62 Name: string; 59 Acronym s: TObjectList; // TObjectList<TAcronym>63 AcronymMeanings: TAcronymMeanings; 60 64 constructor Create; 61 65 destructor Destroy; override; … … 86 90 TAcronymDb = class 87 91 FileName: string; 88 Sources: T ObjectList; // TObjectList<TAcronymSource>92 Sources: TAcronymSources; 89 93 Acronyms: TAcronyms; 90 94 Categories: TAcronymCategories; … … 148 152 149 153 destructor TAcronymMeaning.Destroy; 150 begin 154 var 155 I: Integer; 156 begin 157 for I := 0 to Categories.Count - 1 do 158 TAcronymCategory(Categories[I]).AcronymMeanings.Remove(Self); 151 159 FreeAndNil(Categories); 152 160 inherited Destroy; … … 205 213 begin 206 214 Clear; 207 for I := 0 to Strings.Count - 1 do 215 for I := 0 to Strings.Count - 1 do begin 208 216 Add(TAcronymCategory(Strings.Objects[I])); 217 end; 209 218 end; 210 219 … … 227 236 constructor TAcronymCategory.Create; 228 237 begin 229 Acronym s := TObjectList.Create(False);238 AcronymMeanings := TAcronymMeanings.Create(False); 230 239 end; 231 240 232 241 destructor TAcronymCategory.Destroy; 233 begin 234 FreeAndNil(Acronyms); 242 var 243 I: Integer; 244 begin 245 for I := 0 to AcronymMeanings.Count - 1 do 246 TAcronymMeaning(AcronymMeanings[I]).Categories.Remove(Self); 247 FreeAndNil(AcronymMeanings); 235 248 inherited Destroy; 236 249 end; … … 240 253 constructor TAcronymDb.Create; 241 254 begin 242 Sources := T ObjectList.Create;255 Sources := TAcronymSources.Create; 243 256 Acronyms := TAcronyms.Create; 244 257 Categories := TAcronymCategories.Create; 245 TAcronymCategory(Categories[Categories.Add(TAcronymCategory.Create)]).Name := 'Internet';246 TAcronymCategory(Categories[Categories.Add(TAcronymCategory.Create)]).Name := 'Software';247 TAcronymCategory(Categories[Categories.Add(TAcronymCategory.Create)]).Name := 'Chat';248 258 end; 249 259 … … 260 270 F: TStringList; 261 271 Line: TStringList; 262 C ontext: TStringList;272 CategoryStrings: TStringList; 263 273 NewAcronym: TAcronym; 264 274 NewMeaning: TAcronymMeaning; 265 275 I: Integer; 266 276 J: Integer; 267 AcronymC ontext: TAcronymCategory;277 AcronymCategory: TAcronymCategory; 268 278 begin 269 279 Self.FileName := FileName; … … 272 282 Line := TStringList.Create; 273 283 Line.StrictDelimiter := True; 274 C ontext:= TStringList.Create;275 C ontext.Delimiter := ';';284 CategoryStrings := TStringList.Create; 285 CategoryStrings.Delimiter := ';'; 276 286 try 277 287 F.LoadFromFile(FileName); … … 291 301 NewAcronym.Meanings.Add(NewMeaning); 292 302 end; 293 C ontext.DelimitedText := Line[2];294 for J := 0 to C ontext.Count - 1 do begin295 AcronymC ontext := Categories.SearchByName(Context[J]);296 if not Assigned(AcronymC ontext) then begin297 AcronymC ontext:= TAcronymCategory.Create;298 AcronymC ontext.Name := Context[J];299 Categories.Add(AcronymC ontext);303 CategoryStrings.DelimitedText := Line[2]; 304 for J := 0 to CategoryStrings.Count - 1 do begin 305 AcronymCategory := Categories.SearchByName(CategoryStrings[J]); 306 if not Assigned(AcronymCategory) then begin 307 AcronymCategory := TAcronymCategory.Create; 308 AcronymCategory.Name := CategoryStrings[J]; 309 Categories.Add(AcronymCategory); 300 310 end; 301 NewMeaning.Categories.Add(AcronymContext); 311 NewMeaning.Categories.Add(AcronymCategory); 312 AcronymCategory.AcronymMeanings.Add(NewMeaning); 302 313 end; 303 314 end; … … 305 316 F.Free; 306 317 Line.Free; 307 C ontext.Free;318 CategoryStrings.Free; 308 319 end; 309 320 Modified := False; -
trunk/UFormMain.lfm
r13 r14 30 30 end 31 31 item 32 Caption = 'C ontexts'32 Caption = 'Categories' 33 33 Width = 300 34 34 end> … … 4420 4420 OnExecute = ASettingsExecute 4421 4421 end 4422 object AShowCategories: TAction 4423 Caption = 'Categories' 4424 OnExecute = AShowCategoriesExecute 4425 end 4422 4426 end 4423 4427 object PersistentForm1: TPersistentForm … … 4473 4477 end 4474 4478 end 4479 object MenuItem20: TMenuItem 4480 Caption = 'View' 4481 object MenuItem21: TMenuItem 4482 Action = AShowCategories 4483 end 4484 end 4475 4485 object MenuItem16: TMenuItem 4476 4486 Caption = 'Tools' -
trunk/UFormMain.lrt
r13 r14 2 2 TFORMMAIN.LISTVIEWACRONYMS.COLUMNS[0].CAPTION=Name 3 3 TFORMMAIN.LISTVIEWACRONYMS.COLUMNS[1].CAPTION=Description 4 TFORMMAIN.LISTVIEWACRONYMS.COLUMNS[2].CAPTION=C ontexts4 TFORMMAIN.LISTVIEWACRONYMS.COLUMNS[2].CAPTION=Categories 5 5 TFORMMAIN.AEXIT.CAPTION=Exit 6 6 TFORMMAIN.ASHOW.CAPTION=Show … … 16 16 TFORMMAIN.AFILESAVEAS.CAPTION=Save as... 17 17 TFORMMAIN.ASETTINGS.CAPTION=Settings 18 TFORMMAIN.ASHOWCATEGORIES.CAPTION=Categories 18 19 TFORMMAIN.MENUITEM8.CAPTION=File 19 20 TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent 20 21 TFORMMAIN.MENUITEM15.CAPTION=- 22 TFORMMAIN.MENUITEM20.CAPTION=View 21 23 TFORMMAIN.MENUITEM16.CAPTION=Tools -
trunk/UFormMain.pas
r13 r14 19 19 AAcronymRemove: TAction; 20 20 AAcronymRemoveAll: TAction; 21 AShowCategories: TAction; 21 22 ASettings: TAction; 22 23 AFileSaveAs: TAction; … … 45 46 MenuItem18: TMenuItem; 46 47 MenuItem19: TMenuItem; 48 MenuItem20: TMenuItem; 49 MenuItem21: TMenuItem; 47 50 MenuItemOpenRecent: TMenuItem; 48 51 MenuItem2: TMenuItem; … … 72 75 procedure AImportExecute(Sender: TObject); 73 76 procedure ASettingsExecute(Sender: TObject); 77 procedure AShowCategoriesExecute(Sender: TObject); 74 78 procedure AShowExecute(Sender: TObject); 75 79 procedure EditSearchChange(Sender: TObject); … … 111 115 112 116 uses 113 UFormImport, UFormAcronym, UFormSettings ;117 UFormImport, UFormAcronym, UFormSettings, UFormCategories; 114 118 115 119 resourcestring … … 230 234 TempCategories: TStringList; 231 235 Meaning: TAcronymMeaning; 236 I: Integer; 232 237 begin 233 238 if Assigned(ListViewAcronyms.Selected) then … … 252 257 Meaning.Description := TempEntry.Description; 253 258 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 259 for I := 0 to Meaning.Categories.Count - 1 do 260 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 254 261 UpdateAcronymsList; 255 262 UpdateInterface; … … 289 296 TempEntry: TAcronymEntry; 290 297 Meaning: TAcronymMeaning; 298 I: Integer; 291 299 begin 292 300 TempEntry := TAcronymEntry.Create; … … 300 308 Meaning.Description := TempEntry.Description; 301 309 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 310 for I := 0 to Meaning.Categories.Count - 1 do 311 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 302 312 UpdateAcronymsList; 303 313 UpdateInterface; … … 318 328 if FormSettings.ShowModal = mrOk then 319 329 FormSettings.Save; 330 end; 331 332 procedure TFormMain.AShowCategoriesExecute(Sender: TObject); 333 begin 334 FormCategories.ShowModal; 320 335 end; 321 336 … … 440 455 EditSearch.Enabled := Assigned(AcronymDb); 441 456 AImport.Enabled := Assigned(AcronymDb); 457 AShowCategories.Enabled := Assigned(AcronymDb); 442 458 443 459 Title := Application.Title;
Note:
See TracChangeset
for help on using the changeset viewer.