Exemplo n.º 1
0
		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();
				}));
			}
		}
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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;
		}
		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 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();
 }
Exemplo n.º 7
0
        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();
                    }
                }));
            }
        }
Exemplo n.º 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();
 }
Exemplo n.º 9
0
 BottomControlMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) => this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
Exemplo n.º 10
0
 LeftSelectionMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, HexEditorOperationsFactoryService editorOperationsFactoryService)
 {
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
     this.editorOperationsFactoryService             = editorOperationsFactoryService;
 }
		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;
		}
		HorizontalScrollBarContainerMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
		}
		public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost)
			: base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true) {
			VisualElement.VerticalAlignment = VerticalAlignment.Bottom;
		}
Exemplo n.º 14
0
		LeftSelectionMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, HexEditorOperationsFactoryService editorOperationsFactoryService) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}
Exemplo n.º 15
0
 VerticalScrollBarContainerMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) => this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
Exemplo n.º 16
0
		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;
		}
Exemplo n.º 17
0
 HorizontalScrollBarContainerMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider)
 {
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
 }
Exemplo n.º 18
0
 RightControlMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider)
 {
     this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
 }
Exemplo n.º 19
0
		BottomControlMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
		}
Exemplo n.º 20
0
 public HorizontalScrollBarContainerMargin(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, WpfHexViewHost wpfHexViewHost)
     : base(wpfHexViewMarginProviderCollectionProvider, wpfHexViewHost, PredefinedHexMarginNames.HorizontalScrollBarContainer, true)
 {
     VisualElement.VerticalAlignment = VerticalAlignment.Bottom;
 }