Esempio n. 1
0
        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();
                    }
                }));
            }
        }
Esempio n. 2
0
		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;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
		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();
		}
Esempio n. 8
0
 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();
 }
Esempio n. 9
0
 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;
 }
Esempio n. 10
0
		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;
		}
Esempio n. 12
0
		BottomControlMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) {
			this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider;
		}
Esempio n. 13
0
 RightControlMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider) => this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider;
Esempio n. 14
0
 public HorizontalScrollBarContainerMargin(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IWpfTextViewHost wpfTextViewHost)
     : base(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, PredefinedMarginNames.HorizontalScrollBarContainer, true) => VerticalAlignment = VerticalAlignment.Bottom;
Esempio n. 15
0
 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;
		}
Esempio n. 18
0
 LeftSelectionMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider, IEditorOperationsFactoryService editorOperationsFactoryService)
 {
     this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider;
     this.editorOperationsFactoryService = editorOperationsFactoryService;
 }
Esempio n. 19
0
 BottomControlMarginProvider(IWpfTextViewMarginProviderCollectionProvider wpfTextViewMarginProviderCollectionProvider)
 {
     this.wpfTextViewMarginProviderCollectionProvider = wpfTextViewMarginProviderCollectionProvider;
 }
Esempio n. 20
0
		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;
 }