mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
first half of cell rendering pass
This commit is contained in:
@@ -246,6 +246,29 @@ e_value_from_expr(E_Expr *expr)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal E_Eval
|
||||||
|
e_eval_wrap(Arena *arena, E_Eval eval, String8 string)
|
||||||
|
{
|
||||||
|
E_IRTreeAndType *prev_overridden_irtree = e_ir_state->overridden_irtree;
|
||||||
|
e_ir_state->overridden_irtree = &eval.irtree;
|
||||||
|
E_Eval wrapped_eval = e_eval_from_string(arena, string);
|
||||||
|
e_ir_state->overridden_irtree = prev_overridden_irtree;
|
||||||
|
return wrapped_eval;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal E_Eval
|
||||||
|
e_eval_wrapf(Arena *arena, E_Eval eval, char *fmt, ...)
|
||||||
|
{
|
||||||
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
String8 string = push_str8fv(scratch.arena, fmt, args);
|
||||||
|
E_Eval result = e_eval_wrap(arena, eval, string);
|
||||||
|
va_end(args);
|
||||||
|
scratch_end(scratch);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
e_base_offset_from_eval(E_Eval eval)
|
e_base_offset_from_eval(E_Eval eval)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ internal E_Eval e_value_eval_from_eval(E_Eval eval);
|
|||||||
internal E_Value e_value_from_string(String8 string);
|
internal E_Value e_value_from_string(String8 string);
|
||||||
internal E_Value e_value_from_stringf(char *fmt, ...);
|
internal E_Value e_value_from_stringf(char *fmt, ...);
|
||||||
internal E_Value e_value_from_expr(E_Expr *expr);
|
internal E_Value e_value_from_expr(E_Expr *expr);
|
||||||
|
internal E_Eval e_eval_wrap(Arena *arena, E_Eval eval, String8 string);
|
||||||
|
internal E_Eval e_eval_wrapf(Arena *arena, E_Eval eval, char *fmt, ...);;
|
||||||
|
|
||||||
internal U64 e_base_offset_from_eval(E_Eval eval);
|
internal U64 e_base_offset_from_eval(E_Eval eval);
|
||||||
internal Rng1U64 e_range_from_eval(E_Eval eval);
|
internal Rng1U64 e_range_from_eval(E_Eval eval);
|
||||||
|
|||||||
+3
-2
@@ -2343,7 +2343,8 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
|||||||
//- rjf: equip previous task's irtree
|
//- rjf: equip previous task's irtree
|
||||||
if(t->prev != 0)
|
if(t->prev != 0)
|
||||||
{
|
{
|
||||||
result.prev = t->prev;
|
result.prev = push_array(arena, E_IRTreeAndType, 1);
|
||||||
|
result.prev[0] = *t->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: find any auto hooks according to this generation's type
|
//- rjf: find any auto hooks according to this generation's type
|
||||||
@@ -2360,7 +2361,7 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
|||||||
Task *task = push_array(scratch.arena, Task, 1);
|
Task *task = push_array(scratch.arena, Task, 1);
|
||||||
SLLQueuePush(first_task, last_task, task);
|
SLLQueuePush(first_task, last_task, task);
|
||||||
task->expr = e;
|
task->expr = e;
|
||||||
task->prev = push_array(arena, E_IRTreeAndType, 1);
|
task->prev = push_array(scratch.arena, E_IRTreeAndType, 1);
|
||||||
task->prev[0] = result;
|
task->prev[0] = result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+58
-89
@@ -1502,6 +1502,27 @@ rd_eval_space_from_ctrl_entity(CTRL_Entity *entity, E_SpaceKind kind)
|
|||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- rjf: command name <-> eval space
|
||||||
|
|
||||||
|
internal String8
|
||||||
|
rd_cmd_name_from_eval_space(E_Space space)
|
||||||
|
{
|
||||||
|
String8 result = {0};
|
||||||
|
if(space.kind == RD_EvalSpaceKind_MetaCmd)
|
||||||
|
{
|
||||||
|
result = e_string_from_id(space.u64s[0]);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal E_Space
|
||||||
|
rd_eval_space_from_cmd_name(String8 cmd_name)
|
||||||
|
{
|
||||||
|
E_Space space = e_space_make(RD_EvalSpaceKind_MetaCmd);
|
||||||
|
space.u64s[0] = e_id_from_string(cmd_name);
|
||||||
|
return space;
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: eval space reads/writes
|
//- rjf: eval space reads/writes
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
@@ -2636,6 +2657,8 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
else if(str8_match(view_name, str8_lit("watch"), 0))
|
else if(str8_match(view_name, str8_lit("watch"), 0))
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
|
RD_Font(RD_FontSlot_Code)
|
||||||
|
{
|
||||||
E_Eval eval = e_eval_from_string(scratch.arena, expr_string);
|
E_Eval eval = e_eval_from_string(scratch.arena, expr_string);
|
||||||
RD_WatchViewState *ewv = rd_view_state(RD_WatchViewState);
|
RD_WatchViewState *ewv = rd_view_state(RD_WatchViewState);
|
||||||
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
|
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
|
||||||
@@ -3015,7 +3038,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
if(cell_info.flags & RD_WatchCellFlag_CanEdit)
|
if(cell_info.flags & RD_WatchCellFlag_CanEdit)
|
||||||
{
|
{
|
||||||
any_edits_started = 1;
|
any_edits_started = 1;
|
||||||
String8 string = cell_info.string;
|
String8 string = dr_string_from_fstrs(scratch.arena, &cell_info.fstrs);
|
||||||
string.size = Min(string.size, sizeof(ewv->dummy_text_edit_state.input_buffer));
|
string.size = Min(string.size, sizeof(ewv->dummy_text_edit_state.input_buffer));
|
||||||
RD_WatchPt pt = {row->block->key, row->key, rd_id_from_watch_cell(cell)};
|
RD_WatchPt pt = {row->block->key, row->key, rd_id_from_watch_cell(cell)};
|
||||||
U64 hash = ev_hash_from_key(pt.key);
|
U64 hash = ev_hash_from_key(pt.key);
|
||||||
@@ -3213,28 +3236,12 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
rd_cfg_new_replace(expr, new_string);
|
rd_cfg_new_replace(expr, new_string);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case RD_WatchCellKind_Tag:
|
|
||||||
if(editing_complete)
|
|
||||||
{
|
|
||||||
ev_key_set_view_rule(eval_view, pt.key, new_string);
|
|
||||||
RD_Cfg *cfg = row_info.group_cfg_child;
|
|
||||||
if(cfg != &rd_nil_cfg && new_string.size != 0)
|
|
||||||
{
|
|
||||||
RD_Cfg *view_rule = rd_cfg_child_from_string_or_alloc(cfg, str8_lit("view_rule"));
|
|
||||||
rd_cfg_new(view_rule, new_string);
|
|
||||||
}
|
|
||||||
else if(cfg != &rd_nil_cfg && new_string.size == 0)
|
|
||||||
{
|
|
||||||
rd_cfg_release(rd_cfg_child_from_string(cfg, str8_lit("view_rule")));
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
case RD_WatchCellKind_Eval:
|
case RD_WatchCellKind_Eval:
|
||||||
{
|
{
|
||||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
if(cell->eval.irtree.mode == E_Mode_Offset)
|
||||||
if(cell_info.eval.irtree.mode == E_Mode_Offset)
|
|
||||||
{
|
{
|
||||||
B32 should_commit_asap = editing_complete;
|
B32 should_commit_asap = editing_complete;
|
||||||
if(cell_info.eval.space.kind == RD_EvalSpaceKind_MetaCfg)
|
if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCfg)
|
||||||
{
|
{
|
||||||
should_commit_asap = 1;
|
should_commit_asap = 1;
|
||||||
}
|
}
|
||||||
@@ -3245,7 +3252,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
if(should_commit_asap)
|
if(should_commit_asap)
|
||||||
{
|
{
|
||||||
B32 success = 0;
|
B32 success = 0;
|
||||||
success = rd_commit_eval_value_string(cell_info.eval, new_string);
|
success = rd_commit_eval_value_string(cell->eval, new_string);
|
||||||
if(!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
log_user_error(str8_lit("Could not commit value successfully."));
|
log_user_error(str8_lit("Could not commit value successfully."));
|
||||||
@@ -3284,7 +3291,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||||
String8 cell_string = cell_info.string;
|
String8 cell_string = dr_string_from_fstrs(scratch.arena, &cell_info.fstrs);
|
||||||
cell_string = str8_skip_chop_whitespace(cell_string);
|
cell_string = str8_skip_chop_whitespace(cell_string);
|
||||||
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
|
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
|
||||||
if(selection_tbl.min.x != selection_tbl.max.x || selection_tbl.min.y != selection_tbl.max.y)
|
if(selection_tbl.min.x != selection_tbl.max.x || selection_tbl.min.y != selection_tbl.max.y)
|
||||||
@@ -3367,19 +3374,9 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case RD_WatchCellKind_Tag:
|
|
||||||
{
|
|
||||||
if(row_info.group_cfg_child != &rd_nil_cfg)
|
|
||||||
{
|
|
||||||
rd_cfg_release(rd_cfg_child_from_string(row_info.group_cfg_child, str8_lit("view_rule")));
|
|
||||||
}
|
|
||||||
ev_key_set_view_rule(eval_view, row->key, str8_zero());
|
|
||||||
state_dirty = 1;
|
|
||||||
}break;
|
|
||||||
case RD_WatchCellKind_Eval:
|
case RD_WatchCellKind_Eval:
|
||||||
{
|
{
|
||||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
rd_commit_eval_value_string(cell->eval, str8_zero());
|
||||||
rd_commit_eval_value_string(cell_info.eval, str8_zero());
|
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4054,9 +4051,9 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
RD_WatchViewTextEditState *cell_edit_state = rd_watch_view_text_edit_state_from_pt(ewv, cell_pt);
|
RD_WatchViewTextEditState *cell_edit_state = rd_watch_view_text_edit_state_from_pt(ewv, cell_pt);
|
||||||
B32 cell_selected = (row_selected && selection_tbl.min.x <= cell_x && cell_x <= selection_tbl.max.x);
|
B32 cell_selected = (row_selected && selection_tbl.min.x <= cell_x && cell_x <= selection_tbl.max.x);
|
||||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||||
E_TypeKey cell_type_key = cell_info.eval.irtree.type_key;
|
E_TypeKey cell_type_key = cell->eval.irtree.type_key;
|
||||||
E_Type *cell_type = e_type_from_key__cached(cell_type_key);
|
E_Type *cell_type = e_type_from_key__cached(cell_type_key);
|
||||||
E_Eval cell_value_eval = e_value_eval_from_eval(cell_info.eval);
|
E_Eval cell_value_eval = e_value_eval_from_eval(cell->eval);
|
||||||
F32 cell_width_px = cell->px + cell->pct * (dim_2f32(rect).x - floor_f32(ui_top_font_size()*1.5f));
|
F32 cell_width_px = cell->px + cell->pct * (dim_2f32(rect).x - floor_f32(ui_top_font_size()*1.5f));
|
||||||
F32 next_cell_x_px = cell_x_px + cell_width_px;
|
F32 next_cell_x_px = cell_x_px + cell_width_px;
|
||||||
B32 cell_toggled = (cell_value_eval.value.u64 != 0);
|
B32 cell_toggled = (cell_value_eval.value.u64 != 0);
|
||||||
@@ -4074,7 +4071,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
E_Expr *min_expr = cell_type->args[0];
|
E_Expr *min_expr = cell_type->args[0];
|
||||||
E_Expr *max_expr = cell_type->args[1];
|
E_Expr *max_expr = cell_type->args[1];
|
||||||
E_IRTreeAndType *prev_overridden_irtree = e_ir_state->overridden_irtree;
|
E_IRTreeAndType *prev_overridden_irtree = e_ir_state->overridden_irtree;
|
||||||
e_ir_state->overridden_irtree = &cell_info.eval.irtree;
|
e_ir_state->overridden_irtree = &cell->eval.irtree;
|
||||||
{
|
{
|
||||||
E_TypeKey slider_value_type = e_type_key_unwrap(cell_type->direct_type_key, E_TypeUnwrapFlag_AllDecorative);
|
E_TypeKey slider_value_type = e_type_key_unwrap(cell_type->direct_type_key, E_TypeUnwrapFlag_AllDecorative);
|
||||||
slider_value_type_kind = e_type_kind_from_key(slider_value_type);
|
slider_value_type_kind = e_type_kind_from_key(slider_value_type);
|
||||||
@@ -4164,28 +4161,17 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
UI_TagF("weak")
|
UI_TagF("weak")
|
||||||
UI_Tag(cell_tag)
|
UI_Tag(cell_tag)
|
||||||
{
|
{
|
||||||
//- rjf: cell has errors? -> build error box
|
|
||||||
if(cell_info.flags & RD_WatchCellFlag_IsErrored) RD_Font(RD_FontSlot_Main)
|
|
||||||
{
|
|
||||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###%I64x_%I64x", cell_id, row_hash);
|
|
||||||
sig = ui_signal_from_box(box);
|
|
||||||
UI_Parent(box) UI_Flags(0)
|
|
||||||
{
|
|
||||||
rd_error_label(cell_info.string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: cell has hook? -> build ui by calling hook
|
//- rjf: cell has hook? -> build ui by calling hook
|
||||||
else if(cell_info.view_ui_rule != &rd_nil_view_ui_rule)
|
if(cell_info.view_ui_rule != &rd_nil_view_ui_rule)
|
||||||
{
|
{
|
||||||
RD_Cfg *root = rd_immediate_cfg_from_keyf("view_%I64x_%I64x", rd_regs()->view, row_hash);
|
RD_Cfg *root = rd_immediate_cfg_from_keyf("view_%I64x_%I64x", rd_regs()->view, row_hash);
|
||||||
RD_Cfg *view = rd_view_from_eval(root, cell_info.eval);
|
RD_Cfg *view = rd_view_from_eval(root, cell->eval);
|
||||||
Rng2F32 cell_rect = r2f32p(cell_x_px, 0, next_cell_x_px, row_height_px*(row_node->visual_size_skipped + row->visual_size + row_node->visual_size_chopped));
|
Rng2F32 cell_rect = r2f32p(cell_x_px, 0, next_cell_x_px, row_height_px*(row_node->visual_size_skipped + row->visual_size + row_node->visual_size_chopped));
|
||||||
ui_set_next_fixed_y(-1.f * (row_node->visual_size_skipped) * row_height_px);
|
ui_set_next_fixed_y(-1.f * (row_node->visual_size_skipped) * row_height_px);
|
||||||
ui_set_next_fixed_height((row_node->visual_size_skipped + row->visual_size + row_node->visual_size_chopped) * row_height_px);
|
ui_set_next_fixed_height((row_node->visual_size_skipped + row->visual_size + row_node->visual_size_chopped) * row_height_px);
|
||||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable|UI_BoxFlag_FloatingY, "###val_%I64x", row_hash);
|
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable|UI_BoxFlag_FloatingY, "###val_%I64x", row_hash);
|
||||||
UI_Parent(box)
|
UI_Parent(box)
|
||||||
RD_RegsScope(.view = view->id, .file_path = rd_file_path_from_eval(scratch.arena, cell_info.eval))
|
RD_RegsScope(.view = view->id, .file_path = rd_file_path_from_eval(scratch.arena, cell->eval))
|
||||||
UI_PermissionFlags(UI_PermissionFlag_Clicks|UI_PermissionFlag_ScrollX)
|
UI_PermissionFlags(UI_PermissionFlag_Clicks|UI_PermissionFlag_ScrollX)
|
||||||
UI_Flags(0)
|
UI_Flags(0)
|
||||||
{
|
{
|
||||||
@@ -4224,8 +4210,8 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
|
|
||||||
// rjf: view ui contents
|
// rjf: view ui contents
|
||||||
E_IRTreeAndType *prev_overridden_irtree = e_ir_state->overridden_irtree;
|
E_IRTreeAndType *prev_overridden_irtree = e_ir_state->overridden_irtree;
|
||||||
e_ir_state->overridden_irtree = cell_info.eval.irtree.prev;
|
e_ir_state->overridden_irtree = cell->eval.irtree.prev;
|
||||||
cell_info.view_ui_rule->ui(cell_info.eval, cell_rect);
|
cell_info.view_ui_rule->ui(cell->eval, cell_rect);
|
||||||
e_ir_state->overridden_irtree = prev_overridden_irtree;
|
e_ir_state->overridden_irtree = prev_overridden_irtree;
|
||||||
|
|
||||||
// rjf: loading fill
|
// rjf: loading fill
|
||||||
@@ -4266,32 +4252,18 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
B32 cell_has_fancy_editors = (cell->kind != RD_WatchCellKind_Expr || fancy_editors_in_expr);
|
B32 cell_has_fancy_editors = (cell->kind != RD_WatchCellKind_Expr || fancy_editors_in_expr);
|
||||||
B32 is_button = !!(cell_info.flags & RD_WatchCellFlag_Button);
|
B32 is_button = !!(cell_info.flags & RD_WatchCellFlag_Button);
|
||||||
B32 has_background = !!(cell_info.flags & RD_WatchCellFlag_Background);
|
B32 has_background = !!(cell_info.flags & RD_WatchCellFlag_Background);
|
||||||
B32 is_toggle_switch = (cell_has_fancy_editors && cell_info.eval.irtree.mode != E_Mode_Null && cell_type->kind == E_TypeKind_Bool);
|
B32 is_toggle_switch = (cell_has_fancy_editors && cell->eval.irtree.mode != E_Mode_Null && cell_type->kind == E_TypeKind_Bool);
|
||||||
B32 is_slider = (cell_has_fancy_editors && cell_info.eval.irtree.mode != E_Mode_Null && cell_type->kind == E_TypeKind_Lens && str8_match(cell_type->name, str8_lit("range1"), 0));
|
B32 is_slider = (cell_has_fancy_editors && cell->eval.irtree.mode != E_Mode_Null && cell_type->kind == E_TypeKind_Lens && str8_match(cell_type->name, str8_lit("range1"), 0));
|
||||||
B32 is_activated_on_single_click = !!(cell_info.flags & RD_WatchCellFlag_ActivateWithSingleClick);
|
B32 is_activated_on_single_click = !!(cell_info.flags & RD_WatchCellFlag_ActivateWithSingleClick);
|
||||||
B32 is_non_code = !!(cell_info.flags & RD_WatchCellFlag_IsNonCode);
|
B32 is_non_code = !!(cell_info.flags & RD_WatchCellFlag_IsNonCode);
|
||||||
String8 ghost_text = {0};
|
String8 ghost_text = {0};
|
||||||
if(cell->kind == RD_WatchCellKind_Expr && cell_info.string.size == 0)
|
|
||||||
{
|
|
||||||
ghost_text = str8_lit("Expression");
|
|
||||||
is_non_code = !cell_selected || !ewv->text_editing;
|
|
||||||
}
|
|
||||||
else if(cell->kind == RD_WatchCellKind_Tag && cell_info.string.size == 0 && global_row_idx == 0)
|
|
||||||
{
|
|
||||||
ghost_text = str8_lit("View Rules");
|
|
||||||
is_non_code = !cell_selected || !ewv->text_editing;
|
|
||||||
}
|
|
||||||
if(cell_selected && ewv->text_editing && cell->kind == RD_WatchCellKind_Expr)
|
if(cell_selected && ewv->text_editing && cell->kind == RD_WatchCellKind_Expr)
|
||||||
{
|
{
|
||||||
is_non_code = 0;
|
is_non_code = 0;
|
||||||
is_button = 0;
|
is_button = 0;
|
||||||
is_activated_on_single_click = 0;
|
is_activated_on_single_click = 0;
|
||||||
}
|
}
|
||||||
String8 searched_string = cell_info.string;
|
String8 searched_string = dr_string_from_fstrs(scratch.arena, &cell_info.fstrs);
|
||||||
if(cell_info.fstrs.node_count != 0)
|
|
||||||
{
|
|
||||||
searched_string = dr_string_from_fstrs(scratch.arena, &cell_info.fstrs);
|
|
||||||
}
|
|
||||||
String8 search_query = rd_view_query_input();
|
String8 search_query = rd_view_query_input();
|
||||||
FuzzyMatchRangeList fuzzy_matches = fuzzy_match_find(scratch.arena, search_query, searched_string);
|
FuzzyMatchRangeList fuzzy_matches = fuzzy_match_find(scratch.arena, search_query, searched_string);
|
||||||
if(fuzzy_matches.count == 0)
|
if(fuzzy_matches.count == 0)
|
||||||
@@ -4315,7 +4287,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
cell_params.edit_buffer_size = sizeof(cell_edit_state->input_buffer);
|
cell_params.edit_buffer_size = sizeof(cell_edit_state->input_buffer);
|
||||||
cell_params.edit_string_size_out = &cell_edit_state->input_size;
|
cell_params.edit_string_size_out = &cell_edit_state->input_size;
|
||||||
cell_params.expanded_out = &next_row_expanded;
|
cell_params.expanded_out = &next_row_expanded;
|
||||||
cell_params.pre_edit_value = cell_info.string;
|
cell_params.pre_edit_value = dr_string_from_fstrs(scratch.arena, &cell_info.fstrs);
|
||||||
cell_params.fstrs = cell_info.fstrs;
|
cell_params.fstrs = cell_info.fstrs;
|
||||||
cell_params.fuzzy_matches = &fuzzy_matches;
|
cell_params.fuzzy_matches = &fuzzy_matches;
|
||||||
|
|
||||||
@@ -4427,9 +4399,9 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()) &&
|
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()) &&
|
||||||
(!cell_selected || !ewv->text_editing))
|
(!cell_selected || !ewv->text_editing))
|
||||||
{
|
{
|
||||||
if(cell_info.eval.space.kind == E_SpaceKind_FileSystem)
|
if(cell->eval.space.kind == E_SpaceKind_FileSystem)
|
||||||
{
|
{
|
||||||
String8 file_path = rd_file_path_from_eval(scratch.arena, cell_info.eval);
|
String8 file_path = rd_file_path_from_eval(scratch.arena, cell->eval);
|
||||||
RD_RegsScope(.file_path = file_path) rd_drag_begin(RD_RegSlot_FilePath);
|
RD_RegsScope(.file_path = file_path) rd_drag_begin(RD_RegSlot_FilePath);
|
||||||
}
|
}
|
||||||
else if(cell_info.cfg != &rd_nil_cfg)
|
else if(cell_info.cfg != &rd_nil_cfg)
|
||||||
@@ -4447,12 +4419,12 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
case CTRL_EntityKind_Thread:{RD_RegsScope(.thread = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Thread);}break;
|
case CTRL_EntityKind_Thread:{RD_RegsScope(.thread = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Thread);}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(cell_info.eval.space.kind == RD_EvalSpaceKind_CtrlEntity ||
|
else if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity ||
|
||||||
cell_info.eval.space.kind == E_SpaceKind_FileSystem ||
|
cell->eval.space.kind == E_SpaceKind_FileSystem ||
|
||||||
cell_info.eval.space.kind == E_SpaceKind_File ||
|
cell->eval.space.kind == E_SpaceKind_File ||
|
||||||
cell_info.eval.space.kind == E_SpaceKind_Null)
|
cell->eval.space.kind == E_SpaceKind_Null)
|
||||||
{
|
{
|
||||||
RD_RegsScope(.expr = e_string_from_expr(scratch.arena, cell_info.eval.expr))
|
RD_RegsScope(.expr = e_string_from_expr(scratch.arena, cell->eval.expr))
|
||||||
rd_drag_begin(RD_RegSlot_Expr);
|
rd_drag_begin(RD_RegSlot_Expr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4524,13 +4496,13 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: can't edit, but has address info? -> go to address
|
// rjf: can't edit, but has address info? -> go to address
|
||||||
else if(cell_info.eval.space.kind == RD_EvalSpaceKind_CtrlEntity)
|
else if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity)
|
||||||
{
|
{
|
||||||
CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(cell_info.eval.space);
|
CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(cell->eval.space);
|
||||||
CTRL_Entity *process = ctrl_process_from_entity(entity);
|
CTRL_Entity *process = ctrl_process_from_entity(entity);
|
||||||
if(process != &ctrl_entity_nil)
|
if(process != &ctrl_entity_nil)
|
||||||
{
|
{
|
||||||
U64 vaddr = cell_info.eval.value.u64;
|
U64 vaddr = cell->eval.value.u64;
|
||||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
||||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||||
@@ -4551,9 +4523,9 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: can't edit, but has cfg? -> find or select
|
// rjf: can't edit, but has cfg? -> find or select
|
||||||
else if(cell_info.eval.space.kind == RD_EvalSpaceKind_MetaCfg)
|
else if(cell_info.cfg != &rd_nil_cfg)
|
||||||
{
|
{
|
||||||
RD_Cfg *cfg = rd_cfg_from_eval_space(cell_info.eval.space);
|
RD_Cfg *cfg = cell_info.cfg;
|
||||||
RD_Location loc = rd_location_from_cfg(cfg);
|
RD_Location loc = rd_location_from_cfg(cfg);
|
||||||
if(loc.file_path.size != 0)
|
if(loc.file_path.size != 0)
|
||||||
{
|
{
|
||||||
@@ -4575,13 +4547,9 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: can't edit, but has thread? -> select
|
// rjf: can't edit, but has thread? -> select
|
||||||
else if(cell_info.eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity)
|
else if(cell_info.entity->kind == CTRL_EntityKind_Thread)
|
||||||
{
|
{
|
||||||
CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(cell_info.eval.space);
|
rd_cmd(RD_CmdKind_SelectThread, .thread = cell_info.entity->handle);
|
||||||
if(entity->kind == CTRL_EntityKind_Thread)
|
|
||||||
{
|
|
||||||
rd_cmd(RD_CmdKind_SelectThread, .thread = entity->handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4607,7 +4575,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
//
|
//
|
||||||
if(next_cell_toggled != cell_toggled)
|
if(next_cell_toggled != cell_toggled)
|
||||||
{
|
{
|
||||||
rd_commit_eval_value_string(cell_info.eval, next_cell_toggled ? str8_lit("1") : str8_lit("0"));
|
rd_commit_eval_value_string(cell->eval, next_cell_toggled ? str8_lit("1") : str8_lit("0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
@@ -4638,7 +4606,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
new_value_string = push_str8f(scratch.arena, "%f", new_value);
|
new_value_string = push_str8f(scratch.arena, "%f", new_value);
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
rd_commit_eval_value_string(cell_info.eval, new_value_string);
|
rd_commit_eval_value_string(cell->eval, new_value_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
@@ -4673,6 +4641,7 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rd_store_view_scroll_pos(scroll_pos);
|
rd_store_view_scroll_pos(scroll_pos);
|
||||||
|
}
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -899,6 +899,10 @@ internal E_Space rd_eval_space_from_cfg(RD_Cfg *cfg);
|
|||||||
internal CTRL_Entity *rd_ctrl_entity_from_eval_space(E_Space space);
|
internal CTRL_Entity *rd_ctrl_entity_from_eval_space(E_Space space);
|
||||||
internal E_Space rd_eval_space_from_ctrl_entity(CTRL_Entity *entity, E_SpaceKind kind);
|
internal E_Space rd_eval_space_from_ctrl_entity(CTRL_Entity *entity, E_SpaceKind kind);
|
||||||
|
|
||||||
|
//- rjf: command name <-> eval space
|
||||||
|
internal String8 rd_cmd_name_from_eval_space(E_Space space);
|
||||||
|
internal E_Space rd_eval_space_from_cmd_name(String8 cmd_name);
|
||||||
|
|
||||||
//- rjf: eval space reads/writes
|
//- rjf: eval space reads/writes
|
||||||
internal B32 rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range);
|
internal B32 rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range);
|
||||||
internal B32 rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range);
|
internal B32 rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range);
|
||||||
|
|||||||
+293
-61
@@ -1113,7 +1113,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
for(U64 idx = 0; idx < maybe_table_type->count; idx += 1)
|
for(U64 idx = 0; idx < maybe_table_type->count; idx += 1)
|
||||||
{
|
{
|
||||||
E_Eval cell_eval = e_eval_from_expr(arena, maybe_table_type->args[idx]);
|
E_Eval cell_eval = e_eval_from_expr(arena, maybe_table_type->args[idx]);
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .eval = cell_eval, .default_pct = 1.f/maybe_table_type->count, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, cell_eval, .default_pct = 1.f/maybe_table_type->count, .pct = take_pct());
|
||||||
}
|
}
|
||||||
e_ir_state->overridden_irtree = prev_overridden_irtree;
|
e_ir_state->overridden_irtree = prev_overridden_irtree;
|
||||||
info.can_expand = 0;
|
info.can_expand = 0;
|
||||||
@@ -1129,11 +1129,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
if(type->kind == E_TypeKind_Set)
|
if(type->kind == E_TypeKind_Set)
|
||||||
{
|
{
|
||||||
String8 file_path = e_string_from_id(row->eval.value.u64);
|
String8 file_path = e_string_from_id(row->eval.value.u64);
|
||||||
DR_FStrList fstrs = rd_title_fstrs_from_file_path(arena, file_path);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_IsNonCode, .pct = 1.f);
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr,
|
|
||||||
.flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_IsNonCode,
|
|
||||||
.pct = 1.f,
|
|
||||||
.fstrs = fstrs);
|
|
||||||
if(str8_match(type->name, str8_lit("file"), 0))
|
if(str8_match(type->name, str8_lit("file"), 0))
|
||||||
{
|
{
|
||||||
info.can_expand = 0;
|
info.can_expand = 0;
|
||||||
@@ -1147,8 +1143,8 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
RD_Cfg *w_cfg = style->first;
|
RD_Cfg *w_cfg = style->first;
|
||||||
F32 next_pct = 0;
|
F32 next_pct = 0;
|
||||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.65f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .default_pct = 0.65f, .pct = take_pct());
|
||||||
#undef take_pct
|
#undef take_pct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1156,29 +1152,10 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: @watch_row_build_cells unattached processes
|
//- rjf: @watch_row_build_cells unattached processes
|
||||||
//
|
//
|
||||||
else if(row->eval.space.kind == RD_EvalSpaceKind_MetaUnattachedProcess)
|
else if(row->eval.space.kind == RD_EvalSpaceKind_MetaUnattachedProcess &&
|
||||||
|
str8_match(row_type->name, str8_lit("unattached_process"), 0))
|
||||||
{
|
{
|
||||||
E_Type *type = e_type_from_key__cached(row->eval.irtree.type_key);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
if(str8_match(type->name, str8_lit("unattached_process"), 0))
|
|
||||||
{
|
|
||||||
U64 pid = row->eval.value.u128.u64[0];
|
|
||||||
String8 name = e_string_from_id(row->eval.value.u128.u64[1]);
|
|
||||||
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), ui_top_font_size()};
|
|
||||||
DR_FStrList fstrs = {0};
|
|
||||||
UI_TagF("weak")
|
|
||||||
{
|
|
||||||
dr_fstrs_push_new(arena, &fstrs, ¶ms,
|
|
||||||
rd_icon_kind_text_table[RD_IconKind_Scheduler],
|
|
||||||
.font = rd_font_from_slot(RD_FontSlot_Icons),
|
|
||||||
.raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons),
|
|
||||||
.color = ui_color_from_name(str8_lit("text")));
|
|
||||||
}
|
|
||||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" "));
|
|
||||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, push_str8f(arena, "(PID: %I64u)", pid));
|
|
||||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" "));
|
|
||||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, name);
|
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f, .fstrs = fstrs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -1187,7 +1164,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
else if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("lister")) != &rd_nil_cfg)
|
else if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("lister")) != &rd_nil_cfg)
|
||||||
{
|
{
|
||||||
info.can_expand = 0;
|
info.can_expand = 0;
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -1196,7 +1173,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
else if(is_top_level && evalled_cfg != &rd_nil_cfg)
|
else if(is_top_level && evalled_cfg != &rd_nil_cfg)
|
||||||
{
|
{
|
||||||
RD_Cfg *cfg = evalled_cfg;
|
RD_Cfg *cfg = evalled_cfg;
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f, .fstrs = rd_title_fstrs_from_cfg(arena, cfg));
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
MD_NodePtrList schemas = rd_schemas_from_name(cfg->string);
|
MD_NodePtrList schemas = rd_schemas_from_name(cfg->string);
|
||||||
for(MD_NodePtrNode *n = schemas.first; n != 0; n = n->next)
|
for(MD_NodePtrNode *n = schemas.first; n != 0; n = n->next)
|
||||||
{
|
{
|
||||||
@@ -1244,14 +1221,18 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
}
|
}
|
||||||
if(cmd_kind == RD_CmdKind_EnableCfg || cmd_kind == RD_CmdKind_DisableCfg)
|
if(cmd_kind == RD_CmdKind_EnableCfg || cmd_kind == RD_CmdKind_DisableCfg)
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .flags = RD_WatchCellFlag_Background,
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||||
|
.flags = RD_WatchCellFlag_Background,
|
||||||
.px = floor_f32(ui_top_font_size()*6.f),
|
.px = floor_f32(ui_top_font_size()*6.f),
|
||||||
.string = str8_lit("($expr).enabled"));
|
.string = str8_lit("($expr).enabled"));
|
||||||
}
|
}
|
||||||
else if(cmd_kind != RD_CmdKind_Null)
|
else if(cmd_kind != RD_CmdKind_Null)
|
||||||
{
|
{
|
||||||
String8 cmd_name = rd_cmd_kind_info_table[cmd_kind].string;
|
String8 cmd_name = rd_cmd_kind_info_table[cmd_kind].string;
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .flags = RD_WatchCellFlag_ActivateWithSingleClick|RD_WatchCellFlag_Button, .px = floor_f32(ui_top_font_size()*4.f), .string = push_str8f(arena, "query:commands.%S", cmd_name));
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval,
|
||||||
|
.flags = RD_WatchCellFlag_ActivateWithSingleClick|RD_WatchCellFlag_Button,
|
||||||
|
.px = floor_f32(ui_top_font_size()*4.f),
|
||||||
|
.string = push_str8f(arena, "query:commands.%S", cmd_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1263,14 +1244,15 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
else if(is_top_level && evalled_entity != &ctrl_entity_nil)
|
else if(is_top_level && evalled_entity != &ctrl_entity_nil)
|
||||||
{
|
{
|
||||||
CTRL_Entity *entity = evalled_entity;
|
CTRL_Entity *entity = evalled_entity;
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button, .pct = 1.f, .fstrs = rd_title_fstrs_from_ctrl_entity(arena, entity, 1));
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval,
|
||||||
|
.flags = RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button,
|
||||||
|
.pct = 1.f);
|
||||||
if(entity->kind == CTRL_EntityKind_Machine ||
|
if(entity->kind == CTRL_EntityKind_Machine ||
|
||||||
entity->kind == CTRL_EntityKind_Process ||
|
entity->kind == CTRL_EntityKind_Process ||
|
||||||
entity->kind == CTRL_EntityKind_Thread)
|
entity->kind == CTRL_EntityKind_Thread)
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval,
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_wrapf(arena, row->eval, "active"),
|
||||||
.px = floor_f32(ui_top_font_size()*6.f),
|
.px = floor_f32(ui_top_font_size()*6.f));
|
||||||
.string = str8_lit("($expr).active"));
|
|
||||||
}
|
}
|
||||||
if(entity->kind == CTRL_EntityKind_Thread)
|
if(entity->kind == CTRL_EntityKind_Thread)
|
||||||
{
|
{
|
||||||
@@ -1280,7 +1262,9 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
cmd_kind = RD_CmdKind_DeselectEntity;
|
cmd_kind = RD_CmdKind_DeselectEntity;
|
||||||
}
|
}
|
||||||
String8 cmd_name = rd_cmd_kind_info_table[cmd_kind].string;
|
String8 cmd_name = rd_cmd_kind_info_table[cmd_kind].string;
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .flags = RD_WatchCellFlag_ActivateWithSingleClick|RD_WatchCellFlag_Button, .px = floor_f32(ui_top_font_size()*4.f), .string = push_str8f(arena, "query:commands.%S", cmd_name));
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_from_stringf(arena, "query:commands.%S", cmd_name),
|
||||||
|
.flags = RD_WatchCellFlag_ActivateWithSingleClick|RD_WatchCellFlag_Button,
|
||||||
|
.px = floor_f32(ui_top_font_size()*4.f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1289,7 +1273,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
//
|
//
|
||||||
else if(row->eval.space.kind == RD_EvalSpaceKind_MetaQuery)
|
else if(row->eval.space.kind == RD_EvalSpaceKind_MetaQuery)
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -1300,13 +1284,13 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
E_Type *type = e_type_from_key__cached(row->eval.irtree.type_key);
|
E_Type *type = e_type_from_key__cached(row->eval.irtree.type_key);
|
||||||
if(type->kind == E_TypeKind_Set)
|
if(type->kind == E_TypeKind_Set)
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String8 cmd_name = e_string_from_id(e_value_eval_from_eval(row->eval).value.u64);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval,
|
||||||
RD_CmdKindInfo *cmd_kind_info = rd_cmd_kind_info_from_string(cmd_name);
|
.flags = RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button|RD_WatchCellFlag_ActivateWithSingleClick,
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented|RD_WatchCellFlag_Button|RD_WatchCellFlag_ActivateWithSingleClick, .pct = 1.f, .fstrs = rd_title_fstrs_from_code_name(arena, cmd_kind_info->string));
|
.pct = 1.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1315,7 +1299,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
//
|
//
|
||||||
else if(info.view_ui_rule != &rd_nil_view_ui_rule)
|
else if(info.view_ui_rule != &rd_nil_view_ui_rule)
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_ViewUI, .pct = 1.f);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_ViewUI, row->eval, .pct = 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -1323,7 +1307,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
//
|
//
|
||||||
else if(row->eval.expr == &e_expr_nil && info.group_cfg_name.size != 0 && info.group_cfg_child == &rd_nil_cfg)
|
else if(row->eval.expr == &e_expr_nil && info.group_cfg_name.size != 0 && info.group_cfg_child == &rd_nil_cfg)
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -1334,7 +1318,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
row->eval.space.kind == RD_EvalSpaceKind_MetaCmd ||
|
row->eval.space.kind == RD_EvalSpaceKind_MetaCmd ||
|
||||||
row->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity))
|
row->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity))
|
||||||
{
|
{
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@@ -1356,8 +1340,8 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
RD_Cfg *w_cfg = style->first;
|
RD_Cfg *w_cfg = style->first;
|
||||||
F32 next_pct = 0;
|
F32 next_pct = 0;
|
||||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.65f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .default_pct = 0.65f, .pct = take_pct());
|
||||||
#undef take_pct
|
#undef take_pct
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1372,8 +1356,8 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
RD_Cfg *w_cfg = style->first;
|
RD_Cfg *w_cfg = style->first;
|
||||||
F32 next_pct = 0;
|
F32 next_pct = 0;
|
||||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.75f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.75f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("lens:hex((U64)($expr))"), .default_pct = 0.25f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_wrapf(arena, row->eval, "lens:hex((uint64)$)"), .default_pct = 0.25f, .pct = take_pct());
|
||||||
#undef take_pct
|
#undef take_pct
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1396,11 +1380,10 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
RD_Cfg *w_cfg = style->first;
|
RD_Cfg *w_cfg = style->first;
|
||||||
F32 next_pct = 0;
|
F32 next_pct = 0;
|
||||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_CallStackFrame, .default_pct = 0.05f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_CallStackFrame, row->eval, .default_pct = 0.05f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.55f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .default_pct = 0.55f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("lens:hex((uint64)($expr))"), .default_pct = 0.20f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_wrapf(arena, row->eval, "lens:hex((uint64)$)"), .default_pct = 0.20f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval,
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, (module == &ctrl_entity_nil ? (E_Eval)zero_struct : module_eval),
|
||||||
.eval = (module == &ctrl_entity_nil ? (E_Eval)zero_struct : module_eval),
|
|
||||||
.string = str8_lit(" "),
|
.string = str8_lit(" "),
|
||||||
.default_pct = 0.20f, .pct = take_pct());
|
.default_pct = 0.20f, .pct = take_pct());
|
||||||
#undef take_pct
|
#undef take_pct
|
||||||
@@ -1417,9 +1400,9 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
RD_Cfg *w_cfg = style->first;
|
RD_Cfg *w_cfg = style->first;
|
||||||
F32 next_pct = 0;
|
F32 next_pct = 0;
|
||||||
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
#define take_pct() (next_pct = (F32)f64_from_str8(w_cfg->string), w_cfg = w_cfg->next, next_pct)
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, row->eval, .flags = RD_WatchCellFlag_Indented, .default_pct = 0.35f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.40f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .default_pct = 0.40f, .pct = take_pct());
|
||||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .string = str8_lit("typeof(raw($expr))"), .default_pct = 0.25f, .pct = take_pct());
|
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, e_eval_wrapf(arena, row->eval, "typeof(raw($))"), .default_pct = 0.25f, .pct = take_pct());
|
||||||
#undef take_pct
|
#undef take_pct
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1433,11 +1416,259 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
|||||||
internal RD_WatchRowCellInfo
|
internal RD_WatchRowCellInfo
|
||||||
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_flags, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_flags, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
||||||
{
|
{
|
||||||
RD_WatchRowCellInfo result = {0};
|
RD_WatchRowCellInfo result =
|
||||||
|
{
|
||||||
|
.flags = cell->flags,
|
||||||
|
.view_ui_rule = &rd_nil_view_ui_rule,
|
||||||
|
.cfg = &rd_nil_cfg,
|
||||||
|
.entity = &ctrl_entity_nil,
|
||||||
|
};
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
//- rjf: unpack evaluation
|
||||||
|
//
|
||||||
|
E_Type *cell_type = e_type_from_key__cached(cell->eval.irtree.type_key);
|
||||||
|
if(cell->eval.space.u64s[1] == 0)
|
||||||
|
{
|
||||||
|
result.cfg = rd_cfg_from_eval_space(cell->eval.space);
|
||||||
|
}
|
||||||
|
if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity && cell->eval.space.u64s[2] == 0)
|
||||||
|
{
|
||||||
|
result.entity = rd_ctrl_entity_from_eval_space(cell->eval.space);
|
||||||
|
}
|
||||||
|
result.cmd_name = rd_cmd_name_from_eval_space(cell->eval.space);
|
||||||
|
if(cell->eval.space.kind == E_SpaceKind_FileSystem)
|
||||||
|
{
|
||||||
|
result.file_path = e_string_from_id(cell->eval.space.u64_0);
|
||||||
|
}
|
||||||
|
for(E_Type *type = cell_type;
|
||||||
|
type->kind == E_TypeKind_Lens;
|
||||||
|
type = e_type_from_key__cached(type->direct_type_key))
|
||||||
|
{
|
||||||
|
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(type->name);
|
||||||
|
if(view_ui_rule != &rd_nil_view_ui_rule)
|
||||||
|
{
|
||||||
|
result.view_ui_rule = view_ui_rule;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
//- rjf: build cell's visual appearance info
|
||||||
|
//
|
||||||
|
switch(cell->eval.space.kind)
|
||||||
|
{
|
||||||
|
//- rjf: default case: depending on cell info, generate string
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
//- rjf: cfg evaluation -> button for cfg
|
||||||
|
if(result.cfg != &rd_nil_cfg)
|
||||||
|
{
|
||||||
|
result.fstrs = rd_title_fstrs_from_cfg(arena, result.cfg);
|
||||||
|
result.flags |= RD_WatchCellFlag_Button;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: entity evaluation -> button for entity
|
||||||
|
else if(result.entity != &ctrl_entity_nil)
|
||||||
|
{
|
||||||
|
result.fstrs = rd_title_fstrs_from_ctrl_entity(arena, result.entity, 1);
|
||||||
|
result.flags |= RD_WatchCellFlag_Button;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: buttons -> button for command
|
||||||
|
else if(result.cmd_name.size != 0)
|
||||||
|
{
|
||||||
|
RD_CmdKindInfo *cmd_kind_info = rd_cmd_kind_info_from_string(result.cmd_name);
|
||||||
|
result.fstrs = rd_title_fstrs_from_code_name(arena, cmd_kind_info->string);
|
||||||
|
result.flags |= RD_WatchCellFlag_Button;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: files -> button for file
|
||||||
|
else if(result.file_path.size != 0)
|
||||||
|
{
|
||||||
|
String8 file_path = e_string_from_id(cell->eval.value.u64);
|
||||||
|
result.fstrs = rd_title_fstrs_from_file_path(arena, file_path);
|
||||||
|
result.flags |= RD_WatchCellFlag_Button;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: expression cell -> need to form "left-hand-side", or "meta" string, for some evaluation
|
||||||
|
else if(cell->kind == RD_WatchCellKind_Expr)
|
||||||
|
{
|
||||||
|
// rjf: funnel-through this cell's string, if it has one
|
||||||
|
B32 is_non_code = 0;
|
||||||
|
String8 expr_string = cell->string;
|
||||||
|
|
||||||
|
// rjf: if this cell has no string specified, then we need to synthesize one from the evaluation
|
||||||
|
if(expr_string.size == 0)
|
||||||
|
{
|
||||||
|
// rjf: first, locate a notable expression - we special-case things like member accesses
|
||||||
|
// or array indices, so we should grab those if possible
|
||||||
|
E_Expr *notable_expr = cell->eval.expr;
|
||||||
|
for(B32 good = 0; !good;)
|
||||||
|
{
|
||||||
|
switch(notable_expr->kind)
|
||||||
|
{
|
||||||
|
default:{good = 1;}break;
|
||||||
|
case E_ExprKind_Address:
|
||||||
|
case E_ExprKind_Deref:
|
||||||
|
case E_ExprKind_Cast:
|
||||||
|
{
|
||||||
|
notable_expr = notable_expr->last;
|
||||||
|
}break;
|
||||||
|
case E_ExprKind_Ref:
|
||||||
|
{
|
||||||
|
notable_expr = notable_expr->ref;
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: generate expression string based on our notable expression
|
||||||
|
switch(notable_expr->kind)
|
||||||
|
{
|
||||||
|
// rjf: default case -> just walk the expression tree & generate a string
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
expr_string = e_string_from_expr(arena, notable_expr);
|
||||||
|
}break;
|
||||||
|
|
||||||
|
// rjf: array indices -> fast path to [index]
|
||||||
|
case E_ExprKind_ArrayIndex:
|
||||||
|
{
|
||||||
|
expr_string = push_str8f(arena, "[%S]", e_string_from_expr(arena, notable_expr->last));
|
||||||
|
}break;
|
||||||
|
|
||||||
|
// rjf: member accesses -> fast-path to .name
|
||||||
|
case E_ExprKind_MemberAccess:
|
||||||
|
{
|
||||||
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
|
// TODO(rjf): @cfg need to build inheritance tooltips
|
||||||
|
#if 0
|
||||||
|
if(member.inheritance_key_chain.count != 0)
|
||||||
|
{
|
||||||
|
String8List strings = {0};
|
||||||
|
for(E_TypeKeyNode *n = member.inheritance_key_chain.first; n != 0; n = n->next)
|
||||||
|
{
|
||||||
|
String8 base_class_name = e_type_string_from_key(scratch.arena, n->v);
|
||||||
|
str8_list_push(scratch.arena, &strings, base_class_name);
|
||||||
|
}
|
||||||
|
result.inheritance_tooltip = str8_list_join(arena, &strings, &(StringJoin){.sep = str8_lit_comp("::")});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// rjf: in meta-evaluation spaces, we will try to look up into our vocabulary map
|
||||||
|
// to see if we have a fancy display string for this member. otherwise, we will just
|
||||||
|
// do a code-string of ".member_name"
|
||||||
|
String8 member_name = notable_expr->first->next->string;
|
||||||
|
if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCfg ||
|
||||||
|
cell->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ||
|
||||||
|
cell->eval.space.kind == E_SpaceKind_File ||
|
||||||
|
cell->eval.space.kind == E_SpaceKind_FileSystem)
|
||||||
|
{
|
||||||
|
String8 fancy_name = rd_display_from_code_name(member_name);
|
||||||
|
if(fancy_name.size != 0)
|
||||||
|
{
|
||||||
|
expr_string = fancy_name;
|
||||||
|
is_non_code = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(expr_string.size == 0)
|
||||||
|
{
|
||||||
|
expr_string = push_str8f(arena, ".%S", member_name);
|
||||||
|
}
|
||||||
|
scratch_end(scratch);
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: use expression string / params to generate fancy strings
|
||||||
|
if(is_non_code)
|
||||||
|
{
|
||||||
|
UI_TagF("weak")
|
||||||
|
{
|
||||||
|
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), font_size, 0, 0};
|
||||||
|
dr_fstrs_push_new(arena, &result.fstrs, ¶ms, expr_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.fstrs = rd_fstrs_from_code_string(arena, 1, 0, ui_color_from_name(str8_lit("text")), expr_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- rjf: evaluation -> need to form value string
|
||||||
|
else if(cell->kind == RD_WatchCellKind_Eval)
|
||||||
|
{
|
||||||
|
// rjf: determine string generation parameters based on evaluation
|
||||||
|
EV_StringParams string_params = {string_flags, 10};
|
||||||
|
{
|
||||||
|
if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCfg ||
|
||||||
|
cell->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity)
|
||||||
|
{
|
||||||
|
string_params.flags |= EV_StringFlag_DisableStringQuotes|EV_StringFlag_DisableAddresses;
|
||||||
|
}
|
||||||
|
if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity &&
|
||||||
|
rd_ctrl_entity_from_eval_space(cell->eval.space)->kind == CTRL_EntityKind_Module)
|
||||||
|
{
|
||||||
|
string_params.radix = 16;
|
||||||
|
}
|
||||||
|
if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity &&
|
||||||
|
rd_ctrl_entity_from_eval_space(cell->eval.space)->kind == CTRL_EntityKind_Thread)
|
||||||
|
{
|
||||||
|
string_params.radix = 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: determine if code
|
||||||
|
B32 is_code = 1;
|
||||||
|
{
|
||||||
|
E_Type *type = e_type_from_key__cached(cell->eval.irtree.type_key);
|
||||||
|
if(type->flags & (E_TypeFlag_IsPlainText|E_TypeFlag_IsPathText))
|
||||||
|
{
|
||||||
|
is_code = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rjf: generate string based on that expression & fill
|
||||||
|
String8 string = rd_value_string_from_eval(arena, rd_view_query_input(), &string_params, font, font_size, max_size_px, cell->eval);
|
||||||
|
if(is_code)
|
||||||
|
{
|
||||||
|
result.fstrs = rd_fstrs_from_code_string(arena, 1, 0, ui_color_from_name(str8_lit("text")), string);
|
||||||
|
}
|
||||||
|
else UI_TagF("weak")
|
||||||
|
{
|
||||||
|
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), font_size, 0, 0};
|
||||||
|
dr_fstrs_push_new(arena, &result.fstrs, ¶ms, string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
|
||||||
|
//- rjf: unattached processes
|
||||||
|
case RD_EvalSpaceKind_MetaUnattachedProcess:
|
||||||
|
{
|
||||||
|
U64 pid = cell->eval.value.u128.u64[0];
|
||||||
|
String8 name = e_string_from_id(cell->eval.value.u128.u64[1]);
|
||||||
|
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_color_from_name(str8_lit("text")), ui_top_font_size()};
|
||||||
|
DR_FStrList fstrs = {0};
|
||||||
|
UI_TagF("weak")
|
||||||
|
{
|
||||||
|
dr_fstrs_push_new(arena, &fstrs, ¶ms,
|
||||||
|
rd_icon_kind_text_table[RD_IconKind_Scheduler],
|
||||||
|
.font = rd_font_from_slot(RD_FontSlot_Icons),
|
||||||
|
.raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons),
|
||||||
|
.color = ui_color_from_name(str8_lit("text")));
|
||||||
|
}
|
||||||
|
dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" "));
|
||||||
|
dr_fstrs_push_new(arena, &fstrs, ¶ms, push_str8f(arena, "(PID: %I64u)", pid));
|
||||||
|
dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" "));
|
||||||
|
dr_fstrs_push_new(arena, &fstrs, ¶ms, name);
|
||||||
|
result.fstrs = fstrs;
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
//- rjf: fill basics/defaults
|
//- rjf: fill basics/defaults
|
||||||
result.view_ui_rule = &rd_nil_view_ui_rule;
|
result.view_ui_rule = &rd_nil_view_ui_rule;
|
||||||
result.fstrs = cell->fstrs;
|
|
||||||
result.flags = cell->flags;
|
result.flags = cell->flags;
|
||||||
result.cfg = &rd_nil_cfg;
|
result.cfg = &rd_nil_cfg;
|
||||||
result.entity = &ctrl_entity_nil;
|
result.entity = &ctrl_entity_nil;
|
||||||
@@ -1737,6 +1968,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
|||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ struct RD_CodeViewBuildResult
|
|||||||
typedef enum RD_WatchCellKind
|
typedef enum RD_WatchCellKind
|
||||||
{
|
{
|
||||||
RD_WatchCellKind_Expr, // strings to represent expression itself
|
RD_WatchCellKind_Expr, // strings to represent expression itself
|
||||||
RD_WatchCellKind_Tag, // strings to represent attached tags at row-granularity
|
|
||||||
RD_WatchCellKind_Eval, // an evaluation of the expression, with some optional modification - e.g. `$expr.some_member`, or `typeof($expr)`
|
RD_WatchCellKind_Eval, // an evaluation of the expression, with some optional modification - e.g. `$expr.some_member`, or `typeof($expr)`
|
||||||
RD_WatchCellKind_ViewUI, // an arbitrary user interface, supplied by a hook
|
RD_WatchCellKind_ViewUI, // an arbitrary user interface, supplied by a hook
|
||||||
RD_WatchCellKind_CallStackFrame, // a slot for a yellow arrow, to show call stack frame selection
|
RD_WatchCellKind_CallStackFrame, // a slot for a yellow arrow, to show call stack frame selection
|
||||||
@@ -72,7 +71,6 @@ struct RD_WatchCell
|
|||||||
U64 index;
|
U64 index;
|
||||||
String8 string;
|
String8 string;
|
||||||
E_Eval eval;
|
E_Eval eval;
|
||||||
DR_FStrList fstrs;
|
|
||||||
F32 default_pct;
|
F32 default_pct;
|
||||||
F32 pct;
|
F32 pct;
|
||||||
F32 px;
|
F32 px;
|
||||||
@@ -109,11 +107,10 @@ typedef struct RD_WatchRowCellInfo RD_WatchRowCellInfo;
|
|||||||
struct RD_WatchRowCellInfo
|
struct RD_WatchRowCellInfo
|
||||||
{
|
{
|
||||||
RD_WatchCellFlags flags;
|
RD_WatchCellFlags flags;
|
||||||
E_Eval eval;
|
|
||||||
RD_Cfg *cfg;
|
RD_Cfg *cfg;
|
||||||
CTRL_Entity *entity;
|
CTRL_Entity *entity;
|
||||||
String8 cmd_name;
|
String8 cmd_name;
|
||||||
String8 string;
|
String8 file_path;
|
||||||
DR_FStrList fstrs;
|
DR_FStrList fstrs;
|
||||||
String8 error_tooltip;
|
String8 error_tooltip;
|
||||||
String8 inheritance_tooltip;
|
String8 inheritance_tooltip;
|
||||||
@@ -220,7 +217,7 @@ internal RD_CodeViewBuildResult rd_code_view_build(Arena *arena, RD_CodeViewStat
|
|||||||
internal U64 rd_id_from_watch_cell(RD_WatchCell *cell);
|
internal U64 rd_id_from_watch_cell(RD_WatchCell *cell);
|
||||||
internal RD_WatchCell *rd_watch_cell_list_push(Arena *arena, RD_WatchCellList *list);
|
internal RD_WatchCell *rd_watch_cell_list_push(Arena *arena, RD_WatchCellList *list);
|
||||||
internal RD_WatchCell *rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell *params);
|
internal RD_WatchCell *rd_watch_cell_list_push_new_(Arena *arena, RD_WatchCellList *list, RD_WatchCell *params);
|
||||||
#define rd_watch_cell_list_push_new(arena, list, kind_, ...) rd_watch_cell_list_push_new_((arena), (list), &(RD_WatchCell){.kind = (kind_), __VA_ARGS__})
|
#define rd_watch_cell_list_push_new(arena, list, kind_, eval_, ...) rd_watch_cell_list_push_new_((arena), (list), &(RD_WatchCell){.kind = (kind_), .eval = (eval_), __VA_ARGS__})
|
||||||
|
|
||||||
//- rjf: watch view points <-> table coordinates
|
//- rjf: watch view points <-> table coordinates
|
||||||
internal B32 rd_watch_pt_match(RD_WatchPt a, RD_WatchPt b);
|
internal B32 rd_watch_pt_match(RD_WatchPt a, RD_WatchPt b);
|
||||||
|
|||||||
Reference in New Issue
Block a user