Cleanup: Make panel function static

These functions were not used elsewhere, and the handling for the panel
tabs should be kept local to this file where possible. Also remove
another unused function and removed an unecessary "_ex" function.
This commit is contained in:
Hans Goudey 2020-11-04 15:54:56 -06:00
parent 76416f336a
commit f888f3aa1f
2 changed files with 3 additions and 27 deletions

View File

@ -1708,16 +1708,9 @@ struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *region,
const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallback);
void UI_panel_category_active_set(struct ARegion *region, const char *idname);
void UI_panel_category_active_set_default(struct ARegion *region, const char *idname);
struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *region,
const int x,
const int y);
struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *region,
const struct wmEvent *event);
void UI_panel_category_clear_all(struct ARegion *region);
void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active);
struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname);
/* Panel custom data. */
struct PointerRNA *UI_panel_custom_data_get(const struct Panel *panel);
struct PointerRNA *UI_region_panel_custom_data_under_cursor(const struct bContext *C,

View File

@ -2305,10 +2305,10 @@ const char *UI_panel_category_active_get(ARegion *region, bool set_fallback)
return NULL;
}
PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const int x, const int y)
static PanelCategoryDyn *panel_categories_find_mouse_over(ARegion *region, const wmEvent *event)
{
LISTBASE_FOREACH (PanelCategoryDyn *, ptd, &region->panels_category) {
if (BLI_rcti_isect_pt(&ptd->rect, x, y)) {
if (BLI_rcti_isect_pt(&ptd->rect, event->mval[0], event->mval[1])) {
return ptd;
}
}
@ -2316,11 +2316,6 @@ PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const in
return NULL;
}
PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *region, const wmEvent *event)
{
return UI_panel_category_find_mouse_over_ex(region, event->mval[0], event->mval[1]);
}
void UI_panel_category_add(ARegion *region, const char *name)
{
PanelCategoryDyn *pc_dyn = MEM_callocN(sizeof(*pc_dyn), __func__);
@ -2416,7 +2411,7 @@ int ui_handler_panel_region(bContext *C,
/* Handle category tabs. */
if (UI_panel_category_is_visible(region)) {
if (event->type == LEFTMOUSE) {
PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(region, event);
PanelCategoryDyn *pc_dyn = panel_categories_find_mouse_over(region, event);
if (pc_dyn) {
UI_panel_category_active_set(region, pc_dyn->idname);
ED_region_tag_redraw(region);
@ -2670,16 +2665,4 @@ static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelS
ED_region_tag_redraw(region);
}
PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname)
{
SpaceType *st = BKE_spacetype_from_id(space_id);
if (st) {
ARegionType *art = BKE_regiontype_from_id(st, region_id);
if (art) {
return BLI_findstring(&art->paneltypes, idname, offsetof(PanelType, idname));
}
}
return NULL;
}
/** \} */