UI: Optional Complex Layout for Workspace Status #120595

Merged
Harley Acheson merged 51 commits from Harley/blender:WorkspaceStatus into main 2024-05-06 23:52:47 +02:00
4 changed files with 17 additions and 17 deletions
Showing only changes of commit 764912d50f - Show all commits

View File

@ -963,8 +963,7 @@ void ED_workspace_status_operator(bContext *C,
wmOperatorType *ot,
const int propvalue)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyMap *keymap = WM_keymap_active(wm, ot->modalkeymap);
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), ot->modalkeymap);
if (keymap) {
Harley marked this conversation as resolved Outdated

I'm not sure about using the 🚫 symbol here. I think has meaning "prohibited" rather than "off". I think "✗" maybe be the better opposite of "✔"?

I'm not sure about using the `🚫` symbol here. I think has meaning "prohibited" rather than "off". I think "✗" maybe be the better opposite of "✔"?

It does look "prohibited". But the "✗" (in the various versions we have of it in Unicode) looks a lot like a keypress X. For next update I'll probably make it ✔ & ✖ so we can look at it. Thinner version of these are too small. One matching pair that looks okay is & , but the "x" one can look "on"? Eh, this editor makes these look unlike how we see them in place, will make some captures later. Don't want to spend too much time on this yet as we can always make and use icons for this too.

It does look "prohibited". But the "✗" (in the various versions we have of it in Unicode) looks a lot like a keypress X. For next update I'll probably make it ✔ & ✖ so we can look at it. Thinner version of these are too small. One matching pair that looks okay is ✅ & ❎, but the "x" one can look "on"? Eh, this editor makes these look unlike how we see them in place, will make some captures later. Don't want to spend too much time on this yet as we can always make and use icons for this too.
ED_workspace_status_keymap(C, text, WM_modalkeymap_find_propvalue(keymap, propvalue));
}

View File

@ -794,16 +794,13 @@ static void applyEdgeSlide(TransInfo *t)
ED_area_status_text(t->area, str);
ED_workspace_status_begin(t->context);
std::string desc;
wmOperator *op = nullptr;
wmKeyMap *keymap = WM_window_modal_keymap(t->context, &op);
if (keymap == nullptr || keymap->modal_items == nullptr) {
wmOperator *op = WM_window_modal_operator(t->context);
Harley marked this conversation as resolved Outdated

It's not ideal to get the operator from a global context.

Can you store op->type in EdgeSlideParams in initEdgeSlide perhaps?

It's not ideal to get the operator from a global context. Can you store `op->type` in `EdgeSlideParams` in `initEdgeSlide` perhaps?
if (!op) {
return;
}
ED_workspace_status_begin(t->context);
ED_workspace_status_operator(t->context, TIP_("Confirm"), op->type, TFM_MODAL_CONFIRM);
Harley marked this conversation as resolved Outdated

Some text uses TIP_, while other text uses IFACE_. I would expect it to use one or the other consistently?

Some text uses `TIP_`, while other text uses `IFACE_`. I would expect it to use one or the other consistently?

This was changed recently (!117234), and the decision was to use IFACE_ for the status bar.

This was changed recently (!117234), and the decision was to use `IFACE_` for the status bar.
ED_workspace_status_operator(t->context, TIP_("Cancel"), op->type, TFM_MODAL_CONFIRM);
ED_workspace_status_operator(
@ -815,6 +812,7 @@ static void applyEdgeSlide(TransInfo *t)
ED_workspace_status_operator(t->context, TIP_("Resize"), op->type, TFM_MODAL_RESIZE);
ED_workspace_status_operator(+t->context, TIP_("Precision Mode"), op->type, TFM_MODAL_PRECISION);
std::string desc;
desc = IFACE_("Clamp: ");
desc += WM_bool_as_string(is_clamp);
ED_workspace_status_icons(t->context, ICON_EVENT_C, ICON_EVENT_ALT);

View File

@ -1750,7 +1750,8 @@ void WM_window_status_area_tag_redraw(wmWindow *win);
*/
ScrArea *WM_window_status_area_find(wmWindow *win, bScreen *screen);
wmKeyMap *WM_window_modal_keymap(bContext *C, wmOperator **op_r);
wmOperator *WM_window_modal_operator(bContext *C, wmKeyMap **km_r = nullptr);
bool WM_window_modal_keymap_status_draw(bContext *C, wmWindow *win, uiLayout *layout);
/* `wm_event_query.cc` */

View File

@ -6352,9 +6352,9 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
/** \name Modal Keymap Status
* \{ */
wmKeyMap *WM_window_modal_keymap(bContext *C, wmOperator **op_r)
wmOperator *WM_window_modal_operator(bContext *C, wmKeyMap **km_r)
{
wmKeyMap *keymap = nullptr;
wmOperator *op = nullptr;
wmWindow *win = CTX_wm_window(C);
wmWindowManager *wm = CTX_wm_manager(C);
LISTBASE_FOREACH (wmEventHandler *, handler_base, &win->modalhandlers) {
@ -6365,20 +6365,22 @@ wmKeyMap *WM_window_modal_keymap(bContext *C, wmOperator **op_r)
wmOperator *op_test = handler->op->opm ? handler->op->opm : handler->op;
wmKeyMap *keymap_test = WM_keymap_active(wm, op_test->type->modalkeymap);
if (keymap_test && keymap_test->modal_items) {
keymap = keymap_test;
*op_r = op_test;
if (km_r) {
*km_r = keymap_test;
}
op = op_test;
break;
}
}
}
}
return keymap;
return op;
}
bool WM_window_modal_keymap_status_draw(bContext *C, wmWindow *win, uiLayout *layout)
{
wmOperator *op = nullptr;
wmKeyMap *keymap = WM_window_modal_keymap(C, &op);
wmKeyMap *keymap = nullptr;
wmOperator *op = WM_window_modal_operator(C, &keymap);
if (keymap == nullptr || keymap->modal_items == nullptr) {
return false;
}