Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/ui/space_text.py120
-rw-r--r--source/blender/editors/space_text/space_text.c2
-rw-r--r--source/blender/editors/space_text/text_header.c95
-rw-r--r--source/blender/editors/space_text/text_intern.h3
4 files changed, 108 insertions, 112 deletions
diff --git a/release/ui/space_text.py b/release/ui/space_text.py
index d347fd7c3b1..42e5347ce6a 100644
--- a/release/ui/space_text.py
+++ b/release/ui/space_text.py
@@ -2,12 +2,8 @@
import bpy
# temporary
-ICON_LINENUMBERS_OFF = 588
-ICON_WORDWRAP_OFF = 584
-ICON_SYNTAX_OFF = 586
ICON_TEXT = 120
ICON_HELP = 1
-ICON_SCRIPTPLUGINS = 1
class TEXT_HT_header(bpy.types.Header):
__space_type__ = "TEXT_EDITOR"
@@ -21,7 +17,7 @@ class TEXT_HT_header(bpy.types.Header):
layout.template_header(context)
if context.area.show_menus:
- row = layout.row(align=True)
+ row = layout.row()
row.itemM(context, "TEXT_MT_text")
if text:
row.itemM(context, "TEXT_MT_edit")
@@ -33,10 +29,9 @@ class TEXT_HT_header(bpy.types.Header):
row.itemO("TEXT_OT_resolve_conflict", text="", icon='ICON_HELP')
row = layout.row(align=True)
- row.itemR(st, "line_numbers", text="", icon='ICON_LINENUMBERS_OFF')
- row.itemR(st, "word_wrap", text="", icon='ICON_WORDWRAP_OFF')
- row.itemR(st, "syntax_highlight", text="", icon='ICON_SYNTAX_OFF')
- # row.itemR(st, "do_python_plugins", text="", icon=ICON_SCRIPTPLUGINS)
+ row.itemR(st, "line_numbers", text="")
+ row.itemR(st, "word_wrap", text="")
+ row.itemR(st, "syntax_highlight", text="")
layout.template_ID(context, st, "text", new="TEXT_OT_new", open="TEXT_OT_open", unlink="TEXT_OT_unlink")
@@ -63,9 +58,9 @@ class TEXT_PT_properties(bpy.types.Panel):
layout = self.layout
flow = layout.column_flow()
- flow.itemR(st, "line_numbers", icon='ICON_LINENUMBERS_OFF')
- flow.itemR(st, "word_wrap", icon='ICON_WORDWRAP_OFF')
- flow.itemR(st, "syntax_highlight", icon='ICON_SYNTAX_OFF')
+ flow.itemR(st, "line_numbers")
+ flow.itemR(st, "word_wrap")
+ flow.itemR(st, "syntax_highlight")
flow.itemR(st, "live_edit")
flow = layout.column_flow()
@@ -140,8 +135,109 @@ class TEXT_MT_text(bpy.types.Menu):
# XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, "");
#endif
+class TEXT_MT_edit_view(bpy.types.Menu):
+ __space_type__ = "TEXT_EDITOR"
+ __label__ = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.item_enumO("TEXT_OT_move", "type", "FILE_TOP", text="Top of File")
+ layout.item_enumO("TEXT_OT_move", "type", "FILE_BOTTOM", text="Bottom of File")
+
+class TEXT_MT_edit_select(bpy.types.Menu):
+ __space_type__ = "TEXT_EDITOR"
+ __label__ = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.itemO("TEXT_OT_select_all")
+ layout.itemO("TEXT_OT_select_line")
+
+class TEXT_MT_edit_markers(bpy.types.Menu):
+ __space_type__ = "TEXT_EDITOR"
+ __label__ = "Markers"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.itemO("TEXT_OT_markers_clear")
+ layout.itemO("TEXT_OT_next_marker")
+ layout.itemO("TEXT_OT_previous_marker")
+
+class TEXT_MT_format(bpy.types.Menu):
+ __space_type__ = "TEXT_EDITOR"
+ __label__ = "Format"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.itemO("TEXT_OT_indent")
+ layout.itemO("TEXT_OT_unindent")
+
+ layout.itemS()
+
+ layout.itemO("TEXT_OT_comment")
+ layout.itemO("TEXT_OT_uncomment")
+
+ layout.itemS()
+
+ layout.item_menu_enumO("TEXT_OT_convert_whitespace", "type")
+
+class TEXT_MT_edit_to3d(bpy.types.Menu):
+ __space_type__ = "TEXT_EDITOR"
+ __label__ = "Text To 3D Object"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.item_booleanO("TEXT_OT_to_3d_object", "split_lines", False, text="One Object");
+ layout.item_booleanO("TEXT_OT_to_3d_object", "split_lines", True, text="One Object Per Line");
+
+class TEXT_MT_edit(bpy.types.Menu):
+ __space_type__ = "TEXT_EDITOR"
+ __label__ = "Edit"
+
+ def poll(self, context):
+ st = context.space_data
+ return st.text != None
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.itemO("ED_OT_undo")
+ layout.itemO("ED_OT_redo")
+
+ layout.itemS()
+
+ layout.itemO("TEXT_OT_cut")
+ layout.itemO("TEXT_OT_copy")
+ layout.itemO("TEXT_OT_paste")
+
+ layout.itemS()
+
+ layout.itemM(context, "TEXT_MT_edit_view")
+ layout.itemM(context, "TEXT_MT_edit_select")
+ layout.itemM(context, "TEXT_MT_edit_markers")
+
+ layout.itemS()
+
+ layout.itemO("TEXT_OT_jump")
+ layout.itemO("TEXT_OT_properties")
+
+ layout.itemS()
+
+ layout.itemM(context, "TEXT_MT_edit_to3d")
+
bpy.types.register(TEXT_HT_header)
bpy.types.register(TEXT_PT_properties)
bpy.types.register(TEXT_PT_find)
bpy.types.register(TEXT_MT_text)
+bpy.types.register(TEXT_MT_format)
+bpy.types.register(TEXT_MT_edit)
+bpy.types.register(TEXT_MT_edit_view)
+bpy.types.register(TEXT_MT_edit_select)
+bpy.types.register(TEXT_MT_edit_markers)
+bpy.types.register(TEXT_MT_edit_to3d)
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 384ad3e919c..d3c3b78cc50 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -415,8 +415,6 @@ void ED_spacetype_text(void)
art->init= text_header_area_init;
art->draw= text_header_area_draw;
-
- text_header_register(art);
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index fe00b86e19f..1b8149cb5a2 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -155,101 +155,6 @@ static uiBlock *text_plugin_scriptsmenu(bContext *C, void *args_unused)
}
#endif
-static void text_editmenu_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
- uiItemEnumO(layout, "Top of File", 0, "TEXT_OT_move", "type", FILE_TOP);
- uiItemEnumO(layout, "Bottom of File", 0, "TEXT_OT_move", "type", FILE_BOTTOM);
-}
-
-static void text_editmenu_selectmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
- uiItemO(layout, NULL, 0, "TEXT_OT_select_all");
- uiItemO(layout, NULL, 0, "TEXT_OT_select_line");
-}
-
-static void text_editmenu_markermenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
- uiItemO(layout, NULL, 0, "TEXT_OT_markers_clear");
- uiItemO(layout, NULL, 0, "TEXT_OT_next_marker");
- uiItemO(layout, NULL, 0, "TEXT_OT_previous_marker");
-}
-
-static void text_formatmenu(const bContext *C, Menu *menu)
-{
- uiLayout *layout= menu->layout;
-
- uiItemO(layout, NULL, 0, "TEXT_OT_indent");
- uiItemO(layout, NULL, 0, "TEXT_OT_unindent");
-
- uiItemS(layout);
-
- uiItemO(layout, NULL, 0, "TEXT_OT_comment");
- uiItemO(layout, NULL, 0, "TEXT_OT_uncomment");
-
- uiItemS(layout);
-
- uiItemMenuEnumO(layout, NULL, 0, "TEXT_OT_convert_whitespace", "type");
-}
-
-static void text_editmenu_to3dmenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
- uiItemBooleanO(layout, "One Object", 0, "TEXT_OT_to_3d_object", "split_lines", 0);
- uiItemBooleanO(layout, "One Object Per Line", 0, "TEXT_OT_to_3d_object", "split_lines", 1);
-}
-
-static int text_menu_edit_poll(bContext *C)
-{
- return (CTX_data_edit_text(C) != NULL);
-}
-
-static void text_editmenu(const bContext *C, Menu *menu)
-{
- uiLayout *layout= menu->layout;
-
- uiItemO(layout, NULL, 0, "ED_OT_undo");
- uiItemO(layout, NULL, 0, "ED_OT_redo");
-
- uiItemS(layout);
-
- uiItemO(layout, NULL, 0, "TEXT_OT_cut");
- uiItemO(layout, NULL, 0, "TEXT_OT_copy");
- uiItemO(layout, NULL, 0, "TEXT_OT_paste");
-
- uiItemS(layout);
-
- uiItemMenuF(layout, "View", 0, text_editmenu_viewmenu);
- uiItemMenuF(layout, "Select", 0, text_editmenu_selectmenu);
- uiItemMenuF(layout, "Markers", 0, text_editmenu_markermenu);
-
- uiItemS(layout);
-
- uiItemO(layout, NULL, 0, "TEXT_OT_jump");
- uiItemO(layout, NULL, 0, "TEXT_OT_properties");
-
- uiItemS(layout);
-
- uiItemMenuF(layout, "Text to 3D Object", 0, text_editmenu_to3dmenu);
-}
-
-/********************** header buttons ***********************/
-
-void text_header_register(ARegionType *art)
-{
- MenuType *mt;
-
- mt= MEM_callocN(sizeof(MenuType), "spacetype text menu edit");
- strcpy(mt->idname, "TEXT_MT_edit");
- strcpy(mt->label, "Edit");
- mt->draw= text_editmenu;
- BLI_addhead(&art->menutypes, mt);
-
- mt= MEM_callocN(sizeof(MenuType), "spacetype text menu format");
- strcpy(mt->idname, "TEXT_MT_format");
- strcpy(mt->label, "Format");
- mt->draw= text_formatmenu;
- BLI_addhead(&art->menutypes, mt);
-}
-
/************************** properties ******************************/
ARegion *text_has_properties_region(ScrArea *sa)
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 259811aee0f..31d29ac7f17 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -41,9 +41,6 @@ struct TextLine;
struct wmOperatorType;
struct wmWindowManager;
-/* text_header.c */
-void text_header_register(struct ARegionType *art);
-
/* text_draw.c */
void draw_text_main(struct SpaceText *st, struct ARegion *ar);