示例#1
0
 LogEditorProvider(IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
 {
     this.dnSpyTextEditorFactoryService = dnSpyTextEditorFactoryService;
     this.contentTypeRegistryService    = contentTypeRegistryService;
     this.textBufferFactoryService      = textBufferFactoryService;
     this.editorOptionsFactoryService   = editorOptionsFactoryService;
 }
示例#2
0
        public LogEditor(LogEditorOptions options, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            this.dispatcher       = Dispatcher.CurrentDispatcher;
            this.cachedColorsList = new CachedColorsList();
            options = options?.Clone() ?? new LogEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));

            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = textBufferFactoryService.CreateTextBuffer(contentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var rolesList = new List <string>(defaultRoles);

            rolesList.AddRange(options.ExtraRoles);
            var roles           = dnSpyTextEditorFactoryService.CreateTextViewRoleSet(rolesList);
            var textView        = dnSpyTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
            var wpfTextViewHost = dnSpyTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            this.wpfTextView     = wpfTextViewHost.TextView;
            wpfTextView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStylesConstants.DefaultValue);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
            SetNewDocument();
        }
示例#3
0
 DocumentViewerProvider(IWpfCommandManager wpfCommandManager, IMenuManager menuManager, IDocumentViewerServiceImpl documentViewerServiceImpl, ITextBufferFactoryService textBufferFactoryService, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService)
 {
     this.wpfCommandManager             = wpfCommandManager;
     this.menuManager                   = menuManager;
     this.documentViewerServiceImpl     = documentViewerServiceImpl;
     this.textBufferFactoryService      = textBufferFactoryService;
     this.dnSpyTextEditorFactoryService = dnSpyTextEditorFactoryService;
 }
示例#4
0
 ReplEditorProvider(IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypes themeClassificationTypes, IPickSaveFilename pickSaveFilename)
 {
     this.dnSpyTextEditorFactoryService     = dnSpyTextEditorFactoryService;
     this.contentTypeRegistryService        = contentTypeRegistryService;
     this.textBufferFactoryService          = textBufferFactoryService;
     this.editorOperationsFactoryService    = editorOperationsFactoryService;
     this.editorOptionsFactoryService       = editorOptionsFactoryService;
     this.classificationTypeRegistryService = classificationTypeRegistryService;
     this.themeClassificationTypes          = themeClassificationTypes;
     this.pickSaveFilename = pickSaveFilename;
 }
示例#5
0
        public CodeEditor(CodeEditorOptions options, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            options = options?.Clone() ?? new CodeEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = options.TextBuffer;

            if (textBuffer == null)
            {
                textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
            }
            var roles    = dnSpyTextEditorFactoryService.CreateTextViewRoleSet(defaultRoles);
            var textView = dnSpyTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);

            TextViewHost = dnSpyTextEditorFactoryService.CreateTextViewHost(textView, false);
            TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.CodeEditor);
            TextViewHost.TextView.Options.SetOptionValue(DefaultDnSpyTextViewOptions.RefreshScreenOnChangeId, true);
        }
示例#6
0
        public DocumentViewerControl(ITextBufferFactoryService textBufferFactoryService, IDnSpyTextEditorFactoryService dnSpyTextEditorFactoryService, IDocumentViewerHelper textEditorHelper)
        {
            if (textBufferFactoryService == null)
            {
                throw new ArgumentNullException(nameof(textBufferFactoryService));
            }
            if (dnSpyTextEditorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(dnSpyTextEditorFactoryService));
            }
            if (textEditorHelper == null)
            {
                throw new ArgumentNullException(nameof(textEditorHelper));
            }
            this.textEditorHelper        = textEditorHelper;
            this.defaultContentType      = textBufferFactoryService.TextContentType;
            this.cachedColorsList        = new CachedColorsList();
            this.emptyContent            = new DocumentViewerContent(string.Empty, CachedTextColorsCollection.Empty, SpanDataCollection <ReferenceInfo> .Empty, new Dictionary <string, object>());
            this.currentContent          = new CurrentContent(emptyContent, defaultContentType);
            this.spanReferenceCollection = SpanDataCollection <ReferenceAndId> .Empty;

            var textBuffer = textBufferFactoryService.CreateTextBuffer(textBufferFactoryService.TextContentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var roles           = dnSpyTextEditorFactoryService.CreateTextViewRoleSet(defaultRoles);
            var textView        = dnSpyTextEditorFactoryService.CreateTextView(textBuffer, roles, (TextViewCreatorOptions)null);
            var wpfTextViewHost = dnSpyTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.Viewer);
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true);
            Children.Add(wpfTextViewHost.HostControl);
        }