diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-27 20:48:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-27 20:48:54 +0300 |
commit | d3b814e9ecb18d173a4ed0621c8f714b23c50082 (patch) | |
tree | 48a5537319a856fc40c81f4af24f1c6d0f65194d /source/blender | |
parent | 0e304ca8f57563c8f22313f6cee2551c88dcef3f (diff) |
UI: tweak status bar layout to make it less jumpy.
Keymap on the left, messages and jobs in the middle, stats on the right.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_statusbar/space_statusbar.c | 17 |
3 files changed, 21 insertions, 28 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 1f0cd5bbb42..041dc56cf92 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -4310,14 +4310,20 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C) /* Otherwise should cursor keymap status. */ for (int i = 0; i < 3; i++) { uiLayout *box = uiLayoutRow(layout, true); - for (int j = 0; j < 2; j++) { - const char *msg = WM_window_cursor_keymap_status_get(win, i, j); - if ((j == 0) || (msg != NULL)) { - uiItemL(box, msg, j == 0 ? (ICON_MOUSE_LMB + i) : ICON_MOUSE_DRAG); + + const char *msg = WM_window_cursor_keymap_status_get(win, i, 0); + const char *msg_drag = WM_window_cursor_keymap_status_get(win, i, 1); + + if (msg || msg_drag) { + uiItemL(box, msg ? msg : "", (ICON_MOUSE_LMB + i)); + + if (msg_drag) { + uiItemL(box, msg_drag, ICON_MOUSE_DRAG); + } + + if (i != 2) { + uiItemS(layout); } - } - if (i != 2) { - uiItemSpacer(layout); } } } diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index b0b0f6dee07..3830e6d2792 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -471,7 +471,9 @@ static void stats_string(ViewLayer *view_layer) s = stats->infostr; ofs = 0; - ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", versionstr); + if (ob) { + ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", ob->id.name + 2); + } if (obedit) { if (BKE_keyblock_from_object(obedit)) @@ -505,15 +507,13 @@ static void stats_string(ViewLayer *view_layer) } else { ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, - IFACE_("Verts:%s | Faces:%s | Tris:%s | Objects:%s/%s | Lamps:%s/%s%s%s"), + IFACE_("Verts:%s | Faces:%s | Tris:%s | Objects:%s/%s%s%s"), stats_fmt.totvert, stats_fmt.totface, stats_fmt.tottri, stats_fmt.totobjsel, - stats_fmt.totobj, stats_fmt.totlampsel, - stats_fmt.totlamp, memstr, gpumemstr); + stats_fmt.totobj, memstr, gpumemstr); } - if (ob) - BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", ob->id.name + 2); + ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", versionstr); #undef MAX_INFO_MEM_LEN } diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c index 2d98431bf0c..a66b36c2580 100644 --- a/source/blender/editors/space_statusbar/space_statusbar.c +++ b/source/blender/editors/space_statusbar/space_statusbar.c @@ -56,21 +56,8 @@ static SpaceLink *statusbar_new(const ScrArea *UNUSED(area), const Scene *UNUSED sstatusbar = MEM_callocN(sizeof(*sstatusbar), "init statusbar"); sstatusbar->spacetype = SPACE_STATUSBAR; - /* header regions */ - /* *** NOTE: *** - * Python layout code (space_statusbar.py) depends on the list order of - * these! Not nice at all, but the only way to identify the correct header - * to draw to is using alignment + list position. It can't use alignment - * only since code below has to set two right aligned regions - XXX. */ - ar = MEM_callocN(sizeof(*ar), "right aligned header for statusbar"); - BLI_addtail(&sstatusbar->regionbase, ar); - ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_RIGHT; - ar = MEM_callocN(sizeof(*ar), "center header for statusbar"); - BLI_addtail(&sstatusbar->regionbase, ar); - ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_RIGHT; /* Right aligned too, so region layout code scales it correctly. */ - ar = MEM_callocN(sizeof(*ar), "left aligned header for statusbar"); + /* header region */ + ar = MEM_callocN(sizeof(*ar), "header for statusbar"); BLI_addtail(&sstatusbar->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; ar->alignment = RGN_ALIGN_NONE; |