Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-06 14:37:39 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-06 15:32:25 +0300
commitb0c32818ba401a81c18f89f931d4336d8e859bc2 (patch)
treebcf20bb1f097ce6950085dacc4a5870b6eaffe0a /source
parent9fc79a403374d06a23080df6249c207357009716 (diff)
UI: small layout fixes for RMB context menus.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/screen/screen_ops.c20
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c16
2 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index ab0fbfacf93..4a8ab724c9a 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3659,27 +3659,38 @@ static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot)
/** \name Header Tools Operator
* \{ */
+static bool header_context_menu_poll(bContext *C)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ return (sa && sa->spacetype != SPACE_STATUSBAR);
+}
+
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);
const char *but_flip_str = (ar->alignment == RGN_ALIGN_TOP) ? IFACE_("Flip to Bottom") : IFACE_("Flip to Top");
- uiItemO(layout, IFACE_("Toggle Header"), ICON_NONE, "SCREEN_OT_header");
+ if (!ELEM(sa->spacetype, SPACE_TOPBAR)) {
+ uiItemO(layout, IFACE_("Toggle Header"), ICON_NONE, "SCREEN_OT_header");
+ }
/* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
- uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
+ if (!ELEM(sa->spacetype, SPACE_TOPBAR)) {
+ 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");
- uiItemS(layout);
-
/* file browser should be fullscreen all the time, topbar should
* never be. But other regions can be maximized/restored... */
if (!ELEM(sa->spacetype, SPACE_FILE, SPACE_TOPBAR)) {
+ uiItemS(layout);
+
const char *but_str = sa->full ? IFACE_("Tile Area") : IFACE_("Maximize Area");
uiItemO(layout, but_str, ICON_NONE, "SCREEN_OT_screen_full_area");
}
@@ -3708,6 +3719,7 @@ static void SCREEN_OT_header_context_menu(wmOperatorType *ot)
ot->idname = "SCREEN_OT_header_context_menu";
/* api callbacks */
+ ot->poll = header_context_menu_poll;
ot->invoke = header_context_menu_invoke;
}
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 93670919d4c..fb2907983c8 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -64,17 +64,9 @@
static int context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
- bScreen *sc = CTX_wm_screen(C);
- SpaceButs *sbuts = CTX_wm_space_buts(C);
- PointerRNA ptr;
- uiPopupMenu *pup;
- uiLayout *layout;
-
- RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr);
-
- pup = UI_popup_menu_begin(C, IFACE_("Align"), ICON_NONE);
- layout = UI_popup_menu_layout(pup);
- uiItemsEnumR(layout, &ptr, "align");
+ uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Context Menu"), ICON_NONE);
+ uiLayout *layout = UI_popup_menu_layout(pup);
+ uiItemM(layout, "INFO_MT_area", NULL, ICON_NONE);
UI_popup_menu_end(C, pup);
return OPERATOR_INTERFACE;
@@ -84,7 +76,7 @@ void BUTTONS_OT_context_menu(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Context Menu";
- ot->description = "Display button panel context_menu";
+ ot->description = "Display properties editor context_menu";
ot->idname = "BUTTONS_OT_context_menu";
/* api callbacks */