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):
101 __space_type__ = 'TEXT_EDITOR'
104 def draw(self, context):
107 st = context.space_data
111 layout.itemO("text.new")
112 layout.itemO("text.open")
115 layout.itemO("text.reload")
118 layout.itemO("text.save")
119 layout.itemO("text.save_as")
121 if text.filename != "":
122 layout.itemO("text.make_internal")
125 layout.itemO("text.run_script")
127 #ifndef DISABLE_PYTHON
128 # XXX if(BPY_is_pyconstraint(text))
129 # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
134 layout.itemO("text.properties", icon='ICON_MENU_PANEL')
136 #ifndef DISABLE_PYTHON
137 # XXX layout.column()
138 # XXX uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, "");
139 # XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, "");
142 class TEXT_MT_edit_view(bpy.types.Menu):
143 __space_type__ = 'TEXT_EDITOR'
146 def draw(self, context):
149 layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File")
150 layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
152 class TEXT_MT_edit_select(bpy.types.Menu):
153 __space_type__ = 'TEXT_EDITOR'
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 __space_type__ = 'TEXT_EDITOR'
164 __label__ = "Markers"
166 def draw(self, context):
169 layout.itemO("text.markers_clear")
170 layout.itemO("text.next_marker")
171 layout.itemO("text.previous_marker")
173 class TEXT_MT_format(bpy.types.Menu):
174 __space_type__ = 'TEXT_EDITOR'
177 def draw(self, context):
180 layout.itemO("text.indent")
181 layout.itemO("text.unindent")
185 layout.itemO("text.comment")
186 layout.itemO("text.uncomment")
190 layout.item_menu_enumO("text.convert_whitespace", "type")
192 class TEXT_MT_edit_to3d(bpy.types.Menu):
193 __space_type__ = 'TEXT_EDITOR'
194 __label__ = "Text To 3D Object"
196 def draw(self, context):
199 layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object");
200 layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line");
202 class TEXT_MT_edit(bpy.types.Menu):
203 __space_type__ = 'TEXT_EDITOR'
206 def poll(self, context):
207 return (context.space_data.text)
209 def draw(self, context):
212 layout.itemO("ed.undo")
213 layout.itemO("ed.redo")
217 layout.itemO("text.cut")
218 layout.itemO("text.copy")
219 layout.itemO("text.paste")
223 layout.itemM("TEXT_MT_edit_view")
224 layout.itemM("TEXT_MT_edit_select")
225 layout.itemM("TEXT_MT_edit_markers")
229 layout.itemO("text.jump")
230 layout.itemO("text.properties", text="Find...")
234 layout.itemM("TEXT_MT_edit_to3d")
236 bpy.types.register(TEXT_HT_header)
237 bpy.types.register(TEXT_PT_properties)
238 bpy.types.register(TEXT_PT_find)
239 bpy.types.register(TEXT_MT_text)
240 bpy.types.register(TEXT_MT_format)
241 bpy.types.register(TEXT_MT_edit)
242 bpy.types.register(TEXT_MT_edit_view)
243 bpy.types.register(TEXT_MT_edit_select)
244 bpy.types.register(TEXT_MT_edit_markers)
245 bpy.types.register(TEXT_MT_edit_to3d)