Changeset 13 for trunk/UFormMain.pas
- Timestamp:
- Apr 28, 2016, 10:09:02 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UFormMain.pas
r12 r13 88 88 private 89 89 FAlwaysOnTop: Boolean; 90 function CompareStrings(Strings1, Strings2: TStrings): Boolean; 90 91 procedure SetAlwaysOnTop(AValue: Boolean); 91 92 private … … 227 228 var 228 229 TempEntry: TAcronymEntry; 230 TempCategories: TStringList; 229 231 Meaning: TAcronymMeaning; 230 232 begin … … 235 237 TempEntry.Meaning := Name; 236 238 TempEntry.Description := Description; 239 Categories.AssignToStrings(TempEntry.Categories); 240 TempCategories := TStringList.Create; 241 TempCategories.Assign(TempEntry.Categories); 237 242 FormAcronym.Load(TempEntry); 238 243 if FormAcronym.ShowModal = mrOk then begin … … 240 245 if (TempEntry.Name <> Acronym.Name) or 241 246 (TempEntry.Meaning <> Name) or 242 (TempEntry.Description <> Description) then begin 247 (TempEntry.Description <> Description) or 248 not CompareStrings(TempEntry.Categories, TempCategories) then begin 243 249 // TODO: Update item inplace if possible 244 250 AcronymDb.RemoveAcronym(Acronym.Name, Name); 245 251 Meaning := AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 246 252 Meaning.Description := TempEntry.Description; 253 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 247 254 UpdateAcronymsList; 248 255 UpdateInterface; 249 256 end; 250 257 end; 258 TempEntry.Free; 259 TempCategories.Free; 251 260 end; 252 261 end; … … 290 299 Meaning := AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning); 291 300 Meaning.Description := TempEntry.Description; 301 Meaning.Categories.AssignFromStrings(TempEntry.Categories); 292 302 UpdateAcronymsList; 293 303 UpdateInterface; 294 end else TempEntry.Free; 304 end; 305 TempEntry.Free; 295 306 end; 296 307 … … 347 358 Item.Data := TAcronymMeaning(FoundAcronyms[Item.Index]); 348 359 ContextCombined := ''; 349 for I := 0 to C ontexts.Count - 1 do350 ContextCombined := ContextCombined + TAcronymC ontext(Contexts[I]).Name + ',';360 for I := 0 to Categories.Count - 1 do 361 ContextCombined := ContextCombined + TAcronymCategory(Categories[I]).Name + ','; 351 362 Delete(ContextCombined, Length(ContextCombined), 1); 352 363 Item.SubItems.Add(ContextCombined); … … 372 383 begin 373 384 Visible := not Visible; 385 end; 386 387 function TFormMain.CompareStrings(Strings1, Strings2: TStrings): Boolean; 388 var 389 I: Integer; 390 begin 391 Result := Strings1.Count = Strings2.Count; 392 if not Result then Exit; 393 for I := 0 to Strings1.Count - 1 do 394 if (Strings1[I] <> Strings2[I]) or (Strings1.Objects[I] <> Strings2.Objects[I]) then begin 395 Result := False; 396 Exit; 397 end; 374 398 end; 375 399
Note:
See TracChangeset
for help on using the changeset viewer.