Dope Sheet: remove many hard-coded color and alpha constants.
[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 #include "BLI_sys_types.h"
33
34 #ifndef __UI_RESOURCES_H__
35 #define __UI_RESOURCES_H__
36
37 /* Define icon enum. */
38 #define DEF_ICON(name) ICON_##name,
39 #define DEF_ICON_VECTOR(name) ICON_##name,
40 #define DEF_ICON_COLOR(name) ICON_##name,
41 #define DEF_ICON_BLANK(name) ICON_BLANK_##name,
42
43 typedef enum {
44         /* ui */
45 #include "UI_icons.h"
46         BIFICONID_LAST
47 } BIFIconID;
48
49 #define BIFICONID_FIRST  (ICON_NONE)
50
51 /* use to denote intentionally unset theme color */
52 #define TH_UNDEFINED -1
53
54 typedef enum ThemeColorID {
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_SUB_BACK,
78
79         TH_BUTBACK,
80         TH_BUTBACK_TEXT,
81         TH_BUTBACK_TEXT_HI,
82
83         TH_SHADE1,
84         TH_SHADE2,
85         TH_HILITE,
86
87         TH_GRID,
88         TH_WIRE,
89         TH_WIRE_INNER,
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_LNORMAL,
110         TH_FACE_DOT,
111         TH_FACEDOT_SIZE,
112         TH_CFRAME,
113         TH_TIME_KEYFRAME,
114         TH_TIME_GP_KEYFRAME,
115         TH_NURB_ULINE,
116         TH_NURB_VLINE,
117         TH_NURB_SEL_ULINE,
118         TH_NURB_SEL_VLINE,
119
120         /* this eight colors should be in one block */
121         TH_HANDLE_FREE,
122         TH_HANDLE_AUTO,
123         TH_HANDLE_VECT,
124         TH_HANDLE_ALIGN,
125         TH_HANDLE_AUTOCLAMP,
126         TH_HANDLE_SEL_FREE,
127         TH_HANDLE_SEL_AUTO,
128         TH_HANDLE_SEL_VECT,
129         TH_HANDLE_SEL_ALIGN,
130         TH_HANDLE_SEL_AUTOCLAMP,
131
132         TH_ACTIVE_SPLINE,
133         TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */
134
135         TH_SYNTAX_B,
136         TH_SYNTAX_V,
137         TH_SYNTAX_R,
138         TH_SYNTAX_C,
139         TH_SYNTAX_L,
140         TH_SYNTAX_D,
141         TH_SYNTAX_N,
142         TH_SYNTAX_S,
143
144         TH_BONE_SOLID,
145         TH_BONE_POSE,
146         TH_BONE_POSE_ACTIVE,
147
148         TH_STRIP,
149         TH_STRIP_SELECT,
150
151         TH_KEYTYPE_KEYFRAME, /* KEYTYPES */
152         TH_KEYTYPE_KEYFRAME_SELECT,
153         TH_KEYTYPE_EXTREME,
154         TH_KEYTYPE_EXTREME_SELECT,
155         TH_KEYTYPE_BREAKDOWN,
156         TH_KEYTYPE_BREAKDOWN_SELECT,
157         TH_KEYTYPE_JITTER,
158         TH_KEYTYPE_JITTER_SELECT,
159         TH_KEYTYPE_MOVEHOLD,
160         TH_KEYTYPE_MOVEHOLD_SELECT,
161
162         TH_KEYBORDER,
163         TH_KEYBORDER_SELECT,
164
165         TH_LAMP,
166         TH_SPEAKER,
167         TH_CAMERA,
168         TH_EMPTY,
169
170         TH_NODE,
171         TH_NODE_INPUT,
172         TH_NODE_OUTPUT,
173         TH_NODE_COLOR,
174         TH_NODE_FILTER,
175         TH_NODE_VECTOR,
176         TH_NODE_TEXTURE,
177         TH_NODE_PATTERN,
178         TH_NODE_SCRIPT,
179         TH_NODE_LAYOUT,
180         TH_NODE_SHADER,
181         TH_NODE_INTERFACE,
182         TH_NODE_CONVERTOR,
183         TH_NODE_GROUP,
184         TH_NODE_FRAME,
185         TH_NODE_MATTE,
186         TH_NODE_DISTORT,
187
188         TH_CONSOLE_OUTPUT,
189         TH_CONSOLE_INPUT,
190         TH_CONSOLE_INFO,
191         TH_CONSOLE_ERROR,
192         TH_CONSOLE_CURSOR,
193         TH_CONSOLE_SELECT,
194
195         TH_SEQ_MOVIE,
196         TH_SEQ_MOVIECLIP,
197         TH_SEQ_MASK,
198         TH_SEQ_IMAGE,
199         TH_SEQ_SCENE,
200         TH_SEQ_AUDIO,
201         TH_SEQ_EFFECT,
202         TH_SEQ_TRANSITION,
203         TH_SEQ_META,
204         TH_SEQ_TEXT,
205         TH_SEQ_PREVIEW,
206
207         TH_EDGE_SHARP,
208         TH_EDITMESH_ACTIVE,
209
210         TH_HANDLE_VERTEX,
211         TH_HANDLE_VERTEX_SELECT,
212         TH_HANDLE_VERTEX_SIZE,
213
214         TH_GP_VERTEX,
215         TH_GP_VERTEX_SELECT,
216         TH_GP_VERTEX_SIZE,
217
218         TH_DOPESHEET_CHANNELOB,
219         TH_DOPESHEET_CHANNELSUBOB,
220
221         TH_PREVIEW_BACK,
222
223         TH_EDGE_CREASE,
224
225         TH_DRAWEXTRA_EDGELEN,
226         TH_DRAWEXTRA_EDGEANG,
227         TH_DRAWEXTRA_FACEAREA,
228         TH_DRAWEXTRA_FACEANG,
229
230         TH_NODE_CURVING,
231
232         TH_MARKER_OUTLINE,
233         TH_MARKER,
234         TH_ACT_MARKER,
235         TH_SEL_MARKER,
236         TH_BUNDLE_SOLID,
237         TH_DIS_MARKER,
238         TH_PATH_BEFORE,
239         TH_PATH_AFTER,
240         TH_CAMERA_PATH,
241         TH_LOCK_MARKER,
242
243         TH_STITCH_PREVIEW_FACE,
244         TH_STITCH_PREVIEW_EDGE,
245         TH_STITCH_PREVIEW_VERT,
246         TH_STITCH_PREVIEW_STITCHABLE,
247         TH_STITCH_PREVIEW_UNSTITCHABLE,
248         TH_STITCH_PREVIEW_ACTIVE,
249
250         TH_PAINT_CURVE_HANDLE,
251         TH_PAINT_CURVE_PIVOT,
252
253         TH_UV_SHADOW,
254         TH_UV_OTHERS,
255
256         TH_FREESTYLE_EDGE_MARK,
257         TH_FREESTYLE_FACE_MARK,
258
259         TH_MATCH,           /* highlight color for search matches */
260         TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
261
262         TH_SKIN_ROOT,
263
264         TH_ANIM_ACTIVE,   /* active action */
265         TH_ANIM_INACTIVE, /* no active action */
266         TH_ANIM_PREVIEW_RANGE,/* preview range overlay */
267
268         TH_ICON_COLLECTION,
269         TH_ICON_OBJECT,
270         TH_ICON_OBJECT_DATA,
271         TH_ICON_MODIFIER,
272         TH_ICON_SHADING,
273
274         TH_NLA_TWEAK,        /* 'tweaking' track in NLA */
275         TH_NLA_TWEAK_DUPLI,  /* error/warning flag for other strips referencing dupli strip */
276
277         TH_NLA_TRANSITION,
278         TH_NLA_TRANSITION_SEL,
279         TH_NLA_META,
280         TH_NLA_META_SEL,
281         TH_NLA_SOUND,
282         TH_NLA_SOUND_SEL,
283
284         TH_WIDGET_EMBOSS,
285
286         TH_EDITOR_OUTLINE,
287
288         TH_AXIS_X,              /* X/Y/Z Axis */
289         TH_AXIS_Y,
290         TH_AXIS_Z,
291
292         TH_GIZMO_HI,
293         TH_GIZMO_PRIMARY,
294         TH_GIZMO_SECONDARY,
295         TH_GIZMO_A,
296         TH_GIZMO_B,
297
298         TH_LOW_GRAD,
299         TH_HIGH_GRAD,
300         TH_SHOW_BACK_GRAD,
301
302         TH_INFO_SELECTED,
303         TH_INFO_SELECTED_TEXT,
304         TH_INFO_ERROR,
305         TH_INFO_ERROR_TEXT,
306         TH_INFO_WARNING,
307         TH_INFO_WARNING_TEXT,
308         TH_INFO_INFO,
309         TH_INFO_INFO_TEXT,
310         TH_INFO_DEBUG,
311         TH_INFO_DEBUG_TEXT,
312         TH_VIEW_OVERLAY,
313
314         TH_V3D_CLIPPING_BORDER,
315
316         TH_METADATA_BG,
317         TH_METADATA_TEXT,
318
319         TH_EDGE_BEVEL,
320         TH_VERTEX_BEVEL
321 } ThemeColorID;
322
323 /* specific defines per space should have higher define values */
324
325 struct bTheme;
326
327 struct bThemeState {
328         struct bTheme *theme;
329         int spacetype, regionid;
330 };
331
332 // THE CODERS API FOR THEMES:
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 void    UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
345 // get the color, range 0.0-1.0, complete with shading offset
346 void    UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
347 void    UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
348 void    UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4]);
349
350 // get three color values, range 0-255, complete with shading offset for the RGB components and blending
351 void    UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3]);
352
353 // get four color values, scaled to 0.0-1.0 range
354 void    UI_GetThemeColor4fv(int colorid, float col[4]);
355 // get four color values, range 0.0-1.0, complete with shading offset for the RGB components
356 void    UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]);
357 void    UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]);
358
359 // get four colour values ranged between 0 and 255; includes the alpha channel
360 void    UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]);
361
362 // get four color values, range 0.0-1.0, complete with shading offset for the RGB components and blending
363 void    UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3]);
364 void    UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4]);
365
366 // get the 3 or 4 byte values
367 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
368 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
369
370 // get a theme color from specified space type
371 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
372
373 // get theme color for coloring monochrome icons
374 bool    UI_GetIconThemeColor4fv(int colorid, float col[4]);
375
376 // shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
377 void    UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
378
379 // get a 3 byte color, blended and shaded between two other char color pointers
380 void    UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
381
382 // sets the font color
383 // (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color)
384 void UI_FontThemeColor(int fontid, int colorid);
385
386 // clear the openGL ClearColor using the input colorid
387 void    UI_ThemeClearColor(int colorid);
388
389 // clear the openGL ClearColor using the input colorid using optional transparency
390 void    UI_ThemeClearColorAlpha(int colorid, float alpha);
391
392 // internal (blender) usage only, for init and set active
393 void    UI_SetTheme(int spacetype, int regionid);
394
395 // get current theme
396 struct bTheme *UI_GetTheme(void);
397
398 void UI_Theme_Store(struct bThemeState *theme_state);
399 void UI_Theme_Restore(struct bThemeState *theme_state);
400
401 // return shadow width outside menus and popups */
402 int UI_ThemeMenuShadowWidth(void);
403
404 /* only for buttons in theme editor! */
405 const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
406
407 void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
408
409 #endif  /* __UI_RESOURCES_H__ */