Cleanup: add simplified panel callbacks

This commit is contained in:
Campbell Barton 2018-06-11 19:30:48 +02:00
parent d4b4504260
commit 691471fe22
14 changed files with 33 additions and 24 deletions

View File

@ -78,12 +78,16 @@ void ED_region_tag_redraw_no_rebuild(struct ARegion *ar);
void ED_region_tag_refresh_ui(struct ARegion *ar);
void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar);
void ED_region_panels_ex(
const struct bContext *C, struct ARegion *ar,
const char *contexts[], int contextnr, const bool vertical);
void ED_region_panels(
const struct bContext *C, struct ARegion *ar);
void ED_region_panels_layout_ex(
const struct bContext *C, struct ARegion *ar,
const char *contexts[], int contextnr, const bool vertical);
void ED_region_panels_layout(
const struct bContext *C, struct ARegion *ar,
const char *contexts[], int contextnr, const bool vertical);
const struct bContext *C, struct ARegion *ar);
void ED_region_panels_draw(
const struct bContext *C, struct ARegion *ar);

View File

@ -1891,7 +1891,7 @@ static void ed_panel_draw(const bContext *C,
* Matching against any of these strings will draw the panel.
* Can be NULL to skip context checks.
*/
void ED_region_panels_layout(
void ED_region_panels_layout_ex(
const bContext *C, ARegion *ar,
const char *contexts[], int contextnr, const bool vertical)
{
@ -2097,12 +2097,19 @@ void ED_region_panels_draw(const bContext *C, ARegion *ar)
UI_view2d_scrollers_free(scrollers);
}
void ED_region_panels(
void ED_region_panels_ex(
const bContext *C, ARegion *ar,
const char *contexts[], int contextnr, const bool vertical)
{
/* TODO: remove? */
ED_region_panels_layout(C, ar, contexts, contextnr, vertical);
ED_region_panels_layout_ex(C, ar, contexts, contextnr, vertical);
ED_region_panels_draw(C, ar);
}
void ED_region_panels(const bContext *C, ARegion *ar)
{
/* TODO: remove? */
ED_region_panels_layout_ex(C, ar, NULL, -1, true);
ED_region_panels_draw(C, ar);
}

View File

@ -752,7 +752,7 @@ static void action_buttons_area_init(wmWindowManager *wm, ARegion *ar)
static void action_buttons_area_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void action_region_listener(

View File

@ -203,9 +203,7 @@ static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *
break;
}
if (contexts[0]) {
ED_region_panels(C, ar, contexts, sbuts->mainb, vertical);
}
ED_region_panels_layout_ex(C, ar, contexts, sbuts->mainb, vertical);
}
static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts, ARegion *ar)
@ -265,7 +263,7 @@ static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts,
/* TODO */
}
ED_region_panels_layout(C, ar, contexts, -1, vertical);
ED_region_panels_layout_ex(C, ar, contexts, -1, vertical);
}
static void buttons_main_region_layout(const bContext *C, ARegion *ar)

View File

@ -1435,7 +1435,7 @@ static void clip_tools_region_init(wmWindowManager *wm, ARegion *ar)
static void clip_tools_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
/****************** tool properties region ******************/
@ -1484,7 +1484,7 @@ static void clip_properties_region_draw(const bContext *C, ARegion *ar)
BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes);
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void clip_properties_region_listener(

View File

@ -636,7 +636,7 @@ static void file_tools_region_init(wmWindowManager *wm, ARegion *ar)
static void file_tools_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void file_tools_region_listener(

View File

@ -422,7 +422,7 @@ static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void graph_buttons_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void graph_region_listener(

View File

@ -869,7 +869,7 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void image_buttons_region_listener(
@ -944,7 +944,7 @@ static void image_tools_region_draw(const bContext *C, ARegion *ar)
}
ED_space_image_release_buffer(sima, ibuf, lock);
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void image_tools_region_listener(

View File

@ -360,7 +360,7 @@ static void nla_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void nla_buttons_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void nla_region_listener(

View File

@ -603,7 +603,7 @@ static void node_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void node_buttons_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
/* add handlers, stuff you only do once or on area/region changes */
@ -619,7 +619,7 @@ static void node_toolbar_region_init(wmWindowManager *wm, ARegion *ar)
static void node_toolbar_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)

View File

@ -708,7 +708,7 @@ static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void sequencer_buttons_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void sequencer_buttons_region_listener(

View File

@ -551,7 +551,7 @@ static void text_properties_region_draw(const bContext *C, ARegion *ar)
{
SpaceText *st = CTX_wm_space_text(C);
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
/* this flag trick is make sure buttons have been added already */
if (st->flags & ST_FIND_ACTIVATE) {

View File

@ -113,7 +113,7 @@ static void userpref_main_region_init(wmWindowManager *wm, ARegion *ar)
static void userpref_main_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void userpref_operatortypes(void)

View File

@ -1232,7 +1232,7 @@ static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *ar)
static void view3d_buttons_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, NULL, -1, true);
ED_region_panels(C, ar);
}
static void view3d_buttons_region_listener(
@ -1361,7 +1361,7 @@ static void view3d_tools_region_init(wmWindowManager *wm, ARegion *ar)
static void view3d_tools_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, (const char * []){CTX_data_mode_string(C), NULL}, -1, true);
ED_region_panels_ex(C, ar, (const char * []){CTX_data_mode_string(C), NULL}, -1, true);
}
/* area (not region) level listener */