private bool IsTranslationOrNoteNext(int paragraphInd, ISegment seg, bool moveUp)
{
var para = (IStTxtPara)RootStText.ParagraphsOS[paragraphInd];
Debug.Assert(para != null, "Tried to move to a null paragraph ind=" + paragraphInd);
Debug.Assert(seg != null, "Tried to move to a null segment ind=" + seg.IndexInOwner + " in para " + paragraphInd);
// get the "next" segment with a real analysis or real translation or note
var lines = LineChoices.m_specs as IEnumerable<InterlinLineSpec>; // so we can use linq
while (true)
{
AnalysisOccurrence realAnalysis;
seg = GetNextSegment(para, seg, moveUp, out realAnalysis);
if (seg == null)
return false;
bool hasVisibleAnnotations = HasVisibleTranslationOrNote(seg, lines);
bool hasRealAnalysis = realAnalysis != null;
if (moveUp)
{
if (hasVisibleAnnotations) // check translation or note first
return true;
if (hasRealAnalysis) // then analyses
return false; // if there is a real one, don't go to an annotation
}
else
{ // moving down
if (hasRealAnalysis) // check analyses first
return false; // if there is a real one, don't go to a translation or note
if (hasVisibleAnnotations) // then check translations and notes
return true;
}
// no translation or note, no real analyses, try the next segment
}
}