internal int GetFirstVisibleTranslationOrNoteFlid(ISegment segment, out int ws)
{
var lines = LineChoices.m_specs as IEnumerable<InterlinLineSpec>;
Debug.Assert(lines != null, "Interlinear line configurations not enumerable 2");
var annotations = lines.SkipWhile(line => line.WordLevel);
int tryAnnotationIndex = lines.Count() - annotations.Count();
if (annotations.Count() > 0)
{ // We want to select at the start of this translation or note if it is not a null note.
bool isaNote = annotations.First().Flid == InterlinLineChoices.kflidNote;
if (isaNote && segment.NotesOS.Count == 0)
{ // this note is not visible - skip to the next non-note translation or note
var otherAnnotations = annotations.SkipWhile(line => line.Flid == InterlinLineChoices.kflidNote);
tryAnnotationIndex = lines.Count() - otherAnnotations.Count();
if (otherAnnotations.Count() == 0)
tryAnnotationIndex = -1; // no more translations or notes, go to an analysis in the next segment.
}
}
else // no translations or notes to go to
tryAnnotationIndex = -1;
int tryAnnotationFlid = 0;
ws = -1;
if (tryAnnotationIndex > -1)
{
var lineSpec = lines.Skip(tryAnnotationIndex).First();
tryAnnotationFlid = lineSpec.Flid;
ws = lineSpec.WritingSystem;
}
return tryAnnotationFlid;
}