forked from bartvdbraak/blender
Add a "Header" sub-menu to the right-click one of all buttons in a header area. Also header tools entries are now translatable!
This commit is contained in:
parent
0aa26903f5
commit
b25bea036f
@ -111,6 +111,7 @@ ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
|
||||
void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
|
||||
void ED_screen_full_restore(struct bContext *C, ScrArea *sa);
|
||||
struct ScrArea *ED_screen_full_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa);
|
||||
void ED_screens_header_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg);
|
||||
|
||||
/* anim */
|
||||
void ED_update_for_newframe(struct Main *bmain, struct Scene *scene, int mute);
|
||||
|
@ -4501,6 +4501,7 @@ static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
|
||||
|
||||
static int ui_but_menu(bContext *C, uiBut *but)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
int length;
|
||||
@ -4724,6 +4725,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
/* Show header tools for header buttons. */
|
||||
if (ar->regiontype == RGN_TYPE_HEADER) {
|
||||
uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL);
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
{ /* Docs */
|
||||
char buf[512];
|
||||
|
@ -2850,32 +2850,37 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot)
|
||||
}
|
||||
|
||||
/* ************** header tools operator ***************************** */
|
||||
|
||||
static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
|
||||
void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
pup = uiPupMenuBegin(C, "Header", ICON_NONE);
|
||||
layout = uiPupMenuLayout(pup);
|
||||
|
||||
// XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator
|
||||
/* XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator. */
|
||||
if (ar->alignment == RGN_ALIGN_TOP)
|
||||
uiItemO(layout, "Flip to Bottom", ICON_NONE, "SCREEN_OT_header_flip");
|
||||
uiItemO(layout, IFACE_("Flip to Bottom"), ICON_NONE, "SCREEN_OT_header_flip");
|
||||
else
|
||||
uiItemO(layout, "Flip to Top", ICON_NONE, "SCREEN_OT_header_flip");
|
||||
uiItemO(layout, IFACE_("Flip to Top"), ICON_NONE, "SCREEN_OT_header_flip");
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
/* file browser should be fullscreen all the time, but other regions can be maximized/restored... */
|
||||
if (sa->spacetype != SPACE_FILE) {
|
||||
if (sa->full)
|
||||
uiItemO(layout, "Tile Area", ICON_NONE, "SCREEN_OT_screen_full_area");
|
||||
uiItemO(layout, IFACE_("Tile Area"), ICON_NONE, "SCREEN_OT_screen_full_area");
|
||||
else
|
||||
uiItemO(layout, "Maximize Area", ICON_NONE, "SCREEN_OT_screen_full_area");
|
||||
uiItemO(layout, IFACE_("Maximize Area"), ICON_NONE, "SCREEN_OT_screen_full_area");
|
||||
}
|
||||
}
|
||||
|
||||
static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
|
||||
{
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
pup = uiPupMenuBegin(C, N_("Header"), ICON_NONE);
|
||||
layout = uiPupMenuLayout(pup);
|
||||
|
||||
ED_screens_header_tools_menu_create(C, layout, NULL);
|
||||
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user