bool Intersects(HexBufferSpanSelection span, HexCellPosition point) { if (span.IsDefault) return false; if (point.BufferPosition.Buffer != span.BufferSpan.Buffer) return false; return span.BufferSpan.IntersectsWith(new HexSpan(point.BufferPosition, 0)); }
void SetPresentationSpan(HexBufferSpanSelection newValue) { if (!presentationSpan.Equals(newValue)) { presentationSpan = newValue; PresentationSpanChanged?.Invoke(this, EventArgs.Empty); } }
void SetApplicableToSpan(HexBufferSpanSelection newValue) { if (!applicableToSpan.Equals(newValue)) { applicableToSpan = newValue; ApplicableToSpanChanged?.Invoke(this, EventArgs.Empty); } }
void SetPresentationSpan(HexBufferSpanSelection newValue, HexCellPosition triggerPoint) { // Make sure that the popup is shown in the right column newValue = new HexBufferSpanSelection(newValue.BufferSpan, HexSpanSelectionFlags.Cell | (triggerPoint.Column == HexColumnType.Values ? HexSpanSelectionFlags.Values : HexSpanSelectionFlags.Ascii)); if (!presentationSpan.Equals(newValue)) { presentationSpan = newValue; PresentationSpanChanged?.Invoke(this, EventArgs.Empty); } }
public override void Recalculate() { if (IsDismissed) { throw new InvalidOperationException(); } IsStarted = true; DisposeQuickInfoSources(); quickInfoSources = CreateQuickInfoSources(); var newContent = new List <object>(); var applicableToSpan = default(HexBufferSpanSelection); foreach (var source in quickInfoSources) { HexBufferSpanSelection applicableToSpanTmp; source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp); if (IsDismissed) { return; } if (applicableToSpan.IsDefault) { applicableToSpan = applicableToSpanTmp; } } if (newContent.Count == 0 || applicableToSpan.IsDefault) { Dismiss(); } else { QuickInfoContent.BeginBulkOperation(); QuickInfoContent.Clear(); QuickInfoContent.AddRange(newContent); QuickInfoContent.EndBulkOperation(); hasInteractiveContent = CalculateHasInteractiveContent(); SetApplicableToSpan(applicableToSpan); if (quickInfoPresenter == null) { quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this); if (quickInfoPresenter == null) { Dismiss(); return; } PresenterChanged?.Invoke(this, EventArgs.Empty); } } Recalculated?.Invoke(this, EventArgs.Empty); }
bool Intersects(HexBufferSpanSelection span, HexCellPosition point) { if (span.IsDefault) { return(false); } if (point.BufferPosition.Buffer != span.BufferSpan.Buffer) { return(false); } return(span.BufferSpan.IntersectsWith(new HexSpan(point.BufferPosition, 0))); }
public override void AugmentQuickInfoSession(HexQuickInfoSession session, IList <object> quickInfoContent, out HexBufferSpanSelection applicableToSpan) { applicableToSpan = default(HexBufferSpanSelection); RemoveToolTipInfo(); toolTipInfoCollection = hexToolTipService.GetToolTipInfo(session.TriggerPoint.BufferPosition); if (toolTipInfoCollection == null) { return; } applicableToSpan = new HexBufferSpanSelection(toolTipInfoCollection.BufferSpan, HexSpanSelectionFlags.Selection); hexToolTipService.SetActiveToolTip(toolTipInfoCollection); session.Dismissed += Session_Dismissed; foreach (var info in toolTipInfoCollection) { if (info.ToolTip != null) { quickInfoContent.Add(info.ToolTip); } } }
public override void Recalculate() { if (IsDismissed) throw new InvalidOperationException(); IsStarted = true; DisposeQuickInfoSources(); quickInfoSources = CreateQuickInfoSources(); var newContent = new List<object>(); var applicableToSpan = default(HexBufferSpanSelection); foreach (var source in quickInfoSources) { HexBufferSpanSelection applicableToSpanTmp; source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp); if (IsDismissed) return; if (applicableToSpan.IsDefault) applicableToSpan = applicableToSpanTmp; } if (newContent.Count == 0 || applicableToSpan.IsDefault) Dismiss(); else { QuickInfoContent.BeginBulkOperation(); QuickInfoContent.Clear(); QuickInfoContent.AddRange(newContent); QuickInfoContent.EndBulkOperation(); hasInteractiveContent = CalculateHasInteractiveContent(); SetApplicableToSpan(applicableToSpan); if (quickInfoPresenter == null) { quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this); if (quickInfoPresenter == null) { Dismiss(); return; } PresenterChanged?.Invoke(this, EventArgs.Empty); } } Recalculated?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Shows a tooltip /// </summary> /// <param name="span">Span and selection flags</param> /// <param name="toolTipContent">Tooltip content</param> public void ShowToolTip(HexBufferSpanSelection span, object toolTipContent) => ShowToolTip(span.BufferSpan, span.SelectionFlags, toolTipContent);
/// <summary> /// Shows a tooltip /// </summary> /// <param name="span">Span and selection flags</param> /// <param name="toolTipContent">Tooltip content</param> /// <param name="style">Popup style</param> public void ShowToolTip(HexBufferSpanSelection span, object toolTipContent, VSTA.PopupStyles style) => ShowToolTip(span.BufferSpan, span.SelectionFlags, toolTipContent, style);
/// <summary> /// Gets normalized text bounds /// </summary> /// <param name="span">Span and selection flags</param> /// <returns></returns> public Collection <VSTF.TextBounds> GetNormalizedTextBounds(HexBufferSpanSelection span) => GetNormalizedTextBounds(span.BufferSpan, span.SelectionFlags);
/// <summary> /// Gets normalized text bounds /// </summary> /// <param name="span">Span and selection flags</param> /// <returns></returns> public Collection<VSTF.TextBounds> GetNormalizedTextBounds(HexBufferSpanSelection span) => GetNormalizedTextBounds(span.BufferSpan, span.SelectionFlags);
/// <summary> /// Creates a popup agent /// </summary> /// <param name="span">Span and selection flags</param> /// <param name="style">Popup style</param> /// <param name="content">Popup content</param> /// <returns></returns> public HexSpaceReservationAgent CreatePopupAgent(HexBufferSpanSelection span, VSTA.PopupStyles style, UIElement content) => CreatePopupAgent(span.BufferSpan, span.SelectionFlags, style, content);
/// <summary> /// Augments the quick info session /// </summary> /// <param name="session">Session</param> /// <param name="quickInfoContent">Updated with new content</param> /// <param name="applicableToSpan">Updated with applicable-to span or the default value if nothing was added to <paramref name="quickInfoContent"/></param> public abstract void AugmentQuickInfoSession(HexQuickInfoSession session, IList<object> quickInfoContent, out HexBufferSpanSelection applicableToSpan);
/// <summary> /// Updates a popup agent /// </summary> /// <param name="agent">Popup agent created by <see cref="CreatePopupAgent(HexLineSpan, VSTA.PopupStyles, UIElement)"/></param> /// <param name="span">Span and selection flags</param> /// <param name="styles">New popup style</param> public void UpdatePopupAgent(HexSpaceReservationAgent agent, HexBufferSpanSelection span, VSTA.PopupStyles styles) => UpdatePopupAgent(agent, span.BufferSpan, span.SelectionFlags, styles);
/// <summary> /// Gets column spans in column order /// </summary> /// <param name="span">Span and selection flags</param> /// <returns></returns> public IEnumerable<TextAndHexSpan> GetSpans(HexBufferSpanSelection span) => GetSpans(span.BufferSpan, span.SelectionFlags);
void SetPresentationSpan(HexBufferSpanSelection newValue, in HexCellPosition triggerPoint)
/// <summary> /// Augments the quick info session /// </summary> /// <param name="session">Session</param> /// <param name="quickInfoContent">Updated with new content</param> /// <param name="applicableToSpan">Updated with applicable-to span or the default value if nothing was added to <paramref name="quickInfoContent"/></param> public abstract void AugmentQuickInfoSession(HexQuickInfoSession session, IList <object> quickInfoContent, out HexBufferSpanSelection applicableToSpan);