2.5 Buttons
[blender-staging.git] / release / ui / buttons_data_text.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "data"
8         
9         def poll(self, context):
10                 ob = context.active_object
11                 return (ob and ob.type == 'TEXT')
12                 
13 class DATA_PT_shape_text(DataButtonsPanel):
14                 __idname__ = "DATA_PT_shape_text"
15                 __label__ = "Shape"
16
17                 def draw(self, context):
18                         curve = context.active_object.data
19                         layout = self.layout
20
21                         layout.itemR(curve, "curve_2d")                 
22                                                         
23                         split = layout.split()
24                 
25                         sub = split.column()
26                         sub.itemL(text="Caps:")
27                         sub.itemR(curve, "front")
28                         sub.itemR(curve, "back")
29                         
30                         sub.itemL(text="Textures:")
31                         sub.itemR(curve, "uv_orco")
32                         sub.itemR(curve, "auto_texspace")
33                         
34                         sub = split.column()    
35                         sub.itemL(text="Resolution:")
36                         sub.itemR(curve, "resolution_u", text="Preview U")
37                         sub.itemR(curve, "resolution_v", text="Preview V")
38                         sub.itemR(curve, "render_resolution_u", text="Render U")
39                         sub.itemR(curve, "render_resolution_v", text="Render V")
40
41                         sub.itemL(text="Display:")
42                         sub.itemR(curve, "fast")
43                         
44 class DATA_PT_font(DataButtonsPanel):
45         __idname__ = "DATA_PT_font"
46         __label__ = "Font"
47
48         def draw(self, context):
49                 text = context.active_object.data
50                 layout = self.layout
51
52                 layout.row()
53                 layout.itemR(text, "font")
54                 
55                 split = layout.split()
56                 
57                 sub = split.column()    
58         #       sub.itemR(text, "style")
59         #       sub.itemR(text, "bold")
60         #       sub.itemR(text, "italic")
61         #       sub.itemR(text, "underline")
62         #       ToDo: These settings are in a sub struct (Edit Format). 
63                 sub.itemR(text, "text_size")            
64                 sub.itemR(text, "shear")
65
66                 sub = split.column()
67                 sub.itemR(text, "text_on_curve")
68                 sub.itemR(text, "family")
69                 sub.itemL(text="Underline:")
70                 sub.itemR(text, "ul_position", text="Position")
71                 sub.itemR(text, "ul_height", text="Height")
72
73         #       sub.itemR(text, "edit_format")
74
75 class DATA_PT_paragraph(DataButtonsPanel):
76         __idname__ = "DATA_PT_paragraph"
77         __label__ = "Paragraph"
78
79         def draw(self, context):
80                 text = context.active_object.data
81                 layout = self.layout
82
83                 layout.itemL(text="Align:")
84                 layout.itemR(text, "spacemode", expand=True)
85
86                 split = layout.split()
87                 
88                 sub = split.column()    
89                 sub.itemL(text="Spacing:")
90                 sub.itemR(text, "spacing", text="Character")
91                 sub.itemR(text, "word_spacing", text="Word")
92                 sub.itemR(text, "line_dist", text="Line")
93
94                 sub = split.column()
95                 sub.itemL(text="Offset:")
96                 sub.itemR(text, "x_offset", text="X")
97                 sub.itemR(text, "y_offset", text="Y")
98                 sub.itemR(text, "wrap")
99                         
100 class DATA_PT_textboxes(DataButtonsPanel):
101                 __idname__ = "DATA_PT_textboxes"
102                 __label__ = "Text Boxes"
103
104                 def draw(self, context):
105                         text = context.active_object.data
106                         layout = self.layout
107
108 bpy.types.register(DATA_PT_shape_text)  
109 bpy.types.register(DATA_PT_font)
110 bpy.types.register(DATA_PT_paragraph)
111 #bpy.types.register(DATA_PT_textboxes)