/// <summary> /// Constructor /// </summary> /// <param name="hexView">Hex view</param> public HexViewCreatedEventArgs(HexView hexView) { if (hexView == null) { throw new ArgumentNullException(nameof(hexView)); } HexView = hexView; }
public override HexIntellisenseSessionStack GetStackForHexView(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); var wpfHexView = hexView as WpfHexView; if (wpfHexView == null) throw new InvalidOperationException(); return hexView.Properties.GetOrCreateSingletonProperty(typeof(HexIntellisenseSessionStackImpl), () => new HexIntellisenseSessionStackImpl(wpfHexView)); }
public HexViewEditorFormatMap(HexView hexView, TC.EditorFormatMapService editorFormatMapService) : base(editorFormatMapService, DefaultWpfHexViewOptions.AppearanceCategoryName) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); this.hexView = hexView; hexView.Options.OptionChanged += Options_OptionChanged; Initialize(); }
public override HexToolTipProvider GetToolTipProvider(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); var wpfHexView = hexView as WpfHexView; if (wpfHexView == null) throw new ArgumentException(); return wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(HexToolTipProviderImpl), () => new HexToolTipProviderImpl(wpfHexView)); }
public CommandTargetFilter(HexView hexView, HexCommandOperations hexCommandOperations) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); if (hexCommandOperations == null) throw new ArgumentNullException(nameof(hexCommandOperations)); this.hexView = hexView; this.hexCommandOperations = hexCommandOperations; }
public HexScrollMapImpl(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); HexView = hexView; HexView.BufferLinesChanged += HexView_BufferLinesChanged; HexView.LayoutChanged += HexView_LayoutChanged; HexView.Closed += HexView_Closed; }
public HexEditorOperationsImpl(HexView hexView, HexHtmlBuilderService htmlBuilderService) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); if (htmlBuilderService == null) throw new ArgumentNullException(nameof(htmlBuilderService)); HexView = hexView; HexView.Closed += HexView_Closed; this.htmlBuilderService = htmlBuilderService; }
public HexQuickInfoController(HexQuickInfoBroker quickInfoBroker, HexView hexView) { if (quickInfoBroker == null) throw new ArgumentNullException(nameof(quickInfoBroker)); if (hexView == null) throw new ArgumentNullException(nameof(hexView)); this.hexView = hexView; this.quickInfoBroker = quickInfoBroker; hexView.MouseHover += HexView_MouseHover; }
/// <summary> /// Constructor /// </summary> /// <param name="view">Hex view</param> /// <param name="effectiveViewportWidth">Viewport width</param> /// <param name="effectiveViewportHeight">Viewport height</param> public HexViewState(HexView view, double effectiveViewportWidth, double effectiveViewportHeight) { if (view == null) throw new ArgumentNullException(nameof(view)); ViewportTop = view.ViewportTop; ViewportLeft = view.ViewportLeft; ViewportWidth = effectiveViewportWidth; ViewportHeight = effectiveViewportHeight; Buffer = view.Buffer; }
public override HexQuickInfoSession TriggerQuickInfo(HexView hexView, HexCellPosition triggerPoint, bool trackMouse) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); if (triggerPoint.IsDefault) throw new ArgumentException(); var session = CreateQuickInfoSession(hexView, triggerPoint, trackMouse); session.Start(); return session.IsDismissed ? null : session; }
public override HexQuickInfoSession CreateQuickInfoSession(HexView hexView, HexCellPosition triggerPoint, bool trackMouse) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); if (triggerPoint.IsDefault) throw new ArgumentException(); var stack = intellisenseSessionStackMapService.Value.GetStackForHexView(hexView); var session = new HexQuickInfoSessionImpl(hexView, triggerPoint, trackMouse, intellisensePresenterFactoryService.Value, quickInfoSourceProviders); stack.PushSession(session); return session; }
/// <summary> /// Constructor /// </summary> /// <param name="view">Hex view</param> /// <param name="line">Line</param> /// <param name="textPosition">Text position</param> public HexMouseHoverEventArgs(HexView view, HexBufferLine line, int textPosition) { if (textPosition < 0) { throw new ArgumentOutOfRangeException(nameof(textPosition)); } View = view ?? throw new ArgumentNullException(nameof(view)); Line = line ?? throw new ArgumentNullException(nameof(line)); TextPosition = textPosition; }
public override string GenerateHtmlFragment(NormalizedHexBufferSpanCollection spans, HexView hexView, string delimiter, CancellationToken cancellationToken) { if (spans == null) throw new ArgumentNullException(nameof(spans)); if (hexView == null) throw new ArgumentNullException(nameof(hexView)); if (delimiter == null) throw new ArgumentNullException(nameof(delimiter)); return GenerateHtmlFragmentCore(hexView.BufferLines, spans, hexView, delimiter, cancellationToken); }
static void InitializeHexView(HexView hexView, HexSpan span) { if (!IsVisible(hexView, span)) return; var bufferSpan = new HexBufferSpan(hexView.Buffer, span); hexView.Selection.Select(bufferSpan.Start, bufferSpan.End, alignPoints: false); var column = hexView.Caret.IsValuesCaretPresent ? HexColumnType.Values : HexColumnType.Ascii; hexView.Caret.MoveTo(column, bufferSpan.Start); var flags = column == HexColumnType.Values ? HexSpanSelectionFlags.Values : HexSpanSelectionFlags.Ascii; hexView.ViewScroller.EnsureSpanVisible(bufferSpan, flags, VSTE.EnsureSpanVisibleOptions.ShowStart); }
public HexViewUIState(HexView hexView) { var pos = hexView.Caret.Position.Position; ActiveColumn = pos.ActiveColumn; ValuesPosition = pos.ValuePosition.BufferPosition.Position; ValuesCellPosition = pos.ValuePosition.CellPosition; AsciiPosition = pos.AsciiPosition.BufferPosition.Position; ViewportLeft = hexView.ViewportLeft; var line = hexView.HexViewLines.FirstVisibleLine; TopLinePosition = line.BufferStart.Position; TopLineVerticalDistance = line.Top - hexView.ViewportTop; }
/// <summary> /// Constructor /// </summary> /// <param name="view">Hex view</param> /// <param name="line">Line</param> /// <param name="textPosition">Text position</param> public HexMouseHoverEventArgs(HexView view, HexBufferLine line, int textPosition) { if (view == null) throw new ArgumentNullException(nameof(view)); if (line == null) throw new ArgumentNullException(nameof(line)); if (textPosition < 0) throw new ArgumentOutOfRangeException(nameof(textPosition)); View = view; Line = line; TextPosition = textPosition; }
public HexCommandOperationsImpl(IMessageBoxService messageBoxService, HexEditorGroupFactoryService hexEditorGroupFactoryService, HexView hexView) { if (messageBoxService == null) throw new ArgumentNullException(nameof(messageBoxService)); if (hexEditorGroupFactoryService == null) throw new ArgumentNullException(nameof(hexEditorGroupFactoryService)); if (hexView == null) throw new ArgumentNullException(nameof(hexView)); this.messageBoxService = messageBoxService; this.hexEditorGroupFactoryService = hexEditorGroupFactoryService; HexView = hexView; hexView.Closed += HexView_Closed; }
/// <summary> /// Constructor /// </summary> /// <param name="view">Hex view</param> /// <param name="effectiveViewportWidth">Viewport width</param> /// <param name="effectiveViewportHeight">Viewport height</param> public HexViewState(HexView view, double effectiveViewportWidth, double effectiveViewportHeight) { if (view == null) { throw new ArgumentNullException(nameof(view)); } ViewportTop = view.ViewportTop; ViewportLeft = view.ViewportLeft; ViewportWidth = effectiveViewportWidth; ViewportHeight = effectiveViewportHeight; Buffer = view.Buffer; Version = view.Buffer.Version; }
public override HexStructureInfoAggregator Create(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); return hexView.Properties.GetOrCreateSingletonProperty(typeof(HexStructureInfoAggregatorImpl), () => { var list = new List<HexStructureInfoProvider>(hexStructureInfoProviderFactories.Length); foreach (var lz in hexStructureInfoProviderFactories) { var provider = lz.Value.Create(hexView); if (provider != null) list.Add(provider); } return new HexStructureInfoAggregatorImpl(list.ToArray()); }); }
/// <summary> /// Constructor /// </summary> /// <param name="hexView">Hex view</param> /// <param name="oldPosition">Old position</param> /// <param name="newPosition">New position</param> public HexCaretPositionChangedEventArgs(HexView hexView, HexCaretPosition oldPosition, HexCaretPosition newPosition) { if (oldPosition.IsDefault) { throw new ArgumentException(); } if (newPosition.IsDefault) { throw new ArgumentException(); } HexView = hexView ?? throw new ArgumentNullException(nameof(hexView)); OldPosition = oldPosition; NewPosition = newPosition; }
public override LocalGroupOptions GetDefaultLocalOptions(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); var options = new LocalGroupOptions(); options.ShowOffsetColumn = true; options.ShowValuesColumn = true; options.ShowAsciiColumn = true; options.StartPosition = hexView.Buffer.Span.Start; options.EndPosition = hexView.Buffer.Span.End; options.BasePosition = HexPosition.Zero; options.UseRelativePositions = false; options.OffsetBitSize = 0; options.HexValuesDisplayFormat = HexValuesDisplayFormat.HexByte; options.BytesPerLine = 0; return options; }
public HexQuickInfoSessionImpl(HexView hexView, HexCellPosition triggerPoint, bool trackMouse, HexIntellisensePresenterFactoryService intellisensePresenterFactoryService, Lazy<HexQuickInfoSourceProvider, VSUTIL.IOrderable>[] quickInfoSourceProviders) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); if (triggerPoint.IsDefault) throw new ArgumentException(); if (intellisensePresenterFactoryService == null) throw new ArgumentNullException(nameof(intellisensePresenterFactoryService)); if (quickInfoSourceProviders == null) throw new ArgumentNullException(nameof(quickInfoSourceProviders)); QuickInfoContent = new VSLI.BulkObservableCollection<object>(); HexView = hexView; TriggerPoint = triggerPoint; TrackMouse = trackMouse; this.intellisensePresenterFactoryService = intellisensePresenterFactoryService; this.quickInfoSourceProviders = quickInfoSourceProviders; HexView.Closed += HexView_Closed; }
string GenerateHtmlFragmentCore(HexBufferLineProvider bufferLines, NormalizedHexBufferSpanCollection spans, HexView hexView, string delimiter, CancellationToken cancellationToken) { HexClassifier classifier = null; try { VSTC.IClassificationFormatMap classificationFormatMap; if (hexView != null) { classifier = viewClassifierAggregatorService.GetClassifier(hexView); classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(hexView); } else { classifier = spans.Count == 0 ? null : classifierAggregatorService.GetClassifier(spans[0].Buffer); classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.HexEditor); } const int tabSize = 4; var builder = new HexHtmlBuilder(classificationFormatMap, delimiter, tabSize); if (spans.Count != 0) builder.Add(bufferLines, classifier, spans, cancellationToken); return builder.Create(); } finally { classifier.Dispose(); } }
static bool IsVisible(HexView hexView, HexPosition start, HexPosition end) => start < HexPosition.MaxEndPosition && start >= hexView.BufferLines.StartPosition && end <= hexView.BufferLines.EndPosition;
static void RedisplayHexLines(HexView hexView) { var line = hexView.HexViewLines.FirstVisibleLine; var verticalDistance = line.Top - hexView.ViewportTop; var bufferPosition = line.BufferStart; hexView.DisplayHexLineContainingBufferPosition(bufferPosition, verticalDistance, VSTE.ViewRelativePosition.Top, null, null, DisplayHexLineOptions.CanRecreateBufferLines); }
/// <summary> /// Gets all active quick info sessions in <paramref name="hexView"/> /// </summary> /// <param name="hexView">Hex view</param> /// <returns></returns> public abstract ReadOnlyCollection<HexQuickInfoSession> GetSessions(HexView hexView);
/// <summary> /// Creates a quick info session /// </summary> /// <param name="hexView">Hex view</param> /// <param name="triggerPoint">Trigger point</param> /// <param name="trackMouse">true to track the mouse</param> /// <returns></returns> public abstract HexQuickInfoSession CreateQuickInfoSession(HexView hexView, HexCellPosition triggerPoint, bool trackMouse);
/// <summary> /// Triggers a quick info session /// </summary> /// <param name="hexView">Hex view</param> /// <returns></returns> public abstract HexQuickInfoSession TriggerQuickInfo(HexView hexView);
/// <summary> /// Returns true if quick info is active in <paramref name="hexView"/> /// </summary> /// <param name="hexView">Hex view to check</param> /// <returns></returns> public abstract bool IsQuickInfoActive(HexView hexView);
public override void Detach(HexView hexView) => hexView.MouseHover -= HexView_MouseHover;
/// <summary> /// Constructor /// </summary> /// <param name="hexView">Hex view</param> public HexViewCreatedEventArgs(HexView hexView) => HexView = hexView ?? throw new ArgumentNullException(nameof(hexView));
public static bool IsMultiLineSpan(HexView hexView, HexBufferSpan bufferSpan) { var lineNum1 = hexView.BufferLines.GetLineNumberFromPosition(bufferSpan.Start); var lineNum2 = hexView.BufferLines.GetLineNumberFromPosition(bufferSpan.End); return lineNum1 != lineNum2; }
/// <summary> /// Handles a reference /// </summary> /// <param name="hexView">Hex view</param> /// <param name="reference">Reference created by eg. <see cref="HexStructureInfoProvider.GetReference(HexPosition)"/></param> /// <param name="tags">Tags, see <see cref="PredefinedHexReferenceHandlerTags"/></param> /// <returns></returns> public abstract bool Handle(HexView hexView, object reference, IList <string> tags);
/// <summary> /// Creates a <see cref="HexStructureInfoProvider"/> instance /// </summary> /// <param name="hexView">Hex view</param> /// <returns></returns> public abstract HexStructureInfoProvider Create(HexView hexView);
/// <summary> /// Constructor /// </summary> /// <param name="hexView">Hex view</param> public HexViewCreatedEventArgs(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); HexView = hexView; }
/// <summary> /// Constructor /// </summary> /// <param name="hexView">Hex view</param> /// <param name="oldPosition">Old position</param> /// <param name="newPosition">New position</param> public HexCaretPositionChangedEventArgs(HexView hexView, in HexCaretPosition oldPosition, in HexCaretPosition newPosition)
public HexViewScrollerImpl(HexView hexView) { if (hexView == null) throw new ArgumentNullException(nameof(hexView)); this.hexView = hexView; }
/// <summary> /// Creates a <see cref="HexIntellisenseController"/> or returns null /// </summary> /// <param name="hexView">Hex view</param> /// <returns></returns> public abstract HexIntellisenseController TryCreateIntellisenseController(HexView hexView);
/// <summary> /// Constructor /// </summary> /// <param name="view">Hex view</param> public HexViewState(HexView view) : this(view, view?.ViewportWidth ?? 0, view?.ViewportHeight ?? 0) { }