add templates menu for OSL, use preprocessor directive color for decorators in python.

This commit is contained in:
Campbell Barton 2012-12-30 01:39:55 +00:00
parent e12354c4c5
commit 33955940e4
28 changed files with 24 additions and 5 deletions

@ -194,14 +194,33 @@ class TEXT_MT_text(Menu):
layout.operator("text.run_script")
class TEXT_MT_templates_py(Menu):
bl_label = "Python"
def draw(self, context):
self.path_menu(bpy.utils.script_paths("templates_py"),
"text.open",
{"internal": True},
)
class TEXT_MT_templates_osl(Menu):
bl_label = "Open Shading Language"
def draw(self, context):
self.path_menu(bpy.utils.script_paths("templates_osl"),
"text.open",
{"internal": True},
)
class TEXT_MT_templates(Menu):
bl_label = "Templates"
def draw(self, context):
self.path_menu(bpy.utils.script_paths("templates"),
"text.open",
{"internal": True},
)
layout = self.layout
layout.menu("TEXT_MT_templates_py")
layout.menu("TEXT_MT_templates_osl")
class TEXT_MT_edit_select(Menu):

@ -271,7 +271,7 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const int do_ne
/* Special vars(v) or built-in keywords(b) */
if ((i = txtfmt_py_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) prev = FMT_TYPE_KEYWORD;
else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = FMT_TYPE_SPECIAL; /* could have a new color for this */
else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = FMT_TYPE_DIRECTIVE;
if (i > 0) {
memset(fmt, prev, i);