/// <summary> /// This override ensures that we always have whole objects selected. /// Enhance: it may cause flicker during drag, in which case, we may change to only do it on mouse up, /// or only IF the mouse is up. /// </summary> protected override void HandleSelectionChange(object sender, VwSelectionArgs args) { if (m_InSelectionChanged || RootBox.Selection == null) { return; } TextSelInfo info = new TextSelInfo(RootBox); int end = Math.Max(info.ContainingObjectIndex(info.Levels(true) - 1, true), info.ContainingObjectIndex(info.Levels(false) - 1, false)); int begin = Math.Min(info.ContainingObjectIndex(info.Levels(true) - 1, true), info.ContainingObjectIndex(info.Levels(false) - 1, false)); SelectRange(begin, end); }
/// <summary> /// This override ensures that we always have whole objects selected. /// Enhance: it may cause flicker during drag, in which case, we may change to only do it on mouse up, /// or only IF the mouse is up. /// </summary> protected virtual void HandleSelectionChange(object sender, VwSelectionArgs args) { CheckDisposed(); if (m_InSelectionChanged || RootBox.Selection == null) { return; } var info = new TextSelInfo(RootBox); var end = Math.Max(info.ContainingObjectIndex(info.Levels(true) - 1, true), info.ContainingObjectIndex(info.Levels(false) - 1, false)); SelectUpTo(end); }
/// <summary> /// This override ensures that we always have whole objects selected. /// Enhance: it may cause flicker during drag, in which case, we may change to only do it on mouse up, /// or only IF the mouse is up. /// </summary> /// <param name="prootb"></param> /// <param name="vwselNew"></param> public override void SelectionChanged(IVwRootBox prootb, IVwSelection vwselNew) { base.SelectionChanged(prootb, vwselNew); if (m_InSelectionChanged) { return; } if (RootBox.Selection == null) { return; } TextSelInfo info = new TextSelInfo(RootBox); int end = Math.Max(info.ContainingObjectIndex(info.Levels(true) - 1, true), info.ContainingObjectIndex(info.Levels(false) - 1, false)); int begin = Math.Min(info.ContainingObjectIndex(info.Levels(true) - 1, true), info.ContainingObjectIndex(info.Levels(false) - 1, false)); SelectRange(begin, end); }
/// <summary> /// This override ensures that we always have whole objects selected. /// Enhance: it may cause flicker during drag, in which case, we may change to only do it on mouse up, /// or only IF the mouse is up. /// </summary> /// <param name="prootb"></param> /// <param name="vwselNew"></param> public override void SelectionChanged(IVwRootBox prootb, IVwSelection vwselNew) { base.SelectionChanged(prootb, vwselNew); if (m_InSelectionChanged) { return; } if (RootBox.Selection == null) { return; } if (!(this is DialogInterlinRibbon)) // We want the selection in the dialog to behave differently. { TextSelInfo info = new TextSelInfo(RootBox); int end = Math.Max(info.ContainingObjectIndex(info.Levels(true) - 1, true), info.ContainingObjectIndex(info.Levels(false) - 1, false)); SelectUpTo(end); } }