Пример #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();
				}));
			}
		}
		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();
		}
		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;
		}
		MouseWpfHexViewCreationListener(HexEditorOperationsFactoryService editorOperationsFactoryService, [ImportMany] IEnumerable<Lazy<HexMouseProcessorProvider, IOrderableTextViewRoleMetadata>> mouseProcessorProviders) {
			this.editorOperationsFactoryService = editorOperationsFactoryService;
			this.mouseProcessorProviders = VSUTIL.Orderer.Order(mouseProcessorProviders).ToArray();
		}
Пример #5
0
		LeftSelectionMarginProvider(WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, HexEditorOperationsFactoryService editorOperationsFactoryService) {
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}
		public DefaultHexViewCommandTarget(HexView hexView, HexEditorOperationsFactoryService editorOperationsFactoryService) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			this.hexView = hexView;
			EditorOperations = editorOperationsFactoryService.GetEditorOperations(hexView);
		}
Пример #7
0
		ZoomControlMarginProvider(HexEditorOperationsFactoryService editorOperationsFactoryService) {
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}