diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-29 22:25:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-29 22:25:03 +0400 |
commit | e9c7aaaa3ccd83ee0bb6076f1f9fb2ac5653187f (patch) | |
tree | 974e3fd9e901997e46532fafaa1d255bbac6fdcf /source/blender/editors/interface | |
parent | 14ea0845807dc98a9d4601fcb5d7b232262be5dd (diff) |
patch [#33609] Syntax highlighting for OSL in Text Editor
from Patrick Boelens (senshi). with modifications to split it into its own function.
also added C style multi-line comment support /* ... */
I've left out the part of this patch that sets the language in the space, since I think this might be better stored in the text block.
For now it simply uses OSL syntax highlighting when the extension is '.osl'.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/resources.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index f605616dc50..b0781256126 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -358,6 +358,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->syntaxc; break; case TH_SYNTAX_L: cp = ts->syntaxl; break; + case TH_SYNTAX_D: + cp = ts->syntaxd; break; + case TH_SYNTAX_R: + cp = ts->syntaxr; break; case TH_SYNTAX_N: cp = ts->syntaxn; break; @@ -880,10 +884,12 @@ void ui_theme_init_default(void) /* syntax highlighting */ rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/ - rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */ - rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */ - rgba_char_args_set(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */ - rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */ + rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings Red */ + rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments Greenish */ + rgba_char_args_set(btheme->text.syntaxv, 95, 95, 0, 255); /* Special Yellow*/ + rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */ + rgba_char_args_set(btheme->text.syntaxr, 140, 60, 0, 255); /* Reserved Orange*/ + rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin Red-purple */ /* space oops */ btheme->toops = btheme->tv3d; @@ -2081,6 +2087,14 @@ void init_userdef_do_versions(void) } } } + + if (!MAIN_VERSION_ATLEAST(bmain, 266, 4)) { + bTheme *btheme; + for (btheme = U.themes.first; btheme; btheme = btheme->next) { + rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */ + rgba_char_args_set(btheme->text.syntaxr, 140, 60, 0, 255); /* Reserved Orange */ + } + } if (U.pixelsize == 0.0f) U.pixelsize = 1.0f; |