protected override bool OnRightMouseUp(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot) { IVwSelection sel = RootBox.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, false); TextSelInfo tsi = new TextSelInfo(sel); return(HandleRightClickOnObject(tsi.Hvo(false))); }
protected override bool OnRightMouseUp(Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot) { // if we don't install the selection here, a previous selection may give us // spurious results later on when handling the UI this right click brings up; // see LT-12154. IVwSelection sel = RootBox.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, true); TextSelInfo tsi = new TextSelInfo(sel); return(HandleRightClickOnObject(tsi.Hvo(false))); }
/// <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); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left && (ModifierKeys & Keys.Control) == Keys.Control) { // Control-click: take the first jump-to-tool command from the right-click menu for this location. // Create a selection where we right clicked IVwSelection sel = GetSelectionAtPoint(new Point(e.X, e.Y), false); TextSelInfo tsi = new TextSelInfo(sel); int hvoTarget = tsi.Hvo(false); // May be (for example) dummy ID used for type-ahead object in reference vector list. if (hvoTarget == 0 || !Cache.ServiceLocator.IsValidObjectId(hvoTarget)) { return; } using (ReferenceBaseUi ui = GetCmObjectUiForRightClickMenu(hvoTarget)) { ui.HandleCtrlClick(Mediator, this); } } }