first pass at watch expr location locks - still some jank around the edges due to eval incompleteness, but works for basic cases

This commit is contained in:
Ryan Fleury committed 2026-07-28 11:18:00 -07:00
1 parent ae8960d563
commit 0fe5aa5a43
11 files changed
+258 -149

No files matched your search

+46 -41
View File
@@ -3417,6 +3417,52 @@ rd_cell(RD_CellParams *params, String8 string)
}
}
//////////////////////////////
//- rjf: build lock
//
if(params->flags & RD_CellFlag_Lock && !is_focus_active && !is_focus_active_disabled) UI_Parent(box) UI_Focus(UI_FocusKind_Off)
{
// TODO(rjf): @hack
{
ui_spacer(ui_em(0.5f, 1.f));
}
B32 is_locked = (params->lock_out && params->lock_out[0]);
UI_PrefWidth(ui_em(2.f, 1.f))
UI_TagF(".")
UI_TagF(is_locked ? "pop" : "weak")
UI_TagF("implicit")
UI_Column
UI_Padding(ui_pct(1, 0))
UI_PrefHeight(ui_em(2.f, 1.f))
UI_CornerRadius(ui_top_font_size()*0.5f)
RD_Font(RD_FontSlot_Icons)
UI_TextAlignment(UI_TextAlign_Center)
{
UI_Box *lock_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_DrawBackground|
UI_BoxFlag_DisableFocusOverlay|
UI_BoxFlag_DisableFocusBorder|
UI_BoxFlag_Clickable,
"%S###lock", rd_icon_kind_text_table[is_locked ? RD_IconKind_Locked : RD_IconKind_Unlocked]);
UI_Signal sig = ui_signal_from_box(lock_box);
if(ui_hovering(sig)) UI_Tooltip RD_Font(RD_FontSlot_Main)
{
ui_state->tooltip_anchor_key = lock_box->key;
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
UI_PrefWidth(ui_text_dim(10, 1)) ui_label(is_locked ? s("Unlock Location") : s("Lock Location"));
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_ToggleLock].string, s(""), 1, RD_CmdBindingButtonFlag_NoEdit);
}
}
if(ui_pressed(sig) && params->lock_out)
{
params->lock_out[0] ^= 1;
}
}
}
//////////////////////////////
//- rjf: build left-hand-side container box
//
@@ -3607,47 +3653,6 @@ rd_cell(RD_CellParams *params, String8 string)
}
}
//////////////////////////////
//- rjf: build lock
//
if(params->flags & RD_CellFlag_Lock && !is_focus_active && !is_focus_active_disabled) UI_Parent(box) UI_Focus(UI_FocusKind_Off)
{
UI_PrefWidth(ui_em(2.f, 1.f))
UI_TagF(".")
UI_TagF("weak")
UI_TagF("implicit")
UI_Column
UI_Padding(ui_pct(1, 0))
UI_PrefHeight(ui_em(2.f, 1.f))
UI_CornerRadius(ui_top_font_size()*0.5f)
RD_Font(RD_FontSlot_Icons)
UI_TextAlignment(UI_TextAlign_Center)
{
UI_Box *lock_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_DrawBackground|
UI_BoxFlag_DisableFocusOverlay|
UI_BoxFlag_DisableFocusBorder|
UI_BoxFlag_Clickable,
"%S###lock", rd_icon_kind_text_table[(params->lock_out && params->lock_out[0]) ? RD_IconKind_Locked : RD_IconKind_Unlocked]);
UI_Signal sig = ui_signal_from_box(lock_box);
if(ui_hovering(sig)) UI_Tooltip RD_Font(RD_FontSlot_Main)
{
ui_state->tooltip_anchor_key = lock_box->key;
ui_label((params->lock_out && params->lock_out[0]) ? s("Unlock Evaluated Location") : s("Lock Evaluated Location"));
}
if(ui_pressed(sig) && params->lock_out)
{
params->lock_out[0] ^= 1;
}
}
// TODO(rjf): @hack
{
ui_spacer(ui_em(0.5f, 1.f));
}
}
//////////////////////////////
//- rjf: build toggle-switch
//