UI: keep statusbar keymap icons in same position, if there is enough space.

This commit is contained in:
Brecht Van Lommel 2018-06-27 23:59:05 +02:00
parent 8b2297847f
commit a009f2659f
1 changed files with 11 additions and 10 deletions

View File

@ -4309,22 +4309,23 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
/* Otherwise should cursor keymap status. */
for (int i = 0; i < 3; i++) {
uiLayout *box = uiLayoutRow(layout, true);
uiLayout *box = uiLayoutRow(layout, false);
uiLayout *col = uiLayoutColumn(box, false);
uiLayout *row = uiLayoutRow(col, true);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
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));
uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
if (msg_drag) {
uiItemL(box, msg_drag, ICON_MOUSE_DRAG);
}
if (i != 2) {
uiItemS(layout);
}
if (msg_drag) {
uiItemL(row, msg_drag, ICON_MOUSE_DRAG);
}
/* Use trick with empty string to keep icons in same position. */
row = uiLayoutRow(col, false);
uiItemL(row, " ", ICON_NONE);
}
}