Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_region_menu_popup.c
| Show All 17 Lines | |||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup edinterface | * \ingroup edinterface | ||||
| * | * | ||||
| * PopUp Menu Region | * PopUp Menu Region | ||||
| */ | */ | ||||
| #include <CLG_log.h> | |||||
| #include <assert.h> | #include <assert.h> | ||||
| #include <stdarg.h> | #include <stdarg.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| Show All 19 Lines | |||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| #include "interface_regions_intern.h" | #include "interface_regions_intern.h" | ||||
| static CLG_LogRef LOG = {"interface.menu_popup"}; | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Utility Functions | /** \name Utility Functions | ||||
| * \{ */ | * \{ */ | ||||
| bool ui_but_menu_step_poll(const uiBut *but) | bool ui_but_menu_step_poll(const uiBut *but) | ||||
| { | { | ||||
| BLI_assert(but->type == UI_BTYPE_MENU); | BLI_assert(but->type == UI_BTYPE_MENU); | ||||
| Show All 9 Lines | if (but->menu_step_func) { | ||||
| return but->menu_step_func(but->block->evil_C, direction, but->poin); | return but->menu_step_func(but->block->evil_C, direction, but->poin); | ||||
| } | } | ||||
| const int curval = RNA_property_enum_get(&but->rnapoin, but->rnaprop); | const int curval = RNA_property_enum_get(&but->rnapoin, but->rnaprop); | ||||
| return RNA_property_enum_step( | return RNA_property_enum_step( | ||||
| but->block->evil_C, &but->rnapoin, but->rnaprop, curval, direction); | but->block->evil_C, &but->rnapoin, but->rnaprop, curval, direction); | ||||
| } | } | ||||
| printf("%s: cannot cycle button '%s'\n", __func__, but->str); | CLOG_WARN(&LOG, "cannot cycle button '%s'", but->str); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| static uint ui_popup_string_hash(const char *str, const bool use_sep) | static uint ui_popup_string_hash(const char *str, const bool use_sep) | ||||
| { | { | ||||
| /* sometimes button contains hotkey, sometimes not, strip for proper compare */ | /* sometimes button contains hotkey, sometimes not, strip for proper compare */ | ||||
| int hash; | int hash; | ||||
| const char *delimit = use_sep ? strrchr(str, UI_SEP_CHAR) : NULL; | const char *delimit = use_sep ? strrchr(str, UI_SEP_CHAR) : NULL; | ||||
| ▲ Show 20 Lines • Show All 593 Lines • Show Last 20 Lines | |||||