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")
48 class TEXT_PT_properties(bpy.types.Panel):
49 __space_type__ = 'TEXT_EDITOR'
50 __region_type__ = 'UI'
51 __label__ = "Properties"
53 def draw(self, context):
56 st = context.space_data
58 flow = layout.column_flow()
59 flow.itemR(st, "line_numbers")
60 flow.itemR(st, "word_wrap")
61 flow.itemR(st, "syntax_highlight")
62 flow.itemR(st, "live_edit")
64 flow = layout.column_flow()
65 flow.itemR(st, "font_size")
66 flow.itemR(st, "tab_width")
68 class TEXT_PT_find(bpy.types.Panel):
69 __space_type__ = 'TEXT_EDITOR'
70 __region_type__ = 'UI'
73 def draw(self, context):
76 st = context.space_data
79 col = layout.column(align=True)
81 row.itemR(st, "find_text", text="")
82 row.itemO("text.find_set_selected", text="", icon='ICON_TEXT')
83 col.itemO("text.find")
86 col = layout.column(align=True)
88 row.itemR(st, "replace_text", text="")
89 row.itemO("text.replace_set_selected", text="", icon='ICON_TEXT')
90 col.itemO("text.replace")
93 layout.itemO("text.mark_all")
97 row.itemR(st, "find_wrap", text="Wrap")
98 row.itemR(st, "find_all", text="All")
100 class TEXT_MT_text(bpy.types.Menu):
103 def draw(self, context):
106 st = context.space_data
110 layout.itemO("text.new")
111 layout.itemO("text.open")
114 layout.itemO("text.reload")
117 layout.itemO("text.save")
118 layout.itemO("text.save_as")
120 if text.filename != "":
121 layout.itemO("text.make_internal")
124 layout.itemO("text.run_script")
126 #ifndef DISABLE_PYTHON
127 # XXX if(BPY_is_pyconstraint(text))
128 # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
133 layout.itemO("text.properties", icon='ICON_MENU_PANEL')
135 #ifndef DISABLE_PYTHON
136 # XXX layout.column()
137 # XXX uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, "");
138 # XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, "");
141 class TEXT_MT_edit_view(bpy.types.Menu):
144 def draw(self, context):
147 layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File")
148 layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
150 class TEXT_MT_edit_select(bpy.types.Menu):
153 def draw(self, context):
156 layout.itemO("text.select_all")
157 layout.itemO("text.select_line")
159 class TEXT_MT_edit_markers(bpy.types.Menu):
160 __label__ = "Markers"
162 def draw(self, context):
165 layout.itemO("text.markers_clear")
166 layout.itemO("text.next_marker")
167 layout.itemO("text.previous_marker")
169 class TEXT_MT_format(bpy.types.Menu):
172 def draw(self, context):
175 layout.itemO("text.indent")
176 layout.itemO("text.unindent")
180 layout.itemO("text.comment")
181 layout.itemO("text.uncomment")
185 layout.item_menu_enumO("text.convert_whitespace", "type")
187 class TEXT_MT_edit_to3d(bpy.types.Menu):
188 __label__ = "Text To 3D Object"
190 def draw(self, context):
193 layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object");
194 layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
196 class TEXT_MT_edit(bpy.types.Menu):
199 def poll(self, context):
200 return (context.space_data.text)
202 def draw(self, context):
205 layout.itemO("ed.undo")
206 layout.itemO("ed.redo")
210 layout.itemO("text.cut")
211 layout.itemO("text.copy")
212 layout.itemO("text.paste")
216 layout.itemM("TEXT_MT_edit_view")
217 layout.itemM("TEXT_MT_edit_select")
218 layout.itemM("TEXT_MT_edit_markers")
222 layout.itemO("text.jump")
223 layout.itemO("text.properties", text="Find...")
227 layout.itemM("TEXT_MT_edit_to3d")
229 bpy.types.register(TEXT_HT_header)
230 bpy.types.register(TEXT_PT_properties)
231 bpy.types.register(TEXT_PT_find)
232 bpy.types.register(TEXT_MT_text)
233 bpy.types.register(TEXT_MT_format)
234 bpy.types.register(TEXT_MT_edit)
235 bpy.types.register(TEXT_MT_edit_view)
236 bpy.types.register(TEXT_MT_edit_select)
237 bpy.types.register(TEXT_MT_edit_markers)
238 bpy.types.register(TEXT_MT_edit_to3d)