Changeset 95 for trunk/Forms
- Timestamp:
- Aug 17, 2016, 11:20:37 AM (8 years ago)
- Location:
- trunk/Forms
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormAcronym.pas
r89 r95 75 75 I: Integer; 76 76 begin 77 FormCategorySelect.Load(ListBoxCategories.Items); 78 if FormCategorySelect.ShowModal = mrOk then begin 79 for I := 0 to FormCategorySelect.ListBox1.Count - 1 do 80 if FormCategorySelect.ListBox1.Selected[I] then begin 81 ListBoxCategories.Items.AddObject(FormCategorySelect.ListBox1.Items[I], FormCategorySelect.ListBox1.Items.Objects[I]); 82 end; 77 FormCategorySelect := TFormCategorySelect.Create(Self); 78 try 79 FormCategorySelect.Load(ListBoxCategories.Items); 80 if FormCategorySelect.ShowModal = mrOk then begin 81 for I := 0 to FormCategorySelect.ListBox1.Count - 1 do 82 if FormCategorySelect.ListBox1.Selected[I] then begin 83 ListBoxCategories.Items.AddObject(FormCategorySelect.ListBox1.Items[I], FormCategorySelect.ListBox1.Items.Objects[I]); 84 end; 85 end; 86 finally 87 FreeAndNil(FormCategorySelect); 83 88 end; 84 89 end; -
trunk/Forms/UFormAcronyms.pas
r89 r95 123 123 TempEntry.Meaning := ''; 124 124 TempEntry.Description := ''; 125 FormAcronym.Load(TempEntry); 126 if FormAcronym.ShowModal = mrOk then begin 127 FormAcronym.Save(TempEntry); 128 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 129 Meaning.Description := TempEntry.Description; 130 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 131 for I := 0 to Meaning.Categories.Count - 1 do 132 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 133 UpdateAcronymsList; 134 UpdateInterface; 125 FormAcronym := TFormAcronym.Create(Self); 126 try 127 FormAcronym.Load(TempEntry); 128 if FormAcronym.ShowModal = mrOk then begin 129 FormAcronym.Save(TempEntry); 130 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 131 Meaning.Description := TempEntry.Description; 132 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 133 for I := 0 to Meaning.Categories.Count - 1 do 134 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 135 UpdateAcronymsList; 136 UpdateInterface; 137 end; 138 finally 139 FreeAndNil(FormAcronym); 135 140 end; 136 141 TempEntry.Free; … … 154 159 TempCategories := TStringList.Create; 155 160 TempCategories.Assign(TempEntry.Categories); 156 FormAcronym.Load(TempEntry); 157 if FormAcronym.ShowModal = mrOk then begin 158 FormAcronym.Save(TempEntry); 159 if (TempEntry.Name <> Acronym.Name) or 160 (TempEntry.Meaning <> Name) or 161 (TempEntry.Description <> Description) or 162 not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin 163 // TODO: Update item inplace if possible 164 Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data)); 165 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 166 Meaning.Description := TempEntry.Description; 167 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 168 for I := 0 to Meaning.Categories.Count - 1 do 169 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 170 UpdateAcronymsList; 171 UpdateInterface; 161 FormAcronym := TFormAcronym.Create(Self); 162 try 163 FormAcronym.Load(TempEntry); 164 if FormAcronym.ShowModal = mrOk then begin 165 FormAcronym.Save(TempEntry); 166 if (TempEntry.Name <> Acronym.Name) or 167 (TempEntry.Meaning <> Name) or 168 (TempEntry.Description <> Description) or 169 not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin 170 // TODO: Update item inplace if possible 171 Core.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data)); 172 Meaning := Core.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 173 Meaning.Description := TempEntry.Description; 174 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 175 for I := 0 to Meaning.Categories.Count - 1 do 176 TAcronymCategory(Meaning.Categories.Items[I]).AcronymMeanings.Add(Meaning); 177 UpdateAcronymsList; 178 UpdateInterface; 179 end; 172 180 end; 173 end; 174 TempEntry.Free; 175 TempCategories.Free; 181 finally 182 FreeAndNil(FormAcronym); 183 FreeAndNil(TempEntry); 184 FreeAndNil(TempCategories); 185 end; 176 186 end; 177 187 end; -
trunk/Forms/UFormExport.lfm
r90 r95 1 1 object FormExport: TFormExport 2 Left = 7222 Left = 281 3 3 Height = 654 4 Top = 4914 Top = 221 5 5 Width = 850 6 6 Caption = 'Export' 7 7 ClientHeight = 654 8 8 ClientWidth = 850 9 Position = poScreenCenter 9 10 LCLVersion = '1.6.0.4' 10 11 object ButtonProcess: TButton … … 19 20 object ComboBoxDataFormat: TComboBox 20 21 Left = 341 21 Height = 3422 Height = 28 22 23 Top = 5 23 24 Width = 182 24 ItemHeight = 025 ItemHeight = 20 25 26 ItemIndex = 0 26 27 Items.Strings = ( -
trunk/Forms/UFormImportFormat.lfm
r69 r95 171 171 object AAdd: TAction 172 172 Caption = 'Add' 173 ImageIndex = 0 173 174 OnExecute = AAddExecute 174 175 ShortCut = 45 … … 176 177 object AModify: TAction 177 178 Caption = 'Modify' 179 ImageIndex = 3 178 180 OnExecute = AModifyExecute 179 181 ShortCut = 13 … … 181 183 object ARemove: TAction 182 184 Caption = 'Remove' 185 ImageIndex = 4 183 186 OnExecute = ARemoveExecute 184 187 ShortCut = 46 -
trunk/Forms/UFormImportFormat.pas
r31 r95 80 80 NewImportPattern: TImportPattern; 81 81 begin 82 NewImportPattern := TImportPattern.Create; 83 FormImportPattern.Load(NewImportPattern); 84 if FormImportPattern.ShowModal = mrOk then begin 85 FormImportPattern.Save(NewImportPattern); 86 ImportFormat.ItemPatterns.Add(NewImportPattern); 87 NewImportPattern := nil; 88 ReloadList; 89 end; 90 if Assigned(NewImportPattern) then NewImportPattern.Free; 91 end; 92 93 procedure TFormImportFormat.AModifyExecute(Sender: TObject); 94 var 95 NewImportPattern: TImportPattern; 96 begin 97 if Assigned(ListViewItemRules.Selected) then begin 82 FormImportPattern := TFormImportPattern.Create(Self); 83 try 98 84 NewImportPattern := TImportPattern.Create; 99 NewImportPattern.Assign(ListViewItemRules.Selected.Data);100 85 FormImportPattern.Load(NewImportPattern); 101 86 if FormImportPattern.ShowModal = mrOk then begin 102 87 FormImportPattern.Save(NewImportPattern); 103 TImportPattern(ListViewItemRules.Selected.Data).Assign(NewImportPattern); 88 ImportFormat.ItemPatterns.Add(NewImportPattern); 89 NewImportPattern := nil; 104 90 ReloadList; 105 91 end; 106 92 if Assigned(NewImportPattern) then NewImportPattern.Free; 93 finally 94 FreeAndNil(FormImportPattern); 95 end; 96 end; 97 98 procedure TFormImportFormat.AModifyExecute(Sender: TObject); 99 var 100 NewImportPattern: TImportPattern; 101 begin 102 FormImportPattern := TFormImportPattern.Create(Self); 103 try 104 if Assigned(ListViewItemRules.Selected) then begin 105 NewImportPattern := TImportPattern.Create; 106 NewImportPattern.Assign(ListViewItemRules.Selected.Data); 107 FormImportPattern.Load(NewImportPattern); 108 if FormImportPattern.ShowModal = mrOk then begin 109 FormImportPattern.Save(NewImportPattern); 110 TImportPattern(ListViewItemRules.Selected.Data).Assign(NewImportPattern); 111 ReloadList; 112 end; 113 if Assigned(NewImportPattern) then NewImportPattern.Free; 114 end; 115 finally 116 FreeAndNil(FormImportPattern); 107 117 end; 108 118 end; -
trunk/Forms/UFormImportFormats.pas
r86 r95 112 112 NewImportFormat := TImportFormat.Create; 113 113 NewImportFormat.Formats := ImportFormats; 114 FormImportFormat.Load(NewImportFormat); 115 if FormImportFormat.ShowModal = mrOk then begin 116 FormImportFormat.Save(NewImportFormat); 117 if not Assigned(ImportFormats.SearchByName(NewImportFormat.Name)) then begin; 118 ImportFormats.Add(NewImportFormat); 119 NewImportFormat := nil; 120 Core.AcronymDb.Modified := True; 121 UpdateList; 122 end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name])); 114 FormImportFormat := TFormImportFormat.Create(Self); 115 try 116 FormImportFormat.Load(NewImportFormat); 117 if FormImportFormat.ShowModal = mrOk then begin 118 FormImportFormat.Save(NewImportFormat); 119 if not Assigned(ImportFormats.SearchByName(NewImportFormat.Name)) then begin; 120 ImportFormats.Add(NewImportFormat); 121 NewImportFormat := nil; 122 Core.AcronymDb.Modified := True; 123 UpdateList; 124 end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name])); 125 end; 126 if Assigned(NewImportFormat) then NewImportFormat.Free; 127 finally 128 FreeAndNil(FormImportFormat); 123 129 end; 124 if Assigned(NewImportFormat) then NewImportFormat.Free;125 130 end; 126 131 … … 132 137 NewImportFormat := TImportFormat.Create; 133 138 NewImportFormat.Assign(ListView1.Selected.Data); 134 FormImportFormat.Load(NewImportFormat); 135 if FormImportFormat.ShowModal = mrOk then begin 136 FormImportFormat.Save(NewImportFormat); 137 if (NewImportFormat.Name <> TImportFormat(ListView1.Selected.Data).Name) then begin 138 if not Assigned(ImportFormats.SearchByName(NewImportFormat.Name)) then begin; 139 FormImportFormat := TFormImportFormat.Create(Self); 140 try 141 FormImportFormat.Load(NewImportFormat); 142 if FormImportFormat.ShowModal = mrOk then begin 143 FormImportFormat.Save(NewImportFormat); 144 if (NewImportFormat.Name <> TImportFormat(ListView1.Selected.Data).Name) then begin 145 if not Assigned(ImportFormats.SearchByName(NewImportFormat.Name)) then begin; 146 TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat); 147 Core.AcronymDb.Modified := True; 148 UpdateList; 149 end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name])); 150 end else begin 139 151 TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat); 140 152 Core.AcronymDb.Modified := True; 141 153 UpdateList; 142 end else ShowMessage(Format(SImportFormatAlreadyExists, [NewImportFormat.Name])); 143 end else begin 144 TImportFormat(ListView1.Selected.Data).Assign(NewImportFormat); 145 Core.AcronymDb.Modified := True; 146 UpdateList; 154 end; 147 155 end; 156 if Assigned(NewImportFormat) then NewImportFormat.Free; 157 finally 158 FreeAndNil(FormImportFormat); 148 159 end; 149 if Assigned(NewImportFormat) then NewImportFormat.Free;150 160 end; 151 161 end; -
trunk/Forms/UFormImportSource.pas
r89 r95 72 72 NewImportFormat := TImportFormat.Create; 73 73 NewImportFormat.Assign(TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex])); 74 FormImportFormat.Load(NewImportFormat); 75 if FormImportFormat.ShowModal = mrOk then begin 76 FormImportFormat.Save(NewImportFormat); 77 TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]).Assign(NewImportFormat); 78 Core.AcronymDb.Modified := True; 79 ComboBox1.Items.Strings[ComboBox1.ItemIndex] := NewImportFormat.Name; 74 FormImportFormat := TFormImportFormat.Create(Self); 75 try 76 FormImportFormat.Load(NewImportFormat); 77 if FormImportFormat.ShowModal = mrOk then begin 78 FormImportFormat.Save(NewImportFormat); 79 TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]).Assign(NewImportFormat); 80 Core.AcronymDb.Modified := True; 81 ComboBox1.Items.Strings[ComboBox1.ItemIndex] := NewImportFormat.Name; 82 end; 83 if Assigned(NewImportFormat) then NewImportFormat.Free; 84 finally 85 FreeAndNil(FormImportFormat); 80 86 end; 81 if Assigned(NewImportFormat) then NewImportFormat.Free;82 87 end; 83 88 end; … … 97 102 I: Integer; 98 103 begin 99 FormCategorySelect.Load(ListBox1.Items); 100 if FormCategorySelect.ShowModal = mrOk then begin 101 for I := 0 to FormCategorySelect.ListBox1.Count - 1 do 102 if FormCategorySelect.ListBox1.Selected[I] then begin 103 ListBox1.Items.AddObject(FormCategorySelect.ListBox1.Items[I], FormCategorySelect.ListBox1.Items.Objects[I]); 104 end; 104 FormCategorySelect := TFormCategorySelect.Create(Self); 105 try 106 FormCategorySelect.Load(ListBox1.Items); 107 if FormCategorySelect.ShowModal = mrOk then begin 108 for I := 0 to FormCategorySelect.ListBox1.Count - 1 do 109 if FormCategorySelect.ListBox1.Selected[I] then begin 110 ListBox1.Items.AddObject(FormCategorySelect.ListBox1.Items[I], FormCategorySelect.ListBox1.Items.Objects[I]); 111 end; 112 end; 113 finally 114 FreeAndNil(FormCategorySelect); 105 115 end; 106 116 end; -
trunk/Forms/UFormImportSources.pas
r86 r95 187 187 NewImportSource := TImportSource.Create; 188 188 NewImportSource.Sources := ImportSources; 189 FormImportSource.Load(NewImportSource); 190 if FormImportSource.ShowModal = mrOk then begin 191 FormImportSource.Save(NewImportSource); 192 if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin; 193 ImportSources.Add(NewImportSource); 194 NewImportSource := nil; 195 Core.AcronymDb.Modified := True; 196 UpdateList; 197 end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name])); 198 end; 199 if Assigned(NewImportSource) then NewImportSource.Free; 189 FormImportSource := TFormImportSource.Create(Self); 190 try 191 FormImportSource.Load(NewImportSource); 192 if FormImportSource.ShowModal = mrOk then begin 193 FormImportSource.Save(NewImportSource); 194 if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin; 195 ImportSources.Add(NewImportSource); 196 NewImportSource := nil; 197 Core.AcronymDb.Modified := True; 198 UpdateList; 199 end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name])); 200 end; 201 if Assigned(NewImportSource) then NewImportSource.Free; 202 finally 203 FreeAndNil(FormImportSource); 204 end; 200 205 end; 201 206 … … 227 232 NewImportSource := TImportSource.Create; 228 233 NewImportSource.Assign(ListView1.Selected.Data); 229 FormImportSource.Load(NewImportSource); 230 if FormImportSource.ShowModal = mrOk then begin 231 FormImportSource.Save(NewImportSource); 232 if (NewImportSource.Name <> TImportSource(ListView1.Selected.Data).Name) then begin 233 if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin; 234 FormImportSource := TFormImportSource.Create(Self); 235 try 236 FormImportSource.Load(NewImportSource); 237 if FormImportSource.ShowModal = mrOk then begin 238 FormImportSource.Save(NewImportSource); 239 if (NewImportSource.Name <> TImportSource(ListView1.Selected.Data).Name) then begin 240 if not Assigned(ImportSources.SearchByName(NewImportSource.Name)) then begin; 241 TImportSource(ListView1.Selected.Data).Assign(NewImportSource); 242 Core.AcronymDb.Modified := True; 243 UpdateList; 244 end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name])); 245 end else begin 234 246 TImportSource(ListView1.Selected.Data).Assign(NewImportSource); 235 247 Core.AcronymDb.Modified := True; 236 248 UpdateList; 237 end else ShowMessage(Format(SImportSourceAlreadyExists, [NewImportSource.Name])); 238 end else begin 239 TImportSource(ListView1.Selected.Data).Assign(NewImportSource); 240 Core.AcronymDb.Modified := True; 241 UpdateList; 249 end; 242 250 end; 243 end; 244 if Assigned(NewImportSource) then NewImportSource.Free; 251 if Assigned(NewImportSource) then NewImportSource.Free; 252 finally 253 FreeAndNil(FormImportSource); 254 end; 245 255 end; 246 256 end; -
trunk/Forms/UFormMain.lfm
r90 r95 5 5 Width = 782 6 6 Caption = 'Acronym Decoder' 7 ClientHeight = 4 147 ClientHeight = 421 8 8 ClientWidth = 782 9 9 Menu = MainMenu1 … … 17 17 object Panel1: TPanel 18 18 Left = 0 19 Height = 3 8819 Height = 395 20 20 Top = 26 21 21 Width = 782 22 22 Align = alClient 23 23 BevelOuter = bvNone 24 ClientHeight = 3 8824 ClientHeight = 395 25 25 ClientWidth = 782 26 26 TabOrder = 1 27 27 object CheckBoxExactMath: TCheckBox 28 28 Left = 8 29 Height = 2 829 Height = 24 30 30 Top = 3 31 Width = 1 2931 Width = 104 32 32 Caption = 'Exact match' 33 33 OnChange = CheckBoxExactMathChange … … 44 44 object ListViewAcronyms: TListView 45 45 Left = 8 46 Height = 3 1646 Height = 323 47 47 Top = 64 48 48 Width = 767 -
trunk/Forms/UFormMain.pas
r91 r95 207 207 procedure TFormMain.AExportExecute(Sender: TObject); 208 208 begin 209 FormExport.ShowModal; 209 FormExport := TFormExport.Create(Self); 210 try 211 FormExport.ShowModal; 212 finally 213 FreeAndNil(FormExport); 214 end; 210 215 end; 211 216 … … 281 286 procedure TFormMain.AImportExecute(Sender: TObject); 282 287 begin 283 FormImport.ShowModal; 284 UpdateAcronymsList; 285 UpdateInterface; 288 FormImport := TFormImport.Create(Self); 289 try 290 FormImport.ShowModal; 291 UpdateAcronymsList; 292 UpdateInterface; 293 finally 294 FreeAndNil(FormImport); 295 end; 286 296 end; 287 297 … … 314 324 procedure TFormMain.ASettingsExecute(Sender: TObject); 315 325 begin 316 FormSettings.Load; 317 if FormSettings.ShowModal = mrOk then begin 326 FormSettings := TFormSettings.Create(Self); 327 try 328 FormSettings.Load; 329 if FormSettings.ShowModal = mrOk then begin 318 330 FormSettings.Save; 319 Core.SaveConfig; 331 Core.SaveConfig; 332 end; 333 finally 334 FreeAndNil(FormSettings); 320 335 end; 321 336 end; … … 323 338 procedure TFormMain.AShowAboutExecute(Sender: TObject); 324 339 begin 325 FormAbout.ShowModal; 340 FormAbout := TFormAbout.Create(Self); 341 try 342 FormAbout.ShowModal; 343 finally 344 FreeAndNil(FormAbout); 345 end; 326 346 end; 327 347 328 348 procedure TFormMain.AShowAcronymsExecute(Sender: TObject); 329 349 begin 330 FormAcronyms.ShowModal; 331 UpdateAcronymsList; 332 UpdateInterface; 350 FormAcronyms := TFormAcronyms.Create(Self); 351 try 352 FormAcronyms.ShowModal; 353 UpdateAcronymsList; 354 UpdateInterface; 355 finally 356 FreeAndNil(FormAcronyms); 357 end; 333 358 end; 334 359 335 360 procedure TFormMain.AShowCategoriesExecute(Sender: TObject); 336 361 begin 337 FormCategories.Categories := Core.AcronymDb.Categories; 338 FormCategories.ShowModal; 339 UpdateAcronymsList; 340 UpdateInterface; 362 FormCategories := TFormCategories.Create(Self); 363 try 364 FormCategories.Categories := Core.AcronymDb.Categories; 365 FormCategories.ShowModal; 366 UpdateAcronymsList; 367 UpdateInterface; 368 finally 369 FreeAndNil(FormCategories); 370 end; 341 371 end; 342 372 … … 349 379 procedure TFormMain.AShowImportFormatsExecute(Sender: TObject); 350 380 begin 351 FormImportFormats.ImportFormats := Core.AcronymDb.ImportFormats; 352 FormImportFormats.ShowModal; 353 UpdateInterface; 381 FormImportFormats := TFormImportFormats.Create(Self); 382 try 383 FormImportFormats.ImportFormats := Core.AcronymDb.ImportFormats; 384 FormImportFormats.ShowModal; 385 UpdateInterface; 386 finally 387 FreeAndNil(FormImportFormats); 388 end; 354 389 end; 355 390 356 391 procedure TFormMain.AShowImportSourcesExecute(Sender: TObject); 357 392 begin 358 FormImportSources.ImportSources := Core.AcronymDb.ImportSources; 359 FormImportSources.ShowModal; 360 UpdateAcronymsList; 361 UpdateInterface; 393 FormImportSources := TFormImportSources.Create(Self); 394 try 395 FormImportSources.ImportSources := Core.AcronymDb.ImportSources; 396 FormImportSources.ShowModal; 397 UpdateAcronymsList; 398 UpdateInterface; 399 finally 400 FreeAndNil(FormImportSources); 401 end; 362 402 end; 363 403
Note:
See TracChangeset
for help on using the changeset viewer.