コード例 #1
0
ファイル: WpfHexViewHostImpl.cs プロジェクト: 0xd4d/dnSpy
		public WpfHexViewHostImpl(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexView wpfHexView, HexEditorOperationsFactoryService editorOperationsFactoryService, bool setFocus) {
			if (wpfHexViewMarginProviderCollectionProvider == null)
				throw new ArgumentNullException(nameof(wpfHexViewMarginProviderCollectionProvider));
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			if (editorOperationsFactoryService == null)
				throw new ArgumentNullException(nameof(editorOperationsFactoryService));
			contentControl = new ContentControl();
			this.editorOperationsFactoryService = editorOperationsFactoryService;
			grid = CreateGrid();
			HexView = wpfHexView;
			contentControl.Focusable = false;
			contentControl.Content = grid;
			contentControl.MouseWheel += ContentControl_MouseWheel;

			UpdateBackground();
			HexView.BackgroundBrushChanged += HexView_BackgroundBrushChanged;

			containerMargins = new WpfHexViewMargin[5];
			containerMargins[0] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Top, true, 0, 0, 3);
			containerMargins[1] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Bottom, true, 2, 0, 2);
			containerMargins[2] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.BottomRightCorner, true, 2, 2, 1);
			containerMargins[3] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Left, false, 1, 0, 1);
			containerMargins[4] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Right, false, 1, 2, 1);
			Add(HexView.VisualElement, 1, 1, 1);
			Debug.Assert(!containerMargins.Any(a => a == null));

			if (setFocus) {
				contentControl.Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => {
					if (!HexView.IsClosed)
						HexView.VisualElement.Focus();
				}));
			}
		}
コード例 #2
0
ファイル: WpfHexViewHostImpl.cs プロジェクト: zhenren92/dnSpy
        WpfHexViewMargin CreateContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, string name, bool isHorizontal, int row, int column, int columnSpan)
        {
            var margin = new WpfHexViewContainerMargin(wpfHexViewMarginProviderCollectionProvider, this, name, isHorizontal);

            Add(margin.VisualElement, row, column, columnSpan);
            margin.VisualElement.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(Margin_VisualElement_MouseDown), true);
            return(margin);
        }
コード例 #3
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;
 }
コード例 #4
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;
		}
コード例 #5
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();
		}
コード例 #6
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();
 }
コード例 #7
0
ファイル: WpfHexViewHostImpl.cs プロジェクト: pashav15/pashav
        public WpfHexViewHostImpl(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexView wpfHexView, HexEditorOperationsFactoryService editorOperationsFactoryService, bool setFocus)
        {
            if (wpfHexViewMarginProviderCollectionProvider == null)
            {
                throw new ArgumentNullException(nameof(wpfHexViewMarginProviderCollectionProvider));
            }
            if (wpfHexView == null)
            {
                throw new ArgumentNullException(nameof(wpfHexView));
            }
            if (editorOperationsFactoryService == null)
            {
                throw new ArgumentNullException(nameof(editorOperationsFactoryService));
            }
            contentControl = new ContentControl();
            this.editorOperationsFactoryService = editorOperationsFactoryService;
            grid    = CreateGrid();
            HexView = wpfHexView;
            contentControl.Focusable   = false;
            contentControl.Content     = grid;
            contentControl.MouseWheel += ContentControl_MouseWheel;

            UpdateBackground();
            HexView.BackgroundBrushChanged += HexView_BackgroundBrushChanged;

            containerMargins    = new WpfHexViewMargin[5];
            containerMargins[0] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Top, true, 0, 0, 3);
            containerMargins[1] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Bottom, true, 2, 0, 2);
            containerMargins[2] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.BottomRightCorner, true, 2, 2, 1);
            containerMargins[3] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Left, false, 1, 0, 1);
            containerMargins[4] = CreateContainerMargin(wpfHexViewMarginProviderCollectionProvider, PredefinedHexMarginNames.Right, false, 1, 2, 1);
            Add(HexView.VisualElement, 1, 1, 1);
            Debug.Assert(!containerMargins.Any(a => a == null));

            if (setFocus)
            {
                contentControl.Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => {
                    if (!HexView.IsClosed)
                    {
                        HexView.VisualElement.Focus();
                    }
                }));
            }
        }
コード例 #8
0
 HexEditorFactoryServiceImpl(HexEditorOptionsFactoryService hexEditorOptionsFactoryService, ICommandService commandService, [ImportMany] IEnumerable <Lazy <WpfHexViewCreationListener, IDeferrableTextViewRoleMetadata> > wpfHexViewCreationListeners, [ImportMany] IEnumerable <Lazy <HexEditorFactoryServiceListener> > hexEditorFactoryServiceListeners, FormattedHexSourceFactoryService formattedHexSourceFactoryService, HexViewClassifierAggregatorService hexViewClassifierAggregatorService, HexAndAdornmentSequencerFactoryService hexAndAdornmentSequencerFactoryService, HexClassificationFormatMapService classificationFormatMapService, HexEditorFormatMapService editorFormatMapService, HexAdornmentLayerDefinitionService adornmentLayerDefinitionService, HexLineTransformProviderService lineTransformProviderService, WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, IMenuService menuService, HexEditorOperationsFactoryService editorOperationsFactoryService, HexSpaceReservationStackProvider spaceReservationStackProvider, HexBufferLineFormatterFactoryService hexBufferLineFormatterFactoryService, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService, [ImportMany] IEnumerable <Lazy <HexCursorProviderFactory, ITextViewRoleMetadata> > hexCursorProviderFactories)
 {
     this.hexEditorOptionsFactoryService = hexEditorOptionsFactoryService;
     this.commandService = commandService;
     this.wpfHexViewCreationListeners            = wpfHexViewCreationListeners.ToArray();
     this.hexEditorFactoryServiceListeners       = hexEditorFactoryServiceListeners.ToArray();
     this.formattedHexSourceFactoryService       = formattedHexSourceFactoryService;
     this.hexViewClassifierAggregatorService     = hexViewClassifierAggregatorService;
     this.hexAndAdornmentSequencerFactoryService = hexAndAdornmentSequencerFactoryService;
     this.classificationFormatMapService         = classificationFormatMapService;
     this.editorFormatMapService                     = editorFormatMapService;
     this.adornmentLayerDefinitionService            = adornmentLayerDefinitionService;
     this.lineTransformProviderService               = lineTransformProviderService;
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
     this.menuService = menuService;
     this.editorOperationsFactoryService       = editorOperationsFactoryService;
     this.spaceReservationStackProvider        = spaceReservationStackProvider;
     this.hexBufferLineFormatterFactoryService = hexBufferLineFormatterFactoryService;
     this.classificationTypeRegistryService    = classificationTypeRegistryService;
     this.hexCursorProviderFactories           = hexCursorProviderFactories.ToArray();
 }
コード例 #9
0
 BottomControlMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) => this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
コード例 #10
0
 LeftSelectionMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, HexEditorOperationsFactoryService editorOperationsFactoryService)
 {
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
     this.editorOperationsFactoryService             = editorOperationsFactoryService;
 }
コード例 #11
0
		HexEditorFactoryServiceImpl(HexEditorOptionsFactoryService hexEditorOptionsFactoryService, ICommandService commandService, [ImportMany] IEnumerable<Lazy<WpfHexViewCreationListener, IDeferrableTextViewRoleMetadata>> wpfHexViewCreationListeners, [ImportMany] IEnumerable<Lazy<HexEditorFactoryServiceListener>> hexEditorFactoryServiceListeners, FormattedHexSourceFactoryService formattedHexSourceFactoryService, HexViewClassifierAggregatorService hexViewClassifierAggregatorService, HexAndAdornmentSequencerFactoryService hexAndAdornmentSequencerFactoryService, HexClassificationFormatMapService classificationFormatMapService, HexEditorFormatMapService editorFormatMapService, HexAdornmentLayerDefinitionService adornmentLayerDefinitionService, HexLineTransformProviderService lineTransformProviderService, WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, IMenuService menuService, HexEditorOperationsFactoryService editorOperationsFactoryService, HexSpaceReservationStackProvider spaceReservationStackProvider, HexBufferLineProviderFactoryService hexBufferLineProviderFactoryService, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService) {
			this.hexEditorOptionsFactoryService = hexEditorOptionsFactoryService;
			this.commandService = commandService;
			this.wpfHexViewCreationListeners = wpfHexViewCreationListeners.ToArray();
			this.hexEditorFactoryServiceListeners = hexEditorFactoryServiceListeners.ToArray();
			this.formattedHexSourceFactoryService = formattedHexSourceFactoryService;
			this.hexViewClassifierAggregatorService = hexViewClassifierAggregatorService;
			this.hexAndAdornmentSequencerFactoryService = hexAndAdornmentSequencerFactoryService;
			this.classificationFormatMapService = classificationFormatMapService;
			this.editorFormatMapService = editorFormatMapService;
			this.adornmentLayerDefinitionService = adornmentLayerDefinitionService;
			this.lineTransformProviderService = lineTransformProviderService;
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
			this.menuService = menuService;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
			this.spaceReservationStackProvider = spaceReservationStackProvider;
			this.hexBufferLineProviderFactoryService = hexBufferLineProviderFactoryService;
			this.classificationTypeRegistryService = classificationTypeRegistryService;
		}
コード例 #12
0
		HorizontalScrollBarContainerMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
		}
コード例 #13
0
		public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost)
			: base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true) {
			VisualElement.VerticalAlignment = VerticalAlignment.Bottom;
		}
コード例 #14
0
		LeftSelectionMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, HexEditorOperationsFactoryService editorOperationsFactoryService) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}
コード例 #15
0
 VerticalScrollBarContainerMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) => this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
コード例 #16
0
ファイル: WpfHexViewHostImpl.cs プロジェクト: 0xd4d/dnSpy
		WpfHexViewMargin CreateContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, string name, bool isHorizontal, int row, int column, int columnSpan) {
			var margin = new WpfHexViewContainerMargin(wpfHexViewMarginProviderCollectionProvider, this, name, isHorizontal);
			Add(margin.VisualElement, row, column, columnSpan);
			margin.VisualElement.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(Margin_VisualElement_MouseDown), true);
			return margin;
		}
コード例 #17
0
 HorizontalScrollBarContainerMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider)
 {
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
 }
コード例 #18
0
ファイル: RightControlMargin.cs プロジェクト: pashav15/pashav
 RightControlMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider)
 {
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
 }
コード例 #19
0
		BottomControlMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
		}
コード例 #20
0
 public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost)
     : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true)
 {
     VisualElement.VerticalAlignment = VerticalAlignment.Bottom;
 }