diff options
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 9bf15a292ea..a9b163ab58a 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -462,7 +462,15 @@ void ED_region_do_draw(bContext *C, ARegion *ar) UI_SetTheme(sa ? sa->spacetype : 0, at->regionid); - if (at->draw) { + /* 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) { at->draw(C, ar); } @@ -633,6 +641,30 @@ void ED_area_tag_refresh(ScrArea *sa) /* *************************************************************** */ /* use NULL to disable it */ +void ED_area_status_text(ScrArea *sa, const char *str) +{ + ARegion *ar; + + /* happens when running transform operators in backround mode */ + if (sa == 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); + } + } +} + void ED_workspace_status_text(bContext *C, const char *str) { wmWindow *win = CTX_wm_window(C); |