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