CMake: add WITH_LINKER_LLD option for unix platforms
[blender-staging.git] / source / blender / editors / include / UI_resources.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19
20 /** \file
21  * \ingroup editorui
22  */
23
24 #ifndef __UI_RESOURCES_H__
25 #define __UI_RESOURCES_H__
26
27 #include "BLI_sys_types.h"
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* Define icon enum. */
34 #define DEF_ICON(name) ICON_##name,
35 #define DEF_ICON_VECTOR(name) ICON_##name,
36 #define DEF_ICON_COLOR(name) ICON_##name,
37 #define DEF_ICON_BLANK(name) ICON_BLANK_##name,
38
39 typedef enum {
40 /* ui */
41 #include "UI_icons.h"
42   BIFICONID_LAST,
43 } BIFIconID;
44
45 #define BIFICONID_FIRST (ICON_NONE)
46
47 /* use to denote intentionally unset theme color */
48 #define TH_UNDEFINED -1
49
50 typedef enum ThemeColorID {
51   TH_REDALERT,
52
53   TH_THEMEUI,
54   // common colors among spaces
55
56   TH_BACK,
57   /** Use when 'TH_SHOW_BACK_GRAD' is set (the lower, darker color). */
58   TH_BACK_GRAD,
59   TH_TEXT,
60   TH_TEXT_HI,
61   TH_TITLE,
62   TH_TAB_ACTIVE,
63   TH_TAB_INACTIVE,
64   TH_TAB_BACK,
65   TH_TAB_OUTLINE,
66
67   TH_HEADER,
68   TH_HEADERDESEL,
69   TH_HEADER_TEXT,
70   TH_HEADER_TEXT_HI,
71
72   /* panels */
73   TH_PANEL_HEADER,
74   TH_PANEL_BACK,
75   TH_PANEL_SUB_BACK,
76
77   TH_BUTBACK,
78   TH_BUTBACK_TEXT,
79   TH_BUTBACK_TEXT_HI,
80
81   TH_SHADE1,
82   TH_SHADE2,
83   TH_HILITE,
84
85   TH_GRID,
86   TH_WIRE,
87   TH_WIRE_INNER,
88   TH_WIRE_EDIT,
89   TH_SELECT,
90   TH_ACTIVE,
91   TH_GROUP,
92   TH_GROUP_ACTIVE,
93   TH_TRANSFORM,
94   TH_VERTEX,
95   TH_VERTEX_SELECT,
96   TH_VERTEX_UNREFERENCED,
97   TH_VERTEX_SIZE,
98   TH_OUTLINE_WIDTH,
99   TH_OBCENTER_DIA,
100   TH_EDGE,
101   TH_EDGE_SELECT,
102   TH_EDGE_SEAM,
103   TH_EDGE_FACESEL,
104   TH_FACE,
105   TH_FACE_SELECT,
106   TH_FACE_BACK,
107   TH_FACE_FRONT,
108   TH_NORMAL,
109   TH_VNORMAL,
110   TH_LNORMAL,
111   TH_FACE_DOT,
112   TH_FACEDOT_SIZE,
113   TH_CFRAME,
114   TH_TIME_SCRUB_BACKGROUND,
115   TH_TIME_MARKER_LINE,
116   TH_TIME_MARKER_LINE_SELECTED,
117   TH_TIME_KEYFRAME,
118   TH_TIME_GP_KEYFRAME,
119   TH_NURB_ULINE,
120   TH_NURB_VLINE,
121   TH_NURB_SEL_ULINE,
122   TH_NURB_SEL_VLINE,
123
124   /* this eight colors should be in one block */
125   TH_HANDLE_FREE,
126   TH_HANDLE_AUTO,
127   TH_HANDLE_VECT,
128   TH_HANDLE_ALIGN,
129   TH_HANDLE_AUTOCLAMP,
130   TH_HANDLE_SEL_FREE,
131   TH_HANDLE_SEL_AUTO,
132   TH_HANDLE_SEL_VECT,
133   TH_HANDLE_SEL_ALIGN,
134   TH_HANDLE_SEL_AUTOCLAMP,
135
136   TH_ACTIVE_SPLINE,
137   TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */
138
139   TH_SYNTAX_B,
140   TH_SYNTAX_V,
141   TH_SYNTAX_R,
142   TH_SYNTAX_C,
143   TH_SYNTAX_L,
144   TH_SYNTAX_D,
145   TH_SYNTAX_N,
146   TH_SYNTAX_S,
147   TH_LINENUMBERS,
148
149   TH_BONE_SOLID,
150   TH_BONE_POSE,
151   TH_BONE_POSE_ACTIVE,
152   TH_BONE_LOCKED_WEIGHT,
153
154   TH_STRIP,
155   TH_STRIP_SELECT,
156
157   TH_KEYTYPE_KEYFRAME, /* KEYTYPES */
158   TH_KEYTYPE_KEYFRAME_SELECT,
159   TH_KEYTYPE_EXTREME,
160   TH_KEYTYPE_EXTREME_SELECT,
161   TH_KEYTYPE_BREAKDOWN,
162   TH_KEYTYPE_BREAKDOWN_SELECT,
163   TH_KEYTYPE_JITTER,
164   TH_KEYTYPE_JITTER_SELECT,
165   TH_KEYTYPE_MOVEHOLD,
166   TH_KEYTYPE_MOVEHOLD_SELECT,
167
168   TH_KEYBORDER,
169   TH_KEYBORDER_SELECT,
170
171   TH_LIGHT,
172   TH_SPEAKER,
173   TH_CAMERA,
174   TH_EMPTY,
175
176   TH_NODE,
177   TH_NODE_INPUT,
178   TH_NODE_OUTPUT,
179   TH_NODE_COLOR,
180   TH_NODE_FILTER,
181   TH_NODE_VECTOR,
182   TH_NODE_TEXTURE,
183   TH_NODE_PATTERN,
184   TH_NODE_SCRIPT,
185   TH_NODE_LAYOUT,
186   TH_NODE_SHADER,
187   TH_NODE_INTERFACE,
188   TH_NODE_CONVERTOR,
189   TH_NODE_GROUP,
190   TH_NODE_FRAME,
191   TH_NODE_MATTE,
192   TH_NODE_DISTORT,
193
194   TH_CONSOLE_OUTPUT,
195   TH_CONSOLE_INPUT,
196   TH_CONSOLE_INFO,
197   TH_CONSOLE_ERROR,
198   TH_CONSOLE_CURSOR,
199   TH_CONSOLE_SELECT,
200
201   TH_SEQ_MOVIE,
202   TH_SEQ_MOVIECLIP,
203   TH_SEQ_MASK,
204   TH_SEQ_IMAGE,
205   TH_SEQ_SCENE,
206   TH_SEQ_AUDIO,
207   TH_SEQ_EFFECT,
208   TH_SEQ_META,
209   TH_SEQ_TEXT,
210   TH_SEQ_PREVIEW,
211   TH_SEQ_COLOR,
212   TH_SEQ_ACTIVE,
213   TH_SEQ_SELECTED,
214
215   TH_EDGE_SHARP,
216   TH_EDITMESH_ACTIVE,
217
218   TH_HANDLE_VERTEX,
219   TH_HANDLE_VERTEX_SELECT,
220   TH_HANDLE_VERTEX_SIZE,
221
222   TH_GP_VERTEX,
223   TH_GP_VERTEX_SELECT,
224   TH_GP_VERTEX_SIZE,
225
226   TH_DOPESHEET_CHANNELOB,
227   TH_DOPESHEET_CHANNELSUBOB,
228   TH_DOPESHEET_IPOLINE,
229
230   TH_PREVIEW_BACK,
231
232   TH_EDGE_CREASE,
233
234   TH_DRAWEXTRA_EDGELEN,
235   TH_DRAWEXTRA_EDGEANG,
236   TH_DRAWEXTRA_FACEAREA,
237   TH_DRAWEXTRA_FACEANG,
238
239   TH_NODE_CURVING,
240   TH_NODE_GRID_LEVELS,
241
242   TH_MARKER_OUTLINE,
243   TH_MARKER,
244   TH_ACT_MARKER,
245   TH_SEL_MARKER,
246   TH_BUNDLE_SOLID,
247   TH_DIS_MARKER,
248   TH_PATH_BEFORE,
249   TH_PATH_AFTER,
250   TH_PATH_KEYFRAME_BEFORE,
251   TH_PATH_KEYFRAME_AFTER,
252   TH_CAMERA_PATH,
253   TH_LOCK_MARKER,
254
255   TH_STITCH_PREVIEW_FACE,
256   TH_STITCH_PREVIEW_EDGE,
257   TH_STITCH_PREVIEW_VERT,
258   TH_STITCH_PREVIEW_STITCHABLE,
259   TH_STITCH_PREVIEW_UNSTITCHABLE,
260   TH_STITCH_PREVIEW_ACTIVE,
261
262   TH_PAINT_CURVE_HANDLE,
263   TH_PAINT_CURVE_PIVOT,
264
265   TH_UV_SHADOW,
266   TH_UV_OTHERS,
267
268   TH_FREESTYLE_EDGE_MARK,
269   TH_FREESTYLE_FACE_MARK,
270
271   TH_MATCH,            /* highlight color for search matches */
272   TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
273   TH_SELECT_ACTIVE,    /* highlight color for active outliner item */
274   TH_SELECTED_OBJECT,  /* selected object color for outliner */
275   TH_ACTIVE_OBJECT,    /* active object color for outliner */
276   TH_EDITED_OBJECT,    /* edited object color for outliner */
277   TH_ROW_ALTERNATE,    /* overlay on every other row */
278
279   TH_SKIN_ROOT,
280
281   TH_ANIM_ACTIVE,        /* active action */
282   TH_ANIM_INACTIVE,      /* no active action */
283   TH_ANIM_PREVIEW_RANGE, /* preview range overlay */
284
285   TH_ICON_SCENE,
286   TH_ICON_COLLECTION,
287   TH_ICON_OBJECT,
288   TH_ICON_OBJECT_DATA,
289   TH_ICON_MODIFIER,
290   TH_ICON_SHADING,
291   TH_ICON_FOLDER,
292   TH_ICON_FUND,
293
294   TH_SCROLL_TEXT,
295
296   TH_NLA_TWEAK,       /* 'tweaking' track in NLA */
297   TH_NLA_TWEAK_DUPLI, /* error/warning flag for other strips referencing dupli strip */
298
299   TH_NLA_TRACK,
300   TH_NLA_TRANSITION,
301   TH_NLA_TRANSITION_SEL,
302   TH_NLA_META,
303   TH_NLA_META_SEL,
304   TH_NLA_SOUND,
305   TH_NLA_SOUND_SEL,
306
307   TH_WIDGET_EMBOSS,
308   TH_WIDGET_TEXT_CURSOR,
309   TH_EDITOR_OUTLINE,
310
311   TH_TRANSPARENT_CHECKER_PRIMARY,
312   TH_TRANSPARENT_CHECKER_SECONDARY,
313   TH_TRANSPARENT_CHECKER_SIZE,
314
315   TH_AXIS_X, /* X/Y/Z Axis */
316   TH_AXIS_Y,
317   TH_AXIS_Z,
318
319   TH_GIZMO_HI,
320   TH_GIZMO_PRIMARY,
321   TH_GIZMO_SECONDARY,
322   TH_GIZMO_VIEW_ALIGN,
323   TH_GIZMO_A,
324   TH_GIZMO_B,
325
326   TH_BACKGROUND_TYPE,
327
328   TH_INFO_SELECTED,
329   TH_INFO_SELECTED_TEXT,
330   TH_INFO_ERROR,
331   TH_INFO_ERROR_TEXT,
332   TH_INFO_WARNING,
333   TH_INFO_WARNING_TEXT,
334   TH_INFO_INFO,
335   TH_INFO_INFO_TEXT,
336   TH_INFO_DEBUG,
337   TH_INFO_DEBUG_TEXT,
338   TH_INFO_PROPERTY,
339   TH_INFO_PROPERTY_TEXT,
340   TH_INFO_OPERATOR,
341   TH_INFO_OPERATOR_TEXT,
342   TH_VIEW_OVERLAY,
343
344   TH_V3D_CLIPPING_BORDER,
345
346   TH_METADATA_BG,
347   TH_METADATA_TEXT,
348
349   TH_EDGE_BEVEL,
350   TH_VERTEX_BEVEL,
351 } ThemeColorID;
352
353 /* specific defines per space should have higher define values */
354
355 struct bTheme;
356
357 struct bThemeState {
358   struct bTheme *theme;
359   int spacetype, regionid;
360 };
361
362 // THE CODERS API FOR THEMES:
363
364 // returns one value, not scaled
365 float UI_GetThemeValuef(int colorid);
366 int UI_GetThemeValue(int colorid);
367
368 float UI_GetThemeValueTypef(int colorid, int spacetype);
369 int UI_GetThemeValueType(int colorid, int spacetype);
370
371 // get three color values, scaled to 0.0-1.0 range
372 void UI_GetThemeColor3fv(int colorid, float col[3]);
373 void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]);
374 void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]);
375 void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]);
376 // get the color, range 0.0-1.0, complete with shading offset
377 void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
378 void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
379 void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4]);
380
381 // get three color values, range 0-255,
382 // complete with shading offset for the RGB components and blending.
383 void UI_GetThemeColorBlendShade3ubv(
384     int colorid1, int colorid2, float fac, int offset, unsigned char col[3]);
385
386 // get four color values, scaled to 0.0-1.0 range
387 void UI_GetThemeColor4fv(int colorid, float col[4]);
388
389 /* get four color values from specified space type, scaled to 0.0-1.0 range */
390 void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4]);
391
392 // get four color values, range 0.0-1.0, complete with shading offset for the RGB components
393 void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]);
394 void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]);
395
396 // get four color values ranged between 0 and 255; includes the alpha channel
397 void UI_GetThemeColorShadeAlpha4ubv(int colorid,
398                                     int coloffset,
399                                     int alphaoffset,
400                                     unsigned char col[4]);
401
402 // get four color values, range 0.0-1.0,
403 // complete with shading offset for the RGB components and blending.
404 void UI_GetThemeColorBlendShade3fv(
405     int colorid1, int colorid2, float fac, int offset, float col[3]);
406 void UI_GetThemeColorBlendShade4fv(
407     int colorid1, int colorid2, float fac, int offset, float col[4]);
408
409 // get the 3 or 4 byte values
410 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
411 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
412
413 // get a theme color from specified space type
414 void UI_GetThemeColorType3fv(int colorid, int spacetype, float col[3]);
415 void UI_GetThemeColorType3ubv(int colorid, int spacetype, unsigned char col[3]);
416 void UI_GetThemeColorType4ubv(int colorid, int spacetype, unsigned char col[4]);
417
418 // get theme color for coloring monochrome icons
419 bool UI_GetIconThemeColor4ubv(int colorid, unsigned char col[4]);
420
421 // shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor)
422 void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset);
423
424 // get a 3 byte color, blended and shaded between two other char color pointers
425 void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3],
426                                   const unsigned char cp2[3],
427                                   unsigned char col[3],
428                                   float fac,
429                                   int offset);
430
431 // sets the font color
432 // (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color)
433 void UI_FontThemeColor(int fontid, int colorid);
434
435 // clear the openGL ClearColor using the input colorid
436 void UI_ThemeClearColor(int colorid);
437
438 // clear the openGL ClearColor using the input colorid using optional transparency
439 void UI_ThemeClearColorAlpha(int colorid, float alpha);
440
441 // internal (blender) usage only, for init and set active
442 void UI_SetTheme(int spacetype, int regionid);
443
444 // get current theme
445 struct bTheme *UI_GetTheme(void);
446
447 void UI_Theme_Store(struct bThemeState *theme_state);
448 void UI_Theme_Restore(struct bThemeState *theme_state);
449
450 // return shadow width outside menus and popups */
451 int UI_ThemeMenuShadowWidth(void);
452
453 /* only for buttons in theme editor! */
454 const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
455
456 void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
457
458 #ifdef __cplusplus
459 }
460 #endif
461
462 #endif /* __UI_RESOURCES_H__ */