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
diff options
context:
space:
mode:
authorGeorge Vogiatzis <Gvgeo>2019-04-05 14:48:26 +0300
committerJacques Lucke <mail@jlucke.com>2019-04-05 14:48:26 +0300
commita180b754eb40637a5d37eeb0ae60066f5a6f93d8 (patch)
tree3871e253a8f3b861b27dfd3f666535adffc606b0 /source/blender/editors/screen/screen_ops.c
parentfce469a30c5075216671f9ce3738ed401ad9c03f (diff)
Interface: New region type 'Footer', used by text editor
* It can be hidden by dragging it up/down. * It can be at the top or bottom, independent of the header. * It uses the color theme from the header. * It does not change its color, when the area becomes active. Currently, it is used in the text editor to display the file path. Differential Revision: https://developer.blender.org/D4601
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r--source/blender/editors/screen/screen_ops.c108
1 files changed, 104 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index ed96621a906..09ca0476b10 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2317,12 +2317,13 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
dist -= ar->winx;
}
else if (scalear->alignment == RGN_ALIGN_TOP &&
- (ar->alignment == RGN_ALIGN_BOTTOM || ar->regiontype == RGN_TYPE_HEADER))
+ (ar->alignment == RGN_ALIGN_BOTTOM || ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_FOOTER)))
{
dist -= ar->winy;
}
else if (scalear->alignment == RGN_ALIGN_BOTTOM &&
- (ar->alignment == RGN_ALIGN_TOP || ar->regiontype == RGN_TYPE_HEADER)) {
+ (ar->alignment == RGN_ALIGN_TOP || ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_FOOTER)))
+ {
dist -= ar->winy;
}
}
@@ -2469,8 +2470,8 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
CLAMP(rmd->ar->sizey, 0, rmd->maxsize);
- /* note, 'UI_UNIT_Y/4' means you need to drag the header almost
- * all the way down for it to become hidden, this is done
+ /* note, 'UI_UNIT_Y/4' means you need to drag the footer and execute region
+ * almost all the way down for it to become hidden, this is done
* otherwise its too easy to do this by accident */
if (rmd->ar->sizey < UI_UNIT_Y / 4) {
rmd->ar->sizey = rmd->origval;
@@ -3850,6 +3851,103 @@ static void SCREEN_OT_header_context_menu(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Footer Toggle Operator
+ * \{ */
+
+static int footer_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ ARegion *ar = screen_find_region_type(C, RGN_TYPE_FOOTER);
+
+ if (ar == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
+ ar->flag ^= RGN_FLAG_HIDDEN;
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+static void SCREEN_OT_footer(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Toggle Footer";
+ ot->description = "Toggle footer display";
+ ot->idname = "SCREEN_OT_footer";
+
+ /* api callbacks */
+ ot->exec = footer_exec;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Footer Tools Operator
+ * \{ */
+
+static bool footer_context_menu_poll(bContext *C)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ return sa;
+}
+
+void ED_screens_footer_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 Footer"), ICON_NONE, "SCREEN_OT_footer");
+
+ /* 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");
+
+
+ /* 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");
+ }
+}
+
+static int footer_context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ pup = UI_popup_menu_begin(C, IFACE_("Footer"), ICON_NONE);
+ layout = UI_popup_menu_layout(pup);
+
+ ED_screens_footer_tools_menu_create(C, layout, NULL);
+
+ UI_popup_menu_end(C, pup);
+
+ return OPERATOR_INTERFACE;
+}
+
+static void SCREEN_OT_footer_context_menu(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Footer Context Menu";
+ ot->description = "Display footer region context menu";
+ ot->idname = "SCREEN_OT_footer_context_menu";
+
+ /* api callbacks */
+ ot->poll = footer_context_menu_poll;
+ ot->invoke = footer_context_menu_invoke;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Navigation Bar Tools Menu
* \{ */
@@ -4968,6 +5066,8 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_header);
WM_operatortype_append(SCREEN_OT_header_toggle_menus);
WM_operatortype_append(SCREEN_OT_header_context_menu);
+ WM_operatortype_append(SCREEN_OT_footer);
+ WM_operatortype_append(SCREEN_OT_footer_context_menu);
WM_operatortype_append(SCREEN_OT_screen_set);
WM_operatortype_append(SCREEN_OT_screen_full_area);
WM_operatortype_append(SCREEN_OT_back_to_previous);