public void PropChanged(int hvo, int tag, int ivMin, int cvIns, int cvDel)
{
switch (tag)
{
case TextTags.kflidContents:
if (cvIns > 0 && cvDel == 0)
{
var text = m_textRepository.GetObject(hvo);
CoreTexts.Add(text.ContentsOA);
if (m_interestingTests != null)
m_interestingTests.Add(text.ContentsOA);
RaiseInterestingTextsChanged(CoreTexts.Count - 1, 1, 0);
}
else if (cvIns == 1 && cvDel == 1)
{
ClearInvalidObjects(CoreTexts, 0, false); // get rid of the old one but do NOT raise notification.
var text = m_textRepository.GetObject(hvo);
CoreTexts.Add(text.ContentsOA);
if (m_interestingTests != null)
m_interestingTests.Add(text.ContentsOA);
// We don't know where the old one was removed, safest to treat as changing all.
RaiseInterestingTextsChanged(0, CoreTexts.Count, CoreTexts.Count);
}
else
{
// We could try getting the text and removing its ContentsOA from the list,
// but that assumes a lot about the implementation of deleting objects,
// such as that when a Text is deleted, it is still present in its repository
// at the moment we clear ContentsOA. I think it's safest to do something generic.
ClearInvalidObjects(CoreTexts, 0, true);
}
break;
case RnGenericRecTags.kflidText:
UpdateInterestingTexts();
break;
case ScrSectionTags.kflidHeading:
case ScrSectionTags.kflidContent:
case ScrBookTags.kflidSections:
case ScriptureTags.kflidScriptureBooks:
case ScrBookTags.kflidTitle:
case ScrBookTags.kflidFootnotes:
if (cvDel > 0)
{
if (ClearInvalidObjects(m_scriptureTexts, CoreTexts.Count, IncludeScripture))
if (m_propertyTable != null && !m_propertyTable.IsDisposed)
UpdatePropertyTable();
}
break;
default:
if (tag == Cache.ServiceLocator.GetInstance<Virtuals>().LangProjTexts)
{
UpdateInterestingTexts();
}
break;
}
}