From beaaa428e982ad43bf2e979696c97215548dfbd2 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Sat, 15 Feb 2025 00:57:49 +0100 Subject: [PATCH] UI: Tightened Status Bar Spacing Slight adjustments to the spacing of items on the Status Bar. Mainly to reduce the distance between adjoining icons. Small decrease in space between icon and text. Slight decrease in text size inside the event icons. Proportionally wider gap between items. Pull Request: https://projects.blender.org/blender/blender/pulls/134534 --- .../interface/interface_icons_event.cc | 20 ++++++------ .../editors/interface/interface_layout.cc | 5 +-- .../templates/interface_template_event.cc | 12 ++++--- .../templates/interface_template_status.cc | 32 ++++++++++++------- source/blender/editors/screen/area.cc | 6 ++-- 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/source/blender/editors/interface/interface_icons_event.cc b/source/blender/editors/interface/interface_icons_event.cc index 1798815632c..1cf1afec0ee 100644 --- a/source/blender/editors/interface/interface_icons_event.cc +++ b/source/blender/editors/interface/interface_icons_event.cc @@ -86,7 +86,7 @@ static void icon_draw_rect_input_text(const rctf *rect, icon_draw_icon(rect, icon_bg, aspect, alpha, inverted); /* Margin to allow room between outer icon and text. */ - const float margin = BLI_rctf_size_y(rect) * 0.09f; + const float margin = BLI_rctf_size_y(rect) * 0.12f; const float available_height = BLI_rctf_size_y(rect) - (2.0f * margin); const float available_width = BLI_rctf_size_x(rect) - (2.0f * margin); @@ -147,24 +147,24 @@ float ui_event_icon_offset(const int icon_id) ICON_EVENT_INSERT, ICON_EVENT_APP)) { - return 1.5f; + return 1.07f; } if (icon_id >= ICON_EVENT_PAD0 && icon_id <= ICON_EVENT_PADPERIOD) { - return 1.5f; + return 1.07f; } if (icon_id >= ICON_EVENT_F10 && icon_id <= ICON_EVENT_F24) { - return 1.5f; + return 1.07f; } if (platform != MACOS && ELEM(icon_id, ICON_EVENT_CTRL, ICON_EVENT_ALT, ICON_EVENT_OS)) { - return 1.5f; + return 1.07f; } if (icon_id == ICON_EVENT_OS && platform != MACOS && platform != MSWIN) { - return 1.5f; + return 1.07f; } if (icon_id == ICON_EVENT_SPACEKEY) { - return 3.0f; + return 2.42f; } - return 0.0f; + return -0.4f; } void icon_draw_rect_input(const float x, @@ -198,10 +198,10 @@ void icon_draw_rect_input(const float x, ; const float offset = ui_event_icon_offset(icon_id); - if (offset >= 3.0f) { + if (offset >= 2.0f) { rect.xmax = rect.xmin + BLI_rctf_size_x(&rect) * 2.0f; } - else if (offset >= 1.5f) { + else if (offset >= 1.0f) { rect.xmax = rect.xmin + BLI_rctf_size_x(&rect) * 1.5f; } diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 68b1bc65310..8ff5bf83d81 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -3398,8 +3398,9 @@ void uiItemS_ex(uiLayout *layout, float factor, const LayoutSeparatorType type) return; } - int space = (is_menu) ? int(0.35f * UI_UNIT_X) : int(0.3f * UI_UNIT_X); - space *= factor; + /* Sizing of spaces should not depend on line width. */ + const int space = (is_menu) ? int(7.0f * UI_SCALE_FAC * factor) : + int(6.0f * UI_SCALE_FAC * factor); eButType but_type; diff --git a/source/blender/editors/interface/templates/interface_template_event.cc b/source/blender/editors/interface/templates/interface_template_event.cc index f1f008bb946..1cb499fa408 100644 --- a/source/blender/editors/interface/templates/interface_template_event.cc +++ b/source/blender/editors/interface/templates/interface_template_event.cc @@ -91,18 +91,21 @@ int uiTemplateStatusBarModalItem(uiLayout *layout, } } uiItemL(layout, "", icon); + uiItemS_ex(layout, -0.4f); #ifndef WITH_HEADLESS icon = UI_icon_from_keymap_item(kmi_y, icon_mod); #endif uiItemL(layout, "", icon); + uiItemS_ex(layout, -0.4f); #ifndef WITH_HEADLESS icon = UI_icon_from_keymap_item(kmi_z, icon_mod); #endif uiItemL(layout, "", icon); + uiItemS_ex(layout, -0.18f); uiItemL(layout, xyz_label, ICON_NONE); - uiItemS_ex(layout, 0.7f); + uiItemS_ex(layout, 0.6f); return 3; } } @@ -138,7 +141,7 @@ bool uiTemplateEventFromKeymapItem(uiLayout *layout, uiItemL(layout, "", icon); if (icon >= ICON_MOUSE_LMB && icon <= ICON_MOUSE_MMB_SCROLL) { /* Negative space after narrow mice icons. */ - uiItemS_ex(layout, -0.5f); + uiItemS_ex(layout, -0.68f); } const float offset = ui_event_icon_offset(icon); @@ -146,15 +149,16 @@ bool uiTemplateEventFromKeymapItem(uiLayout *layout, uiItemS_ex(layout, offset); } + uiItemS_ex(layout, 0.2f); uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text.c_str()), ICON_NONE); - uiItemS_ex(layout, 0.7f); + uiItemS_ex(layout, 0.6f); 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.c_str()), ICON_NONE); - uiItemS_ex(layout, 0.5f); + uiItemS_ex(layout, 0.6f); ok = true; } return ok; diff --git a/source/blender/editors/interface/templates/interface_template_status.cc b/source/blender/editors/interface/templates/interface_template_status.cc index b61e5e90f66..0d106a8038c 100644 --- a/source/blender/editors/interface/templates/interface_template_status.cc +++ b/source/blender/editors/interface/templates/interface_template_status.cc @@ -154,21 +154,26 @@ static bool uiTemplateInputStatusAzone(uiLayout *layout, const AZone *az, const { if (az->type == AZONE_AREA) { uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemS_ex(layout, -0.2f); uiItemL(layout, IFACE_("Split/Dock"), ICON_NONE); - uiItemS_ex(layout, 0.7f); + uiItemS_ex(layout, 0.6f); uiItemL(layout, "", ICON_EVENT_SHIFT); + uiItemS_ex(layout, -0.4f); uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemS_ex(layout, -0.2f); uiItemL(layout, IFACE_("Duplicate into Window"), ICON_NONE); - uiItemS_ex(layout, 0.7f); + uiItemS_ex(layout, 0.6f); uiItemL(layout, "", ICON_EVENT_CTRL); - uiItemS_ex(layout, 1.5f); + uiItemS_ex(layout, 1.0f); uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemS_ex(layout, -0.2f); uiItemL(layout, IFACE_("Swap Areas"), ICON_NONE); return true; } if (az->type == AZONE_REGION) { uiItemL(layout, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemS_ex(layout, -0.2f); uiItemL(layout, (region->runtime->visible) ? IFACE_("Resize Region") : IFACE_("Show Hidden Region"), ICON_NONE); @@ -191,11 +196,12 @@ static bool uiTemplateInputStatusBorder(wmWindow *win, uiLayout *row) if (BLI_rcti_isect_pt_v(&win_rect, win->eventstate->xy)) { /* No resize at top and bottom. */ uiItemL(row, nullptr, ICON_MOUSE_LMB_DRAG); + uiItemS_ex(row, -0.2f); uiItemL(row, IFACE_("Resize"), ICON_NONE); - uiItemS_ex(row, 0.7f); + uiItemS_ex(row, 0.6f); } uiItemL(row, nullptr, ICON_MOUSE_RMB); - uiItemS_ex(row, -0.5f); + uiItemS_ex(row, -0.9f); uiItemL(row, IFACE_("Options"), ICON_NONE); return true; } @@ -209,10 +215,11 @@ static bool uiTemplateInputStatusHeader(ARegion *region, uiLayout *row) } /* Over a header region. */ uiItemL(row, nullptr, ICON_MOUSE_MMB_DRAG); + uiItemS_ex(row, -0.2f); uiItemL(row, IFACE_("Pan"), ICON_NONE); - uiItemS_ex(row, 0.7f); + uiItemS_ex(row, 0.6f); uiItemL(row, nullptr, ICON_MOUSE_RMB); - uiItemS_ex(row, -0.5f); + uiItemS_ex(row, -0.9f); uiItemL(row, IFACE_("Options"), ICON_NONE); return true; } @@ -230,7 +237,7 @@ static bool uiTemplateInputStatus3DView(bContext *C, uiLayout *row) uiItemS_ex(row, -0.2f); uiItemL(row, IFACE_("Active object has negative scale"), ICON_NONE); uiItemS_ex(row, 0.5f, LayoutSeparatorType::Line); - uiItemS_ex(row, 0.8f); + uiItemS_ex(row, 0.5f); /* Return false to allow other items to be added after. */ return false; } @@ -242,7 +249,7 @@ static bool uiTemplateInputStatus3DView(bContext *C, uiLayout *row) uiItemS_ex(row, -0.2f); uiItemL(row, IFACE_("Active object has non-uniform scale"), ICON_NONE); uiItemS_ex(row, 0.5f, LayoutSeparatorType::Line); - uiItemS_ex(row, 0.8f); + uiItemS_ex(row, 0.5f); /* Return false to allow other items to be added after. */ return false; } @@ -346,15 +353,16 @@ void uiTemplateInputStatus(uiLayout *layout, bContext *C) if (msg) { uiItemL(row, "", (ICON_MOUSE_LMB + i)); - uiItemS_ex(row, -0.5f); + uiItemS_ex(row, -0.9f); uiItemL(row, msg, ICON_NONE); - uiItemS_ex(row, 0.7f); + uiItemS_ex(row, 0.6f); } if (msg_drag) { uiItemL(row, "", (ICON_MOUSE_LMB_DRAG + i)); + uiItemS_ex(row, -0.4f); uiItemL(row, msg_drag, ICON_NONE); - uiItemS_ex(row, 0.7f); + uiItemS_ex(row, 0.6f); } } } diff --git a/source/blender/editors/screen/area.cc b/source/blender/editors/screen/area.cc index 1d550489eeb..2fc8c318df7 100644 --- a/source/blender/editors/screen/area.cc +++ b/source/blender/editors/screen/area.cc @@ -880,12 +880,14 @@ WorkspaceStatus::WorkspaceStatus(bContext *C) /** \name Private helper functions to help ensure consistent spacing * \{ */ -static constexpr float STATUS_AFTER_TEXT = 0.7f; -static constexpr float STATUS_MOUSE_ICON_PAD = -0.5f; +static constexpr float STATUS_BEFORE_TEXT = 0.17f; +static constexpr float STATUS_AFTER_TEXT = 0.90f; +static constexpr float STATUS_MOUSE_ICON_PAD = -0.68f; static void ed_workspace_status_text_item(WorkSpace *workspace, std::string text) { if (!text.empty()) { + ed_workspace_status_space(workspace, STATUS_BEFORE_TEXT); ed_workspace_status_item(workspace, std::move(text), ICON_NONE); ed_workspace_status_space(workspace, STATUS_AFTER_TEXT); }