From 9573bf432c4b06d940b4b38cc455826f47518884 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Apr 2019 21:13:22 +0200 Subject: UI: move top-bar into the spaces header Currently this is only in the 3D viewport however all spaces that use the tool-system will have this region added. D4680 by @brecht with own updates. --- source/blender/editors/include/ED_screen.h | 11 ++++ .../editors/interface/interface_context_menu.c | 2 +- .../blender/editors/interface/interface_handlers.c | 6 +- .../interface/interface_region_menu_popup.c | 2 +- .../editors/interface/interface_region_popover.c | 2 +- .../editors/interface/interface_templates.c | 7 +-- source/blender/editors/screen/area.c | 68 ++++++++++++++++++---- source/blender/editors/screen/screen_edit.c | 22 +++---- source/blender/editors/screen/screen_ops.c | 29 +++++++-- source/blender/editors/space_image/space_image.c | 18 ++++++ source/blender/editors/space_topbar/space_topbar.c | 4 -- source/blender/editors/space_view3d/space_view3d.c | 48 ++++++++++++++- 12 files changed, 176 insertions(+), 43 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 04bbbbdf25f..b4349ff6cc7 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -131,10 +131,21 @@ bool ED_region_snap_size_apply(struct ARegion *ar, int snap_flag); void ED_region_do_msg_notify_tag_redraw(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); +void ED_area_do_msg_notify_tag_redraw(struct bContext *C, + struct wmMsgSubscribeKey *msg_key, + struct wmMsgSubscribeValue *msg_val); void ED_area_do_msg_notify_tag_refresh(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); +void ED_area_do_mgs_subscribe_for_tool_header(const struct bContext *C, + struct WorkSpace *workspace, + struct Scene *scene, + struct bScreen *screen, + struct ScrArea *sa, + struct ARegion *ar, + struct wmMsgBus *mbus); + /* message bus */ void ED_region_message_subscribe(struct bContext *C, struct WorkSpace *workspace, diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index c8800f495ce..b6d9863f9b5 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -1064,7 +1064,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) if (!ar) { /* skip */ } - else if (ar->regiontype == RGN_TYPE_HEADER) { + else if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL); } else if (ar->regiontype == RGN_TYPE_NAV_BAR) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e9914ce6f24..72aa9920248 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1778,7 +1778,11 @@ static bool ui_but_drag_init(bContext *C, /* Initialize alignment for single row/column regions, * otherwise we use the relative position of the first other button dragged over. */ - if (ELEM(data->region->regiontype, RGN_TYPE_NAV_BAR, RGN_TYPE_HEADER, RGN_TYPE_FOOTER)) { + if (ELEM(data->region->regiontype, + RGN_TYPE_NAV_BAR, + RGN_TYPE_HEADER, + RGN_TYPE_TOOL_HEADER, + RGN_TYPE_FOOTER)) { int lock_axis = -1; if (ELEM(data->region->alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) { lock_axis = 0; diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index d364bf7e102..b97cbcdfef5 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -279,7 +279,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); if (sa && ar) { - if (ar->regiontype == RGN_TYPE_HEADER) { + if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { if (ED_area_header_alignment(sa) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); UI_block_order_flip(block); diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index bbf3df6a264..110c8827849 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -187,7 +187,7 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v } /* Prefer popover from header to be positioned into the editor. */ else if (sa && ar) { - if (ar->regiontype == RGN_TYPE_HEADER) { + if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { if (ED_area_header_alignment(sa) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X); } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 76d82b93ad1..bbff2c16636 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -127,11 +127,8 @@ static void template_add_button_search_menu(const bContext *C, if (use_previews) { ARegion *region = CTX_wm_region(C); - ScrArea *area = CTX_wm_area(C); - /* XXX ugly top-bar exception */ - const bool use_big_size = ( - /* silly check, could be more generic */ - (region->regiontype != RGN_TYPE_HEADER) && (area->spacetype != SPACE_TOPBAR)); + /* Ugly tool header exception. */ + const bool use_big_size = (region->regiontype != RGN_TYPE_TOOL_HEADER); /* Ugly exception for screens here, * drawing their preview in icon size looks ugly/useless */ const bool use_preview_icon = use_big_size || (id && (GS(id->name) != ID_SCR)); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1aa54bcd8b5..250a4171e8a 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -421,17 +421,18 @@ static void region_draw_status_text(ScrArea *sa, ARegion *ar) BLF_draw(fontid, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX); } -/* Follow wmMsgNotifyFn spec */ -void ED_region_do_msg_notify_tag_redraw(bContext *UNUSED(C), - wmMsgSubscribeKey *UNUSED(msg_key), - wmMsgSubscribeValue *msg_val) +void ED_region_do_msg_notify_tag_redraw( + /* Follow wmMsgNotifyFn spec */ + bContext *UNUSED(C), + wmMsgSubscribeKey *UNUSED(msg_key), + wmMsgSubscribeValue *msg_val) { ARegion *ar = msg_val->owner; ED_region_tag_redraw(ar); /* This avoids _many_ situations where header/properties control display settings. * the common case is space properties in the header */ - if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_UI)) { + if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_UI)) { while (ar && ar->prev) { ar = ar->prev; } @@ -442,15 +443,48 @@ void ED_region_do_msg_notify_tag_redraw(bContext *UNUSED(C), } } } -/* Follow wmMsgNotifyFn spec */ -void ED_area_do_msg_notify_tag_refresh(bContext *UNUSED(C), - wmMsgSubscribeKey *UNUSED(msg_key), - wmMsgSubscribeValue *msg_val) +/** + * Use #ED_region_do_msg_notify_tag_redraw where possible, this draws too much typically. + */ +void ED_area_do_msg_notify_tag_redraw( + /* Follow wmMsgNotifyFn spec */ + bContext *UNUSED(C), + wmMsgSubscribeKey *UNUSED(msg_key), + wmMsgSubscribeValue *msg_val) +{ + ScrArea *sa = msg_val->owner; + ED_area_tag_redraw(sa); +} +void ED_area_do_msg_notify_tag_refresh( + /* Follow wmMsgNotifyFn spec */ + bContext *UNUSED(C), + wmMsgSubscribeKey *UNUSED(msg_key), + wmMsgSubscribeValue *msg_val) { ScrArea *sa = msg_val->user_data; ED_area_tag_refresh(sa); } +void ED_area_do_mgs_subscribe_for_tool_header( + /* Follow ARegionType.message_subscribe */ + const struct bContext *UNUSED(C), + struct WorkSpace *workspace, + struct Scene *UNUSED(scene), + struct bScreen *UNUSED(screen), + struct ScrArea *sa, + struct ARegion *UNUSED(ar), + struct wmMsgBus *mbus) +{ + /* TODO(campbell): investigate why ED_region_do_msg_notify_tag_redraw doesn't work here. */ + wmMsgSubscribeValue msg_sub_value_region_tag_redraw = { + .owner = sa, + .user_data = sa, + .notify = ED_area_do_msg_notify_tag_redraw, + }; + WM_msg_subscribe_rna_prop( + mbus, &workspace->id, workspace, WorkSpace, tools, &msg_sub_value_region_tag_redraw); +} + /** * Although there's no general support for minimizing areas, the status-bar can * be snapped to be only a few pixels high. A few pixels rather than 0 so it @@ -931,7 +965,7 @@ static bool region_azone_edge_poll(const ARegion *ar, const bool is_fullscreen) if (is_hidden && is_fullscreen) { return false; } - if (!is_hidden && ar->regiontype == RGN_TYPE_HEADER) { + if (!is_hidden && ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { return false; } @@ -1011,6 +1045,12 @@ static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *ar, c { const bool is_fullscreen = screen->state == SCREENFULL; + /* Only display tab or icons when the header region is hidden + * (not the tool header - they overlap). */ + if (ar->regiontype == RGN_TYPE_TOOL_HEADER) { + return; + } + /* edge code (t b l r) is along which area edge azone will be drawn */ if (alignment == RGN_ALIGN_TOP) region_azone_edge_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT, is_fullscreen); @@ -1183,6 +1223,9 @@ static void region_rect_recursive( else if (ar->regiontype == RGN_TYPE_HEADER) { prefsizey = ED_area_headersize(); } + else if (ar->regiontype == RGN_TYPE_TOOL_HEADER) { + prefsizey = ED_area_headersize(); + } else if (ar->regiontype == RGN_TYPE_FOOTER) { prefsizey = ED_area_footersize(); } @@ -1937,7 +1980,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi /* Spaces with footer. */ if (st->spaceid == SPACE_TEXT) { for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_HEADER) { + if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { ar->alignment = header_alignment; } if (ar->regiontype == RGN_TYPE_FOOTER) { @@ -1950,7 +1993,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi } else { for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_HEADER) { + if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { ar->alignment = header_alignment; break; } @@ -2035,6 +2078,7 @@ static ThemeColorID region_background_color_id(const bContext *C, const ARegion switch (region->regiontype) { case RGN_TYPE_HEADER: + case RGN_TYPE_TOOL_HEADER: if (ED_screen_area_active(C) || ED_area_is_global(area)) { return TH_HEADER; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 8caa960bb9a..259076f194f 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -428,6 +428,10 @@ static void screen_refresh_headersizes(void) if (art) art->prefsizey = ED_area_headersize(); + art = BKE_regiontype_from_id(st, RGN_TYPE_TOOL_HEADER); + if (art) + art->prefsizey = ED_area_headersize(); + art = BKE_regiontype_from_id(st, RGN_TYPE_FOOTER); if (art) art->prefsizey = ED_area_headersize(); @@ -679,7 +683,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) if (do_draw) { for (ar = area_iter->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_HEADER) { + if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { ED_region_tag_redraw_no_rebuild(ar); } } @@ -813,16 +817,14 @@ static int screen_global_header_size(void) static void screen_global_topbar_area_refresh(wmWindow *win, bScreen *screen) { - const short size_min = screen_global_header_size(); - const short size_max = 2.25 * screen_global_header_size(); - const short size = (screen->flag & SCREEN_COLLAPSE_TOPBAR) ? size_min : size_max; + const short size = screen_global_header_size(); rcti rect; BLI_rcti_init(&rect, 0, WM_window_pixels_x(win) - 1, 0, WM_window_pixels_y(win) - 1); - rect.ymin = rect.ymax - size_max; + rect.ymin = rect.ymax - size; screen_global_area_refresh( - win, screen, SPACE_TOPBAR, GLOBAL_AREA_ALIGN_TOP, &rect, size, size_min, size_max); + win, screen, SPACE_TOPBAR, GLOBAL_AREA_ALIGN_TOP, &rect, size, size, size); } static void screen_global_statusbar_area_refresh(wmWindow *win, bScreen *screen) @@ -845,14 +847,11 @@ void ED_screen_global_areas_sync(wmWindow *win) * global areas should just become part of the screen instead. */ bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); - screen->flag &= ~(SCREEN_COLLAPSE_STATUSBAR | SCREEN_COLLAPSE_TOPBAR); + screen->flag &= ~SCREEN_COLLAPSE_STATUSBAR; for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { if (area->global->cur_fixed_height == area->global->size_min) { - if (area->spacetype == SPACE_TOPBAR) { - screen->flag |= SCREEN_COLLAPSE_TOPBAR; - } - else if (area->spacetype == SPACE_STATUSBAR) { + if (area->spacetype == SPACE_STATUSBAR) { screen->flag |= SCREEN_COLLAPSE_STATUSBAR; } } @@ -1278,6 +1277,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_HEADER, + RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER, RGN_TYPE_TOOLS, RGN_TYPE_NAV_BAR, diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 07f60552ce4..4e39f56ddee 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1324,7 +1324,7 @@ static void area_move_set_limits( int size_max = ED_area_global_max_size_y(area) - 1; size_min = max_ii(size_min, 0); - BLI_assert(size_min < size_max); + BLI_assert(size_min <= size_max); /* logic here is only tested for lower edge :) */ /* left edge */ @@ -2338,12 +2338,12 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) } else if (scalear->alignment == RGN_ALIGN_TOP && (ar->alignment == RGN_ALIGN_BOTTOM || - ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_FOOTER))) { + ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) { dist -= ar->winy; } else if (scalear->alignment == RGN_ALIGN_BOTTOM && (ar->alignment == RGN_ALIGN_TOP || - ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_FOOTER))) { + ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) { dist -= ar->winy; } } @@ -2430,6 +2430,18 @@ static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd) region_toggle_hidden(C, rmd->ar, 0); region_scale_validate_size(rmd); + + if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) { + if (rmd->ar->regiontype == RGN_TYPE_HEADER) { + ARegion *ar_tool_header = BKE_area_find_region_type(rmd->sa, RGN_TYPE_TOOL_HEADER); + if (ar_tool_header != NULL) { + if ((ar_tool_header->flag & RGN_FLAG_HIDDEN_BY_USER) == 0 && + (ar_tool_header->flag & RGN_FLAG_HIDDEN) != 0) { + region_toggle_hidden(C, ar_tool_header, 0); + } + } + } + } } static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) @@ -3794,11 +3806,16 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN ARegion *ar = CTX_wm_region(C); const char *but_flip_str = (ar->alignment == RGN_ALIGN_TOP) ? IFACE_("Flip to Bottom") : IFACE_("Flip to Top"); - - if (!ELEM(sa->spacetype, SPACE_TOPBAR)) { + { PointerRNA ptr; RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, sa->spacedata.first, &ptr); uiItemR(layout, &ptr, "show_region_header", 0, IFACE_("Show Header"), ICON_NONE); + if (BKE_area_find_region_type(sa, RGN_TYPE_TOOL_HEADER)) { + ARegion *ar_header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + uiLayoutSetActive(layout, (ar_header->flag & RGN_FLAG_HIDDEN) == 0); + uiItemR(layout, &ptr, "show_region_tool_header", 0, IFACE_("Show Tool Settings"), ICON_NONE); + uiLayoutSetActive(layout, true); + } } /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */ @@ -4058,7 +4075,7 @@ static int match_region_with_redraws(int spacetype, if (redraws & TIME_ALL_BUTS_WIN) return 1; } - else if (regiontype == RGN_TYPE_HEADER) { + else if (ELEM(regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { if (spacetype == SPACE_ACTION) return 1; } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index ded19b10300..1e1d1e570b3 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -134,6 +134,13 @@ static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sce scopes_new(&simage->scopes); simage->sample_line_hist.height = 100; + /* tool header */ + ar = MEM_callocN(sizeof(ARegion), "tool header for image"); + + BLI_addtail(&simage->regionbase, ar); + ar->regiontype = RGN_TYPE_TOOL_HEADER; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + /* header */ ar = MEM_callocN(sizeof(ARegion), "header for image"); @@ -1033,6 +1040,17 @@ void ED_spacetype_image(void) art->draw = image_tools_region_draw; BLI_addhead(&st->regiontypes, art); + /* regions: tool header */ + art = MEM_callocN(sizeof(ARegionType), "spacetype image tool header region"); + art->regionid = RGN_TYPE_TOOL_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; + art->listener = image_header_region_listener; + art->init = image_header_region_init; + art->draw = image_header_region_draw; + art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header; + BLI_addhead(&st->regiontypes, art); + /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); art->regionid = RGN_TYPE_HEADER; diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index 46a86bcbc86..8b290009a97 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -71,10 +71,6 @@ static SpaceLink *topbar_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sc ar->alignment = RGN_ALIGN_RIGHT | RGN_SPLIT_PREV; /* main regions */ - ar = MEM_callocN(sizeof(ARegion), "right aligned main region for topbar"); - BLI_addtail(&stopbar->regionbase, ar); - ar->regiontype = RGN_TYPE_WINDOW; - ar->alignment = RGN_ALIGN_RIGHT; ar = MEM_callocN(sizeof(ARegion), "main region of topbar"); BLI_addtail(&stopbar->regionbase, ar); ar->regiontype = RGN_TYPE_WINDOW; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index a829584b580..8a0d1b5b322 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -293,6 +293,13 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene) v3d->vertex_opacity = 1.0f; v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES; + /* tool header */ + ar = MEM_callocN(sizeof(ARegion), "tool header for view3d"); + + BLI_addtail(&v3d->regionbase, ar); + ar->regiontype = RGN_TYPE_TOOL_HEADER; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + /* header */ ar = MEM_callocN(sizeof(ARegion), "header for view3d"); @@ -1120,6 +1127,34 @@ static void view3d_header_region_listener(wmWindow *UNUSED(win), } break; } + + /* From topbar, which ones are needed? split per header? */ + /* Disable for now, re-enable if neede, or remove - campbell. */ +#if 0 + /* context changes */ + switch (wmn->category) { + case NC_WM: + if (wmn->data == ND_HISTORY) { + ED_region_tag_redraw(ar); + } + break; + case NC_SCENE: + if (wmn->data == ND_MODE) { + ED_region_tag_redraw(ar); + } + break; + case NC_SPACE: + if (wmn->data == ND_SPACE_VIEW3D) { + ED_region_tag_redraw(ar); + } + break; + case NC_GPENCIL: + if (wmn->data == ND_DATA) { + ED_region_tag_redraw(ar); + } + break; + } +#endif } static void view3d_header_region_message_subscribe(const struct bContext *UNUSED(C), @@ -1489,6 +1524,17 @@ void ED_spacetype_view3d(void) art->draw = view3d_tools_region_draw; BLI_addhead(&st->regiontypes, art); + /* regions: tool header */ + art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tool header region"); + art->regionid = RGN_TYPE_TOOL_HEADER; + art->prefsizey = HEADERY; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; + art->listener = view3d_header_region_listener; + art->init = view3d_header_region_init; + art->draw = view3d_header_region_draw; + art->message_subscribe = view3d_header_region_message_subscribe; + BLI_addhead(&st->regiontypes, art); + /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region"); art->regionid = RGN_TYPE_HEADER; @@ -1497,7 +1543,7 @@ void ED_spacetype_view3d(void) art->listener = view3d_header_region_listener; art->init = view3d_header_region_init; art->draw = view3d_header_region_draw; - art->message_subscribe = view3d_header_region_message_subscribe; + art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header; BLI_addhead(&st->regiontypes, art); /* regions: hud */ -- cgit v1.2.3