public BottomRightCornerMargin(WpfHexViewHost wpfHexViewHost) { if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); canvas = new Canvas(); this.wpfHexViewHost = wpfHexViewHost; wpfHexViewHost.HexView.Options.OptionChanged += Options_OptionChanged; canvas.SetResourceReference(Control.BackgroundProperty, "EnvironmentScrollBarBackground"); UpdateVisibility(); }
public override WpfHexViewMarginProviderCollection Create(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer, string marginContainerName) { if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); if (marginContainer == null) throw new ArgumentNullException(nameof(marginContainer)); if (marginContainerName == null) throw new ArgumentNullException(nameof(marginContainerName)); return new WpfHexViewMarginProviderCollectionImpl(wpfHexViewMarginProviders, wpfHexViewHost, marginContainer, marginContainerName); }
public SpacerMargin(WpfHexViewHost wpfHexViewHost) { if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); frameworkElement = new FrameworkElement(); this.wpfHexViewHost = wpfHexViewHost; wpfHexViewHost.HexView.Options.OptionChanged += Options_OptionChanged; frameworkElement.Width = SELECTION_MARGIN_WIDTH; frameworkElement.ClipToBounds = true; frameworkElement.IsHitTestVisible = false; UpdateVisibility(); }
public HorizontalScrollBarMargin(WpfHexViewHost wpfHexViewHost) { if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); theScrollBar = new TheScrollBar(this); this.wpfHexViewHost = wpfHexViewHost; theScrollBar.IsVisibleChanged += HorizontalScrollBarMargin_IsVisibleChanged; wpfHexViewHost.HexView.Options.OptionChanged += Options_OptionChanged; theScrollBar.SetResourceReference(FrameworkElement.StyleProperty, typeof(ScrollBar)); theScrollBar.VerticalAlignment = VerticalAlignment.Top; theScrollBar.Orientation = System.Windows.Controls.Orientation.Horizontal; theScrollBar.SmallChange = 12.0; theScrollBar.Minimum = 0; UpdateVisibility(); }
public LeftSelectionMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost, HexEditorOperations editorOperations) : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.LeftSelection, false) { if (editorOperations == null) throw new ArgumentNullException(nameof(editorOperations)); VisualElement.Cursor = Cursors.Arrow;//TODO: Use an arrow pointing to the right this.wpfHexViewHost = wpfHexViewHost; this.editorOperations = editorOperations; wpfHexViewHost.HexView.ZoomLevelChanged += HexView_ZoomLevelChanged; // Make sure that the user can click anywhere in this margin so we'll get mouse events Grid.Background = Brushes.Transparent; VisualElement.MouseLeftButtonDown += VisualElement_MouseLeftButtonDown; VisualElement.MouseLeftButtonUp += VisualElement_MouseLeftButtonUp; VisualElement.MouseMove += VisualElement_MouseMove; }
public WpfHexViewContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost, string name, bool isHorizontal) { if (wpfHexViewMarginProviderCollectionProvider == null) throw new ArgumentNullException(nameof(wpfHexViewMarginProviderCollectionProvider)); if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); if (name == null) throw new ArgumentNullException(nameof(name)); grid = new Grid(); this.name = name; this.isHorizontal = isHorizontal; margins = Array.Empty<WpfHexViewMarginInfo>(); wpfHexViewMarginProviderCollection = wpfHexViewMarginProviderCollectionProvider.Create(wpfHexViewHost, this, name); wpfHexViewMarginProviderCollection.MarginsChanged += WpfHexViewMarginProviderCollection_MarginsChanged; UpdateMarginChildren(); }
public WpfHexViewMarginProviderCollectionImpl(Lazy<WpfHexViewMarginProvider, IWpfHexViewMarginMetadata>[] wpfHexViewMarginProviders, WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer, string marginContainerName) { if (wpfHexViewMarginProviders == null) throw new ArgumentNullException(nameof(wpfHexViewMarginProviders)); if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); if (marginContainer == null) throw new ArgumentNullException(nameof(marginContainer)); if (marginContainerName == null) throw new ArgumentNullException(nameof(marginContainerName)); this.wpfHexViewMarginProviders = wpfHexViewMarginProviders.Where(a => StringComparer.OrdinalIgnoreCase.Equals(marginContainerName, a.Metadata.MarginContainer) && wpfHexViewHost.HexView.Roles.ContainsAny(a.Metadata.TextViewRoles) ).ToArray(); this.wpfHexViewHost = wpfHexViewHost; this.marginContainer = marginContainer; currentMargins = Array.Empty<WpfHexViewMarginInfo>(); wpfHexViewHost.Closed += WpfHexViewHost_Closed; UpdateMargins(); }
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new SpacerMargin(wpfHexViewHost);
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new BottomRightCornerMargin(wpfHexViewHost);
public LeftSelectionMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost, HexEditorOperations editorOperations) : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.LeftSelection, false) { VisualElement.Cursor = Cursors.Arrow; //TODO: Use an arrow pointing to the right this.wpfHexViewHost = wpfHexViewHost; this.editorOperations = editorOperations ?? throw new ArgumentNullException(nameof(editorOperations)); wpfHexViewHost.HexView.ZoomLevelChanged += HexView_ZoomLevelChanged; // Make sure that the user can click anywhere in this margin so we'll get mouse events Grid.Background = Brushes.Transparent; VisualElement.MouseLeftButtonDown += VisualElement_MouseLeftButtonDown; VisualElement.MouseLeftButtonUp += VisualElement_MouseLeftButtonUp; VisualElement.MouseMove += VisualElement_MouseMove; }
public HexViewDocumentTabUIContext(HexEditorGroupFactoryService hexEditorGroupFactoryService, HexBuffer buffer) { hexViewHost = hexEditorGroupFactoryService.Create(buffer, PredefinedHexViewRoles.HexEditorGroup, PredefinedHexViewRoles.HexEditorGroupDefault, new Guid(MenuConstants.GUIDOBJ_ASMEDITOR_HEXVIEW_GUID)); }
public ZoomControlMargin(WpfHexViewHost wpfHexViewHost, HexEditorOperations editorOperations) { if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); if (editorOperations == null) throw new ArgumentNullException(nameof(editorOperations)); zoomControl = new TheZoomControl(this); this.wpfHexViewHost = wpfHexViewHost; this.editorOperations = editorOperations; wpfHexViewHost.HexView.Options.OptionChanged += Options_OptionChanged; // Need to set these explicitly so our themed styles are used zoomControl.SetResourceReference(FrameworkElement.StyleProperty, typeof(ComboBox)); zoomControl.SetResourceReference(ItemsControl.ItemContainerStyleProperty, typeof(ComboBoxItem)); zoomControl.MinHeight = 0; zoomControl.Margin = new Thickness(0); zoomControl.Width = 60; UpdateVisibility(); }
public abstract WpfHexViewMarginProviderCollection Create(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer, string marginContainerName);
public GuidObjectsProvider(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin margin, string marginName, Lazy<HexMarginContextMenuHandlerProvider, IMarginContextMenuHandlerProviderMetadata>[] marginContextMenuHandlerProviders) { this.wpfHexViewHost = wpfHexViewHost; this.margin = margin; this.marginName = marginName; this.marginContextMenuHandlerProviders = marginContextMenuHandlerProviders; }
/// <summary> /// Creates <see cref="IHexMarginContextMenuHandler"/>s or returns null /// </summary> /// <param name="wpfHexViewHost">Hex view host</param> /// <param name="margin">Margin</param> /// <returns></returns> public abstract IHexMarginContextMenuHandler Create(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin margin);
public WpfHexViewContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost, string name, bool isHorizontal) { if (wpfHexViewMarginProviderCollectionProvider is null) { throw new ArgumentNullException(nameof(wpfHexViewMarginProviderCollectionProvider)); } if (wpfHexViewHost is null) { throw new ArgumentNullException(nameof(wpfHexViewHost)); } grid = new Grid(); this.name = name ?? throw new ArgumentNullException(nameof(name)); this.isHorizontal = isHorizontal; margins = Array.Empty <WpfHexViewMarginInfo>(); wpfHexViewMarginProviderCollection = wpfHexViewMarginProviderCollectionProvider.Create(wpfHexViewHost, this, name); wpfHexViewMarginProviderCollection.MarginsChanged += WpfHexViewMarginProviderCollection_MarginsChanged; UpdateMarginChildren(); }
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new HexGlyphMargin(menuService, wpfHexViewHost, viewTagAggregatorFactoryService, editorFormatMapService, glyphMouseProcessorProviders, glyphFactoryProviders, marginContextMenuHandlerProviderService);
public HexGlyphMargin(IMenuService menuService, WpfHexViewHost wpfHexViewHost, HexViewTagAggregatorFactoryService viewTagAggregatorFactoryService, HexEditorFormatMapService editorFormatMapService, Lazy<HexGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy<HexGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, HexMarginContextMenuService marginContextMenuHandlerProviderService) { if (menuService == null) throw new ArgumentNullException(nameof(menuService)); if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); if (viewTagAggregatorFactoryService == null) throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService)); if (editorFormatMapService == null) throw new ArgumentNullException(nameof(editorFormatMapService)); if (glyphMouseProcessorProviders == null) throw new ArgumentNullException(nameof(glyphMouseProcessorProviders)); if (glyphFactoryProviders == null) throw new ArgumentNullException(nameof(glyphFactoryProviders)); canvas = new Canvas(); glyphFactories = new Dictionary<Type, GlyphFactoryInfo>(); childCanvases = Array.Empty<Canvas>(); this.wpfHexViewHost = wpfHexViewHost; this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; this.editorFormatMapService = editorFormatMapService; lazyGlyphMouseProcessorProviders = glyphMouseProcessorProviders; lazyGlyphFactoryProviders = glyphFactoryProviders; var binding = new Binding { Path = new PropertyPath(Panel.BackgroundProperty), Source = canvas, }; canvas.SetBinding(DsImage.BackgroundBrushProperty, binding); wpfHexViewHost.HexView.Options.OptionChanged += Options_OptionChanged; wpfHexViewHost.HexView.ZoomLevelChanged += HexView_ZoomLevelChanged; canvas.IsVisibleChanged += GlyphMargin_IsVisibleChanged; UpdateVisibility(); canvas.Width = MARGIN_WIDTH; canvas.ClipToBounds = true; menuService.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfHexViewHost, this, PredefinedHexMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID)); }
/// <summary> /// Creates a <see cref="IGuidObjectsProvider"/> /// </summary> /// <param name="wpfHexViewHost">Hex view host</param> /// <param name="margin">Margin</param> /// <param name="marginName">Margin name</param> /// <returns></returns> public abstract IGuidObjectsProvider Create(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin margin, string marginName);
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new WpfHexViewContainerMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.BottomControl, false);
public override IGuidObjectsProvider Create(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin margin, string marginName) { if (wpfHexViewHost == null) throw new ArgumentNullException(nameof(wpfHexViewHost)); if (margin == null) throw new ArgumentNullException(nameof(margin)); if (marginName == null) throw new ArgumentNullException(nameof(marginName)); if (margin.GetHexViewMargin(marginName) != margin) throw new ArgumentException(); return new GuidObjectsProvider(wpfHexViewHost, margin, marginName, marginContextMenuHandlerProviders); }
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new HorizontalScrollBarContainerMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost);
/// <summary> /// Creates a mouse processor or returns null /// </summary> /// <param name="wpfHexViewHost">Hex view host</param> /// <param name="margin">Margin</param> /// <returns></returns> public abstract HexMouseProcessor GetAssociatedMouseProcessor(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin margin);
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new ZoomControlMargin(wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new LeftSelectionMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
public override WpfHexViewMargin?CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new LeftSelectionMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) => new HorizontalScrollBarMargin(wpfHexViewHost);
public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost) : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true) { VisualElement.VerticalAlignment = VerticalAlignment.Bottom; }
public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost) : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true) => VisualElement.VerticalAlignment = VerticalAlignment.Bottom;