GSOC 2013 paint
[blender-staging.git] / source / blender / editors / include / UI_resources.h
1 /*
2  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  * 
25  * ***** END GPL/BL DUAL LICENSE BLOCK *****
26  */
27
28 /** \file UI_resources.h
29  *  \ingroup editorui
30  */
31
32 #ifndef __UI_RESOURCES_H__
33 #define __UI_RESOURCES_H__
34
35 /* elubie: TODO: move the typedef for icons to UI_interface_icons.h */
36 /* and add/replace include of UI_resources.h by UI_interface_icons.h */
37 #define DEF_ICON(name) ICON_##name,
38 #define DEF_VICO(name) VICO_##name,
39
40 typedef enum {
41         /* ui */
42 #include "UI_icons.h"
43         BIFICONID_LAST
44 } BIFIconID;
45
46 #define BIFICONID_FIRST  (ICON_NONE)
47
48 #undef DEF_ICON
49 #undef DEF_VICO
50
51 /* use to denote intentionally unset theme color */
52 #define TH_UNDEFINED -1
53
54 enum {
55         TH_REDALERT,
56
57         TH_THEMEUI,
58 // common colors among spaces
59         
60         TH_BACK,
61         TH_TEXT,
62         TH_TEXT_HI,
63         TH_TITLE,
64         TH_TAB_ACTIVE,
65         TH_TAB_INACTIVE,
66         TH_TAB_BACK,
67         TH_TAB_OUTLINE,
68         
69         TH_HEADER,
70         TH_HEADERDESEL,
71         TH_HEADER_TEXT,
72         TH_HEADER_TEXT_HI,
73         
74         /* panels */
75         TH_PANEL_HEADER,
76         TH_PANEL_BACK,
77         TH_PANEL_SHOW_HEADER,
78         TH_PANEL_SHOW_BACK,
79         
80         TH_BUTBACK,
81         TH_BUTBACK_TEXT,
82         TH_BUTBACK_TEXT_HI,
83         
84         TH_SHADE1,
85         TH_SHADE2,
86         TH_HILITE,
87
88         TH_GRID,
89         TH_WIRE,
90         TH_WIRE_EDIT,
91         TH_SELECT,
92         TH_ACTIVE,
93         TH_GROUP,
94         TH_GROUP_ACTIVE,
95         TH_TRANSFORM,
96         TH_VERTEX,
97         TH_VERTEX_SELECT,
98         TH_VERTEX_UNREFERENCED,
99         TH_VERTEX_SIZE,
100         TH_OUTLINE_WIDTH,
101         TH_EDGE,
102         TH_EDGE_SELECT,
103         TH_EDGE_SEAM,
104         TH_EDGE_FACESEL,
105         TH_FACE,
106         TH_FACE_SELECT,
107         TH_NORMAL,
108         TH_VNORMAL,
109         TH_FACE_DOT,
110         TH_FACEDOT_SIZE,
111         TH_CFRAME,
112         TH_NURB_ULINE,
113         TH_NURB_VLINE,
114         TH_NURB_SEL_ULINE,
115         TH_NURB_SEL_VLINE,
116
117         /* this eight colors should be in one block */
118         TH_HANDLE_FREE,
119         TH_HANDLE_AUTO,
120         TH_HANDLE_VECT,
121         TH_HANDLE_ALIGN,
122         TH_HANDLE_AUTOCLAMP,
123         TH_HANDLE_SEL_FREE,
124         TH_HANDLE_SEL_AUTO,
125         TH_HANDLE_SEL_VECT,
126         TH_HANDLE_SEL_ALIGN,
127         TH_HANDLE_SEL_AUTOCLAMP,
128
129         TH_ACTIVE_SPLINE,
130         TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */
131
132         TH_SYNTAX_B,
133         TH_SYNTAX_V,
134         TH_SYNTAX_R,
135         TH_SYNTAX_C,
136         TH_SYNTAX_L,
137         TH_SYNTAX_D,
138         TH_SYNTAX_N,
139         TH_SYNTAX_S,
140         
141         TH_BONE_SOLID,
142         TH_BONE_POSE,
143         TH_BONE_POSE_ACTIVE,
144         
145         TH_STRIP,
146         TH_STRIP_SELECT,
147         
148         TH_KEYTYPE_KEYFRAME, /* KEYTYPES */
149         TH_KEYTYPE_KEYFRAME_SELECT,
150         TH_KEYTYPE_EXTREME,
151         TH_KEYTYPE_EXTREME_SELECT,
152         TH_KEYTYPE_BREAKDOWN,
153         TH_KEYTYPE_BREAKDOWN_SELECT,
154         TH_KEYTYPE_JITTER,
155         TH_KEYTYPE_JITTER_SELECT,
156         
157         TH_KEYBORDER,
158         TH_KEYBORDER_SELECT,
159         
160         TH_LAMP,
161         TH_SPEAKER,
162         TH_CAMERA,
163         TH_EMPTY,
164         
165         TH_NODE,
166         TH_NODE_INPUT,
167         TH_NODE_OUTPUT,
168         TH_NODE_COLOR,
169         TH_NODE_FILTER,
170         TH_NODE_VECTOR,
171         TH_NODE_TEXTURE,
172         TH_NODE_PATTERN,
173         TH_NODE_SCRIPT,
174         TH_NODE_LAYOUT,
175         TH_NODE_SHADER,
176         TH_NODE_INTERFACE,
177         TH_NODE_CONVERTOR,
178         TH_NODE_GROUP,
179         TH_NODE_FRAME,
180         TH_NODE_MATTE,
181         TH_NODE_DISTORT,
182         
183         TH_CONSOLE_OUTPUT,
184         TH_CONSOLE_INPUT,
185         TH_CONSOLE_INFO,
186         TH_CONSOLE_ERROR,
187         TH_CONSOLE_CURSOR,
188         TH_CONSOLE_SELECT,
189         
190         TH_SEQ_MOVIE,
191         TH_SEQ_MOVIECLIP,
192         TH_SEQ_MASK,
193         TH_SEQ_IMAGE,
194         TH_SEQ_SCENE,
195         TH_SEQ_AUDIO,
196         TH_SEQ_EFFECT,
197         TH_SEQ_TRANSITION,
198         TH_SEQ_META,
199         TH_SEQ_PREVIEW,
200         
201         TH_EDGE_SHARP,
202         TH_EDITMESH_ACTIVE,
203         
204         TH_HANDLE_VERTEX,
205         TH_HANDLE_VERTEX_SELECT,
206         TH_HANDLE_VERTEX_SIZE,
207         
208         TH_DOPESHEET_CHANNELOB,
209         TH_DOPESHEET_CHANNELSUBOB,
210         
211         TH_PREVIEW_BACK,
212         
213         TH_EDGE_CREASE,
214
215         TH_DRAWEXTRA_EDGELEN,
216         TH_DRAWEXTRA_EDGEANG,
217         TH_DRAWEXTRA_FACEAREA,
218         TH_DRAWEXTRA_FACEANG,
219
220         TH_NODE_CURVING,
221
222         TH_MARKER_OUTLINE,
223         TH_MARKER,
224         TH_ACT_MARKER,
225         TH_SEL_MARKER,
226         TH_BUNDLE_SOLID,
227         TH_DIS_MARKER,
228         TH_PATH_BEFORE,
229         TH_PATH_AFTER,
230         TH_CAMERA_PATH,
231         TH_LOCK_MARKER,
232
233         TH_STITCH_PREVIEW_FACE,
234         TH_STITCH_PREVIEW_EDGE,
235         TH_STITCH_PREVIEW_VERT,
236         TH_STITCH_PREVIEW_STITCHABLE,
237         TH_STITCH_PREVIEW_UNSTITCHABLE,
238         TH_STITCH_PREVIEW_ACTIVE,
239
240         TH_PAINT_CURVE_HANDLE,
241         TH_PAINT_CURVE_PIVOT,
242
243         TH_UV_SHADOW,
244         TH_UV_OTHERS,
245
246         TH_FREESTYLE_EDGE_MARK,
247         TH_FREESTYLE_FACE_MARK,
248
249         TH_MATCH,           /* highlight color for search matches */
250         TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
251
252         TH_SKIN_ROOT,
253         
254         TH_ANIM_ACTIVE,   /* active action */
255         TH_ANIM_INACTIVE, /* no active action */
256         
257         TH_NLA_TWEAK,        /* 'tweaking' track in NLA */
258         TH_NLA_TWEAK_DUPLI,  /* error/warning flag for other strips referencing dupli strip */
259         
260         TH_NLA_TRANSITION,
261         TH_NLA_TRANSITION_SEL,
262         TH_NLA_META,
263         TH_NLA_META_SEL,
264         TH_NLA_SOUND,
265         TH_NLA_SOUND_SEL,
266         
267         TH_AXIS_X,              /* X/Y/Z Axis */
268         TH_AXIS_Y,
269         TH_AXIS_Z,
270
271         TH_LOW_GRAD,
272         TH_HIGH_GRAD,
273         TH_SHOW_BACK_GRAD,
274
275         TH_INFO_SELECTED,
276         TH_INFO_SELECTED_TEXT,
277         TH_INFO_ERROR,
278         TH_INFO_ERROR_TEXT,
279         TH_INFO_WARNING,
280         TH_INFO_WARNING_TEXT,
281         TH_INFO_INFO,
282         TH_INFO_INFO_TEXT,
283         TH_INFO_DEBUG,
284         TH_INFO_DEBUG_TEXT,
285         TH_VIEW_OVERLAY,
286 };
287 /* XXX WARNING: previous is saved in file, so do not change order! */
288
289 /* specific defines per space should have higher define values */
290
291 struct bTheme;
292 struct PointerRNA;
293
294 // THE CODERS API FOR THEMES:
295
296 // sets the color
297 void    UI_ThemeColor(int colorid);
298
299 // sets the color plus alpha
300 void    UI_ThemeColor4(int colorid);
301
302 // sets color plus offset for shade
303 void    UI_ThemeColorShade(int colorid, int offset);
304
305 // sets color plus offset for alpha
306 void    UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
307
308 // sets color, which is blend between two theme colors
309 void    UI_ThemeColorBlend(int colorid1, int colorid2, float fac);
310 // same, with shade offset
311 void    UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
312 void    UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset);
313
314 // returns one value, not scaled
315 float   UI_GetThemeValuef(int colorid);
316 int     UI_GetThemeValue(int colorid);
317
318 // get three color values, scaled to 0.0-1.0 range
319 void    UI_GetThemeColor3fv(int colorid, float col[3]);
320 void    UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
321 // get the color, range 0.0-1.0, complete with shading offset
322 void    UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
323 void    UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
324
325 // get four color values, scaled to 0.0-1.0 range
326 void    UI_GetThemeColor4fv(int colorid, float col[4]);
327
328 // get the 3 or 4 byte values
329 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
330 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
331
332 // get a theme color from specified space type
333 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
334
335 // blends and shades between two color pointers
336 void    UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset);
337
338 // shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
339 void    UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
340
341 // get a 3 byte color, blended and shaded between two other char color pointers
342 void    UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
343
344 // clear the openGL ClearColor using the input colorid
345 void    UI_ThemeClearColor(int colorid);
346
347 // internal (blender) usage only, for init and set active
348 void    UI_SetTheme(int spacetype, int regionid);
349
350 // get current theme
351 struct bTheme *UI_GetTheme(void);
352
353 // return shadow width outside menus and popups */
354 int UI_ThemeMenuShadowWidth(void);
355
356 /* only for buttons in theme editor! */
357 const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
358
359 void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
360
361 #endif  /* __UI_RESOURCES_H__ */