UI: Optional Complex Layout for Workspace Status #120595
|
@ -463,10 +463,26 @@ void ED_workspace_status_item(bContext *C,
|
|||
void ED_workspace_status_space(bContext *C, float space_factor = 1.0f);
|
||||
/* Adds one ormore icons to the status bar. */
|
||||
void ED_workspace_status_icons(bContext *C, const int icon);
|
||||
void ED_workspace_status_icons(bContext *C, const int icon1, const int icon2, bool is_range = false);
|
||||
void ED_workspace_status_icons(bContext *C, const int icon1, const int icon2);
|
||||
void ED_workspace_status_icons(bContext *C, const int icon1, const int icon2, const int icon3);
|
||||
void ED_workspace_status_icons(
|
||||
bContext *C, const int icon1, const int icon2, const int icon3, const int icon4);
|
||||
Harley marked this conversation as resolved
Outdated
|
||||
|
||||
void ED_workspace_status_range(bContext *C,
|
||||
const std::string text,
|
||||
const int icon1,
|
||||
const int icon2);
|
||||
|
||||
void ED_workspace_status_key(bContext *C,
|
||||
const std::string text,
|
||||
const int icon,
|
||||
const bool shift = false,
|
||||
const bool ctrl = false,
|
||||
const bool alt = false,
|
||||
const bool oskey = false);
|
||||
|
||||
void ED_workspace_status_keymap(bContext *C, const std::string text, const wmKeyMapItem *kmi);
|
||||
|
||||
/* Ends complex layout and requests a redraw of the status bar. */
|
||||
void ED_workspace_status_end(bContext *C);
|
||||
|
||||
|
|
|
@ -612,9 +612,7 @@ static void ui_popup_menu_create_from_menutype(bContext *C,
|
|||
|
||||
if (bool(mt->flag & MenuTypeFlag::SearchOnKeyPress)) {
|
||||
ED_workspace_status_begin(C);
|
||||
ED_workspace_status_icons(C, ICON_EVENT_A, ICON_EVENT_Z, true);
|
||||
ED_workspace_status_space(C, 0.6f);
|
||||
ED_workspace_status_item(C, IFACE_("Search"));
|
||||
ED_workspace_status_range(C, IFACE_("Search"), ICON_EVENT_A, ICON_EVENT_Z);
|
||||
ED_workspace_status_end(C);
|
||||
}
|
||||
else if (mt->idname[0]) {
|
||||
|
|
|
@ -114,19 +114,19 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
|
|||
|
||||
desc = IFACE_("Tweak: ");
|
||||
desc += WM_bool_as_string(opdata->modify_depth);
|
||||
ED_workspace_status_item(C, desc, ICON_EVENT_CTRL);
|
||||
ED_workspace_status_key(C, desc, ICON_EVENT_CTRL);
|
||||
|
||||
desc = IFACE_("Outset: ");
|
||||
desc += WM_bool_as_string(RNA_boolean_get(op->ptr, "use_outset"));
|
||||
ED_workspace_status_item(C, desc, ICON_EVENT_O);
|
||||
ED_workspace_status_key(C, desc, ICON_EVENT_O);
|
||||
|
||||
desc = IFACE_("Boundary: ");
|
||||
desc += WM_bool_as_string(RNA_boolean_get(op->ptr, "use_boundary"));
|
||||
ED_workspace_status_item(C, desc, ICON_EVENT_B);
|
||||
ED_workspace_status_key(C, desc, ICON_EVENT_B);
|
||||
|
||||
desc = IFACE_("Individual: ");
|
||||
desc += WM_bool_as_string(RNA_boolean_get(op->ptr, "use_individual"));
|
||||
ED_workspace_status_item(C, desc, ICON_EVENT_I);
|
||||
ED_workspace_status_key(C, desc, ICON_EVENT_I);
|
||||
|
||||
ED_workspace_status_end(C);
|
||||
}
|
||||
|
|
|
@ -879,13 +879,9 @@ void ED_workspace_status_icons(bContext *C, const int icon)
|
|||
ED_workspace_status_item(C, {}, icon);
|
||||
}
|
||||
|
||||
void ED_workspace_status_icons(bContext *C, const int icon1, const int icon2, bool is_range)
|
||||
void ED_workspace_status_icons(bContext *C, const int icon1, const int icon2)
|
||||
{
|
||||
ED_workspace_status_item(C, {}, icon1);
|
||||
if (is_range) {
|
||||
ED_workspace_status_item(C, "-");
|
||||
ED_workspace_status_space(C, -0.5f);
|
||||
}
|
||||
ED_workspace_status_item(C, {}, icon2);
|
||||
}
|
||||
|
||||
|
@ -905,6 +901,59 @@ void ED_workspace_status_icons(
|
|||
ED_workspace_status_item(C, {}, icon4);
|
||||
}
|
||||
|
||||
/* Helpers for common keymap patterns. */
|
||||
|
||||
void ED_workspace_status_range(bContext *C,
|
||||
const std::string text,
|
||||
const int icon1,
|
||||
const int icon2)
|
||||
{
|
||||
ED_workspace_status_item(C, {}, icon1);
|
||||
ED_workspace_status_item(C, "-");
|
||||
ED_workspace_status_space(C, -0.5f);
|
||||
ED_workspace_status_item(C, {}, icon2);
|
||||
ED_workspace_status_space(C, 0.6f);
|
||||
ED_workspace_status_item(C, text, ICON_NONE);
|
||||
ED_workspace_status_space(C, 0.7f);
|
||||
}
|
||||
|
||||
void ED_workspace_status_key(bContext *C,
|
||||
const std::string text,
|
||||
const int icon,
|
||||
const bool shift,
|
||||
const bool ctrl,
|
||||
const bool alt,
|
||||
const bool oskey)
|
||||
{
|
||||
if (shift) {
|
||||
ED_workspace_status_item(C, {}, ICON_EVENT_SHIFT);
|
||||
}
|
||||
if (ctrl) {
|
||||
ED_workspace_status_item(C, {}, ICON_EVENT_CTRL);
|
||||
}
|
||||
if (alt) {
|
||||
ED_workspace_status_item(C, {}, ICON_EVENT_ALT);
|
||||
}
|
||||
if (oskey) {
|
||||
ED_workspace_status_item(C, {}, ICON_EVENT_OS);
|
||||
}
|
||||
ED_workspace_status_item(C, {}, icon);
|
||||
ED_workspace_status_space(C, 0.6f);
|
||||
ED_workspace_status_item(C, text, ICON_NONE);
|
||||
ED_workspace_status_space(C, 0.7f);
|
||||
}
|
||||
|
||||
void ED_workspace_status_keymap(bContext *C, const std::string text, const wmKeyMapItem *kmi)
|
||||
{
|
||||
ED_workspace_status_key(C,
|
||||
text,
|
||||
UI_icon_from_event_type(kmi->type, kmi->val),
|
||||
!ELEM(kmi->shift, KM_NOTHING, KM_ANY),
|
||||
!ELEM(kmi->ctrl, KM_NOTHING, KM_ANY),
|
||||
!ELEM(kmi->alt, KM_NOTHING, KM_ANY),
|
||||
!ELEM(kmi->oskey, KM_NOTHING, KM_ANY));
|
||||
}
|
||||
|
||||
void ED_workspace_status_end(bContext *C)
|
||||
{
|
||||
ED_area_tag_redraw(WM_window_status_area_find(CTX_wm_window(C), CTX_wm_screen(C)));
|
||||
|
|
Loading…
Reference in New Issue
Can this just be a single function?