Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-26 18:19:25 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-26 20:45:55 +0300
commitdf02675e21736bd79acb0e34bb410efe748a86bc (patch)
tree876e21c395f20fe945bae6a3bfd031a386f2620a /source/blender/editors/screen
parentc817a89e73891307c2a04e75d0968d49be0e6c29 (diff)
UI: move modal operator text from headers to status bar.
Python API is context.workspace.status_text_set()
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c46
-rw-r--r--source/blender/editors/screen/screen_edit.c7
2 files changed, 22 insertions, 31 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 1eda6da6e40..986a2a030e2 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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;
}
}
}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 3d18d2abafd..cdd0225e1b7 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -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) {