UI: move modal operator text from headers to status bar.
Python API is context.workspace.status_text_set()
This commit is contained in:
@@ -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'}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'}
|
||||
|
||||
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
/** \} */
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
ED_area_headerprint(sa, msg);
|
||||
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_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);
|
||||
|
||||
Reference in New Issue
Block a user