Example #1
0
        /// <summary>
        /// Copies editor options and default element customizations.
        /// Does not copy the syntax highlighting.
        /// </summary>
        public static void CopySettingsFrom(this TextEditor editor, TextEditor source)
        {
            editor.Options = source.Options;
            string language = source.SyntaxHighlighting != null ? source.SyntaxHighlighting.Name : null;

            CustomizingHighlighter.ApplyCustomizationsToDefaultElements(editor, CustomizedHighlightingColor.FetchCustomizations(language));
            HighlightingOptions.ApplyToRendering(editor, CustomizedHighlightingColor.FetchCustomizations(language));
        }
        public void UpdateCustomizedHighlighting()
        {
            string language       = this.SyntaxHighlighting != null ? this.SyntaxHighlighting.Name : null;
            var    customizations = CustomizedHighlightingColor.FetchCustomizations(language);

            CustomizingHighlighter.ApplyCustomizationsToDefaultElements(this, customizations);
            BracketHighlightRenderer.ApplyCustomizationsToRendering(this.bracketRenderer, customizations);
            HighlightingOptions.ApplyToRendering(this, customizations);
            this.TextArea.TextView.Redraw();             // manually redraw if default elements didn't change but customized highlightings did
        }
		public void CopyEditorSettingsAndHighlighting(TextEditor source)
		{
			editor.CopySettingsFrom(source);
			string language = source.SyntaxHighlighting != null ? source.SyntaxHighlighting.Name : null;
			editor.TextArea.TextView.LineTransformers.RemoveAll(x => x is HighlightingColorizer);
			var customizedHighlighter = new CustomizingHighlighter(
				new DocumentHighlighter(editor.Document, source.SyntaxHighlighting),
				CustomizedHighlightingColor.FetchCustomizations(language)
			);
			editor.TextArea.TextView.LineTransformers.Insert(0, new HighlightingColorizer(customizedHighlighter));
		}
        public void CopyEditorSettingsAndHighlighting(TextEditor source)
        {
            editor.CopySettingsFrom(source);
            string language = source.SyntaxHighlighting != null ? source.SyntaxHighlighting.Name : null;

            editor.TextArea.TextView.LineTransformers.RemoveAll(x => x is HighlightingColorizer);
            var customizedHighlighter = new CustomizingHighlighter(
                new DocumentHighlighter(editor.Document, source.SyntaxHighlighting),
                CustomizedHighlightingColor.FetchCustomizations(language)
                );

            editor.TextArea.TextView.LineTransformers.Insert(0, new HighlightingColorizer(customizedHighlighter));
        }