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-08-15 15:47:48 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-15 17:00:40 +0300
commit1d067868c05cc3b8b8b76f6d21ef4a3eebdc885c (patch)
tree41279d3fdb8b1da22b3336981d4314ded90ebf9d /source/blender/editors/screen/area.c
parent913b8396d971f258df70827274bcdf86dd894185 (diff)
UI: tweak drawing of header status text for transparent headers.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 18bacee98b9..034e75a1b87 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -393,6 +393,49 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
GPU_blend(false);
}
+static void region_draw_status_text(ScrArea *sa, ARegion *ar)
+{
+ bool overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
+
+ if (overlap) {
+ GPU_clear_color(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+ else {
+ UI_ThemeClearColor(TH_HEADER);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
+ int fontid = BLF_set_default();
+
+ const float width = BLF_width(fontid, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
+ const float x = UI_UNIT_X;
+ const float y = 0.4f * UI_UNIT_Y;
+
+ if (overlap) {
+ const float pad = 2.0f * UI_DPI_FAC;
+ const float x1 = x - (UI_UNIT_X - pad);
+ const float x2 = x + width + (UI_UNIT_X - pad);
+ const float y1 = pad;
+ const float y2 = ar->winy - pad;
+
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+
+ float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
+ UI_GetThemeColor3fv(TH_BACK, color);
+ UI_draw_roundbox_corner_set(UI_CNR_ALL);
+ UI_draw_roundbox_aa(true, x1, y1, x2, y2, 4.0f, color);
+
+ UI_FontThemeColor(fontid, TH_TEXT);
+ }
+ else {
+ UI_FontThemeColor(fontid, TH_TEXT);
+ }
+
+ BLF_position(fontid, x, y, 0.0f);
+ BLF_draw(fontid, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
+}
+
/* Follow wmMsgNotifyFn spec */
void ED_region_do_msg_notify_tag_redraw(
bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val)
@@ -480,11 +523,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
}
/* optional header info instead? */
else 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);
+ region_draw_status_text(sa, ar);
}
else if (at->draw) {
at->draw(C, ar);
@@ -671,6 +710,7 @@ void ED_area_status_text(ScrArea *sa, const char *str)
if (ar->headerstr == NULL)
ar->headerstr = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
BLI_strncpy(ar->headerstr, str, UI_MAX_DRAW_STR);
+ BLI_str_rstrip(ar->headerstr);
}
else if (ar->headerstr) {
MEM_freeN(ar->headerstr);