UI: move modal operator text from headers to status bar.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 26 Jun 2018 15:19:25 +0000 (17:19 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 26 Jun 2018 17:45:55 +0000 (19:45 +0200)
Python API is context.workspace.status_text_set()

40 files changed:
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/space_statusbar.py
release/scripts/templates_py/manipulator_custom_geometry.py
release/scripts/templates_py/operator_modal_view3d.py
source/blender/blenkernel/intern/screen.c
source/blender/blenkernel/intern/workspace.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/armature/pose_lib.c
source/blender/editors/armature/pose_slide.c
source/blender/editors/gpencil/gpencil_brush.c
source/blender/editors/gpencil/gpencil_interpolate.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_screen.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_templates.c
source/blender/editors/mesh/editmesh_bevel.c
source/blender/editors/mesh/editmesh_bisect.c
source/blender/editors/mesh/editmesh_inset.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_loopcut.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_node/node_relationships.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_ruler.c
source/blender/editors/space_view3d/view3d_walk.c
source/blender/editors/transform/transform.c
source/blender/editors/uvedit/uvedit_smart_stitch.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/makesdna/DNA_screen_types.h
source/blender/makesdna/DNA_workspace_types.h
source/blender/makesrna/intern/rna_screen.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_workspace_api.c
source/blender/windowmanager/intern/wm_operators.c

index b6f77505410796202075db8f544660e9e6d5dc77..8a520edb70e1d28f81502156b2973b75d633a148 100644 (file)
@@ -828,17 +828,17 @@ class WM_OT_context_modal_mouse(Operator):
                     header_text = header_text % eval("item.%s" % self.data_path_item)
                 else:
                     header_text = (self.header_text % delta) + " (delta)"
-                context.area.header_text_set(header_text)
+                context.workspace.status_text_set(header_text)
 
         elif 'LEFTMOUSE' == event_type:
             item = next(iter(self._values.keys()))
             self._values_clear()
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return operator_value_undo_return(item)
 
         elif event_type in {'RIGHTMOUSE', 'ESC'}:
             self._values_restore()
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
index a738eb315e72adcd00b2b6aee07a7c96d7fcde4b..b0cfe424d3edbc3db17083d825251c3936edc507 100644 (file)
@@ -39,7 +39,7 @@ class STATUSBAR_HT_header(Header):
     def draw_left(self, context):
         layout = self.layout
 
-        layout.template_cursor_keymap()
+        layout.template_input_status()
 
     def draw_center(self, context):
         layout = self.layout
index 48bb6956f8578655fbe7f21d6058568ebd8626b4..7ebd864e69fe696eb422af9f68ff75c63a27a7fb 100644 (file)
@@ -96,7 +96,7 @@ class MyCustomShapeWidget(Manipulator):
         return {'RUNNING_MODAL'}
 
     def exit(self, context, cancel):
-        context.area.header_text_set()
+        context.workspace.status_text_set()
         if cancel:
             self.target_set_value("offset", self.init_value)
 
@@ -108,7 +108,7 @@ class MyCustomShapeWidget(Manipulator):
             delta /= 10.0
         value = self.init_value + delta
         self.target_set_value("offset", value)
-        context.area.header_text_set("My Manipulator: %.4f" % value)
+        context.workspace.status_text_set("My Manipulator: %.4f" % value)
         return {'RUNNING_MODAL'}
 
 
index c870bbffdcfabb6d61633074e051201a52d47dad..ed8d031285d514eb90e14634be77acad8bf5fa1f 100644 (file)
@@ -26,15 +26,15 @@ class ViewOperator(bpy.types.Operator):
         if event.type == 'MOUSEMOVE':
             self.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02
             self.execute(context)
-            context.area.header_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
+            context.workspace.status_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
 
         elif event.type == 'LEFTMOUSE':
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return {'FINISHED'}
 
         elif event.type in {'RIGHTMOUSE', 'ESC'}:
             rv3d.view_location = self._initial_location
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
index 4a840b5ffbee90f028325e4b33586f45057a77a9..049c73322c84c3c8d742747190a00aebc69c787e 100644 (file)
@@ -224,7 +224,6 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
        newar->visible = 0;
        newar->manipulator_map = NULL;
        newar->regiontimer = NULL;
-       newar->headerstr = NULL;
        newar->draw_buffer = NULL;
 
        /* use optional regiondata callback */
index 3a9a392da4a000a2c51d419bb955567ea1655466..2e5798cd172d9262608b3f81a263ddfc6d1e1a20 100644 (file)
@@ -173,6 +173,11 @@ void BKE_workspace_free(WorkSpace *workspace)
                }
        }
        BLI_freelistN(&workspace->tools);
+
+       if (workspace->status_text) {
+               MEM_freeN(workspace->status_text);
+               workspace->status_text = NULL;
+       }
 }
 
 /**
index 65692e2d15e89b5ef0920f540c4562375eb4b693..a8fec123477e9f63f03e0487e6bfead2d0cf0b3e 100644 (file)
@@ -2946,6 +2946,8 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main
                tref->properties = newdataadr(fd, tref->properties);
                IDP_DirectLinkGroup_OrFree(&tref->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
        }
+
+       workspace->status_text = NULL;
 }
 
 static void lib_link_workspace_instance_hook(FileData *fd, WorkSpaceInstanceHook *hook, ID *id)
@@ -6460,7 +6462,6 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
        BLI_listbase_clear(&ar->panels_category);
        BLI_listbase_clear(&ar->handlers);
        BLI_listbase_clear(&ar->uiblocks);
-       ar->headerstr = NULL;
        ar->visible = 0;
        ar->type = NULL;
        ar->do_draw = 0;
index e957e84857a8a5597a824c03f06e8644329b545b..c4fbc86a38979c6127547e734497e453fdce5a45 100644 (file)
@@ -769,7 +769,7 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
                BLI_snprintf(str, sizeof(str), IFACE_("Marker offset %s"), str_offs);
        }
 
-       ED_area_headerprint(CTX_wm_area(C), str);
+       ED_workspace_status_text(C, str);
 }
 
 /* copy selection to temp buffer */
@@ -829,7 +829,7 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
        op->customdata = NULL;
 
        /* clear custom header prints */
-       ED_area_headerprint(CTX_wm_area(C), NULL);
+       ED_workspace_status_text(C, NULL);
 }
 
 static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
index b9c4584ff15028b2d1ec413ffcc24e3a337f87e5..b5ae950a28a86769edfd67ee689c980ed17b8261 100644 (file)
@@ -1118,7 +1118,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
                        BLI_strncpy(pld->headerstr,
                                    IFACE_("PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again"),
                                    sizeof(pld->headerstr));
-                       ED_area_headerprint(pld->sa, pld->headerstr);
+                       ED_workspace_status_text(C, pld->headerstr);
                }
                else if (pld->searchstr[0]) {
                        char tempstr[65];
@@ -1145,14 +1145,14 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
                                            "Current Pose - \"%s\"  | "
                                            "Use ScrollWheel or PageUp/Down to change"),
                                     tempstr, markern);
-                       ED_area_headerprint(pld->sa, pld->headerstr);
+                       ED_workspace_status_text(C, pld->headerstr);
                }
                else {
                        BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
                                     IFACE_("PoseLib Previewing Pose: \"%s\"  | "
                                            "Use ScrollWheel or PageUp/Down to change"),
                                     pld->marker->name);
-                       ED_area_headerprint(pld->sa, pld->headerstr);
+                       ED_workspace_status_text(C, pld->headerstr);
                }
        }
 
@@ -1602,7 +1602,7 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
        TimeMarker *marker = pld->marker;
 
        /* redraw the header so that it doesn't show any of our stuff anymore */
-       ED_area_headerprint(pld->sa, NULL);
+       ED_workspace_status_text(C, NULL);
 
        /* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
        pose->flag |= POSE_DO_UNLOCK;
index b82535f013b046d195f23476a4b6c3e16619a869..4f2e2397ef41228ba083030034b316b84dfa9d48 100644 (file)
@@ -627,7 +627,7 @@ static void pose_slide_reset(tPoseSlideOp *pso)
 
 /* draw percentage indicator in header */
 // TODO: Include hints about locks here...
-static void pose_slide_draw_status(tPoseSlideOp *pso)
+static void pose_slide_draw_status(bContext *C, tPoseSlideOp *pso)
 {
        char status_str[UI_MAX_DRAW_STR];
        char limits_str[UI_MAX_DRAW_STR];
@@ -705,7 +705,7 @@ static void pose_slide_draw_status(tPoseSlideOp *pso)
                BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%     |   %s", mode_str, (int)(pso->percentage * 100.0f), limits_str);
        }
 
-       ED_area_headerprint(pso->sa, status_str);
+       ED_workspace_status_text(C, status_str);
 }
 
 /* common code for invoke() methods */
@@ -781,7 +781,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p
        WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR);
 
        /* header print */
-       pose_slide_draw_status(pso);
+       pose_slide_draw_status(C, pso);
 
        /* add a modal handler for this operator */
        WM_event_add_modal_handler(C, op);
@@ -857,7 +857,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
                case PADENTER:
                {
                        /* return to normal cursor and header status */
-                       ED_area_headerprint(pso->sa, NULL);
+                       ED_workspace_status_text(C, NULL);
                        WM_cursor_modal_restore(win);
 
                        /* insert keyframes as required... */
@@ -872,7 +872,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
                case RIGHTMOUSE:
                {
                        /* return to normal cursor and header status */
-                       ED_area_headerprint(pso->sa, NULL);
+                       ED_workspace_status_text(C, NULL);
                        WM_cursor_modal_restore(win);
 
                        /* reset transforms back to original state */
@@ -997,7 +997,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
        /* perform pose updates - in response to some user action (e.g. pressing a key or moving the mouse) */
        if (do_pose_update) {
                /* update percentage indicator in header */
-               pose_slide_draw_status(pso);
+               pose_slide_draw_status(C, pso);
 
                /* reset transforms (to avoid accumulation errors) */
                pose_slide_reset(pso);
index f9284d71db35664894584c78d273f048d02cc2e8..5eb3321b414cd396a804bb985564a4b1d59da76e 100644 (file)
@@ -1042,7 +1042,7 @@ static void gpsculpt_brush_header_set(bContext *C, tGP_BrushEditData *gso)
                            " | Shift-Wheel Up/Down for Strength"),
                     (brush_name) ? brush_name : "<?>");
 
-       ED_area_headerprint(CTX_wm_area(C), str);
+       ED_workspace_status_text(C, str);
 }
 
 /* ************************************************ */
@@ -1176,7 +1176,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
        }
 
        /* disable cursor and headerprints */
-       ED_area_headerprint(CTX_wm_area(C), NULL);
+       ED_workspace_status_text(C, NULL);
        WM_cursor_modal_restore(win);
        gpencil_toggle_brush_cursor(C, false);
 
index ff3f5b2085805da96381f402b37a3f35b9d528c6..d7e4be676e5c4392fdc935278402dccfb6f7d292 100644 (file)
@@ -352,7 +352,7 @@ static void gpencil_mouse_update_shift(tGPDinterpolate *tgpi, wmOperator *op, co
 }
 
 /* Helper: Draw status message while the user is running the operator */
-static void gpencil_interpolate_status_indicators(tGPDinterpolate *p)
+static void gpencil_interpolate_status_indicators(bContext *C, tGPDinterpolate *p)
 {
        Scene *scene = p->scene;
        char status_str[UI_MAX_DRAW_STR];
@@ -370,14 +370,14 @@ static void gpencil_interpolate_status_indicators(tGPDinterpolate *p)
                BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", msg_str, (int)((p->init_factor + p->shift)  * 100.0f));
        }
 
-       ED_area_headerprint(p->sa, status_str);
+       ED_workspace_status_text(C, status_str);
 }
 
 /* Update screen and stroke */
 static void gpencil_interpolate_update(bContext *C, wmOperator *op, tGPDinterpolate *tgpi)
 {
        /* update shift indicator in header */
-       gpencil_interpolate_status_indicators(tgpi);
+       gpencil_interpolate_status_indicators(C, tgpi);
        /* apply... */
        tgpi->shift = RNA_float_get(op->ptr, "shift");
        /* update points position */
@@ -403,7 +403,7 @@ static void gpencil_interpolate_exit(bContext *C, wmOperator *op)
                }
 
                /* clear status message area */
-               ED_area_headerprint(tgpi->sa, NULL);
+               ED_workspace_status_text(C, NULL);
 
                /* finally, free memory used by temp data */
                for (tgpil = tgpi->ilayers.first; tgpil; tgpil = tgpil->next) {
@@ -526,7 +526,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
        WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR);
 
        /* update shift indicator in header */
-       gpencil_interpolate_status_indicators(tgpi);
+       gpencil_interpolate_status_indicators(C, tgpi);
        WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
 
        /* add a modal handler for this operator */
@@ -550,7 +550,7 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
                case RETKEY:
                {
                        /* return to normal cursor and header status */
-                       ED_area_headerprint(tgpi->sa, NULL);
+                       ED_workspace_status_text(C, NULL);
                        WM_cursor_modal_restore(win);
 
                        /* insert keyframes as required... */
@@ -585,7 +585,7 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
                case RIGHTMOUSE:
                {
                        /* return to normal cursor and header status */
-                       ED_area_headerprint(tgpi->sa, NULL);
+                       ED_workspace_status_text(C, NULL);
                        WM_cursor_modal_restore(win);
 
                        /* clean up temp data */
index c8f1901d075770e51a11cc6b2eb3c21a9344b47d..800c899f9c2081209f0b7cfec4f3d60237df3c19 100644 (file)
@@ -2025,38 +2025,38 @@ static void gpencil_draw_cursor_set(tGPsdata *p)
 }
 
 /* update UI indicators of status, including cursor and header prints */
-static void gpencil_draw_status_indicators(tGPsdata *p)
+static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p)
 {
        /* header prints */
        switch (p->status) {
                case GP_STATUS_PAINTING:
                        /* only print this for paint-sessions, otherwise it gets annoying */
                        if (GPENCIL_SKETCH_SESSIONS_ON(p->scene))
-                               ED_area_headerprint(p->sa, IFACE_("Grease Pencil: Drawing/erasing stroke... Release to end stroke"));
+                               ED_workspace_status_text(C, IFACE_("Grease Pencil: Drawing/erasing stroke... Release to end stroke"));
                        break;
 
                case GP_STATUS_IDLING:
                        /* print status info */
                        switch (p->paintmode) {
                                case GP_PAINTMODE_ERASER:
-                                       ED_area_headerprint(p->sa, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | "
+                                       ED_workspace_status_text(C, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | "
                                                                          "ESC/Enter to end  (or click outside this area)"));
                                        break;
                                case GP_PAINTMODE_DRAW_STRAIGHT:
-                                       ED_area_headerprint(p->sa, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
+                                       ED_workspace_status_text(C, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
                                                                          "ESC/Enter to end  (or click outside this area)"));
                                        break;
                                case GP_PAINTMODE_DRAW:
-                                       ED_area_headerprint(p->sa, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
+                                       ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
                                                                          "E/ESC/Enter to end  (or click outside this area)"));
                                        break;
                                case GP_PAINTMODE_DRAW_POLY:
-                                       ED_area_headerprint(p->sa, IFACE_("Grease Pencil Poly Session: LMB click to place next stroke vertex | "
+                                       ED_workspace_status_text(C, IFACE_("Grease Pencil Poly Session: LMB click to place next stroke vertex | "
                                                                          "ESC/Enter to end  (or click outside this area)"));
                                        break;
 
                                default: /* unhandled future cases */
-                                       ED_area_headerprint(p->sa, IFACE_("Grease Pencil Session: ESC/Enter to end   (or click outside this area)"));
+                                       ED_workspace_status_text(C, IFACE_("Grease Pencil Session: ESC/Enter to end   (or click outside this area)"));
                                        break;
                        }
                        break;
@@ -2064,7 +2064,7 @@ static void gpencil_draw_status_indicators(tGPsdata *p)
                case GP_STATUS_ERROR:
                case GP_STATUS_DONE:
                        /* clear status string */
-                       ED_area_headerprint(p->sa, NULL);
+                       ED_workspace_status_text(C, NULL);
                        break;
        }
 }
@@ -2744,7 +2744,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
                estate = OPERATOR_CANCELLED;
        else {
                /* update status indicators - cursor, header, etc. */
-               gpencil_draw_status_indicators(p);
+               gpencil_draw_status_indicators(C, p);
                gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */
        }
 
index cb4048ac63e9e7a69db070c10ea63094cc2e5685..4b0011b92fc5bc4ee5fb887cc1752c3d625464be 100644 (file)
@@ -143,7 +143,6 @@ void    ED_area_tag_redraw_regiontype(ScrArea *sa, int type);
 void    ED_area_tag_refresh(ScrArea *sa);
 void    ED_area_do_refresh(struct bContext *C, ScrArea *sa);
 void    ED_area_azones_update(ScrArea *sa, const int mouse_xy[]);
-void    ED_area_headerprint(ScrArea *sa, const char *str);
 void    ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool skip_ar_exit);
 void    ED_area_prevspace(struct bContext *C, ScrArea *sa);
 void    ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
@@ -244,6 +243,8 @@ void ED_workspace_object_mode_sync_from_object(
 void ED_workspace_object_mode_sync_from_scene(
         struct wmWindowManager *wm, WorkSpace *workspace, struct Scene *scene);
 
+void    ED_workspace_status_text(struct bContext *C, const char *str);
+
 /* anim */
 void    ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph);
 
index d4285f5a96ed63db4396fe061806fa94c982299e..b00717665a9a371ec3b23b78c5095949b364d4c1 100644 (file)
@@ -1065,7 +1065,7 @@ void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C);
 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
 void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
 void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
-void uiTemplateCursorKeymap(uiLayout *layout, struct bContext *C);
+void uiTemplateInputStatus(uiLayout *layout, struct bContext *C);
 void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
 void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name);
 void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color);
index c2bea466015597cca7b9b281eaa13b35dfaa8546..1f0cd5bbb42a569b376d7a30f0ca28fa0f0967ba 100644 (file)
@@ -4296,9 +4296,18 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
 }
 
 
-void uiTemplateCursorKeymap(uiLayout *layout, struct bContext *C)
+void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
 {
        wmWindow *win = CTX_wm_window(C);
+       WorkSpace *workspace = CTX_wm_workspace(C);
+
+       /* Workspace status text has priority. */
+       if (workspace->status_text) {
+               uiItemL(layout, workspace->status_text, ICON_NONE);
+               return;
+       }
+
+       /* Otherwise should cursor keymap status. */
        for (int i = 0; i < 3; i++) {
                uiLayout *box = uiLayoutRow(layout, true);
                for (int j = 0; j < 2; j++) {
index 2041852c9ee73a19640f48dd8feacfb9d34f007e..62271dcdae128d558ddc9d393a6366347b512dab 100644 (file)
@@ -130,7 +130,7 @@ static void edbm_bevel_update_header(bContext *C, wmOperator *op)
                             WM_bool_as_string(opdata->value_mode == PROFILE_VALUE),
                             offset_str, RNA_int_get(op->ptr, "segments"), RNA_float_get(op->ptr, "profile"));
 
-               ED_area_headerprint(sa, msg);
+               ED_workspace_status_text(C, msg);
        }
 }
 
@@ -273,7 +273,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
        ScrArea *sa = CTX_wm_area(C);
 
        if (sa) {
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
        }
 
        if (opdata->is_modal) {
index ee06f7abd2b549f648be7a41fc587c0724e93fdc..9a8bef0c863d9955010249267959769ce362485c 100644 (file)
@@ -160,7 +160,7 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
                v3d->twflag = 0;
 
                /* initialize modal callout */
-               ED_area_headerprint(CTX_wm_area(C), IFACE_("LMB: Click and drag to draw cut line"));
+               ED_workspace_status_text(C, IFACE_("LMB: Click and drag to draw cut line"));
        }
        return ret;
 }
@@ -185,10 +185,10 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
        /* update or clear modal callout */
        if (event->type == EVT_MODAL_MAP) {
                if (event->val == GESTURE_MODAL_BEGIN) {
-                       ED_area_headerprint(CTX_wm_area(C), IFACE_("LMB: Release to confirm cut line"));
+                       ED_workspace_status_text(C, IFACE_("LMB: Release to confirm cut line"));
                }
                else {
-                       ED_area_headerprint(CTX_wm_area(C), NULL);
+                       ED_workspace_status_text(C, NULL);
                }
        }
 
index 985d873dfc245a87401052ae57600ac2aae9af27..0fe318f80f000935157854b5b384f9eedee2c58c 100644 (file)
@@ -112,7 +112,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
                             WM_bool_as_string(RNA_boolean_get(op->ptr, "use_individual"))
                            );
 
-               ED_area_headerprint(sa, msg);
+               ED_workspace_status_text(C, msg);
        }
 }
 
@@ -202,7 +202,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
        }
 
        if (sa) {
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
        }
 
        MEM_SAFE_FREE(opdata->ob_store);
index be54bba7aa48f9b130aacf0c3104da9bebd0eb3e..84da02b3b419c2342fa5fe37e8e0afb82688d6b2 100644 (file)
@@ -301,7 +301,7 @@ static void knife_update_header(bContext *C, wmOperator *op, KnifeTool_OpData *k
 
 #undef WM_MODALKEY
 
-       ED_area_headerprint(CTX_wm_area(C), header);
+       ED_workspace_status_text(C, header);
 }
 
 static void knife_project_v2(const KnifeTool_OpData *kcd, const float co[3], float sco[2])
@@ -2787,7 +2787,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
 
        if (!obedit || obedit->type != OB_MESH || BKE_editmesh_from_object(obedit) != kcd->em) {
                knifetool_exit(C, op);
-               ED_area_headerprint(CTX_wm_area(C), NULL);
+               ED_workspace_status_text(C, NULL);
                return OPERATOR_FINISHED;
        }
 
@@ -2808,7 +2808,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
                                ED_region_tag_redraw(kcd->ar);
 
                                knifetool_exit(C, op);
-                               ED_area_headerprint(CTX_wm_area(C), NULL);
+                               ED_workspace_status_text(C, NULL);
 
                                return OPERATOR_CANCELLED;
                        case KNF_MODAL_CONFIRM:
@@ -2817,7 +2817,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
 
                                knifetool_finish(op);
                                knifetool_exit(C, op);
-                               ED_area_headerprint(CTX_wm_area(C), NULL);
+                               ED_workspace_status_text(C, NULL);
 
                                return OPERATOR_FINISHED;
                        case KNF_MODAL_MIDPOINT_ON:
index 7dac9a09b97f8882b025a0d613afdd78e98b5d8f..cf806b0b10478fe95b1560002e6421b5b7ffc6d2 100644 (file)
@@ -703,8 +703,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
 #endif
 
        if (is_interactive) {
-               ScrArea *sa = CTX_wm_area(C);
-               ED_area_headerprint(sa, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, "
+               ED_workspace_status_text(C, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, "
                                               "hold Alt for smooth"));
                return OPERATOR_RUNNING_MODAL;
        }
@@ -729,7 +728,7 @@ static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
 {
        /* finish */
        ED_region_tag_redraw(lcd->ar);
-       ED_area_headerprint(CTX_wm_area(C), NULL);
+       ED_workspace_status_text(C, NULL);
 
        if (lcd->eed) {
                /* set for redo */
@@ -785,14 +784,14 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
                        case RIGHTMOUSE: /* abort */ // XXX hardcoded
                                ED_region_tag_redraw(lcd->ar);
                                ringsel_exit(C, op);
-                               ED_area_headerprint(CTX_wm_area(C), NULL);
+                               ED_workspace_status_text(C, NULL);
 
                                return OPERATOR_CANCELLED;
                        case ESCKEY:
                                if (event->val == KM_RELEASE) {
                                        /* cancel */
                                        ED_region_tag_redraw(lcd->ar);
-                                       ED_area_headerprint(CTX_wm_area(C), NULL);
+                                       ED_workspace_status_text(C, NULL);
 
                                        ringcut_cancel(C, op);
                                        return OPERATOR_CANCELLED;
@@ -897,7 +896,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
                }
                BLI_snprintf(buf, sizeof(buf), IFACE_("Number of Cuts: %s, Smooth: %s (Alt)"),
                             str_rep, str_rep + NUM_STR_REP_LEN);
-               ED_area_headerprint(CTX_wm_area(C), buf);
+               ED_workspace_status_text(C, buf);
        }
 
        /* keep going until the user confirms */
index 1eda6da6e405c1d9fe6919ed7e38bc5db2258471..986a2a030e2cc03142112d86afc0c87056f9050c 100644 (file)
@@ -460,15 +460,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
 
        UI_SetTheme(sa ? sa->spacetype : 0, at->regionid);
 
-       /* optional header info instead? */
-       if (ar->headerstr) {
-               UI_ThemeClearColor(TH_HEADER);
-               glClear(GL_COLOR_BUFFER_BIT);
-
-               UI_FontThemeColor(BLF_default(), TH_TEXT);
-               BLF_draw_default(UI_UNIT_X, 0.4f * UI_UNIT_Y, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
-       }
-       else if (at->draw) {
+       if (at->draw) {
                at->draw(C, ar);
        }
 
@@ -639,26 +631,30 @@ void ED_area_tag_refresh(ScrArea *sa)
 /* *************************************************************** */
 
 /* use NULL to disable it */
-void ED_area_headerprint(ScrArea *sa, const char *str)
+void ED_workspace_status_text(bContext *C, const char *str)
 {
-       ARegion *ar;
+       wmWindow *win = CTX_wm_window(C);
+       WorkSpace *workspace = CTX_wm_workspace(C);
 
-       /* happens when running transform operators in backround mode */
-       if (sa == NULL)
+       /* Can be NULL when running operators in background mode. */
+       if (workspace == NULL)
                return;
 
-       for (ar = sa->regionbase.first; ar; ar = ar->next) {
-               if (ar->regiontype == RGN_TYPE_HEADER) {
-                       if (str) {
-                               if (ar->headerstr == NULL)
-                                       ar->headerstr = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
-                               BLI_strncpy(ar->headerstr, str, UI_MAX_DRAW_STR);
-                       }
-                       else if (ar->headerstr) {
-                               MEM_freeN(ar->headerstr);
-                               ar->headerstr = NULL;
-                       }
-                       ED_region_tag_redraw(ar);
+       if (str) {
+               if (workspace->status_text == NULL)
+                       workspace->status_text = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
+               BLI_strncpy(workspace->status_text, str, UI_MAX_DRAW_STR);
+       }
+       else if (workspace->status_text) {
+               MEM_freeN(workspace->status_text);
+               workspace->status_text = NULL;
+       }
+
+       /* Redraw status bar. */
+       for (ScrArea *sa = win->global_areas.areabase.first; sa; sa = sa->next) {
+               if (sa->spacetype == SPACE_STATUSBAR) {
+                       ED_area_tag_redraw(sa);
+                       break;
                }
        }
 }
index 3d18d2abafd2ee27e9a0373fe1df1c2538eea3a7..cdd0225e1b758d60e141fa69d316e334021cd12d 100644 (file)
@@ -876,11 +876,6 @@ void ED_region_exit(bContext *C, ARegion *ar)
        WM_event_modal_handler_region_replace(win, ar, NULL);
        WM_draw_region_free(ar);
 
-       if (ar->headerstr) {
-               MEM_freeN(ar->headerstr);
-               ar->headerstr = NULL;
-       }
-
        if (ar->regiontimer) {
                WM_event_remove_timer(wm, win, ar->regiontimer);
                ar->regiontimer = NULL;
@@ -1419,7 +1414,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
                }
 
                /* prevent hanging header prints */
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
        }
 
        if (sa && sa->full) {
index 3c097095ddc756dcfff698eceaf780b8e9e7e080..c3a0ca4299f402bd10750223f435bb10c52da46b 100644 (file)
@@ -886,7 +886,7 @@ static void sample_color_update_header(SampleColorData *data, bContext *C)
                             !data->sample_palette ?
                             IFACE_("Brush. Use Left Click to sample for palette instead") :
                             IFACE_("Palette. Use Left Click to sample more colors"));
-               ED_area_headerprint(sa, msg);
+               ED_workspace_status_text(C, msg);
        }
 }
 
@@ -965,8 +965,6 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
        Brush *brush = BKE_paint_brush(paint);
 
        if ((event->type == data->event_type) && (event->val == KM_RELEASE)) {
-               ScrArea *sa = CTX_wm_area(C);
-
                if (data->show_cursor) {
                        paint->flags |= PAINT_SHOW_BRUSH;
                }
@@ -977,7 +975,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
                }
                WM_cursor_modal_restore(CTX_wm_window(C));
                MEM_freeN(data);
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
 
                return OPERATOR_FINISHED;
        }
index 414b9f2062f90bf56b57447dfc859d89000e11eb..88cb6f548e89ba479bbfccbeb11c547fc9630cb2 100644 (file)
@@ -5970,8 +5970,7 @@ static int sculpt_sample_detail_size_exec(bContext *C, wmOperator *op)
 
 static int sculpt_sample_detail_size_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e))
 {
-       ScrArea *sa = CTX_wm_area(C);
-       ED_area_headerprint(sa, "Click on the mesh to set the detail");
+       ED_workspace_status_text(C, "Click on the mesh to set the detail");
        WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR);
        WM_event_add_modal_handler(C, op);
        return OPERATOR_RUNNING_MODAL;
@@ -5982,14 +5981,13 @@ static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wm
        switch (e->type) {
                case LEFTMOUSE:
                        if (e->val == KM_PRESS) {
-                               ScrArea *sa = CTX_wm_area(C);
                                int ss_co[2] = {e->mval[0], e->mval[1]};
 
                                sample_detail(C, ss_co);
 
                                RNA_int_set_array(op->ptr, "location", ss_co);
                                WM_cursor_modal_restore(CTX_wm_window(C));
-                               ED_area_headerprint(sa, NULL);
+                               ED_workspace_status_text(C, NULL);
                                WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
 
                                return OPERATOR_FINISHED;
@@ -5998,9 +5996,8 @@ static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wm
 
                case RIGHTMOUSE:
                {
-                       ScrArea *sa = CTX_wm_area(C);
                        WM_cursor_modal_restore(CTX_wm_window(C));
-                       ED_area_headerprint(sa, NULL);
+                       ED_workspace_status_text(C, NULL);
 
                        return OPERATOR_CANCELLED;
                }
index bfce5a862d012207f824ee956fd155623bd35cd7..1572b9b8f78327583ae407fc90037eb4bfb0e3bc 100644 (file)
@@ -155,8 +155,8 @@ static int add_marker_at_click_invoke(bContext *C,
                                       wmOperator *op,
                                       const wmEvent *UNUSED(event))
 {
-       ED_area_headerprint(
-               CTX_wm_area(C),
+       ED_workspace_status_text(
+               C,
                IFACE_("Use LMB click to define location where place the marker"));
 
        /* Add modal handler for ESC. */
@@ -180,7 +180,7 @@ static int add_marker_at_click_modal(bContext *C,
                        ARegion *ar = CTX_wm_region(C);
                        float pos[2];
 
-                       ED_area_headerprint(CTX_wm_area(C), NULL);
+                       ED_workspace_status_text(C, NULL);
 
                        ED_clip_point_stable_pos(sc, ar,
                                                 event->x - ar->winrct.xmin,
@@ -196,7 +196,7 @@ static int add_marker_at_click_modal(bContext *C,
                }
 
                case ESCKEY:
-                       ED_area_headerprint(CTX_wm_area(C), NULL);
+                       ED_workspace_status_text(C, NULL);
                        return OPERATOR_CANCELLED;
        }
 
index e4c59bc9508222328113781b115dd909446452dc..c4cd59b65f497ce8df611046ff65c53e3c0306ec 100644 (file)
@@ -532,7 +532,7 @@ static void node_link_update_header(bContext *C, bNodeLinkDrag *UNUSED(nldrag))
        char header[UI_MAX_DRAW_STR];
 
        BLI_strncpy(header, IFACE_("LMB: drag node link, RMB: cancel"), sizeof(header));
-       ED_area_headerprint(CTX_wm_area(C), header);
+       ED_workspace_status_text(C, header);
 }
 
 static int node_count_links(bNodeTree *ntree, bNodeSocket *sock)
@@ -729,7 +729,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
                        if (event->val == KM_RELEASE) {
                                node_link_exit(C, op, true);
 
-                               ED_area_headerprint(CTX_wm_area(C), NULL);
+                               ED_workspace_status_text(C, NULL);
                                ED_region_tag_redraw(ar);
                                return OPERATOR_FINISHED;
                        }
index a78b3ee79c157411c8475b9251d6663b5008d707..f227ac299ab1a0216b9e81577baafe13324155ac 100644 (file)
@@ -1519,29 +1519,26 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op)
 }
 
 
-static void sequencer_slip_update_header(Scene *scene, ScrArea *sa, SlipData *data, int offset)
+static void sequencer_slip_update_header(bContext *C, Scene *scene, SlipData *data, int offset)
 {
        char msg[UI_MAX_DRAW_STR];
 
-       if (sa) {
-               if (hasNumInput(&data->num_input)) {
-                       char num_str[NUM_STR_REP_LEN];
-                       outputNumInput(&data->num_input, num_str, &scene->unit);
-                       BLI_snprintf(msg, sizeof(msg), IFACE_("Trim offset: %s"), num_str);
-               }
-               else {
-                       BLI_snprintf(msg, sizeof(msg), IFACE_("Trim offset: %d"), offset);
-               }
+       if (hasNumInput(&data->num_input)) {
+               char num_str[NUM_STR_REP_LEN];
+               outputNumInput(&data->num_input, num_str, &scene->unit);
+               BLI_snprintf(msg, sizeof(msg), IFACE_("Trim offset: %s"), num_str);
+       }
+       else {
+               BLI_snprintf(msg, sizeof(msg), IFACE_("Trim offset: %d"), offset);
        }
 
-       ED_area_headerprint(sa, msg);
+       ED_workspace_status_text(C, msg);
 }
 
 static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
        Scene *scene = CTX_data_scene(C);
        SlipData *data = (SlipData *)op->customdata;
-       ScrArea *sa = CTX_wm_area(C);
        const bool has_numInput = hasNumInput(&data->num_input);
        bool handled = true;
 
@@ -1550,7 +1547,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
                float offset;
                applyNumInput(&data->num_input, &offset);
 
-               sequencer_slip_update_header(scene, sa, data, (int)offset);
+               sequencer_slip_update_header(C, scene, data, (int)offset);
 
                RNA_int_set(op->ptr, "offset", offset);
 
@@ -1584,7 +1581,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
                                UI_view2d_region_to_view(v2d, mouse_x, 0, &mouseloc[0], &mouseloc[1]);
                                offset = mouseloc[0] - data->init_mouseloc[0];
 
-                               sequencer_slip_update_header(scene, sa, data, offset);
+                               sequencer_slip_update_header(C, scene, data, offset);
 
                                RNA_int_set(op->ptr, "offset", offset);
 
@@ -1604,9 +1601,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
                        MEM_freeN(data->ts);
                        MEM_freeN(data);
                        op->customdata = NULL;
-                       if (sa) {
-                               ED_area_headerprint(sa, NULL);
-                       }
+                       ED_workspace_status_text(C, NULL);
                        WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
                        return OPERATOR_FINISHED;
                }
@@ -1636,10 +1631,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
                        WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
                        BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
-
-                       if (sa) {
-                               ED_area_headerprint(sa, NULL);
-                       }
+                       ED_workspace_status_text(C, NULL);
 
                        return OPERATOR_CANCELLED;
                }
@@ -1667,7 +1659,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
                float offset;
                applyNumInput(&data->num_input, &offset);
 
-               sequencer_slip_update_header(scene, sa, data, (int)offset);
+               sequencer_slip_update_header(C, scene, data, (int)offset);
 
                RNA_int_set(op->ptr, "offset", offset);
 
index d8cc9ab982875c64c35823b54868e3d9aa08382f..f9fdf8c2cc0b3c1d53c256cf1b26aaa6b430c8ed 100644 (file)
@@ -333,7 +333,7 @@ static void fly_update_header(bContext *C, wmOperator *op, FlyInfo *fly)
 
 #undef WM_MODALKEY
 
-       ED_area_headerprint(CTX_wm_area(C), header);
+       ED_workspace_status_text(C, header);
 }
 
 /* FlyInfo->state */
@@ -1082,7 +1082,7 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
        }
 
        if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))
-               ED_area_headerprint(CTX_wm_area(C), NULL);
+               ED_workspace_status_text(C, NULL);
 
        return exit_code;
 }
index e001ed9112b78f8e1a160e8fc716baa82cd8b094..cc951805289339712853dacd71d73051a17a6e25 100644 (file)
@@ -811,7 +811,7 @@ static bool view3d_ruler_item_mousemove(
        }
 }
 
-static void view3d_ruler_header_update(ScrArea *sa)
+static void view3d_ruler_header_update(bContext *C)
 {
        const char *text = IFACE_("Ctrl+LMB: Add, "
                                  "Del: Remove, "
@@ -821,7 +821,7 @@ static void view3d_ruler_header_update(ScrArea *sa)
                                  "Enter: Store,  "
                                  "Esc: Cancel");
 
-       ED_area_headerprint(sa, text);
+       ED_workspace_status_text(C, text);
 }
 
 /* -------------------------------------------------------------------- */
@@ -847,7 +847,7 @@ static int view3d_ruler_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
        ruler_info->draw_handle_pixel = ED_region_draw_cb_activate(ar->type, ruler_info_draw_pixel,
                                                                   ruler_info, REGION_DRAW_POST_PIXEL);
 
-       view3d_ruler_header_update(sa);
+       view3d_ruler_header_update(C);
 
        op->flag |= OP_IS_MODAL_CURSOR_REGION;
 
@@ -1079,7 +1079,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event)
        }
 
        if (do_draw) {
-               view3d_ruler_header_update(sa);
+               view3d_ruler_header_update(C);
 
                /* all 3d views draw rulers */
                WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
@@ -1093,7 +1093,7 @@ exit:
                view3d_ruler_free(ruler_info);
                op->customdata = NULL;
 
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
        }
 
        return exit_code;
index 352e85703bc235c6794c92c03332fad84f39a015..e3e82e8b9c2fd82fa8259688341635385bbd0f00 100644 (file)
@@ -404,7 +404,7 @@ static void walk_update_header(bContext *C, wmOperator *op, WalkInfo *walk)
 
 #undef WM_MODALKEY
 
-       ED_area_headerprint(CTX_wm_area(C), header);
+       ED_workspace_status_text(C, header);
 }
 
 static void walk_navigation_mode_set(bContext *C, wmOperator *op, WalkInfo *walk, eWalkMethod mode)
@@ -1436,7 +1436,7 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
        }
 
        if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))
-               ED_area_headerprint(CTX_wm_area(C), NULL);
+               ED_workspace_status_text(C, NULL);
 
        return exit_code;
 }
index b4f7e9256a3163959150b6ceaebfaab94bbf0573..bb51678080fa21f2c579df7688f7e97dfdf4ba7a 100644 (file)
@@ -651,7 +651,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
 
 static void viewRedrawPost(bContext *C, TransInfo *t)
 {
-       ED_area_headerprint(t->sa, NULL);
+       ED_workspace_status_text(t->context, NULL);
 
        if (t->spacetype == SPACE_VIEW3D) {
                /* if autokeying is enabled, send notifiers that keyframes were added */
@@ -3128,7 +3128,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -3282,7 +3282,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -3561,7 +3561,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -3664,7 +3664,7 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -3762,7 +3762,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4121,7 +4121,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4238,7 +4238,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4567,7 +4567,7 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4669,7 +4669,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4748,7 +4748,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4829,7 +4829,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -4935,7 +4935,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -5016,7 +5016,7 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -5111,7 +5111,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -5193,7 +5193,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -5278,7 +5278,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -5401,7 +5401,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -5478,7 +5478,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -7204,7 +7204,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -7803,7 +7803,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -7877,7 +7877,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -7968,7 +7968,7 @@ static void applyBakeTime(TransInfo *t, const int mval[2])
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -8029,7 +8029,7 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
 
                recalcData(t);
 
-               ED_area_headerprint(t->sa, str);
+               ED_workspace_status_text(t->context, str);
        }
        else {
                size[0] = size[1] = size[2] = 1;
@@ -8052,9 +8052,9 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
                recalcData(t);
 
                if (t->flag & T_2D_EDIT)
-                       ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y)"));
+                       ED_workspace_status_text(t->context, IFACE_("Select a mirror axis (X, Y)"));
                else
-                       ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
+                       ED_workspace_status_text(t->context, IFACE_("Select a mirror axis (X, Y, Z)"));
        }
 }
 /** \} */
@@ -8116,7 +8116,7 @@ static void applyAlign(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, IFACE_("Align"));
+       ED_workspace_status_text(t->context, IFACE_("Align"));
 }
 /** \} */
 
@@ -8215,7 +8215,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -8499,7 +8499,7 @@ static void applyTimeTranslate(TransInfo *t, const int mval[2])
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -8689,7 +8689,7 @@ static void applyTimeSlide(TransInfo *t, const int mval[2])
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
@@ -8810,7 +8810,7 @@ static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, str);
+       ED_workspace_status_text(t->context, str);
 }
 /** \} */
 
index f39498b08f3c6f40d8882156272d3b867699c4f5..bac308305165bb7fead7af6df5acd95182e1037b 100644 (file)
@@ -291,7 +291,7 @@ static void stitch_update_header(StitchState *state, bContext *C)
                             state->limit_dist,
                             WM_bool_as_string(state->use_limit));
 
-               ED_area_headerprint(sa, msg);
+               ED_workspace_status_text(C, msg);
        }
 }
 
@@ -2089,7 +2089,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
        }
 
        if (sa)
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
 
        ED_region_draw_cb_exit(CTX_wm_region(C)->type, state->draw_handle);
 
index 5f60a5a714a90cf36930dc46b6d61ae27fb9da81..2c54cc3b456e1f2294f7cfed3865de8a9b2475a3 100644 (file)
@@ -658,7 +658,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interac
                if (sa) {
                        BLI_snprintf(str, sizeof(str),
                                     IFACE_("Minimize Stretch. Blend %.2f (Press + and -, or scroll wheel to set)"), ms->blend);
-                       ED_area_headerprint(sa, str);
+                       ED_workspace_status_text(C, str);
                }
 
                ms->lasttime = PIL_check_seconds_timer();
@@ -674,7 +674,7 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel)
        ScrArea *sa = CTX_wm_area(C);
 
        if (sa)
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
        if (ms->timer)
                WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ms->timer);
 
index 500d198fa7450482288a2cef725379dc10c5b66d..f660864d519c956f2f179f6f1566ecf8311ab4d7 100644 (file)
@@ -351,7 +351,6 @@ typedef struct ARegion {
        struct wmTimer *regiontimer; /* blend in/out */
        struct wmDrawBuffer *draw_buffer;
 
-       char *headerstr;                        /* use this string to draw info */
        void *regiondata;                       /* XXX 2.50, need spacedata equivalent? */
 
        ARegion_Runtime runtime;
index b29e1f808c0a2682164b56ca2783aa7ce3616546..585794fbe97034b51eb3be9c656399ea68b9520a 100644 (file)
@@ -145,6 +145,9 @@ typedef struct WorkSpace {
 
        char _pad[2];
        int flags DNA_PRIVATE_WORKSPACE; /* enum eWorkSpaceFlags */
+
+       /* Info text from modal operators (runtime). */
+       char *status_text;
 } WorkSpace;
 
 /* internal struct, but exported for read/write */
index 2a16d2a41ee8598061d590223935529684c9157c..adbfc33c698fcf5d673813cc1326625da04a3bb3 100644 (file)
@@ -320,7 +320,6 @@ static void rna_def_area(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
-       FunctionRNA *func;
 
        srna = RNA_def_struct(brna, "Area", NULL);
        RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
@@ -384,10 +383,6 @@ static void rna_def_area(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Height", "Area height");
 
        RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
-
-       func = RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
-       RNA_def_function_ui_description(func, "Set the header text");
-       RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
 }
 
 static void rna_def_view2d_api(StructRNA *srna)
index 702bcf154620cb5049a831bf7afa59e723222c93..943e6c2e31fd126dc5b86ef7b1b1682b46581bbd 100644 (file)
@@ -1021,7 +1021,7 @@ void RNA_api_ui_layout(StructRNA *srna)
        func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
        RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
-       func = RNA_def_function(srna, "template_cursor_keymap", "uiTemplateCursorKeymap");
+       func = RNA_def_function(srna, "template_input_status", "uiTemplateInputStatus");
        RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
        func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
index 81606dfba4ab3c330fd9ff06f90261163bb516c6..1f3930c7259210f48ab5760fb3c550cfe54e2bce 100644 (file)
@@ -41,6 +41,8 @@
 
 #ifdef RNA_RUNTIME
 
+#include "ED_screen.h"
+
 static void rna_WorkspaceTool_setup(
         ID *id,
         bToolRef *tref,
@@ -80,10 +82,14 @@ static PointerRNA rna_WorkspaceTool_operator_properties(
 
 #else
 
-void RNA_api_workspace(StructRNA *UNUSED(srna))
+void RNA_api_workspace(StructRNA *srna)
 {
-       /* FunctionRNA *func; */
-       /* PropertyRNA *parm; */
+       FunctionRNA *func;
+
+       func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text");
+       RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+       RNA_def_function_ui_description(func, "Set the status bar text, typically for modal operators");
+       RNA_def_string(func, "text", NULL, 0, "Text", "New string for the status bar, no argument clears the text");
 }
 
 void RNA_api_workspace_tool(StructRNA *srna)
index d83d4b7320a8b87b121a2c02983881a03c7c3e88..5f66deefb9315520fa0e466252d2564a77022430 100644 (file)
@@ -2444,41 +2444,39 @@ static void radial_control_update_header(wmOperator *op, bContext *C)
 {
        RadialControl *rc = op->customdata;
        char msg[UI_MAX_DRAW_STR];
-       ScrArea *sa = CTX_wm_area(C);
        Scene *scene = CTX_data_scene(C);
 
-       if (sa) {
-               if (hasNumInput(&rc->num_input)) {
-                       char num_str[NUM_STR_REP_LEN];
-                       outputNumInput(&rc->num_input, num_str, &scene->unit);
-                       BLI_snprintf(msg, sizeof(msg), "%s: %s", RNA_property_ui_name(rc->prop), num_str);
-               }
-               else {
-                       const char *ui_name = RNA_property_ui_name(rc->prop);
-                       switch (rc->subtype) {
-                               case PROP_NONE:
-                               case PROP_DISTANCE:
-                                       BLI_snprintf(msg, sizeof(msg), "%s: %0.4f", ui_name, rc->current_value);
-                                       break;
-                               case PROP_PIXEL:
-                                       BLI_snprintf(msg, sizeof(msg), "%s: %d", ui_name, (int)rc->current_value); /* XXX: round to nearest? */
-                                       break;
-                               case PROP_PERCENTAGE:
-                                       BLI_snprintf(msg, sizeof(msg), "%s: %3.1f%%", ui_name, rc->current_value);
-                                       break;
-                               case PROP_FACTOR:
-                                       BLI_snprintf(msg, sizeof(msg), "%s: %1.3f", ui_name, rc->current_value);
-                                       break;
-                               case PROP_ANGLE:
-                                       BLI_snprintf(msg, sizeof(msg), "%s: %3.2f", ui_name, RAD2DEGF(rc->current_value));
-                                       break;
-                               default:
-                                       BLI_snprintf(msg, sizeof(msg), "%s", ui_name); /* XXX: No value? */
-                                       break;
-                       }
+       if (hasNumInput(&rc->num_input)) {
+               char num_str[NUM_STR_REP_LEN];
+               outputNumInput(&rc->num_input, num_str, &scene->unit);
+               BLI_snprintf(msg, sizeof(msg), "%s: %s", RNA_property_ui_name(rc->prop), num_str);
+       }
+       else {
+               const char *ui_name = RNA_property_ui_name(rc->prop);
+               switch (rc->subtype) {
+                       case PROP_NONE:
+                       case PROP_DISTANCE:
+                               BLI_snprintf(msg, sizeof(msg), "%s: %0.4f", ui_name, rc->current_value);
+                               break;
+                       case PROP_PIXEL:
+                               BLI_snprintf(msg, sizeof(msg), "%s: %d", ui_name, (int)rc->current_value); /* XXX: round to nearest? */
+                               break;
+                       case PROP_PERCENTAGE:
+                               BLI_snprintf(msg, sizeof(msg), "%s: %3.1f%%", ui_name, rc->current_value);
+                               break;
+                       case PROP_FACTOR:
+                               BLI_snprintf(msg, sizeof(msg), "%s: %1.3f", ui_name, rc->current_value);
+                               break;
+                       case PROP_ANGLE:
+                               BLI_snprintf(msg, sizeof(msg), "%s: %3.2f", ui_name, RAD2DEGF(rc->current_value));
+                               break;
+                       default:
+                               BLI_snprintf(msg, sizeof(msg), "%s", ui_name); /* XXX: No value? */
+                               break;
                }
-               ED_area_headerprint(sa, msg);
        }
+
+       ED_workspace_status_text(C, msg);
 }
 
 static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *event)
@@ -3013,7 +3011,7 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
        }
 
        if (sa) {
-               ED_area_headerprint(sa, NULL);
+               ED_workspace_status_text(C, NULL);
        }
 
        WM_paint_cursor_end(wm, rc->cursor);