public WpfTextViewHost(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IDsWpfTextView wpfTextView, IEditorOperationsFactoryService editorOperationsFactoryService, bool setFocus) { if (wpfTextViewMarginProviderCollectionProvider == null) { throw new ArgumentNullException(nameof(wpfTextViewMarginProviderCollectionProvider)); } this.editorOperationsFactoryService = editorOperationsFactoryService ?? throw new ArgumentNullException(nameof(editorOperationsFactoryService)); grid = CreateGrid(); TextView = wpfTextView ?? throw new ArgumentNullException(nameof(wpfTextView)); Focusable = false; Content = grid; UpdateBackground(); TextView.BackgroundBrushChanged += TextView_BackgroundBrushChanged; containerMargins = new IWpfTextViewMargin[5]; containerMargins[0] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Top, true, 0, 0, 3); containerMargins[1] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Bottom, true, 2, 0, 2); containerMargins[2] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.BottomRightCorner, true, 2, 2, 1); containerMargins[3] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Left, false, 1, 0, 1); containerMargins[4] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Right, false, 1, 2, 1); Add(TextView.VisualElement, 1, 1, 1); Debug.Assert(!containerMargins.Any(a => a == null)); if (setFocus) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { if (!TextView.IsClosed) { TextView.VisualElement.Focus(); } })); } }
public WpfTextViewHost(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IDsWpfTextView wpfTextView, IEditorOperationsFactoryService editorOperationsFactoryService, bool setFocus) { if (wpfTextViewMarginProviderCollectionProvider == null) throw new ArgumentNullException(nameof(wpfTextViewMarginProviderCollectionProvider)); if (wpfTextView == null) throw new ArgumentNullException(nameof(wpfTextView)); if (editorOperationsFactoryService == null) throw new ArgumentNullException(nameof(editorOperationsFactoryService)); this.editorOperationsFactoryService = editorOperationsFactoryService; grid = CreateGrid(); TextView = wpfTextView; Focusable = false; Content = grid; UpdateBackground(); TextView.BackgroundBrushChanged += TextView_BackgroundBrushChanged; containerMargins = new IWpfTextViewMargin[5]; containerMargins[0] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Top, true, 0, 0, 3); containerMargins[1] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Bottom, true, 2, 0, 2); containerMargins[2] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.BottomRightCorner, true, 2, 2, 1); containerMargins[3] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Left, false, 1, 0, 1); containerMargins[4] = CreateContainerMargin(wpfTextViewMarginProviderCollectionProvider, PredefinedMarginNames.Right, false, 1, 2, 1); Add(TextView.VisualElement, 1, 1, 1); Debug.Assert(!containerMargins.Any(a => a == null)); if (setFocus) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { if (!TextView.IsClosed) TextView.VisualElement.Focus(); })); } }
TextEditorFactoryService(ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ICommandService commandService, ISmartIndentationService smartIndentationService, [ImportMany] IEnumerable <Lazy <IWpfTextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata> > wpfTextViewCreationListeners, [ImportMany] IEnumerable <Lazy <ITextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata> > textViewCreationListeners, IFormattedTextSourceFactoryService formattedTextSourceFactoryService, IViewClassifierAggregatorService viewClassifierAggregatorService, ITextAndAdornmentSequencerFactoryService textAndAdornmentSequencerFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IAdornmentLayerDefinitionService adornmentLayerDefinitionService, ILineTransformProviderService lineTransformProviderService, IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IMenuService menuService, IEditorOperationsFactoryService editorOperationsFactoryService, ISpaceReservationStackProvider spaceReservationStackProvider, IWpfTextViewConnectionListenerServiceProvider wpfTextViewConnectionListenerServiceProvider, IBufferGraphFactoryService bufferGraphFactoryService, [ImportMany] IEnumerable <Lazy <ITextViewModelProvider, IContentTypeAndTextViewRoleMetadata> > textViewModelProviders, IContentTypeRegistryService contentTypeRegistryService, IThemeService themeService, Lazy <ITextViewUndoManagerProvider> textViewUndoManagerProvider) { this.textBufferFactoryService = textBufferFactoryService; this.editorOptionsFactoryService = editorOptionsFactoryService; this.commandService = commandService; this.smartIndentationService = smartIndentationService; this.wpfTextViewCreationListeners = wpfTextViewCreationListeners.ToArray(); this.textViewCreationListeners = textViewCreationListeners.ToArray(); this.formattedTextSourceFactoryService = formattedTextSourceFactoryService; this.viewClassifierAggregatorService = viewClassifierAggregatorService; this.textAndAdornmentSequencerFactoryService = textAndAdornmentSequencerFactoryService; this.classificationFormatMapService = classificationFormatMapService; this.editorFormatMapService = editorFormatMapService; this.adornmentLayerDefinitionService = adornmentLayerDefinitionService; this.lineTransformProviderService = lineTransformProviderService; this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; this.menuService = menuService; this.editorOperationsFactoryService = editorOperationsFactoryService; this.spaceReservationStackProvider = spaceReservationStackProvider; this.wpfTextViewConnectionListenerServiceProvider = wpfTextViewConnectionListenerServiceProvider; this.bufferGraphFactoryService = bufferGraphFactoryService; this.textViewModelProviders = textViewModelProviders.ToArray(); this.contentTypeRegistryService = contentTypeRegistryService; this.themeService = themeService; this.textViewUndoManagerProvider = textViewUndoManagerProvider; }
IWpfTextViewMargin CreateContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, string name, bool isHorizontal, int row, int column, int columnSpan) { var margin = new WpfTextViewContainerMargin(wpfTextViewMarginProviderCollectionProvider, this, name, isHorizontal); Add(margin.VisualElement, row, column, columnSpan); margin.VisualElement.AddHandler(MouseDownEvent, new MouseButtonEventHandler(Margin_VisualElement_MouseDown), true); return(margin); }
public LeftSelectionMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost, IEditorOperations editorOperations) : base(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, PredefinedMarginNames.LeftSelection, false) { Cursor = Cursors.Arrow; //TODO: Use an arrow pointing to the right this.wpfTextViewHost = wpfTextViewHost; this.editorOperations = editorOperations ?? throw new ArgumentNullException(nameof(editorOperations)); wpfTextViewHost.TextView.ZoomLevelChanged += TextView_ZoomLevelChanged; // Make sure that the user can click anywhere in this margin so we'll get mouse events Background = Brushes.Transparent; }
public LeftSelectionMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost, IEditorOperations editorOperations) : base(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, PredefinedMarginNames.LeftSelection, false) { if (editorOperations == null) throw new ArgumentNullException(nameof(editorOperations)); Cursor = Cursors.Arrow;//TODO: Use an arrow pointing to the right this.wpfTextViewHost = wpfTextViewHost; this.editorOperations = editorOperations; wpfTextViewHost.TextView.ZoomLevelChanged += TextView_ZoomLevelChanged; // Make sure that the user can click anywhere in this margin so we'll get mouse events Background = Brushes.Transparent; }
public WpfTextViewContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost, string name, bool isHorizontal) { if (wpfTextViewMarginProviderCollectionProvider == null) throw new ArgumentNullException(nameof(wpfTextViewMarginProviderCollectionProvider)); if (wpfTextViewHost == null) throw new ArgumentNullException(nameof(wpfTextViewHost)); if (name == null) throw new ArgumentNullException(nameof(name)); this.name = name; this.isHorizontal = isHorizontal; margins = Array.Empty<WpfTextViewMarginInfo>(); wpfTextViewMarginProviderCollection = wpfTextViewMarginProviderCollectionProvider.Create(wpfTextViewHost, this, name); wpfTextViewMarginProviderCollection.MarginsChanged += WpfTextViewMarginProviderCollection_MarginsChanged; UpdateMarginChildren(); }
public WpfTextViewContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost, string name, bool isHorizontal) { if (wpfTextViewMarginProviderCollectionProvider is null) { throw new ArgumentNullException(nameof(wpfTextViewMarginProviderCollectionProvider)); } if (wpfTextViewHost is null) { throw new ArgumentNullException(nameof(wpfTextViewHost)); } this.name = name ?? throw new ArgumentNullException(nameof(name)); this.isHorizontal = isHorizontal; margins = Array.Empty <WpfTextViewMarginInfo>(); wpfTextViewMarginProviderCollection = wpfTextViewMarginProviderCollectionProvider.Create(wpfTextViewHost, this, name); wpfTextViewMarginProviderCollection.MarginsChanged += WpfTextViewMarginProviderCollection_MarginsChanged; UpdateMarginChildren(); }
TextEditorFactoryService(ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ICommandManager commandManager, ISmartIndentationService smartIndentationService, [ImportMany] IEnumerable <Lazy <IWpfTextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata> > wpfTextViewCreationListeners, IFormattedTextSourceFactoryService formattedTextSourceFactoryService, IViewClassifierAggregatorService viewClassifierAggregatorService, ITextAndAdornmentSequencerFactoryService textAndAdornmentSequencerFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IAdornmentLayerDefinitionService adornmentLayerDefinitionService, ILineTransformProviderService lineTransformProviderService, IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IMenuManager menuManager, IEditorOperationsFactoryService editorOperationsFactoryService) { this.textBufferFactoryService = textBufferFactoryService; this.editorOptionsFactoryService = editorOptionsFactoryService; this.commandManager = commandManager; this.smartIndentationService = smartIndentationService; this.wpfTextViewCreationListeners = wpfTextViewCreationListeners.ToArray(); this.formattedTextSourceFactoryService = formattedTextSourceFactoryService; this.viewClassifierAggregatorService = viewClassifierAggregatorService; this.textAndAdornmentSequencerFactoryService = textAndAdornmentSequencerFactoryService; this.classificationFormatMapService = classificationFormatMapService; this.editorFormatMapService = editorFormatMapService; this.adornmentLayerDefinitionService = adornmentLayerDefinitionService; this.lineTransformProviderService = lineTransformProviderService; this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; this.menuManager = menuManager; this.editorOperationsFactoryService = editorOperationsFactoryService; }
LeftSelectionMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IEditorOperationsFactoryService editorOperationsFactoryService) { this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; this.editorOperationsFactoryService = editorOperationsFactoryService; }
TextEditorFactoryService(ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ICommandService commandService, ISmartIndentationService smartIndentationService, [ImportMany] IEnumerable<Lazy<IWpfTextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata>> wpfTextViewCreationListeners, IFormattedTextSourceFactoryService formattedTextSourceFactoryService, IViewClassifierAggregatorService viewClassifierAggregatorService, ITextAndAdornmentSequencerFactoryService textAndAdornmentSequencerFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IAdornmentLayerDefinitionService adornmentLayerDefinitionService, ILineTransformProviderService lineTransformProviderService, IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IMenuService menuService, IEditorOperationsFactoryService editorOperationsFactoryService, ISpaceReservationStackProvider spaceReservationStackProvider, IWpfTextViewConnectionListenerServiceProvider wpfTextViewConnectionListenerServiceProvider, IBufferGraphFactoryService bufferGraphFactoryService, [ImportMany] IEnumerable<Lazy<ITextViewModelProvider, IContentTypeAndTextViewRoleMetadata>> textViewModelProviders, IContentTypeRegistryService contentTypeRegistryService, Lazy<ITextViewUndoManagerProvider> textViewUndoManagerProvider) { this.textBufferFactoryService = textBufferFactoryService; this.editorOptionsFactoryService = editorOptionsFactoryService; this.commandService = commandService; this.smartIndentationService = smartIndentationService; this.wpfTextViewCreationListeners = wpfTextViewCreationListeners.ToArray(); this.formattedTextSourceFactoryService = formattedTextSourceFactoryService; this.viewClassifierAggregatorService = viewClassifierAggregatorService; this.textAndAdornmentSequencerFactoryService = textAndAdornmentSequencerFactoryService; this.classificationFormatMapService = classificationFormatMapService; this.editorFormatMapService = editorFormatMapService; this.adornmentLayerDefinitionService = adornmentLayerDefinitionService; this.lineTransformProviderService = lineTransformProviderService; this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; this.menuService = menuService; this.editorOperationsFactoryService = editorOperationsFactoryService; this.spaceReservationStackProvider = spaceReservationStackProvider; this.wpfTextViewConnectionListenerServiceProvider = wpfTextViewConnectionListenerServiceProvider; this.bufferGraphFactoryService = bufferGraphFactoryService; this.textViewModelProviders = textViewModelProviders.ToArray(); this.contentTypeRegistryService = contentTypeRegistryService; this.textViewUndoManagerProvider = textViewUndoManagerProvider; }
BottomControlMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) { this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; }
RightControlMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) => this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider;
public HorizontalScrollBarContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost) : base(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, PredefinedMarginNames.HorizontalScrollBarContainer, true) => VerticalAlignment = VerticalAlignment.Bottom;
HorizontalScrollBarContainerMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) => this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider;
public HorizontalScrollBarContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost) : base(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, PredefinedMarginNames.HorizontalScrollBarContainer, true) { VerticalAlignment = VerticalAlignment.Bottom; }
HorizontalScrollBarContainerMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) { this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; }
LeftSelectionMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IEditorOperationsFactoryService editorOperationsFactoryService) { this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; this.editorOperationsFactoryService = editorOperationsFactoryService; }
BottomControlMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) { this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; }
IWpfTextViewMargin CreateContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, string name, bool isHorizontal, int row, int column, int columnSpan) { var margin = new WpfTextViewContainerMargin(wpfTextViewMarginProviderCollectionProvider, this, name, isHorizontal); Add(margin.VisualElement, row, column, columnSpan); margin.VisualElement.AddHandler(MouseDownEvent, new MouseButtonEventHandler(Margin_VisualElement_MouseDown), true); return margin; }
VerticalScrollBarContainerMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) { this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider; }