public HexPopupSpaceReservationAgent(HexSpaceReservationManager spaceReservationManager, WpfHexView wpfHexView, HexLineSpan lineSpan, VSTA.PopupStyles style, UIElement content) { if (lineSpan.IsDefault) { throw new ArgumentException(); } if ((style & (VSTA.PopupStyles.DismissOnMouseLeaveText | VSTA.PopupStyles.DismissOnMouseLeaveTextOrContent)) == (VSTA.PopupStyles.DismissOnMouseLeaveText | VSTA.PopupStyles.DismissOnMouseLeaveTextOrContent)) { throw new ArgumentOutOfRangeException(nameof(style)); } this.spaceReservationManager = spaceReservationManager ?? throw new ArgumentNullException(nameof(spaceReservationManager)); this.wpfHexView = wpfHexView; this.lineSpan = lineSpan; this.style = style; this.content = content ?? throw new ArgumentNullException(nameof(content)); popup = new Popup { PlacementTarget = wpfHexView.VisualElement, Placement = PlacementMode.Relative, Visibility = Visibility.Collapsed, IsOpen = false, AllowsTransparency = true, UseLayoutRounding = true, SnapsToDevicePixels = true, }; }
void Closed(WpfHexView hexView) { Debug.Assert(hexView.IsClosed); bool b = hexViews.Remove(hexView); Debug.Assert(b); }
#pragma warning restore CS0169 HexViewBackgroundImageService(WpfHexView wpfHexView, IImageSourceService imageSourceService) : base(imageSourceService) { this.wpfHexView = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView)); Initialize(); wpfHexView.Closed += WpfHexView_Closed; }
public override void HexViewCreated(WpfHexView hexView) { hexView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, (s, e) => hexView.CommandTarget.Execute(CommandConstants.StandardGroup, (int)StandardIds.Cut), (s, e) => e.CanExecute = hexView.CommandTarget.CanExecute(CommandConstants.StandardGroup, (int)StandardIds.Cut) == CommandTargetStatus.Handled)); hexView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, (s, e) => hexView.CommandTarget.Execute(CommandConstants.StandardGroup, (int)StandardIds.Copy), (s, e) => e.CanExecute = hexView.CommandTarget.CanExecute(CommandConstants.StandardGroup, (int)StandardIds.Copy) == CommandTargetStatus.Handled)); hexView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, (s, e) => hexView.CommandTarget.Execute(CommandConstants.StandardGroup, (int)StandardIds.Paste), (s, e) => e.CanExecute = hexView.CommandTarget.CanExecute(CommandConstants.StandardGroup, (int)StandardIds.Paste) == CommandTargetStatus.Handled)); hexView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, (s, e) => hexView.CommandTarget.Execute(CommandConstants.HexEditorGroup, (int)HexEditorIds.SELECTALL), (s, e) => e.CanExecute = hexView.CommandTarget.CanExecute(CommandConstants.HexEditorGroup, (int)HexEditorIds.SELECTALL) == CommandTargetStatus.Handled)); }
public HexCaretImpl(WpfHexView hexView, HexAdornmentLayer caretLayer, VSTC.IClassificationFormatMap classificationFormatMap, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService) { if (hexView == null) { throw new ArgumentNullException(nameof(hexView)); } if (caretLayer == null) { throw new ArgumentNullException(nameof(caretLayer)); } if (classificationFormatMap == null) { throw new ArgumentNullException(nameof(classificationFormatMap)); } if (classificationTypeRegistryService == null) { throw new ArgumentNullException(nameof(classificationTypeRegistryService)); } this.hexView = hexView; imeState = new ImeState(); preferredXCoordinate = 0; __preferredYCoordinate = 0; hexView.Options.OptionChanged += Options_OptionChanged; hexView.VisualElement.AddHandler(UIElement.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true); hexView.VisualElement.AddHandler(UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true); hexView.LayoutChanged += HexView_LayoutChanged; hexView.BufferLinesChanged += HexView_BufferLinesChanged; hexView.ZoomLevelChanged += HexView_ZoomLevelChanged; hexCaretLayer = new HexCaretLayer(this, caretLayer, classificationFormatMap, classificationTypeRegistryService); InputMethod.SetIsInputMethodSuspended(hexView.VisualElement, true); }
public static HexMouseLocation TryCreateTextOnly(WpfHexView wpfHexView, MouseEventArgs e) { var point = GetTextPoint(wpfHexView, e); var line = wpfHexView.HexViewLines.GetHexViewLineContainingYCoordinate(point.Y); if (line == null) { return(null); } if (!(line.TextTop <= point.Y && point.Y < line.TextBottom)) { return(null); } if (!(line.TextLeft <= point.X && point.X < line.TextRight)) { return(null); } var position = line.GetLinePositionFromXCoordinate(point.X, true); if (position == null) { return(null); } return(new HexMouseLocation(line, position.Value, point)); }
public static HexMouseLocation Create(WpfHexView wpfHexView, MouseEventArgs e, bool insertionPosition) { HexViewLine hexViewLine; int position; var point = GetTextPoint(wpfHexView, e); var line = wpfHexView.HexViewLines.GetHexViewLineContainingYCoordinate(point.Y); if (line != null) { hexViewLine = line; } else if (point.Y <= wpfHexView.ViewportTop) { hexViewLine = wpfHexView.HexViewLines.FirstVisibleLine; } else { hexViewLine = wpfHexView.HexViewLines.LastVisibleLine; } if (insertionPosition) { position = hexViewLine.GetInsertionLinePositionFromXCoordinate(point.X); } else { position = hexViewLine.GetVirtualLinePositionFromXCoordinate(point.X); } return(new HexMouseLocation(hexViewLine, position, point)); }
public HexSpaceReservationManagerImpl(WpfHexView wpfHexView) { this.wpfHexView = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView)); spaceReservationAgents = new List <HexSpaceReservationAgent>(); Agents = new ReadOnlyCollection <HexSpaceReservationAgent>(spaceReservationAgents); wpfHexView.Closed += WpfHexView_Closed; }
public HexMarkerService(WpfHexView wpfHexView, HexTagAggregator <HexMarkerTag> tagAggregator, VSTC.IEditorFormatMap editorFormatMap, IThemeService themeService) { if (wpfHexView == null) { throw new ArgumentNullException(nameof(wpfHexView)); } if (tagAggregator == null) { throw new ArgumentNullException(nameof(tagAggregator)); } if (editorFormatMap == null) { throw new ArgumentNullException(nameof(editorFormatMap)); } if (themeService == null) { throw new ArgumentNullException(nameof(themeService)); } this.wpfHexView = wpfHexView; this.tagAggregator = tagAggregator; this.editorFormatMap = editorFormatMap; this.themeService = themeService; textMarkerAdornmentLayer = wpfHexView.GetAdornmentLayer(PredefinedHexAdornmentLayers.TextMarker); negativeTextMarkerAdornmentLayer = wpfHexView.GetAdornmentLayer(PredefinedHexAdornmentLayers.NegativeTextMarker); markerElements = new List <MarkerElement>(); useReducedOpacityForHighContrast = wpfHexView.Options.GetOptionValue(DefaultWpfHexViewOptions.UseReducedOpacityForHighContrastOptionId); onRemovedDelegate = OnRemoved; wpfHexView.Closed += WpfHexView_Closed; wpfHexView.LayoutChanged += WpfHexView_LayoutChanged; wpfHexView.Options.OptionChanged += Options_OptionChanged; tagAggregator.BatchedTagsChanged += TagAggregator_BatchedTagsChanged; editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged; }
public HexSpaceReservationStackImpl(WpfHexView wpfHexView, string[] spaceReservationManagerNames) { this.wpfHexView = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView)); this.spaceReservationManagerNames = spaceReservationManagerNames ?? throw new ArgumentNullException(nameof(spaceReservationManagerNames)); spaceReservationManagers = new HexSpaceReservationManagerImpl[spaceReservationManagerNames.Length]; wpfHexView.Closed += WpfHexView_Closed; }
public override HexSpaceReservationStack Create(WpfHexView wpfHexView) { if (wpfHexView is null) { throw new ArgumentNullException(nameof(wpfHexView)); } return(wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(HexSpaceReservationStackImpl), () => new HexSpaceReservationStackImpl(wpfHexView, spaceReservationManagerNames))); }
public IImageSourceService Create(WpfHexView wpfHexView) { if (wpfHexView is null) { throw new ArgumentNullException(nameof(wpfHexView)); } return(Create(backgroundImageOptionDefinitionService.GetOptionDefinition(wpfHexView))); }
public HexViewListener(HexViewOptionsGroupImpl owner, WpfHexView hexView) { this.owner = owner; this.hexView = hexView; hexView.Closed += HexView_Closed; hexView.Options.OptionChanged += Options_OptionChanged; owner.InitializeOptions(hexView); }
public HexAdornmentLayerImpl(WpfHexView hexView, HexLayerKind layerKind, MetadataAndOrder <IAdornmentLayersMetadata> info) { canvas = new Canvas(); HexView = hexView ?? throw new ArgumentNullException(nameof(hexView)); this.layerKind = layerKind; Info = info; adornmentLayerElements = new List <HexAdornmentLayerElementImpl>(); }
public static Size GetMaxSize(WpfHexView wpfHexView) { var screen = new Screen(wpfHexView.VisualElement); var screenRect = screen.IsValid ? screen.DisplayRect : SystemParameters.WorkArea; var size = TransformFromDevice(wpfHexView, screenRect.Size); return(new Size(size.Width * maxWidthMultiplier, size.Height * maxHeightMultiplier)); }
public override CurrentValueHighlighter Get(WpfHexView wpfHexView) { if (wpfHexView is null) { throw new ArgumentNullException(nameof(wpfHexView)); } return(wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(CurrentValueHighlighter), () => new CurrentValueHighlighter(wpfHexView))); }
public override HexIntraTextAdornmentService Get(WpfHexView wpfHexView) { if (wpfHexView == null) { throw new ArgumentNullException(nameof(wpfHexView)); } return(wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(HexIntraTextAdornmentServiceImpl), () => new HexIntraTextAdornmentServiceImpl(wpfHexView, viewTagAggregatorFactoryService))); }
public override string TryGetGroupName(WpfHexView hexView) { if (hexView.Roles.Contains(PredefinedHexViewRoles.HexEditorGroup)) { return(PredefinedHexViewGroupNames.HexEditor); } return(null); }
public override void InstallLineSeparatorService(WpfHexView wpfHexView) { if (wpfHexView == null) { throw new ArgumentNullException(nameof(wpfHexView)); } wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(ColumnLineSeparatorService), () => new ColumnLineSeparatorService(wpfHexView, editorFormatMapService)); }
public override WpfHexViewHost CreateHost(WpfHexView wpfHexView, bool setFocus) { if (wpfHexView is null) { throw new ArgumentNullException(nameof(wpfHexView)); } return(new WpfHexViewHostImpl(wpfHexViewMarginProviderCollectionProvider, wpfHexView, editorOperationsFactoryService, themeService, setFocus)); }
#pragma warning restore 0169 public HexToolTipProviderImpl(WpfHexView wpfHexView) { if (wpfHexView == null) { throw new ArgumentNullException(nameof(wpfHexView)); } this.wpfHexView = wpfHexView; spaceReservationManager = wpfHexView.GetSpaceReservationManager(PredefinedHexSpaceReservationManagerNames.ToolTip); }
public override void HexViewCreated(WpfHexView hexView) { if (!hexView.Roles.Contains(PredefinedHexViewRoles.Interactive)) { return; } new HexKeyProcessorCollection(hexView, keyProcessorProviders); }
public DefaultHexViewMouseProcessor(WpfHexView wpfHexView, HexEditorOperationsFactoryService editorOperationsFactoryService) { if (wpfHexView == null) { throw new ArgumentNullException(nameof(wpfHexView)); } this.wpfHexView = wpfHexView; editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfHexView); }
public override void HexViewCreated(WpfHexView hexView) { if (!hexView.Roles.Contains(PredefinedHexViewRoles.Interactive)) { return; } new HexViewMouseProcessorCollection(hexView, editorOperationsFactoryService, mouseProcessorProviders); }
public override HexViewSearchService Get(WpfHexView wpfHexView) { if (wpfHexView is null) { throw new ArgumentNullException(nameof(wpfHexView)); } return(wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(HexViewSearchService), () => new HexViewSearchServiceImpl(wpfHexView, hexSearchServiceFactory, searchSettings, messageBoxService, editorOperationsFactoryService))); }
public CurrentLineHighlighter(WpfHexView wpfHexView, VSTC.IEditorFormatMap editorFormatMap) { this.wpfHexView = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView)); this.editorFormatMap = editorFormatMap ?? throw new ArgumentNullException(nameof(editorFormatMap)); currentLineHighlighterElement = new CurrentLineHighlighterElement(); wpfHexView.Closed += WpfHexView_Closed; wpfHexView.Options.OptionChanged += Options_OptionChanged; UpdateEnableState(); }
void OptionChanged(WpfHexView hexView, VSTE.EditorOptionChangedEventArgs e) { var coll = GetCollection(GetSubGroup(hexView)); if (!coll.HasOption(e.OptionId)) { return; } coll.SetOptionValue(e.OptionId, hexView.Options.GetOptionValue(e.OptionId)); }
public HexViewMouseProcessorCollection(WpfHexView wpfHexView, HexEditorOperationsFactoryService editorOperationsFactoryService, Lazy <HexMouseProcessorProvider, IOrderableTextViewRoleMetadata>[] mouseProcessorProviders) { this.wpfHexView = wpfHexView; wpfHexViewImpl = wpfHexView as WpfHexViewImpl; this.editorOperationsFactoryService = editorOperationsFactoryService; this.mouseProcessorProviders = mouseProcessorProviders; allowEventDelegate = AllowMouseEvent; wpfHexView.Closed += WpfHexView_Closed; Reinitialize(); }
#pragma warning restore 0169 HexViewBackgroundImageService(WpfHexView wpfHexView, IImageSourceService imageSourceService) : base(imageSourceService) { if (wpfHexView == null) { throw new ArgumentNullException(nameof(wpfHexView)); } this.wpfHexView = wpfHexView; wpfHexView.Closed += WpfHexView_Closed; }
public static Size TransformToDevice(WpfHexView wpfHexView, Size size) { var zoomMultiplier = wpfHexView.ZoomLevel == 0 ? 1 : wpfHexView.ZoomLevel / 100; var source = PresentationSource.FromVisual(wpfHexView.VisualElement); var transformToDevice = source?.CompositionTarget.TransformToDevice ?? Matrix.Identity; var wpfRect = transformToDevice.Transform(new Point(size.Width, size.Height)); var width = wpfRect.X * zoomMultiplier; var height = wpfRect.Y * zoomMultiplier; return(new Size(width, height)); }
/// <summary> /// Creates a <see cref="HexKeyProcessor"/> or returns null /// </summary> /// <param name="wpfHexView">Hex view</param> /// <returns></returns> public abstract HexKeyProcessor GetAssociatedProcessor(WpfHexView wpfHexView);
/// <summary> /// Called after a hex view with the correct role is created /// </summary> /// <param name="hexView">Hex view</param> public abstract void HexViewCreated(WpfHexView hexView);