mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-09 15:28:08 +00:00
watch lock (ui part, no caching yet)
This commit is contained in:
@@ -4024,9 +4024,30 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
needle = str8_skip_last_slash(needle);
|
needle = str8_skip_last_slash(needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: determine if this cell can be locked
|
||||||
|
B32 cell_can_be_locked = 0;
|
||||||
|
if(str8_match(row_info->group_cfg_name, s("watch_expression"), 0) &&
|
||||||
|
cell_info.flags & RD_WatchCellFlag_Expr &&
|
||||||
|
cell->eval.string.size != 0 &&
|
||||||
|
cell->eval.msgs.count == 0)
|
||||||
|
{
|
||||||
|
cell_can_be_locked = ((cell->eval.irtree.mode == E_Mode_Offset) ||
|
||||||
|
(cell->eval.irtree.mode == E_Mode_Value &&
|
||||||
|
e_type_kind_is_pointer_or_ref(e_type_kind_from_key(e_type_key_unwrap(cell->eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)))));
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: determine if this cell is locked
|
||||||
|
B32 cell_is_locked = 0;
|
||||||
|
if(cell_can_be_locked)
|
||||||
|
{
|
||||||
|
CFG_Node *cfg = row_info->group_cfg_child;
|
||||||
|
cell_is_locked = (cfg_node_child_from_string(cfg, s("locked")) != &cfg_nil_node);
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: form cell build parameters
|
// rjf: form cell build parameters
|
||||||
UI_Key line_edit_key = {0};
|
UI_Key line_edit_key = {0};
|
||||||
RD_CellParams cell_params = {0};
|
RD_CellParams cell_params = {0};
|
||||||
|
B32 next_cell_is_locked = cell_is_locked;
|
||||||
ProfScope("form cell build parameters")
|
ProfScope("form cell build parameters")
|
||||||
{
|
{
|
||||||
E_Type *block_type = e_type_from_key(row->block->eval.irtree.type_key);
|
E_Type *block_type = e_type_from_key(row->block->eval.irtree.type_key);
|
||||||
@@ -4042,6 +4063,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
cell_params.edit_string_size_out = &cell_edit_state->input_size;
|
cell_params.edit_string_size_out = &cell_edit_state->input_size;
|
||||||
cell_params.line_edit_key_out = &line_edit_key;
|
cell_params.line_edit_key_out = &line_edit_key;
|
||||||
cell_params.expanded_out = &next_row_expanded;
|
cell_params.expanded_out = &next_row_expanded;
|
||||||
|
cell_params.lock_out = &next_cell_is_locked;
|
||||||
cell_params.search_needle = needle;
|
cell_params.search_needle = needle;
|
||||||
cell_params.meta_fstrs = cell_info.expr_fstrs;
|
cell_params.meta_fstrs = cell_info.expr_fstrs;
|
||||||
cell_params.value_fstrs = cell_info.eval_fstrs;
|
cell_params.value_fstrs = cell_info.eval_fstrs;
|
||||||
@@ -4145,6 +4167,12 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
cell_params.flags &= ~RD_CellFlag_NoBackground;
|
cell_params.flags &= ~RD_CellFlag_NoBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: watch expression values -> lock
|
||||||
|
if(cell_can_be_locked)
|
||||||
|
{
|
||||||
|
cell_params.flags |= RD_CellFlag_Lock;
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: apply toggle-switch
|
// rjf: apply toggle-switch
|
||||||
if(is_toggle_switch)
|
if(is_toggle_switch)
|
||||||
{
|
{
|
||||||
@@ -4234,6 +4262,23 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
String8 input = str8(cell_edit_state->input_buffer, cell_edit_state->input_size);
|
String8 input = str8(cell_edit_state->input_buffer, cell_edit_state->input_size);
|
||||||
rd_set_autocomp_regs(cell->eval, .ui_key = line_edit_key, .string = input, .cursor = cell_edit_state->cursor);
|
rd_set_autocomp_regs(cell->eval, .ui_key = line_edit_key, .string = input, .cursor = cell_edit_state->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: apply locks
|
||||||
|
if(next_cell_is_locked != cell_is_locked)
|
||||||
|
{
|
||||||
|
CFG_Node *cfg = row_info->group_cfg_child;
|
||||||
|
if(cfg != &cfg_nil_node)
|
||||||
|
{
|
||||||
|
if(next_cell_is_locked)
|
||||||
|
{
|
||||||
|
cfg_node_child_from_string_or_alloc(rd_state->cfg, cfg, s("locked"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cfg_node_release(rd_state->cfg, cfg_node_child_from_string(cfg, s("locked")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3607,6 +3607,47 @@ 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
|
//- rjf: build toggle-switch
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -27,19 +27,20 @@ enum
|
|||||||
//- rjf: extra button extensions
|
//- rjf: extra button extensions
|
||||||
RD_CellFlag_EmptyEditButton = (1<<6),
|
RD_CellFlag_EmptyEditButton = (1<<6),
|
||||||
RD_CellFlag_RevertButton = (1<<7),
|
RD_CellFlag_RevertButton = (1<<7),
|
||||||
|
RD_CellFlag_Lock = (1<<8),
|
||||||
|
|
||||||
//- rjf: behavior
|
//- rjf: behavior
|
||||||
RD_CellFlag_DisableEdit = (1<<8),
|
RD_CellFlag_DisableEdit = (1<<9),
|
||||||
RD_CellFlag_KeyboardClickable = (1<<9),
|
RD_CellFlag_KeyboardClickable = (1<<10),
|
||||||
RD_CellFlag_SingleClickActivate = (1<<10),
|
RD_CellFlag_SingleClickActivate = (1<<11),
|
||||||
|
|
||||||
//- rjf: contents description
|
//- rjf: contents description
|
||||||
RD_CellFlag_CodeContents = (1<<11),
|
RD_CellFlag_CodeContents = (1<<12),
|
||||||
|
|
||||||
//- rjf: appearance
|
//- rjf: appearance
|
||||||
RD_CellFlag_Border = (1<<12),
|
RD_CellFlag_Border = (1<<13),
|
||||||
RD_CellFlag_NoBackground = (1<<13),
|
RD_CellFlag_NoBackground = (1<<14),
|
||||||
RD_CellFlag_Button = (1<<14),
|
RD_CellFlag_Button = (1<<15),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct RD_CellParams RD_CellParams;
|
typedef struct RD_CellParams RD_CellParams;
|
||||||
@@ -59,6 +60,9 @@ struct RD_CellParams
|
|||||||
//- rjf: expander r/w info
|
//- rjf: expander r/w info
|
||||||
B32 *expanded_out;
|
B32 *expanded_out;
|
||||||
|
|
||||||
|
//- rjf: lock r/w info
|
||||||
|
B32 *lock_out;
|
||||||
|
|
||||||
//- rjf: toggle-switch r/w info
|
//- rjf: toggle-switch r/w info
|
||||||
B32 *toggled_out;
|
B32 *toggled_out;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user