Blender V5.0
interface_icons_event.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
13
14#include "BLI_rect.h"
15#include "BLI_string_utf8.h"
16
17#include "BLF_api.hh"
18
19#include "BLT_translation.hh"
20
21#include "interface_intern.hh"
22
23static int inverted_icon(int icon_id)
24{
25 switch (icon_id) {
26 case ICON_KEY_BACKSPACE:
27 return ICON_KEY_BACKSPACE_FILLED;
28 case ICON_KEY_COMMAND:
29 return ICON_KEY_COMMAND_FILLED;
30 case ICON_KEY_CONTROL:
31 return ICON_KEY_CONTROL_FILLED;
32 case ICON_KEY_EMPTY1:
33 return ICON_KEY_EMPTY1_FILLED;
34 case ICON_KEY_EMPTY2:
35 return ICON_KEY_EMPTY2_FILLED;
36 case ICON_KEY_EMPTY3:
37 return ICON_KEY_EMPTY3_FILLED;
38 case ICON_KEY_MENU:
39 return ICON_KEY_MENU_FILLED;
40 case ICON_KEY_OPTION:
41 return ICON_KEY_OPTION_FILLED;
42 case ICON_KEY_RETURN:
43 return ICON_KEY_RETURN_FILLED;
44 case ICON_KEY_RING:
45 return ICON_KEY_RING_FILLED;
46 case ICON_KEY_SHIFT:
47 return ICON_KEY_SHIFT_FILLED;
48 case ICON_KEY_TAB:
49 return ICON_KEY_TAB_FILLED;
50 case ICON_KEY_WINDOWS:
51 return ICON_KEY_WINDOWS_FILLED;
52 default:
53 return icon_id;
54 }
55}
56
57static void icon_draw_icon(const rctf *rect,
58 const int icon_id,
59 const float aspect,
60 const float alpha,
61 const bool inverted)
62{
63 float color[4];
65 if (alpha < 1.0f) {
66 color[3] *= alpha;
67 }
68
69 BLF_draw_svg_icon(uint(inverted ? inverted_icon(icon_id) : icon_id),
70 rect->xmin,
71 rect->ymin,
72 float(ICON_DEFAULT_HEIGHT) / aspect,
73 color,
74 0.0f);
75}
76
77static void icon_draw_rect_input_text(const rctf *rect,
78 const char *str,
79 const float aspect,
80 const float alpha,
81 const bool inverted,
82 const int icon_bg = ICON_KEY_EMPTY1)
83{
84 icon_draw_icon(rect, icon_bg, aspect, alpha, inverted);
85
86 /* Margin to allow room between outer icon and text. */
87 const float margin = BLI_rctf_size_y(rect) * 0.12f;
88
89 const float available_height = BLI_rctf_size_y(rect) - (2.0f * margin);
90 const float available_width = BLI_rctf_size_x(rect) - (2.0f * margin);
91
92 const int font_id = BLF_default();
93 float color[4];
94 UI_GetThemeColor4fv(inverted ? TH_BACK : TH_TEXT, color);
95 if (alpha < 1.0f) {
96 color[3] *= alpha;
97 }
98 BLF_color4fv(font_id, color);
99
100 float font_size = available_height;
101 BLF_size(font_id, font_size);
102
103 rcti str_bounds;
104 BLF_boundbox(font_id, str, BLF_DRAW_STR_DUMMY_MAX, &str_bounds);
105 float width = float(BLI_rcti_size_x(&str_bounds));
106 float height = float(BLI_rcti_size_y(&str_bounds));
107 if (width > available_width) {
108 font_size *= available_width / width;
109 BLF_size(font_id, font_size);
110 BLF_boundbox(font_id, str, BLF_DRAW_STR_DUMMY_MAX, &str_bounds);
111 width = float(BLI_rcti_size_x(&str_bounds));
112 height = float(BLI_rcti_size_y(&str_bounds));
113 }
114
115 const float x = rect->xmin + margin + ((available_width - width) / 2.0f);
116 const float v_offset = ((available_height - height) / 2.0f) - str_bounds.ymin + margin;
117 BLF_position(font_id, x, rect->ymin + v_offset, 0.0f);
119}
120
121static void icon_draw_rect_input_icon(const rctf *rect,
122 const int icon,
123 const float aspect,
124 const float alpha,
125 const bool inverted,
126 const int icon_bg = ICON_KEY_EMPTY1)
127{
128 icon_draw_icon(rect, icon_bg, aspect, alpha, inverted);
129 icon_draw_icon(rect, icon, aspect, alpha, false);
130}
131
132float ui_event_icon_offset(const int icon_id)
133{
134 const enum {
135 UNIX,
136 MACOS,
137 MSWIN,
138 } platform =
139
140#if defined(__APPLE__)
141 MACOS
142#elif defined(_WIN32)
143 MSWIN
144#else
145 UNIX
146#endif
147 ;
148
149 if (ELEM(icon_id,
150 ICON_EVENT_ESC,
151 ICON_EVENT_DEL,
152 ICON_EVENT_HOME,
153 ICON_EVENT_END,
154 ICON_EVENT_PAGEUP,
155 ICON_EVENT_PAGEDOWN,
156 ICON_EVENT_BACKSPACE,
157 ICON_EVENT_PAUSE,
158 ICON_EVENT_INSERT,
159 ICON_EVENT_HYPER,
160 ICON_EVENT_APP))
161 {
162 return 1.07f;
163 }
164 if (icon_id >= ICON_EVENT_PAD0 && icon_id <= ICON_EVENT_PADPERIOD) {
165 return 1.07f;
166 }
167 if (icon_id >= ICON_EVENT_F10 && icon_id <= ICON_EVENT_F24) {
168 return 1.07f;
169 }
170 if (platform != MACOS && ELEM(icon_id, ICON_EVENT_CTRL, ICON_EVENT_ALT, ICON_EVENT_OS)) {
171 return 1.07f;
172 }
173 if (icon_id == ICON_EVENT_OS && platform != MACOS && platform != MSWIN) {
174 return 1.07f;
175 }
176 if (icon_id == ICON_EVENT_SPACEKEY) {
177 return 2.42f;
178 }
179 return -0.4f;
180}
181
182void icon_draw_rect_input(const float x,
183 const float y,
184 const int w,
185 const int h,
186 const int icon_id,
187 const float aspect,
188 const float alpha,
189 const bool inverted)
190{
191 rctf rect{};
192 rect.xmin = int(x);
193 rect.xmax = int(x + w);
194 rect.ymin = int(y);
195 rect.ymax = int(y + h);
196
197 const enum {
198 UNIX,
199 MACOS,
200 MSWIN,
201 } platform =
202
203#if defined(__APPLE__)
204 MACOS
205#elif defined(_WIN32)
206 MSWIN
207#else
208 UNIX
209#endif
210 ;
211
212 const float offset = ui_event_icon_offset(icon_id);
213 if (offset >= 2.0f) {
214 rect.xmax = rect.xmin + BLI_rctf_size_x(&rect) * 2.0f;
215 }
216 else if (offset >= 1.0f) {
217 rect.xmax = rect.xmin + BLI_rctf_size_x(&rect) * 1.5f;
218 }
219
220 if ((icon_id >= ICON_EVENT_A) && (icon_id <= ICON_EVENT_Z)) {
221 const char str[2] = {char('A' + (icon_id - ICON_EVENT_A)), '\0'};
222 icon_draw_rect_input_text(&rect, str, aspect, alpha, inverted);
223 }
224 else if ((icon_id >= ICON_EVENT_ZEROKEY) && (icon_id <= ICON_EVENT_NINEKEY)) {
225 const char str[2] = {char('0' + (icon_id - ICON_EVENT_ZEROKEY)), '\0'};
226 icon_draw_rect_input_text(&rect, str, aspect, alpha, inverted);
227 }
228 else if ((icon_id >= ICON_EVENT_F1) && (icon_id <= ICON_EVENT_F24)) {
229 char str[4];
230 SNPRINTF_UTF8(str, "F%d", 1 + (icon_id - ICON_EVENT_F1));
232 str,
233 aspect,
234 alpha,
235 inverted,
236 (icon_id >= ICON_EVENT_F10) ? ICON_KEY_EMPTY2 : ICON_KEY_EMPTY1);
237 }
238 if (icon_id == ICON_EVENT_SHIFT) {
239 icon_draw_icon(&rect, ICON_KEY_SHIFT, aspect, alpha, inverted);
240 }
241 else if (icon_id == ICON_EVENT_CTRL) {
242 if (platform == MACOS) {
243 icon_draw_icon(&rect, ICON_KEY_CONTROL, aspect, alpha, inverted);
244 }
245 else {
246 icon_draw_rect_input_text(&rect, IFACE_("Ctrl"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
247 }
248 }
249 else if (icon_id == ICON_EVENT_ALT) {
250 if (platform == MACOS) {
251 icon_draw_icon(&rect, ICON_KEY_OPTION, aspect, alpha, inverted);
252 }
253 else {
254 icon_draw_rect_input_text(&rect, IFACE_("Alt"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
255 }
256 }
257 else if (icon_id == ICON_EVENT_OS) {
258 if (platform == MACOS) {
259 icon_draw_icon(&rect, ICON_KEY_COMMAND, aspect, alpha, inverted);
260 }
261 else if (platform == MSWIN) {
262 icon_draw_icon(&rect, ICON_KEY_WINDOWS, aspect, alpha, inverted);
263 }
264 else {
265 icon_draw_rect_input_text(&rect, IFACE_("OS"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
266 }
267 }
268 else if (icon_id == ICON_EVENT_HYPER) {
269 icon_draw_rect_input_text(&rect, IFACE_("Hyp"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
270 }
271 else if (icon_id == ICON_EVENT_DEL) {
272 icon_draw_rect_input_text(&rect, IFACE_("Del"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
273 }
274 else if (icon_id == ICON_EVENT_TAB) {
275 icon_draw_icon(&rect, ICON_KEY_TAB, aspect, alpha, inverted);
276 }
277 else if (icon_id == ICON_EVENT_HOME) {
280 aspect,
281 alpha,
282 inverted,
283 ICON_KEY_EMPTY2);
284 }
285 else if (icon_id == ICON_EVENT_END) {
286 icon_draw_rect_input_text(&rect, IFACE_("End"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
287 }
288 else if (icon_id == ICON_EVENT_RETURN) {
289 icon_draw_icon(&rect, ICON_KEY_RETURN, aspect, alpha, inverted);
290 }
291 else if (icon_id == ICON_EVENT_ESC) {
292 icon_draw_rect_input_text(&rect, IFACE_("Esc"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
293 }
294 else if (icon_id == ICON_EVENT_PAGEUP) {
296 &rect, "Pg" BLI_STR_UTF8_UPWARDS_ARROW, aspect, alpha, inverted, ICON_KEY_EMPTY2);
297 }
298 else if (icon_id == ICON_EVENT_PAGEDOWN) {
300 &rect, "Pg" BLI_STR_UTF8_DOWNWARDS_ARROW, aspect, alpha, inverted, ICON_KEY_EMPTY2);
301 }
302 else if (icon_id == ICON_EVENT_LEFT_ARROW) {
303 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_LEFTWARDS_ARROW, aspect, alpha, inverted);
304 }
305 else if (icon_id == ICON_EVENT_UP_ARROW) {
306 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_UPWARDS_ARROW, aspect, alpha, inverted);
307 }
308 else if (icon_id == ICON_EVENT_RIGHT_ARROW) {
309 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_RIGHTWARDS_ARROW, aspect, alpha, inverted);
310 }
311 else if (icon_id == ICON_EVENT_DOWN_ARROW) {
312 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_DOWNWARDS_ARROW, aspect, alpha, inverted);
313 }
314 else if (icon_id == ICON_EVENT_SPACEKEY) {
317 aspect,
318 alpha,
319 inverted,
320 ICON_KEY_EMPTY3);
321 }
322 else if (icon_id == ICON_EVENT_MOUSE_4) {
324 &rect, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "4", aspect, alpha, inverted);
325 }
326 else if (icon_id == ICON_EVENT_MOUSE_5) {
328 &rect, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "5", aspect, alpha, inverted);
329 }
330 else if (icon_id == ICON_EVENT_MOUSE_6) {
332 &rect, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "6", aspect, alpha, inverted);
333 }
334 else if (icon_id == ICON_EVENT_MOUSE_7) {
336 &rect, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "7", aspect, alpha, inverted);
337 }
338 else if (icon_id == ICON_EVENT_TABLET_STYLUS) {
339 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_LOWER_RIGHT_PENCIL, aspect, alpha, inverted);
340 }
341 else if (icon_id == ICON_EVENT_TABLET_ERASER) {
342 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_UPPER_RIGHT_PENCIL, aspect, alpha, inverted);
343 }
344 else if ((icon_id >= ICON_EVENT_PAD0) && (icon_id <= ICON_EVENT_PAD9)) {
345 char str[5];
347 str, "%s%i", BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH, icon_id - ICON_EVENT_PAD0);
348 icon_draw_rect_input_text(&rect, str, aspect, alpha, inverted, ICON_KEY_EMPTY2);
349 }
350 else if (icon_id == ICON_EVENT_PADASTER) {
353 aspect,
354 alpha,
355 inverted,
356 ICON_KEY_EMPTY2);
357 }
358 else if (icon_id == ICON_EVENT_PADSLASH) {
361 aspect,
362 alpha,
363 inverted,
364 ICON_KEY_EMPTY2);
365 }
366 else if (icon_id == ICON_EVENT_PADMINUS) {
369 aspect,
370 alpha,
371 inverted,
372 ICON_KEY_EMPTY2);
373 }
374 else if (icon_id == ICON_EVENT_PADENTER) {
376 &rect,
378 aspect,
379 alpha,
380 inverted,
381 ICON_KEY_EMPTY2);
382 }
383 else if (icon_id == ICON_EVENT_PADPLUS) {
386 aspect,
387 alpha,
388 inverted,
389 ICON_KEY_EMPTY2);
390 }
391 else if (icon_id == ICON_EVENT_PADPERIOD) {
394 aspect,
395 alpha,
396 inverted,
397 ICON_KEY_EMPTY2);
398 }
399 else if (icon_id == ICON_EVENT_PAUSE) {
400 icon_draw_rect_input_text(&rect, IFACE_("Pause"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
401 }
402 else if (icon_id == ICON_EVENT_INSERT) {
403 icon_draw_rect_input_text(&rect, IFACE_("Insert"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
404 }
405 else if (icon_id == ICON_EVENT_UNKNOWN) {
406 icon_draw_rect_input_text(&rect, " ", aspect, alpha, inverted);
407 }
408 else if (icon_id == ICON_EVENT_GRLESS) {
410 &rect, BLI_STR_UTF8_GREATER_THAN_OR_LESS_THAN, aspect, alpha, inverted);
411 }
412 else if (icon_id == ICON_EVENT_MEDIAPLAY) {
415 aspect,
416 alpha,
417 inverted);
418 }
419 else if (icon_id == ICON_EVENT_MEDIASTOP) {
420 icon_draw_rect_input_text(&rect, BLI_STR_UTF8_BLACK_SQUARE_FOR_STOP, aspect, alpha, inverted);
421 }
422 else if (icon_id == ICON_EVENT_MEDIAFIRST) {
425 aspect,
426 alpha,
427 inverted);
428 }
429 else if (icon_id == ICON_EVENT_MEDIALAST) {
432 aspect,
433 alpha,
434 inverted);
435 }
436 else if (icon_id == ICON_EVENT_APP) {
437 icon_draw_rect_input_text(&rect, IFACE_("App"), aspect, alpha, inverted, ICON_KEY_EMPTY2);
438 }
439 else if (icon_id == ICON_EVENT_CAPSLOCK) {
441 &rect, BLI_STR_UTF8_UPWARDS_UP_ARROW_FROM_BAR, aspect, alpha, inverted);
442 }
443 else if (icon_id == ICON_EVENT_BACKSPACE) {
444 icon_draw_icon(&rect, ICON_KEY_BACKSPACE, aspect, alpha, inverted);
445 }
446 else if (icon_id == ICON_EVENT_SEMICOLON) {
447 icon_draw_rect_input_text(&rect, ";", aspect, alpha, inverted);
448 }
449 else if (icon_id == ICON_EVENT_PERIOD) {
450 icon_draw_rect_input_text(&rect, ".", aspect, alpha, inverted);
451 }
452 else if (icon_id == ICON_EVENT_COMMA) {
453 icon_draw_rect_input_text(&rect, ",", aspect, alpha, inverted);
454 }
455 else if (icon_id == ICON_EVENT_QUOTE) {
456 icon_draw_rect_input_text(&rect, "'", aspect, alpha, inverted);
457 }
458 else if (icon_id == ICON_EVENT_ACCENTGRAVE) {
459 icon_draw_rect_input_text(&rect, "`", aspect, alpha, inverted);
460 }
461 else if (icon_id == ICON_EVENT_MINUS) {
462 icon_draw_rect_input_text(&rect, "-", aspect, alpha, inverted);
463 }
464 else if (icon_id == ICON_EVENT_PLUS) {
465 icon_draw_rect_input_text(&rect, "+", aspect, alpha, inverted);
466 }
467 else if (icon_id == ICON_EVENT_SLASH) {
468 icon_draw_rect_input_text(&rect, "/", aspect, alpha, inverted);
469 }
470 else if (icon_id == ICON_EVENT_BACKSLASH) {
471 icon_draw_rect_input_text(&rect, "\\", aspect, alpha, inverted);
472 }
473 else if (icon_id == ICON_EVENT_EQUAL) {
474 icon_draw_rect_input_text(&rect, "=", aspect, alpha, inverted);
475 }
476 else if (icon_id == ICON_EVENT_LEFTBRACKET) {
477 icon_draw_rect_input_text(&rect, "[", aspect, alpha, inverted);
478 }
479 else if (icon_id == ICON_EVENT_RIGHTBRACKET) {
480 icon_draw_rect_input_text(&rect, "]", aspect, alpha, inverted);
481 }
482 else if (icon_id == ICON_EVENT_PAD_PAN) {
483 icon_draw_rect_input_icon(&rect, ICON_GESTURE_PAN, aspect, alpha, inverted);
484 }
485 else if (icon_id == ICON_EVENT_PAD_ROTATE) {
486 icon_draw_rect_input_icon(&rect, ICON_GESTURE_ROTATE, aspect, alpha, inverted);
487 }
488 else if (icon_id == ICON_EVENT_PAD_ZOOM) {
489 icon_draw_rect_input_icon(&rect, ICON_GESTURE_ZOOM, aspect, alpha, inverted);
490 }
491 else if (icon_id >= ICON_EVENT_NDOF_BUTTON_V1 && icon_id <= ICON_EVENT_NDOF_BUTTON_MINUS) {
492 if (/* `(icon_id >= ICON_EVENT_NDOF_BUTTON_V1) &&` */ (icon_id <= ICON_EVENT_NDOF_BUTTON_V3)) {
493 char str[7];
494 SNPRINTF_UTF8(str, "v%i", (icon_id + 1) - ICON_EVENT_NDOF_BUTTON_V1);
495 icon_draw_rect_input_text(&rect, str, aspect, alpha, inverted, ICON_KEY_RING);
496 }
497 if ((icon_id >= ICON_EVENT_NDOF_BUTTON_SAVE_V1) && (icon_id <= ICON_EVENT_NDOF_BUTTON_SAVE_V3))
498 {
499 char str[7];
500 SNPRINTF_UTF8(str, "s%i", (icon_id + 1) - ICON_EVENT_NDOF_BUTTON_SAVE_V1);
501 icon_draw_rect_input_text(&rect, str, aspect, alpha, inverted, ICON_KEY_RING);
502 }
503 else if ((icon_id >= ICON_EVENT_NDOF_BUTTON_1) && (icon_id <= ICON_EVENT_NDOF_BUTTON_12)) {
504 char str[7];
505 SNPRINTF_UTF8(str, "%i", (1 + icon_id) - ICON_EVENT_NDOF_BUTTON_1);
506 icon_draw_rect_input_text(&rect, str, aspect, alpha, inverted, ICON_KEY_RING);
507 }
508 else if (icon_id == ICON_EVENT_NDOF_BUTTON_MENU) {
509 icon_draw_rect_input_text(&rect, "Me", aspect, alpha, inverted, ICON_KEY_RING);
510 }
511 else if (icon_id == ICON_EVENT_NDOF_BUTTON_FIT) {
512 icon_draw_rect_input_text(&rect, "Ft", aspect, alpha, inverted, ICON_KEY_RING);
513 }
514 else if (icon_id == ICON_EVENT_NDOF_BUTTON_TOP) {
515 icon_draw_rect_input_text(&rect, "Tp", aspect, alpha, inverted, ICON_KEY_RING);
516 }
517 else if (icon_id == ICON_EVENT_NDOF_BUTTON_BOTTOM) {
518 icon_draw_rect_input_text(&rect, "Bt", aspect, alpha, inverted, ICON_KEY_RING);
519 }
520 else if (icon_id == ICON_EVENT_NDOF_BUTTON_LEFT) {
521 icon_draw_rect_input_text(&rect, "Le", aspect, alpha, inverted, ICON_KEY_RING);
522 }
523 else if (icon_id == ICON_EVENT_NDOF_BUTTON_RIGHT) {
524 icon_draw_rect_input_text(&rect, "Ri", aspect, alpha, inverted, ICON_KEY_RING);
525 }
526 else if (icon_id == ICON_EVENT_NDOF_BUTTON_FRONT) {
527 icon_draw_rect_input_text(&rect, "Fr", aspect, alpha, inverted, ICON_KEY_RING);
528 }
529 else if (icon_id == ICON_EVENT_NDOF_BUTTON_BACK) {
530 icon_draw_rect_input_text(&rect, "Bk", aspect, alpha, inverted, ICON_KEY_RING);
531 }
532 else if (icon_id == ICON_EVENT_NDOF_BUTTON_ISO1) {
533 icon_draw_rect_input_text(&rect, "I1", aspect, alpha, inverted, ICON_KEY_RING);
534 }
535 else if (icon_id == ICON_EVENT_NDOF_BUTTON_ISO2) {
536 icon_draw_rect_input_text(&rect, "I2", aspect, alpha, inverted, ICON_KEY_RING);
537 }
538 else if (icon_id == ICON_EVENT_NDOF_BUTTON_ROLL_CW) {
539 icon_draw_rect_input_text(&rect, "Rl", aspect, alpha, inverted, ICON_KEY_RING);
540 }
541 else if (icon_id == ICON_EVENT_NDOF_BUTTON_ROLL_CCW) {
542 icon_draw_rect_input_text(&rect, "Rc", aspect, alpha, inverted, ICON_KEY_RING);
543 }
544 else if (icon_id == ICON_EVENT_NDOF_BUTTON_SPIN_CW) {
545 icon_draw_rect_input_text(&rect, "Sp", aspect, alpha, inverted, ICON_KEY_RING);
546 }
547 else if (icon_id == ICON_EVENT_NDOF_BUTTON_SPIN_CCW) {
548 icon_draw_rect_input_text(&rect, "Sc", aspect, alpha, inverted, ICON_KEY_RING);
549 }
550 else if (icon_id == ICON_EVENT_NDOF_BUTTON_TILT_CW) {
551 icon_draw_rect_input_text(&rect, "Ti", aspect, alpha, inverted, ICON_KEY_RING);
552 }
553 else if (icon_id == ICON_EVENT_NDOF_BUTTON_TILT_CCW) {
554 icon_draw_rect_input_text(&rect, "Tc", aspect, alpha, inverted, ICON_KEY_RING);
555 }
556 else if (icon_id == ICON_EVENT_NDOF_BUTTON_ROTATE) {
557 icon_draw_rect_input_text(&rect, "Ro", aspect, alpha, inverted, ICON_KEY_RING);
558 }
559 else if (icon_id == ICON_EVENT_NDOF_BUTTON_PANZOOM) {
560 icon_draw_rect_input_text(&rect, "PZ", aspect, alpha, inverted, ICON_KEY_RING);
561 }
562 else if (icon_id == ICON_EVENT_NDOF_BUTTON_DOMINANT) {
563 icon_draw_rect_input_text(&rect, "Dm", aspect, alpha, inverted, ICON_KEY_RING);
564 }
565 else if (icon_id == ICON_EVENT_NDOF_BUTTON_PLUS) {
566 icon_draw_rect_input_text(&rect, "+", aspect, alpha, inverted, ICON_KEY_RING);
567 }
568 else if (icon_id == ICON_EVENT_NDOF_BUTTON_MINUS) {
569 icon_draw_rect_input_text(&rect, "-", aspect, alpha, inverted, ICON_KEY_RING);
570 }
571 }
572}
void BLF_draw_svg_icon(uint icon_id, float x, float y, float size, const float color[4]=nullptr, float outline_alpha=1.0f, bool multicolor=false, blender::FunctionRef< void(std::string &)> edit_source_cb=nullptr)
Definition blf.cc:625
void BLF_size(int fontid, float size)
Definition blf.cc:443
void BLF_color4fv(int fontid, const float rgba[4])
Definition blf.cc:505
void BLF_boundbox(int fontid, const char *str, size_t str_len, rcti *r_box, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:772
#define BLF_DRAW_STR_DUMMY_MAX
Definition BLF_api.hh:440
int BLF_default()
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:585
void BLF_position(int fontid, float x, float y, float z)
Definition blf.cc:388
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.h:202
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.h:206
#define SNPRINTF_UTF8(dst, format,...)
#define BLI_STR_UTF8_LOWER_RIGHT_PENCIL
#define BLI_STR_UTF8_GREATER_THAN_OR_LESS_THAN
#define BLI_STR_UTF8_LEFTWARDS_ARROW
#define BLI_STR_UTF8_UPWARDS_ARROW
#define BLI_STR_UTF8_DOWNWARDS_ARROW
#define BLI_STR_UTF8_UPWARDS_UP_ARROW_FROM_BAR
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR
#define BLI_STR_UTF8_BLACK_SQUARE_FOR_STOP
#define BLI_STR_UTF8_UPPER_RIGHT_PENCIL
#define BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH
#define BLI_STR_UTF8_RIGHTWARDS_ARROW
#define BLI_STR_UTF8_RETURN_SYMBOL
#define BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE
#define BLI_STR_UTF8_BLACK_LEFT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_TRIANGLE_WITH_DOUBLE_VERTICAL_BAR
unsigned int uint
#define ELEM(...)
#define CTX_IFACE_(context, msgid)
#define IFACE_(msgid)
#define BLT_I18NCONTEXT_UI_EVENTS
#define ICON_DEFAULT_HEIGHT
@ TH_BACK
@ TH_TEXT
void UI_GetThemeColor4fv(int colorid, float col[4])
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
nullptr float
#define str(s)
static int inverted_icon(int icon_id)
static void icon_draw_rect_input_text(const rctf *rect, const char *str, const float aspect, const float alpha, const bool inverted, const int icon_bg=ICON_KEY_EMPTY1)
static void icon_draw_rect_input_icon(const rctf *rect, const int icon, const float aspect, const float alpha, const bool inverted, const int icon_bg=ICON_KEY_EMPTY1)
static void icon_draw_icon(const rctf *rect, const int icon_id, const float aspect, const float alpha, const bool inverted)
void icon_draw_rect_input(const float x, const float y, const int w, const int h, const int icon_id, const float aspect, const float alpha, const bool inverted)
float ui_event_icon_offset(const int icon_id)
float xmax
float xmin
float ymax
float ymin
int ymin