Merge branch 'master' into blender2.8
[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 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         TH_PANEL_SHOW_HEADER,
79         TH_PANEL_SHOW_BACK,
80
81         TH_BUTBACK,
82         TH_BUTBACK_TEXT,
83         TH_BUTBACK_TEXT_HI,
84
85         TH_SHADE1,
86         TH_SHADE2,
87         TH_HILITE,
88
89         TH_GRID,
90         TH_WIRE,
91         TH_WIRE_INNER,
92         TH_WIRE_EDIT,
93         TH_SELECT,
94         TH_ACTIVE,
95         TH_GROUP,
96         TH_GROUP_ACTIVE,
97         TH_TRANSFORM,
98         TH_VERTEX,
99         TH_VERTEX_SELECT,
100         TH_VERTEX_UNREFERENCED,
101         TH_VERTEX_SIZE,
102         TH_OUTLINE_WIDTH,
103         TH_EDGE,
104         TH_EDGE_SELECT,
105         TH_EDGE_SEAM,
106         TH_EDGE_FACESEL,
107         TH_FACE,
108         TH_FACE_SELECT,
109         TH_NORMAL,
110         TH_VNORMAL,
111         TH_LNORMAL,
112         TH_FACE_DOT,
113         TH_FACEDOT_SIZE,
114         TH_CFRAME,
115         TH_TIME_KEYFRAME,
116         TH_TIME_GP_KEYFRAME,
117         TH_NURB_ULINE,
118         TH_NURB_VLINE,
119         TH_NURB_SEL_ULINE,
120         TH_NURB_SEL_VLINE,
121
122         /* this eight colors should be in one block */
123         TH_HANDLE_FREE,
124         TH_HANDLE_AUTO,
125         TH_HANDLE_VECT,
126         TH_HANDLE_ALIGN,
127         TH_HANDLE_AUTOCLAMP,
128         TH_HANDLE_SEL_FREE,
129         TH_HANDLE_SEL_AUTO,
130         TH_HANDLE_SEL_VECT,
131         TH_HANDLE_SEL_ALIGN,
132         TH_HANDLE_SEL_AUTOCLAMP,
133
134         TH_ACTIVE_SPLINE,
135         TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */
136
137         TH_SYNTAX_B,
138         TH_SYNTAX_V,
139         TH_SYNTAX_R,
140         TH_SYNTAX_C,
141         TH_SYNTAX_L,
142         TH_SYNTAX_D,
143         TH_SYNTAX_N,
144         TH_SYNTAX_S,
145
146         TH_BONE_SOLID,
147         TH_BONE_POSE,
148         TH_BONE_POSE_ACTIVE,
149
150         TH_STRIP,
151         TH_STRIP_SELECT,
152
153         TH_KEYTYPE_KEYFRAME, /* KEYTYPES */
154         TH_KEYTYPE_KEYFRAME_SELECT,
155         TH_KEYTYPE_EXTREME,
156         TH_KEYTYPE_EXTREME_SELECT,
157         TH_KEYTYPE_BREAKDOWN,
158         TH_KEYTYPE_BREAKDOWN_SELECT,
159         TH_KEYTYPE_JITTER,
160         TH_KEYTYPE_JITTER_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
267         TH_NLA_TWEAK,        /* 'tweaking' track in NLA */
268         TH_NLA_TWEAK_DUPLI,  /* error/warning flag for other strips referencing dupli strip */
269
270         TH_NLA_TRANSITION,
271         TH_NLA_TRANSITION_SEL,
272         TH_NLA_META,
273         TH_NLA_META_SEL,
274         TH_NLA_SOUND,
275         TH_NLA_SOUND_SEL,
276
277         TH_WIDGET_EMBOSS,
278
279         TH_EDITOR_OUTLINE,
280
281         TH_AXIS_X,              /* X/Y/Z Axis */
282         TH_AXIS_Y,
283         TH_AXIS_Z,
284
285         TH_MANIPULATOR_HI,
286         TH_MANIPULATOR_PRIMARY,
287         TH_MANIPULATOR_SECONDARY,
288         TH_MANIPULATOR_A,
289         TH_MANIPULATOR_B,
290
291         TH_LOW_GRAD,
292         TH_HIGH_GRAD,
293         TH_SHOW_BACK_GRAD,
294
295         TH_INFO_SELECTED,
296         TH_INFO_SELECTED_TEXT,
297         TH_INFO_ERROR,
298         TH_INFO_ERROR_TEXT,
299         TH_INFO_WARNING,
300         TH_INFO_WARNING_TEXT,
301         TH_INFO_INFO,
302         TH_INFO_INFO_TEXT,
303         TH_INFO_DEBUG,
304         TH_INFO_DEBUG_TEXT,
305         TH_VIEW_OVERLAY,
306
307         TH_V3D_CLIPPING_BORDER,
308
309         TH_METADATA_BG,
310         TH_METADATA_TEXT,
311
312         TH_EDGE_BEVEL,
313         TH_VERTEX_BEVEL
314 } ThemeColorID;
315
316 /* specific defines per space should have higher define values */
317
318 struct bTheme;
319
320 struct bThemeState {
321         struct bTheme *theme;
322         int spacetype, regionid;
323 };
324
325 // THE CODERS API FOR THEMES:
326
327 // sets the color
328 void    UI_ThemeColor(int colorid);
329
330 // sets the color plus alpha
331 void    UI_ThemeColor4(int colorid);
332
333 // sets color plus offset for shade
334 void    UI_ThemeColorShade(int colorid, int offset);
335
336 // sets color plus offset for alpha
337 void    UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
338
339 // sets color, which is blend between two theme colors
340 void    UI_ThemeColorBlend(int colorid1, int colorid2, float fac);
341 // same, with shade offset
342 void    UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
343 void    UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset);
344
345 // returns one value, not scaled
346 float   UI_GetThemeValuef(int colorid);
347 int     UI_GetThemeValue(int colorid);
348
349 float   UI_GetThemeValueTypef(int colorid, int spacetype);
350 int     UI_GetThemeValueType(int colorid, int spacetype);
351
352 // get three color values, scaled to 0.0-1.0 range
353 void    UI_GetThemeColor3fv(int colorid, float col[3]);
354 void    UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
355 void    UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
356 // get the color, range 0.0-1.0, complete with shading offset
357 void    UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
358 void    UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
359 void    UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4]);
360
361 // get three color values, range 0-255, complete with shading offset for the RGB components and blending
362 void    UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3]);
363
364 // get four color values, scaled to 0.0-1.0 range
365 void    UI_GetThemeColor4fv(int colorid, float col[4]);
366 // get four color values, range 0.0-1.0, complete with shading offset for the RGB components
367 void    UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]);
368 void    UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]);
369
370 // get four colour values ranged between 0 and 255; includes the alpha channel
371 void    UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]);
372
373 // get four color values, range 0.0-1.0, complete with shading offset for the RGB components and blending
374 void    UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3]);
375 void    UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4]);
376
377 // get the 3 or 4 byte values
378 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
379 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
380
381 // get a theme color from specified space type
382 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
383
384 // blends and shades between two color pointers
385 void    UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset);
386
387 // shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
388 void    UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
389
390 // get a 3 byte color, blended and shaded between two other char color pointers
391 void    UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset);
392
393 // sets the font color
394 // (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color)
395 void UI_FontThemeColor(int fontid, int colorid);
396
397 // clear the openGL ClearColor using the input colorid
398 void    UI_ThemeClearColor(int colorid);
399
400 // clear the openGL ClearColor using the input colorid using optional transparency
401 void    UI_ThemeClearColorAlpha(int colorid, float alpha);
402
403 // internal (blender) usage only, for init and set active
404 void    UI_SetTheme(int spacetype, int regionid);
405
406 // get current theme
407 struct bTheme *UI_GetTheme(void);
408
409 void UI_Theme_Store(struct bThemeState *theme_state);
410 void UI_Theme_Restore(struct bThemeState *theme_state);
411
412 // return shadow width outside menus and popups */
413 int UI_ThemeMenuShadowWidth(void);
414
415 /* only for buttons in theme editor! */
416 const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
417
418 void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
419
420 #endif  /* __UI_RESOURCES_H__ */