/// <summary> /// Index in the strip before the selected item. /// </summary> public int StripIndexBefore(ISelectableInContentView item) { int index = item is Strip ? ((Strip)item).Selection is StripIndexSelection ? ((StripIndexSelection)((Strip)item).Selection).Index - 1 : (mBlockLayout.Controls.Count - 1) / 2 : item is Block?mBlockLayout.Controls.IndexOf((Control)item) / 2 : item is StripCursor?mBlockLayout.Controls.IndexOf((Control)item) / 2 - 1 : -1; return(index >= 0 ? index : 0); }
/// <summary> /// Return the block before the selection. In the case of a strip this is the last block. /// Return null if this is before the first block, there are no blocks, or nothing was selected /// in the first place. /// </summary> public Block BlockBefore(ISelectableInContentView item) { int index = item is Strip ? ((Strip)item).Selection is StripIndexSelection ? ((StripIndexSelection)((Strip)item).Selection).Index - 1 : mBlockLayout.Controls.Count - 2 : item is Block?mBlockLayout.Controls.IndexOf((Control)item) - 2 : item is StripCursor?mBlockLayout.Controls.IndexOf((Control)item) - 1 : -1; return(index >= 0 ? (Block)mBlockLayout.Controls[index] : null); }
/// <summary> /// Get the strip index after the given (selected) item. /// </summary> public int StripIndexAfter(ISelectableInContentView item) { int lastIndex = Node.PhraseChildCount; int index = item is Strip ? ((Strip)item).Selection is StripIndexSelection ? ((StripIndexSelection)((Strip)item).Selection).Index + 1 : 0 : item is Block ? (mBlockLayout.Controls.IndexOf((Control)item) + 1) / 2 : item is StripCursor?mBlockLayout.Controls.IndexOf((Control)item) / 2 + 1 : lastIndex + 1; return(index <= lastIndex ? index : lastIndex); }
/// <summary> /// Return the block after the selection. In the case of a strip it is the first block. /// Return null if this goes past the last block, there are no blocks, or nothing was selected /// in the first place. /// </summary> public Block BlockAfter(ISelectableInContentView item) { int count = mBlockLayout.Controls.Count; int index = item is Strip ? ((Strip)item).Selection is StripIndexSelection ? ((StripIndexSelection)((Strip)item).Selection).Index : 1 : item is Block?mBlockLayout.Controls.IndexOf((Control)item) + 2 : item is StripCursor?mBlockLayout.Controls.IndexOf((Control)item) + 1 : count; return(index < count ? (Block)mBlockLayout.Controls[index] : null); }