diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-16 17:24:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-16 17:49:04 +0300 |
commit | 145f851731655910f653763f4122288bc12c5629 (patch) | |
tree | c4950da91f1615731ed26131d35477174ebeb1d0 /source/blender | |
parent | 42cee6ab213406814aae62ff28845559fbd5f4f1 (diff) |
UI: click on status bar report message now opens window with Info editor
Patch by Valentin (Poulpator)
Differential Revision: https://developer.blender.org/D5468
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 17 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 40 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 6 |
4 files changed, 53 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 37eb1770f68..0cd048323f1 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6392,22 +6392,17 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) block, UI_BTYPE_LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); } - UI_block_emboss_set(block, UI_EMBOSS); - - uiDefBut(block, - UI_BTYPE_LABEL, - 0, + but = uiDefButO(block, + UI_BTYPE_BUT, + "SCREEN_OT_info_log_show", + WM_OP_INVOKE_REGION_WIN, report->message, UI_UNIT_X + 5, 0, UI_UNIT_X + width, UI_UNIT_Y, - NULL, - 0.0f, - 0.0f, - 0, - 0, - ""); + "Show in Info Log"); + rgba_float_to_uchar(but->col, rti->col); } void uiTemplateInputStatus(uiLayout *layout, struct bContext *C) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 8377fd0e128..272c5623dc6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4775,6 +4775,45 @@ static void SCREEN_OT_drivers_editor_show(struct wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Show Info Log Operator + * \{ */ + +static int info_log_show_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + PointerRNA ptr = {{NULL}}; + PropertyRNA *prop = NULL; + + int sizex = 900 * UI_DPI_FAC; + int sizey = 580 * UI_DPI_FAC; + int shift_y = 480; + + /* changes context! */ + if (WM_window_open_temp(C, event->x, event->y+shift_y, sizex, sizey, WM_WINDOW_INFO) != NULL) { + ScrArea *area = CTX_wm_area(C); + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HEADER); + return OPERATOR_FINISHED; + } + else { + BKE_report(op->reports, RPT_ERROR, "Failed to open window!"); + return OPERATOR_CANCELLED; + } +} + +static void SCREEN_OT_info_log_show(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Show Info Log"; + ot->description = "Show info log in a separate window"; + ot->idname = "SCREEN_OT_info_log_show"; + + /* api callbacks */ + ot->invoke = info_log_show_invoke; + ot->poll = ED_operator_screenactive; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name New Screen Operator * \{ */ @@ -5241,6 +5280,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_screenshot); WM_operatortype_append(SCREEN_OT_userpref_show); WM_operatortype_append(SCREEN_OT_drivers_editor_show); + WM_operatortype_append(SCREEN_OT_info_log_show); WM_operatortype_append(SCREEN_OT_region_blend); WM_operatortype_append(SCREEN_OT_space_type_set_or_cycle); WM_operatortype_append(SCREEN_OT_space_context_cycle); diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index cf87afa2a34..0f0d74c259b 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -162,6 +162,7 @@ enum { WM_WINDOW_RENDER = 1, WM_WINDOW_USERPREFS, WM_WINDOW_DRIVERS, + WM_WINDOW_INFO, // WM_WINDOW_FILESEL // UNUSED }; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d17b8817691..dc9a7b29bb2 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -893,6 +893,9 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i else if (type == WM_WINDOW_DRIVERS) { ED_area_newspace(C, sa, SPACE_GRAPH, false); } + else if (type == WM_WINDOW_INFO) { + ED_area_newspace(C,sa, SPACE_INFO,false); + } else { ED_area_newspace(C, sa, SPACE_USERPREF, false); } @@ -917,6 +920,9 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i else if (sa->spacetype == SPACE_GRAPH) { title = IFACE_("Blender Drivers Editor"); } + else if (sa->spacetype == SPACE_INFO){ + title = IFACE_("Blender Info Log"); + } else { title = "Blender"; } |