4 class TEXT_HT_header(bpy.types.Header):
5 __space_type__ = 'TEXT_EDITOR'
7 def draw(self, context):
10 st = context.space_data
13 row = layout.row(align=True)
16 if context.area.show_menus:
17 sub = row.row(align=True)
18 sub.itemM("TEXT_MT_text")
20 sub.itemM("TEXT_MT_edit")
21 sub.itemM("TEXT_MT_format")
23 if text and text.modified:
26 row.itemO("text.resolve_conflict", text="", icon='ICON_HELP')
28 layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
30 row = layout.row(align=True)
31 row.itemR(st, "line_numbers", text="")
32 row.itemR(st, "word_wrap", text="")
33 row.itemR(st, "syntax_highlight", text="")
37 if text.filename != "":
39 row.itemL(text="File: *%s (unsaved)" % text.filename)
41 row.itemL(text="File: %s" % text.filename )
44 row.itemL(text="Text: External")
46 row.itemL(text="Text: Internal")
49 row.itemO("text.run_script")
51 class TEXT_PT_properties(bpy.types.Panel):
52 __space_type__ = 'TEXT_EDITOR'
53 __region_type__ = 'UI'
54 __label__ = "Properties"
56 def draw(self, context):
59 st = context.space_data
61 flow = layout.column_flow()
62 flow.itemR(st, "line_numbers")
63 flow.itemR(st, "word_wrap")
64 flow.itemR(st, "syntax_highlight")
65 flow.itemR(st, "live_edit")
67 flow = layout.column_flow()
68 flow.itemR(st, "font_size")
69 flow.itemR(st, "tab_width")
71 class TEXT_PT_find(bpy.types.Panel):
72 __space_type__ = 'TEXT_EDITOR'
73 __region_type__ = 'UI'
76 def draw(self, context):
79 st = context.space_data
82 col = layout.column(align=True)
84 row.itemR(st, "find_text", text="")
85 row.itemO("text.find_set_selected", text="", icon='ICON_TEXT')
86 col.itemO("text.find")
89 col = layout.column(align=True)
91 row.itemR(st, "replace_text", text="")
92 row.itemO("text.replace_set_selected", text="", icon='ICON_TEXT')
93 col.itemO("text.replace")
96 layout.itemO("text.mark_all")
100 row.itemR(st, "find_wrap", text="Wrap")
101 row.itemR(st, "find_all", text="All")
103 class TEXT_MT_text(bpy.types.Menu):
106 def draw(self, context):
109 st = context.space_data
113 layout.itemO("text.new")
114 layout.itemO("text.open")
117 layout.itemO("text.reload")
120 layout.itemO("text.save")
121 layout.itemO("text.save_as")
123 if text.filename != "":
124 layout.itemO("text.make_internal")
127 layout.itemO("text.run_script")
129 #ifndef DISABLE_PYTHON
130 # XXX if(BPY_is_pyconstraint(text))
131 # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
136 layout.itemO("text.properties", icon='ICON_MENU_PANEL')
138 #ifndef DISABLE_PYTHON
139 # XXX layout.column()
140 # XXX uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, "");
141 # XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, "");
144 class TEXT_MT_edit_view(bpy.types.Menu):
147 def draw(self, context):
150 layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File")
151 layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
153 class TEXT_MT_edit_select(bpy.types.Menu):
156 def draw(self, context):
159 layout.itemO("text.select_all")
160 layout.itemO("text.select_line")
162 class TEXT_MT_edit_markers(bpy.types.Menu):
163 __label__ = "Markers"
165 def draw(self, context):
168 layout.itemO("text.markers_clear")
169 layout.itemO("text.next_marker")
170 layout.itemO("text.previous_marker")
172 class TEXT_MT_format(bpy.types.Menu):
175 def draw(self, context):
178 layout.itemO("text.indent")
179 layout.itemO("text.unindent")
183 layout.itemO("text.comment")
184 layout.itemO("text.uncomment")
188 layout.item_menu_enumO("text.convert_whitespace", "type")
190 class TEXT_MT_edit_to3d(bpy.types.Menu):
191 __label__ = "Text To 3D Object"
193 def draw(self, context):
196 layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object");
197 layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
199 class TEXT_MT_edit(bpy.types.Menu):
202 def poll(self, context):
203 return (context.space_data.text)
205 def draw(self, context):
208 layout.itemO("ed.undo")
209 layout.itemO("ed.redo")
213 layout.itemO("text.cut")
214 layout.itemO("text.copy")
215 layout.itemO("text.paste")
219 layout.itemM("TEXT_MT_edit_view")
220 layout.itemM("TEXT_MT_edit_select")
221 layout.itemM("TEXT_MT_edit_markers")
225 layout.itemO("text.jump")
226 layout.itemO("text.properties", text="Find...")
230 layout.itemM("TEXT_MT_edit_to3d")
232 bpy.types.register(TEXT_HT_header)
233 bpy.types.register(TEXT_PT_properties)
234 bpy.types.register(TEXT_PT_find)
235 bpy.types.register(TEXT_MT_text)
236 bpy.types.register(TEXT_MT_format)
237 bpy.types.register(TEXT_MT_edit)
238 bpy.types.register(TEXT_MT_edit_view)
239 bpy.types.register(TEXT_MT_edit_select)
240 bpy.types.register(TEXT_MT_edit_markers)
241 bpy.types.register(TEXT_MT_edit_to3d)