diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-19 12:53:06 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-19 13:26:45 +0300 |
commit | a277804c25853610876abdb68b54d9c678618eb7 (patch) | |
tree | 6afc69394409d1b9fea2b896ec82fa497585d70a /source/blender/editors/screen/screen_ops.c | |
parent | d2979279582e790f0e6c264696d339a1b81f0bfc (diff) |
UI: tweak header context menu, gray out items when they have no effect
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 4e39f56ddee..5e88af31a7c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3810,12 +3810,21 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN 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); + + ARegion *ar_header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); + uiLayout *col = uiLayoutColumn(layout, 0); + uiLayoutSetActive(col, (ar_header->flag & RGN_FLAG_HIDDEN) == 0); + 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); + uiItemR(col, &ptr, "show_region_tool_header", 0, IFACE_("Show Tool Settings"), ICON_NONE); } + + uiItemO(col, + IFACE_("Show Menus"), + (sa->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT, + "SCREEN_OT_header_toggle_menus"); + + uiItemS(layout); } /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */ @@ -3825,11 +3834,6 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip"); } - uiItemO(layout, - IFACE_("Collapse Menus"), - (sa->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT, - "SCREEN_OT_header_toggle_menus"); - /* File browser should be fullscreen all the time, top-bar should * never be. But other regions can be maximized/restored. */ if (!ELEM(sa->spacetype, SPACE_FILE, SPACE_TOPBAR)) { |