UI: Status Bar Keymap Spacing #120124

Merged
Harley Acheson merged 5 commits from Harley/blender:StatusBarSpacing into main 2024-04-02 21:26:06 +02:00
1 changed files with 16 additions and 3 deletions

View File

@ -6176,11 +6176,14 @@ void uiTemplateInputStatus(uiLayout *layout, bContext *C)
WM_window_cursor_keymap_status_get(win, i, 1));
if (msg || (msg_drag == nullptr)) {
uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
/* Icon and text separately are closer together with aligned layout. */
uiItemL(row, "", (ICON_MOUSE_LMB + i));
uiItemL(row, msg ? msg : "", ICON_NONE);
}
if (msg_drag) {
uiItemL(row, msg_drag, (ICON_MOUSE_LMB_DRAG + i));
uiItemL(row, "", (ICON_MOUSE_LMB_DRAG + i));
uiItemL(row, msg_drag, ICON_NONE);
}
/* Use trick with empty string to keep icons in same position. */
@ -6415,13 +6418,23 @@ bool uiTemplateEventFromKeymapItem(uiLayout *layout,
for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) {
uiItemL(layout, "", icon_mod[j]);
}
uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text), icon);
/* Icon and text separately is closer together with aligned layout. */
uiItemL(layout, "", icon);
if (icon < ICON_MOUSE_LMB || icon > ICON_MOUSE_RMB_DRAG) {
/* Mouse icons are left-aliged. Everything else needs a bit of space here. */
uiItemS_ex(layout, 0.6f);
}
uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text), ICON_NONE);
/* Separate items with some extra space. */
uiItemS_ex(layout, 0.7f);
ok = true;
}
else if (text_fallback) {
const char *event_text = WM_key_event_string(kmi->type, true);
uiItemL(layout, event_text, ICON_NONE);
uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text), ICON_NONE);
uiItemS_ex(layout, 0.5f);
ok = true;
}
return ok;