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_prevspace(struct bContext *C, ScrArea *sa);
|
||||||
void ED_screen_full_restore(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);
|
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 */
|
/* anim */
|
||||||
void ED_update_for_newframe(struct Main *bmain, struct Scene *scene, int mute);
|
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)
|
static int ui_but_menu(bContext *C, uiBut *but)
|
||||||
{
|
{
|
||||||
|
ARegion *ar = CTX_wm_region(C);
|
||||||
uiPopupMenu *pup;
|
uiPopupMenu *pup;
|
||||||
uiLayout *layout;
|
uiLayout *layout;
|
||||||
int length;
|
int length;
|
||||||
@ -4724,7 +4725,12 @@ static int ui_but_menu(bContext *C, uiBut *but)
|
|||||||
uiItemS(layout);
|
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 */
|
{ /* Docs */
|
||||||
char buf[512];
|
char buf[512];
|
||||||
PointerRNA ptr_props;
|
PointerRNA ptr_props;
|
||||||
|
@ -2850,35 +2850,40 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ************** header tools operator ***************************** */
|
/* ************** header tools operator ***************************** */
|
||||||
|
void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
|
||||||
static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
|
|
||||||
{
|
{
|
||||||
ScrArea *sa = CTX_wm_area(C);
|
ScrArea *sa = CTX_wm_area(C);
|
||||||
ARegion *ar = CTX_wm_region(C);
|
ARegion *ar = CTX_wm_region(C);
|
||||||
uiPopupMenu *pup;
|
|
||||||
uiLayout *layout;
|
/* XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator. */
|
||||||
|
|
||||||
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
|
|
||||||
if (ar->alignment == RGN_ALIGN_TOP)
|
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
|
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);
|
uiItemS(layout);
|
||||||
|
|
||||||
/* file browser should be fullscreen all the time, but other regions can be maximized/restored... */
|
/* file browser should be fullscreen all the time, but other regions can be maximized/restored... */
|
||||||
if (sa->spacetype != SPACE_FILE) {
|
if (sa->spacetype != SPACE_FILE) {
|
||||||
if (sa->full)
|
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
|
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);
|
uiPupMenuEnd(C, pup);
|
||||||
|
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user