Fix T46909: Text strip not themeable
[blender.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_INNER,
91         TH_WIRE_EDIT,
92         TH_SELECT,
93         TH_ACTIVE,
94         TH_GROUP,
95         TH_GROUP_ACTIVE,
96         TH_TRANSFORM,
97         TH_VERTEX,
98         TH_VERTEX_SELECT,
99         TH_VERTEX_UNREFERENCED,
100         TH_VERTEX_SIZE,
101         TH_OUTLINE_WIDTH,
102         TH_EDGE,
103         TH_EDGE_SELECT,
104         TH_EDGE_SEAM,
105         TH_EDGE_FACESEL,
106         TH_FACE,
107         TH_FACE_SELECT,
108         TH_NORMAL,
109         TH_VNORMAL,
110         TH_LNORMAL,
111         TH_FACE_DOT,
112         TH_FACEDOT_SIZE,
113         TH_CFRAME,
114         TH_TIME_KEYFRAME,
115         TH_TIME_GP_KEYFRAME,
116         TH_NURB_ULINE,
117         TH_NURB_VLINE,
118         TH_NURB_SEL_ULINE,
119         TH_NURB_SEL_VLINE,
120
121         /* this eight colors should be in one block */
122         TH_HANDLE_FREE,
123         TH_HANDLE_AUTO,
124         TH_HANDLE_VECT,
125         TH_HANDLE_ALIGN,
126         TH_HANDLE_AUTOCLAMP,
127         TH_HANDLE_SEL_FREE,
128         TH_HANDLE_SEL_AUTO,
129         TH_HANDLE_SEL_VECT,
130         TH_HANDLE_SEL_ALIGN,
131         TH_HANDLE_SEL_AUTOCLAMP,
132
133         TH_ACTIVE_SPLINE,
134         TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */
135
136         TH_SYNTAX_B,
137         TH_SYNTAX_V,
138         TH_SYNTAX_R,
139         TH_SYNTAX_C,
140         TH_SYNTAX_L,
141         TH_SYNTAX_D,
142         TH_SYNTAX_N,
143         TH_SYNTAX_S,
144         
145         TH_BONE_SOLID,
146         TH_BONE_POSE,
147         TH_BONE_POSE_ACTIVE,
148         
149         TH_STRIP,
150         TH_STRIP_SELECT,
151         
152         TH_KEYTYPE_KEYFRAME, /* KEYTYPES */
153         TH_KEYTYPE_KEYFRAME_SELECT,
154         TH_KEYTYPE_EXTREME,
155         TH_KEYTYPE_EXTREME_SELECT,
156         TH_KEYTYPE_BREAKDOWN,
157         TH_KEYTYPE_BREAKDOWN_SELECT,
158         TH_KEYTYPE_JITTER,
159         TH_KEYTYPE_JITTER_SELECT,
160         
161         TH_KEYBORDER,
162         TH_KEYBORDER_SELECT,
163         
164         TH_LAMP,
165         TH_SPEAKER,
166         TH_CAMERA,
167         TH_EMPTY,
168         
169         TH_NODE,
170         TH_NODE_INPUT,
171         TH_NODE_OUTPUT,
172         TH_NODE_COLOR,
173         TH_NODE_FILTER,
174         TH_NODE_VECTOR,
175         TH_NODE_TEXTURE,
176         TH_NODE_PATTERN,
177         TH_NODE_SCRIPT,
178         TH_NODE_LAYOUT,
179         TH_NODE_SHADER,
180         TH_NODE_INTERFACE,
181         TH_NODE_CONVERTOR,
182         TH_NODE_GROUP,
183         TH_NODE_FRAME,
184         TH_NODE_MATTE,
185         TH_NODE_DISTORT,
186         
187         TH_CONSOLE_OUTPUT,
188         TH_CONSOLE_INPUT,
189         TH_CONSOLE_INFO,
190         TH_CONSOLE_ERROR,
191         TH_CONSOLE_CURSOR,
192         TH_CONSOLE_SELECT,
193         
194         TH_SEQ_MOVIE,
195         TH_SEQ_MOVIECLIP,
196         TH_SEQ_MASK,
197         TH_SEQ_IMAGE,
198         TH_SEQ_SCENE,
199         TH_SEQ_AUDIO,
200         TH_SEQ_EFFECT,
201         TH_SEQ_TRANSITION,
202         TH_SEQ_META,
203         TH_SEQ_TEXT,
204         TH_SEQ_PREVIEW,
205
206         TH_EDGE_SHARP,
207         TH_EDITMESH_ACTIVE,
208         
209         TH_HANDLE_VERTEX,
210         TH_HANDLE_VERTEX_SELECT,
211         TH_HANDLE_VERTEX_SIZE,
212         
213         TH_GP_VERTEX,
214         TH_GP_VERTEX_SELECT,
215         TH_GP_VERTEX_SIZE,
216         
217         TH_DOPESHEET_CHANNELOB,
218         TH_DOPESHEET_CHANNELSUBOB,
219         
220         TH_PREVIEW_BACK,
221         
222         TH_EDGE_CREASE,
223
224         TH_DRAWEXTRA_EDGELEN,
225         TH_DRAWEXTRA_EDGEANG,
226         TH_DRAWEXTRA_FACEAREA,
227         TH_DRAWEXTRA_FACEANG,
228
229         TH_NODE_CURVING,
230
231         TH_MARKER_OUTLINE,
232         TH_MARKER,
233         TH_ACT_MARKER,
234         TH_SEL_MARKER,
235         TH_BUNDLE_SOLID,
236         TH_DIS_MARKER,
237         TH_PATH_BEFORE,
238         TH_PATH_AFTER,
239         TH_CAMERA_PATH,
240         TH_LOCK_MARKER,
241
242         TH_STITCH_PREVIEW_FACE,
243         TH_STITCH_PREVIEW_EDGE,
244         TH_STITCH_PREVIEW_VERT,
245         TH_STITCH_PREVIEW_STITCHABLE,
246         TH_STITCH_PREVIEW_UNSTITCHABLE,
247         TH_STITCH_PREVIEW_ACTIVE,
248
249         TH_PAINT_CURVE_HANDLE,
250         TH_PAINT_CURVE_PIVOT,
251
252         TH_UV_SHADOW,
253         TH_UV_OTHERS,
254
255         TH_FREESTYLE_EDGE_MARK,
256         TH_FREESTYLE_FACE_MARK,
257
258         TH_MATCH,           /* highlight color for search matches */
259         TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
260
261         TH_SKIN_ROOT,
262         
263         TH_ANIM_ACTIVE,   /* active action */
264         TH_ANIM_INACTIVE, /* no active action */
265         
266         TH_NLA_TWEAK,        /* 'tweaking' track in NLA */
267         TH_NLA_TWEAK_DUPLI,  /* error/warning flag for other strips referencing dupli strip */
268         
269         TH_NLA_TRANSITION,
270         TH_NLA_TRANSITION_SEL,
271         TH_NLA_META,
272         TH_NLA_META_SEL,
273         TH_NLA_SOUND,
274         TH_NLA_SOUND_SEL,
275         
276         TH_WIDGET_EMBOSS,
277
278         TH_AXIS_X,              /* X/Y/Z Axis */
279         TH_AXIS_Y,
280         TH_AXIS_Z,
281
282         TH_LOW_GRAD,
283         TH_HIGH_GRAD,
284         TH_SHOW_BACK_GRAD,
285
286         TH_INFO_SELECTED,
287         TH_INFO_SELECTED_TEXT,
288         TH_INFO_ERROR,
289         TH_INFO_ERROR_TEXT,
290         TH_INFO_WARNING,
291         TH_INFO_WARNING_TEXT,
292         TH_INFO_INFO,
293         TH_INFO_INFO_TEXT,
294         TH_INFO_DEBUG,
295         TH_INFO_DEBUG_TEXT,
296         TH_VIEW_OVERLAY,
297         
298         TH_V3D_CLIPPING_BORDER,
299
300         TH_METADATA_BG,
301         TH_METADATA_TEXT
302 };
303 /* XXX WARNING: previous is saved in file, so do not change order! */
304
305 /* specific defines per space should have higher define values */
306
307 struct bTheme;
308
309 struct bThemeState {
310         struct bTheme *theme;
311         int spacetype, regionid;
312 };
313
314 // THE CODERS API FOR THEMES:
315
316 // sets the color
317 void    UI_ThemeColor(int colorid);
318
319 // sets the color plus alpha
320 void    UI_ThemeColor4(int colorid);
321
322 // sets color plus offset for shade
323 void    UI_ThemeColorShade(int colorid, int offset);
324
325 // sets color plus offset for alpha
326 void    UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
327
328 // sets color, which is blend between two theme colors
329 void    UI_ThemeColorBlend(int colorid1, int colorid2, float fac);
330 // same, with shade offset
331 void    UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
332 void    UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset);
333
334 // returns one value, not scaled
335 float   UI_GetThemeValuef(int colorid);
336 int     UI_GetThemeValue(int colorid);
337
338 float   UI_GetThemeValueTypef(int colorid, int spacetype);
339 int     UI_GetThemeValueType(int colorid, int spacetype);
340
341 // get three color values, scaled to 0.0-1.0 range
342 void    UI_GetThemeColor3fv(int colorid, float col[3]);
343 void    UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
344 // get the color, range 0.0-1.0, complete with shading offset
345 void    UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
346 void    UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
347
348 // get four color values, scaled to 0.0-1.0 range
349 void    UI_GetThemeColor4fv(int colorid, float col[4]);
350
351 // get the 3 or 4 byte values
352 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
353 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
354
355 // get a theme color from specified space type
356 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
357
358 // blends and shades between two color pointers
359 void    UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset);
360
361 // shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
362 void    UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
363
364 // get a 3 byte color, blended and shaded between two other char color pointers
365 void    UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
366
367 // clear the openGL ClearColor using the input colorid
368 void    UI_ThemeClearColor(int colorid);
369
370 // clear the openGL ClearColor using the input colorid using optional transparency
371 void    UI_ThemeClearColorAlpha(int colorid, float alpha);
372
373 // internal (blender) usage only, for init and set active
374 void    UI_SetTheme(int spacetype, int regionid);
375
376 // get current theme
377 struct bTheme *UI_GetTheme(void);
378
379 void UI_Theme_Store(struct bThemeState *theme_state);
380 void UI_Theme_Restore(struct bThemeState *theme_state);
381
382 // return shadow width outside menus and popups */
383 int UI_ThemeMenuShadowWidth(void);
384
385 /* only for buttons in theme editor! */
386 const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
387
388 void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
389
390 #endif  /* __UI_RESOURCES_H__ */