public DocumentViewerControl(ITextBufferFactoryService textBufferFactoryService, IDsTextEditorFactoryService dsTextEditorFactoryService, IDocumentViewerHelper textEditorHelper) { if (textBufferFactoryService == null) { throw new ArgumentNullException(nameof(textBufferFactoryService)); } if (dsTextEditorFactoryService == null) { throw new ArgumentNullException(nameof(dsTextEditorFactoryService)); } this.textEditorHelper = textEditorHelper ?? throw new ArgumentNullException(nameof(textEditorHelper)); defaultContentType = textBufferFactoryService.TextContentType; cachedColorsList = new CachedColorsList(); emptyContent = new DocumentViewerContent(string.Empty, CachedTextColorsCollection.Empty, SpanDataCollection <ReferenceInfo> .Empty, new Dictionary <string, object>()); currentContent = new CurrentContent(emptyContent, defaultContentType); spanReferenceCollection = SpanDataCollection <ReferenceAndId> .Empty; var textBuffer = textBufferFactoryService.CreateTextBuffer(textBufferFactoryService.TextContentType); CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList); var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(defaultRoles); var options = new TextViewCreatorOptions { EnableUndoHistory = false }; var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, options); var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false); this.wpfTextViewHost = wpfTextViewHost; wpfTextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor); wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true); wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true); Children.Add(wpfTextViewHost.HostControl); }
public IDnSpyWpfTextView CreateTextView(ITextBuffer textBuffer, TextViewCreatorOptions options) { if (textBuffer == null) { throw new ArgumentNullException(nameof(textBuffer)); } return(CreateTextView(new TextDataModel(textBuffer), DefaultRoles, editorOptionsFactoryService.GlobalOptions, options)); }
IDnSpyWpfTextView CreateTextViewImpl(ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options, Func <IGuidObjectsProvider> createGuidObjectsProvider = null) { var guidObjectsProvider = new GuidObjectsProvider(options?.CreateGuidObjects, createGuidObjectsProvider?.Invoke()); var wpfTextView = new WpfTextView(textViewModel, roles, parentOptions, editorOptionsFactoryService, commandManager, smartIndentationService, formattedTextSourceFactoryService, viewClassifierAggregatorService, textAndAdornmentSequencerFactoryService, classificationFormatMapService, editorFormatMapService, adornmentLayerDefinitionService, lineTransformProviderService, spaceReservationStackProvider, wpfTextViewConnectionListenerServiceProvider, bufferGraphFactoryService, wpfTextViewCreationListeners); guidObjectsProvider.WpfTextView = wpfTextView; if (options?.MenuGuid != null) { menuManager.InitializeContextMenu(wpfTextView.VisualElement, options.MenuGuid.Value, guidObjectsProvider, new ContextMenuInitializer(wpfTextView)); } TextViewCreated?.Invoke(this, new TextViewCreatedEventArgs(wpfTextView)); return(wpfTextView); }
public IDnSpyWpfTextView CreateTextView(ITextViewModel viewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } if (roles == null) { throw new ArgumentNullException(nameof(roles)); } if (parentOptions == null) { throw new ArgumentNullException(nameof(parentOptions)); } return(CreateTextViewImpl(viewModel, roles, parentOptions, options)); }
public IDnSpyWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options) { if (textBuffer == null) { throw new ArgumentNullException(nameof(textBuffer)); } if (roles == null) { throw new ArgumentNullException(nameof(roles)); } if (parentOptions == null) { throw new ArgumentNullException(nameof(parentOptions)); } return(CreateTextView(new TextDataModel(textBuffer), roles, parentOptions, options)); }
public IDnSpyWpfTextView CreateTextView(TextViewCreatorOptions options) => CreateTextView(textBufferFactoryService.CreateTextBuffer(), DefaultRoles, options);
public IDsWpfTextView CreateTextView(ITextDataModel dataModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options) { if (dataModel == null) { throw new ArgumentNullException(nameof(dataModel)); } if (roles == null) { throw new ArgumentNullException(nameof(roles)); } if (parentOptions == null) { throw new ArgumentNullException(nameof(parentOptions)); } return(CreateTextView(new TextViewModel(dataModel), roles, parentOptions, options)); }