Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_layout.c
| Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "CLG_log.h" | |||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| /* Show an icon button after each RNA button to use to quickly set keyframes, | /* Show an icon button after each RNA button to use to quickly set keyframes, | ||||
| * this is a way to display animation/driven/override status, see T54951. */ | * this is a way to display animation/driven/override status, see T54951. */ | ||||
| #define UI_PROP_DECORATE | #define UI_PROP_DECORATE | ||||
| /* Alternate draw mode where some buttons can use single icon width, | /* Alternate draw mode where some buttons can use single icon width, | ||||
| * giving more room for the text at the expense of nicely aligned text. */ | * giving more room for the text at the expense of nicely aligned text. */ | ||||
| #define UI_PROP_SEP_ICON_WIDTH_EXCEPTION | #define UI_PROP_SEP_ICON_WIDTH_EXCEPTION | ||||
| static CLG_LogRef LOG = {"interface.layout"}; | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Structs and Defines | /** \name Structs and Defines | ||||
| * \{ */ | * \{ */ | ||||
| #define UI_OPERATOR_ERROR_RET(_ot, _opname, return_statement) \ | #define UI_OPERATOR_ERROR_RET(_ot, _opname, return_statement) \ | ||||
| if (ot == NULL) { \ | if (ot == NULL) { \ | ||||
| ui_item_disabled(layout, _opname); \ | ui_item_disabled(layout, _opname); \ | ||||
| RNA_warning("'%s' unknown operator", _opname); \ | RNA_warning("'%s' unknown operator", _opname); \ | ||||
| ▲ Show 20 Lines • Show All 3,230 Lines • ▼ Show 20 Lines | |||||
| /* Flexible spacing. */ | /* Flexible spacing. */ | ||||
| void uiItemSpacer(uiLayout *layout) | void uiItemSpacer(uiLayout *layout) | ||||
| { | { | ||||
| uiBlock *block = layout->root->block; | uiBlock *block = layout->root->block; | ||||
| const bool is_popup = ui_block_is_popup_any(block); | const bool is_popup = ui_block_is_popup_any(block); | ||||
| if (is_popup) { | if (is_popup) { | ||||
| printf("Error: separator_spacer() not supported in popups.\n"); | CLOG_STR_ERROR(&LOG, "separator_spacer() not supported in popups"); | ||||
| return; | return; | ||||
| } | } | ||||
| if (block->direction & UI_DIR_RIGHT) { | if (block->direction & UI_DIR_RIGHT) { | ||||
| printf("Error: separator_spacer() only supported in horizontal blocks.\n"); | CLOG_STR_ERROR(&LOG, "separator_spacer() only supported in horizontal blocks"); | ||||
| return; | return; | ||||
| } | } | ||||
| UI_block_layout_set_current(block, layout); | UI_block_layout_set_current(block, layout); | ||||
| uiDefBut(block, | uiDefBut(block, | ||||
| UI_BTYPE_SEPR_SPACER, | UI_BTYPE_SEPR_SPACER, | ||||
| 0, | 0, | ||||
| "", | "", | ||||
| ▲ Show 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | |||||
| /* calculates the angle of a specified button in a radial menu, | /* calculates the angle of a specified button in a radial menu, | ||||
| * stores a float vector in unit circle */ | * stores a float vector in unit circle */ | ||||
| static RadialDirection ui_get_radialbut_vec(float vec[2], short itemnum) | static RadialDirection ui_get_radialbut_vec(float vec[2], short itemnum) | ||||
| { | { | ||||
| RadialDirection dir; | RadialDirection dir; | ||||
| if (itemnum >= PIE_MAX_ITEMS) { | if (itemnum >= PIE_MAX_ITEMS) { | ||||
| itemnum %= PIE_MAX_ITEMS; | itemnum %= PIE_MAX_ITEMS; | ||||
| printf("Warning: Pie menus with more than %i items are currently unsupported\n", | CLOG_WARN(&LOG, | ||||
| "Warning: Pie menus with more than %i items are currently unsupported", | |||||
| PIE_MAX_ITEMS); | PIE_MAX_ITEMS); | ||||
| } | } | ||||
| dir = ui_radial_dir_order[itemnum]; | dir = ui_radial_dir_order[itemnum]; | ||||
| ui_but_pie_dir(dir, vec); | ui_but_pie_dir(dir, vec); | ||||
| return dir; | return dir; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,756 Lines • ▼ Show 20 Lines | |||||
| void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout) | void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout) | ||||
| { | { | ||||
| Menu menu = { | Menu menu = { | ||||
| .layout = layout, | .layout = layout, | ||||
| .type = mt, | .type = mt, | ||||
| }; | }; | ||||
| if (G.debug & G_DEBUG_WM) { | CLOG_VERBOSE(&LOG, 3, "opening menu \"%s\"", mt->idname); | ||||
| printf("%s: opening menu \"%s\"\n", __func__, mt->idname); | |||||
| } | |||||
| if (layout->context) { | if (layout->context) { | ||||
| CTX_store_set(C, layout->context); | CTX_store_set(C, layout->context); | ||||
| } | } | ||||
| mt->draw(C, &menu); | mt->draw(C, &menu); | ||||
| if (layout->context) { | if (layout->context) { | ||||
| ▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines | |||||