Cleanup: add simplified panel callbacks
This commit is contained in:
@@ -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_tag_refresh_ui(struct ARegion *ar);
|
||||||
|
|
||||||
void ED_region_panels_init(struct wmWindowManager *wm, 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(
|
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 struct bContext *C, struct ARegion *ar,
|
||||||
const char *contexts[], int contextnr, const bool vertical);
|
const char *contexts[], int contextnr, const bool vertical);
|
||||||
void ED_region_panels_layout(
|
void ED_region_panels_layout(
|
||||||
const struct bContext *C, struct ARegion *ar,
|
const struct bContext *C, struct ARegion *ar);
|
||||||
const char *contexts[], int contextnr, const bool vertical);
|
|
||||||
void ED_region_panels_draw(
|
void ED_region_panels_draw(
|
||||||
const struct bContext *C, struct ARegion *ar);
|
const struct bContext *C, struct ARegion *ar);
|
||||||
|
|
||||||
|
|||||||
@@ -1891,7 +1891,7 @@ static void ed_panel_draw(const bContext *C,
|
|||||||
* Matching against any of these strings will draw the panel.
|
* Matching against any of these strings will draw the panel.
|
||||||
* Can be NULL to skip context checks.
|
* Can be NULL to skip context checks.
|
||||||
*/
|
*/
|
||||||
void ED_region_panels_layout(
|
void ED_region_panels_layout_ex(
|
||||||
const bContext *C, ARegion *ar,
|
const bContext *C, ARegion *ar,
|
||||||
const char *contexts[], int contextnr, const bool vertical)
|
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);
|
UI_view2d_scrollers_free(scrollers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ED_region_panels(
|
void ED_region_panels_ex(
|
||||||
const bContext *C, ARegion *ar,
|
const bContext *C, ARegion *ar,
|
||||||
const char *contexts[], int contextnr, const bool vertical)
|
const char *contexts[], int contextnr, const bool vertical)
|
||||||
{
|
{
|
||||||
/* TODO: remove? */
|
/* 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);
|
ED_region_panels_draw(C, ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
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(
|
static void action_region_listener(
|
||||||
|
|||||||
@@ -203,9 +203,7 @@ static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contexts[0]) {
|
ED_region_panels_layout_ex(C, ar, contexts, sbuts->mainb, vertical);
|
||||||
ED_region_panels(C, ar, contexts, sbuts->mainb, vertical);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts, ARegion *ar)
|
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 */
|
/* 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)
|
static void buttons_main_region_layout(const bContext *C, ARegion *ar)
|
||||||
|
|||||||
@@ -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)
|
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 ******************/
|
/****************** 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);
|
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(
|
static void clip_properties_region_listener(
|
||||||
|
|||||||
@@ -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)
|
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(
|
static void file_tools_region_listener(
|
||||||
|
|||||||
@@ -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)
|
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(
|
static void graph_region_listener(
|
||||||
|
|||||||
@@ -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)
|
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(
|
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_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(
|
static void image_tools_region_listener(
|
||||||
|
|||||||
@@ -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)
|
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(
|
static void nla_region_listener(
|
||||||
|
|||||||
@@ -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)
|
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 */
|
/* 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)
|
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)
|
static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
|
||||||
|
|||||||
@@ -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)
|
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(
|
static void sequencer_buttons_region_listener(
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ static void text_properties_region_draw(const bContext *C, ARegion *ar)
|
|||||||
{
|
{
|
||||||
SpaceText *st = CTX_wm_space_text(C);
|
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 */
|
/* this flag trick is make sure buttons have been added already */
|
||||||
if (st->flags & ST_FIND_ACTIVATE) {
|
if (st->flags & ST_FIND_ACTIVATE) {
|
||||||
|
|||||||
@@ -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)
|
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)
|
static void userpref_operatortypes(void)
|
||||||
|
|||||||
@@ -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)
|
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(
|
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)
|
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 */
|
/* area (not region) level listener */
|
||||||
|
|||||||
Reference in New Issue
Block a user