コード例 #1
0
		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);
		}
コード例 #3
0
ファイル: SpacerMargin.cs プロジェクト: manojdjoshi/dnSpy
		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();
		}
コード例 #4
0
		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();
		}
コード例 #5
0
		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;
		}
コード例 #6
0
		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();
		}
コード例 #7
0
		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();
		}
コード例 #8
0
 public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
 new SpacerMargin(wpfHexViewHost);
コード例 #9
0
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new BottomRightCornerMargin(wpfHexViewHost);
コード例 #10
0
 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;
 }
コード例 #11
0
		public HexViewDocumentTabUIContext(HexEditorGroupFactoryService hexEditorGroupFactoryService, HexBuffer buffer) {
			hexViewHost = hexEditorGroupFactoryService.Create(buffer, PredefinedHexViewRoles.HexEditorGroup, PredefinedHexViewRoles.HexEditorGroupDefault, new Guid(MenuConstants.GUIDOBJ_ASMEDITOR_HEXVIEW_GUID));
		}
コード例 #12
0
ファイル: ZoomControlMargin.cs プロジェクト: 0xd4d/dnSpy
		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);
コード例 #14
0
			public GuidObjectsProvider(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin margin, string marginName, Lazy<HexMarginContextMenuHandlerProvider, IMarginContextMenuHandlerProviderMetadata>[] marginContextMenuHandlerProviders) {
				this.wpfHexViewHost = wpfHexViewHost;
				this.margin = margin;
				this.marginName = marginName;
				this.marginContextMenuHandlerProviders = marginContextMenuHandlerProviders;
			}
コード例 #15
0
		/// <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);
コード例 #16
0
 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();
 }
コード例 #17
0
ファイル: SpacerMargin.cs プロジェクト: manojdjoshi/dnSpy
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new SpacerMargin(wpfHexViewHost);
コード例 #18
0
 public HexViewDocumentTabUIContext(HexEditorGroupFactoryService hexEditorGroupFactoryService, HexBuffer buffer)
 {
     hexViewHost = hexEditorGroupFactoryService.Create(buffer, PredefinedHexViewRoles.HexEditorGroup, PredefinedHexViewRoles.HexEditorGroupDefault, new Guid(MenuConstants.GUIDOBJ_ASMEDITOR_HEXVIEW_GUID));
 }
コード例 #19
0
ファイル: HexGlyphMargin.cs プロジェクト: azureidea/dnSpy-1
 public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
 new HexGlyphMargin(menuService, wpfHexViewHost, viewTagAggregatorFactoryService, editorFormatMapService, glyphMouseProcessorProviders, glyphFactoryProviders, marginContextMenuHandlerProviderService);
コード例 #20
0
ファイル: HexGlyphMargin.cs プロジェクト: manojdjoshi/dnSpy
		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));
		}
コード例 #21
0
		/// <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);
コード例 #22
0
ファイル: HexGlyphMargin.cs プロジェクト: manojdjoshi/dnSpy
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new HexGlyphMargin(menuService, wpfHexViewHost, viewTagAggregatorFactoryService, editorFormatMapService, glyphMouseProcessorProviders, glyphFactoryProviders, marginContextMenuHandlerProviderService);
コード例 #23
0
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new WpfHexViewContainerMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.BottomControl, false);
コード例 #24
0
		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);
		}
コード例 #25
0
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new HorizontalScrollBarContainerMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost);
コード例 #26
0
 /// <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 abstract WpfHexViewMarginProviderCollection Create(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer, string marginContainerName);
コード例 #28
0
ファイル: ZoomControlMargin.cs プロジェクト: 0xd4d/dnSpy
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new ZoomControlMargin(wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
コード例 #29
0
ファイル: ZoomControlMargin.cs プロジェクト: pashav15/pashav
 public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
 new ZoomControlMargin(wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
コード例 #30
0
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new LeftSelectionMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
コード例 #31
0
 public override WpfHexViewMargin?CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
 new LeftSelectionMargin(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, editorOperationsFactoryService.GetEditorOperations(wpfHexViewHost.HexView));
コード例 #32
0
		/// <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);
コード例 #33
0
		public override WpfHexViewMargin CreateMargin(WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer) =>
			new HorizontalScrollBarMargin(wpfHexViewHost);
コード例 #34
0
		public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost)
			: base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true) {
			VisualElement.VerticalAlignment = VerticalAlignment.Bottom;
		}
コード例 #35
0
 public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost)
     : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true) => VisualElement.VerticalAlignment = VerticalAlignment.Bottom;