コード例 #1
0
#pragma warning disable IDE0051 // Remove unused private members -- this will be used later
        private void SetBackgroundColor(string colorName, Color newColor)
#pragma warning restore IDE0051 // Remove unused private members
        {
            HighlightingColor color = cottleHighlightingDef.GetNamedColor(colorName);

            color.Background = new SimpleHighlightingBrush(newColor);
        }
コード例 #2
0
        public Component_ShaderScript_DocumentWindow()
        {
            InitializeComponent();

            if (EditorUtility.IsDesignerHosted(this))
            {
                return;
            }

            UpdateHighlightingScheme();
            UpdateBackgroundForeground();
            UpdateFont();

            HighlightingColor defaultNamedColor = null;

            if (loadedHighlightingDefinition != null)
            {
                defaultNamedColor = loadedHighlightingDefinition.GetNamedColor("Default");
            }

            if (defaultNamedColor != null)
            {
                avalonTextEditor.Editor.Foreground = defaultNamedColor.Foreground.GetBrush(null);
            }

            avalonTextEditor.Editor.PreviewMouseWheel += Editor_PreviewMouseWheel;

            avalonTextEditor.InstallSearchReplacePanel();
            //searchReplacePanel = SearchReplacePanel.Install( avalonTextEditor.Editor.TextArea );
        }
コード例 #3
0
        /// <inheritdoc/>
        public HighlightingColor GetNamedColor(string name)
        {
            if (EnsureDefinition())
            {
                return(_definition.GetNamedColor(name));
            }

            return(null);
        }
コード例 #4
0
        private void ApplyEditorStyle()
        {
            Editor.Background = new SolidColorBrush(Settings.BasicEditorSettings.BackgroundColor.Color);
            Editor.Foreground = new SolidColorBrush(Settings.BasicEditorSettings.ForegroundColor.Color);
            Editor.FontFamily = new FontFamily(Settings.BasicEditorSettings.EditorFontName);
            Editor.FontSize   = Settings.BasicEditorSettings.EditorFontSize;

            IHighlightingDefinition basicDefinition = HighlightingManager.Instance.GetDefinition(StyleNames.Basic);

            var color = basicDefinition.GetNamedColor(ColorNames.StringColor);

            color.Foreground = new SimpleHighlightingBrush(Settings.BasicEditorSettings.StringColor.Color);

            color            = basicDefinition.GetNamedColor(ColorNames.BasicInstructions);
            color.Foreground = new SimpleHighlightingBrush(Settings.BasicEditorSettings.KeywordColor.Color);

            color            = basicDefinition.GetNamedColor(ColorNames.NumericConstans);
            color.Foreground = new SimpleHighlightingBrush(Settings.BasicEditorSettings.NumberColor.Color);
        }
コード例 #5
0
 HighlightingColor GetColor(XshdElement position, XshdReference<XshdColor> colorReference)
 {
     if (colorReference.InlineElement != null) {
         return (HighlightingColor)colorReference.InlineElement.AcceptVisitor(this);
     } else if (colorReference.ReferencedElement != null) {
         IHighlightingDefinition definition = GetDefinition(position, colorReference.ReferencedDefinition);
         HighlightingColor color = definition.GetNamedColor(colorReference.ReferencedElement);
         if (color == null)
             throw Error(position, "Could not find color named '" + colorReference.ReferencedElement + "'.");
         return color;
     } else {
         return null;
     }
 }
コード例 #6
0
        private void ConfigHighlightColor(IHighlightingDefinition highlighting, string name)
        {
            string color_name = null;

            switch (name)
            {
            case "Keyword":
                color_name = m_AppSettings.Colors.ColorOfHighlightingKeyword;
                break;

            case "StepWord":
                color_name = m_AppSettings.Colors.ColorOfHighlightingStepWord;
                break;

            case "Table":
                color_name = m_AppSettings.Colors.ColorOfHighlightingTable;
                break;

            case "Tag":
                color_name = m_AppSettings.Colors.ColorOfHighlightingTag;
                break;

            case "DocString":
                color_name = m_AppSettings.Colors.ColorOfHighlightingDocString;
                break;

            case "Constants":
                color_name = m_AppSettings.Colors.ColorOfHighlightingConstants;
                break;

            case "Mock":
                color_name = m_AppSettings.Colors.ColorOfHighlightingMockAttribute;
                break;
            }

            color_name.IfNotNull(x =>
            {
                HighlightingColor highlightingColor;
                highlightingColor            = highlighting.GetNamedColor(name);
                highlightingColor.Foreground = new SimpleHighlightingBrush(x.ToColor());
            }
                                 );
        }
コード例 #7
0
ファイル: ScriptPrinter.cs プロジェクト: zwiglm/NeoAxisEngine
        public BitmapSource PrintToBitmap(string script, Size size)
        {
            var editor = GetOrCreateTextEditor(script, FontFamily, FontSize, IndentationSize);

            var document = DocumentPrinter.CreateFlowDocumentForEditor(editor);

            document.PagePadding = Padding;

            if (loadedHighlightingDefinition != null)
            {
                var defaultNamedColor = loadedHighlightingDefinition.GetNamedColor("Default");
                if (defaultNamedColor != null)
                {
                    document.Foreground = defaultNamedColor.Foreground.GetBrush(null);
                }
            }

            return(FlowDocumentToBitmap(document, size));
        }
コード例 #8
0
 private static void ApplySchemeEntry(this IHighlightingDefinition def, string rule, string entry)
 {
     def.GetNamedColor(rule).MergeWith(StringToHighlightingColor(entry));
 }
コード例 #9
0
 /// <inheritdoc/>
 public HighlightingColor GetNamedColor(string name)
 {
     return(definition.GetNamedColor(name));
 }