convergence - source view switching commands

This commit is contained in:
Ryan Fleury
2025-03-20 10:09:06 -07:00
parent 1ffb8a082e
commit f5683b0f3d
8 changed files with 118 additions and 158 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ D_CmdTable: // | | |
{
//- rjf: low-level target control operations
{LaunchAndRun 1 1 "query:targets" Cfg null Target Null 0 0 0 0 0 1 1 Play "launch_and_run" "Launch and Run" "Starts debugging a new instance of a target, then runs." "launch,start,run,target" "" }
{LaunchAndInit 1 1 "query:targets" Cfg null Target Null 0 0 0 0 0 1 1 PlayStepForward "launch_and_init" "Launch and Initialize" "Starts debugging a new instance of a target, then stops at the program's entry point." "launch,start,entry,point" "" }
{LaunchAndStepInto 1 1 "query:targets" Cfg null Target Null 0 0 0 0 0 1 1 PlayStepForward "launch_and_step_into" "Launch and Step Into" "Starts debugging a new instance of a target, then stops at the program's entry point." "launch,start,entry,point" "" }
{Kill 1 1 "query:processes" Process null Nil Process 0 0 0 0 0 1 1 X "kill" "Kill" "Kills the specified existing attached process(es)." "stop,kill" "" }
{KillAll 1 1 "" Null null Nil Null 0 0 0 0 0 0 0 Stop "kill_all" "Kill All" "Kills all attached processes." "stop,kill,all" "" }
{Detach 1 1 "query:processes" Process null Nil Process 0 0 0 0 0 1 1 Null "detach" "Detach" "Detaches the specified attached process(es)." "detach" "" }
+3 -3
View File
@@ -1967,7 +1967,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
//- rjf: low-level target control operations
case D_CmdKind_LaunchAndRun:
case D_CmdKind_LaunchAndInit:
case D_CmdKind_LaunchAndStepInto:
{
// rjf: get list of targets to launch
D_TargetArray *targets_to_launch = &params->targets;
@@ -2047,7 +2047,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
need_run = 1;
run_kind = D_RunKind_Run;
run_thread = &ctrl_entity_nil;
run_flags = (cmd->kind == D_CmdKind_LaunchAndInit) ? CTRL_RunFlag_StopOnEntryPoint : 0;
run_flags = (cmd->kind == D_CmdKind_LaunchAndStepInto) ? CTRL_RunFlag_StopOnEntryPoint : 0;
}
// rjf: no targets -> error
@@ -2291,7 +2291,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
}
else if(!d_ctrl_targets_running())
{
d_cmd(D_CmdKind_LaunchAndInit, .targets = *targets);
d_cmd(D_CmdKind_LaunchAndStepInto, .targets = *targets);
}
}break;
+1 -1
View File
@@ -10,7 +10,7 @@ typedef enum D_CmdKind
{
D_CmdKind_Null,
D_CmdKind_LaunchAndRun,
D_CmdKind_LaunchAndInit,
D_CmdKind_LaunchAndStepInto,
D_CmdKind_Kill,
D_CmdKind_KillAll,
D_CmdKind_Detach,
+3 -3
View File
@@ -90,7 +90,7 @@ RD_VocabInfo rd_vocab_info_table[298] =
{str8_lit_comp("recent_project"), str8_lit_comp("recent_projects"), str8_lit_comp("Recent Project"), str8_lit_comp("Recent Projects"), RD_IconKind_Briefcase},
{str8_lit_comp("recent_file"), str8_lit_comp("recent_files"), str8_lit_comp("Recent File"), str8_lit_comp("Recent Files"), RD_IconKind_FileOutline},
{str8_lit_comp("launch_and_run"), str8_lit_comp(""), str8_lit_comp("Launch and Run"), str8_lit_comp(""), RD_IconKind_Play},
{str8_lit_comp("launch_and_init"), str8_lit_comp(""), str8_lit_comp("Launch and Initialize"), str8_lit_comp(""), RD_IconKind_PlayStepForward},
{str8_lit_comp("launch_and_step_into"), str8_lit_comp(""), str8_lit_comp("Launch and Step Into"), str8_lit_comp(""), RD_IconKind_PlayStepForward},
{str8_lit_comp("kill"), str8_lit_comp(""), str8_lit_comp("Kill"), str8_lit_comp(""), RD_IconKind_X},
{str8_lit_comp("kill_all"), str8_lit_comp(""), str8_lit_comp("Kill All"), str8_lit_comp(""), RD_IconKind_Stop},
{str8_lit_comp("detach"), str8_lit_comp(""), str8_lit_comp("Detach"), str8_lit_comp(""), RD_IconKind_Null},
@@ -309,7 +309,7 @@ RD_VocabInfo rd_vocab_info_table[298] =
RD_NameSchemaInfo rd_name_schema_info_table[12] =
{
{str8_lit_comp("settings"), str8_lit_comp("x:\n{\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n @default(1) 'background_blur': bool,\n @default(1) 'thread_lines': bool,\n @default(1) 'breakpoint_lines': bool,\n @default(1) 'thread_glow': bool,\n @default(1) 'breakpoint_glow': bool,\n @default(0) 'opaque_backgrounds': bool,\n @default(1) 'smooth_main_text': bool,\n @default(0) 'smooth_code_text': bool,\n @default(1) 'hint_main_text': bool,\n @default(1) 'hint_code_text': bool,\n @default(2) 'tab_width': @range[1, 32] u64,\n @can_be_per_window 'main_font_size': @range[6, 72] u64,\n @can_be_per_window 'code_font_size': @range[1, 32] u64,\n}\n")},
{str8_lit_comp("target"), str8_lit_comp("@commands(launch_and_run, launch_and_init, enable_cfg, remove_cfg)\n@collection_commands(add_target)\nx:\n{\n 'label': code_string,\n 'executable': path,\n 'arguments': string,\n 'working_directory': path,\n 'entry_point': code_string,\n 'stdout_path': path,\n 'stderr_path': path,\n 'stdin_path': path,\n 'debug_subprocesses': bool,\n 'environment': query,\n}\n")},
{str8_lit_comp("target"), str8_lit_comp("@commands(launch_and_run, launch_and_step_into, enable_cfg, remove_cfg)\n@collection_commands(add_target)\nx:\n{\n 'label': code_string,\n 'executable': path,\n 'arguments': string,\n 'working_directory': path,\n 'entry_point': code_string,\n 'stdout_path': path,\n 'stderr_path': path,\n 'stdin_path': path,\n 'debug_subprocesses': bool,\n 'environment': query,\n}\n")},
{str8_lit_comp("breakpoint"), str8_lit_comp("@commands(enable_cfg, remove_cfg)\n@collection_commands(toggle_breakpoint, add_breakpoint, add_address_breakpoint, add_function_breakpoint)\nx:\n{\n 'label': code_string,\n 'condition': code_string,\n 'source_location': path_pt,\n 'address_location': code_string,\n 'hit_count': u64,\n 'disabled': bool,\n}\n")},
{str8_lit_comp("watch_pin"), str8_lit_comp("@commands(remove_cfg)\n@collection_commands(add_watch_pin)\nx:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'source_location': path_pt,\n 'address_location': code_string,\n}\n")},
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @commands(remove_cfg) x:{'source':path, 'dest':path}")},
@@ -370,7 +370,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[216] =
{
{0},
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("launch_and_init"), str8_lit_comp("Starts debugging a new instance of a target, then stops at the program's entry point."), str8_lit_comp("launch,start,entry,point"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("launch_and_step_into"), str8_lit_comp("Starts debugging a new instance of a target, then stops at the program's entry point."), str8_lit_comp("launch,start,entry,point"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("kill"), str8_lit_comp("Kills the specified existing attached process(es)."), str8_lit_comp("stop,kill"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Process, str8_lit_comp("query:processes"), str8_lit_comp(""), CTRL_EntityKind_Process}},
{ str8_lit_comp("kill_all"), str8_lit_comp("Kills all attached processes."), str8_lit_comp("stop,kill,all"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
{ str8_lit_comp("detach"), str8_lit_comp("Detaches the specified attached process(es)."), str8_lit_comp("detach"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Process, str8_lit_comp("query:processes"), str8_lit_comp(""), CTRL_EntityKind_Process}},
+1 -1
View File
@@ -55,7 +55,7 @@ typedef enum RD_CmdKind
{
RD_CmdKind_Null,
RD_CmdKind_LaunchAndRun,
RD_CmdKind_LaunchAndInit,
RD_CmdKind_LaunchAndStepInto,
RD_CmdKind_Kill,
RD_CmdKind_KillAll,
RD_CmdKind_Detach,
+1 -1
View File
@@ -156,7 +156,7 @@ RD_VocabTable:
{
target,
```
@commands(launch_and_run, launch_and_init, enable_cfg, remove_cfg)
@commands(launch_and_run, launch_and_step_into, enable_cfg, remove_cfg)
@collection_commands(add_target)
x:
{
+43 -84
View File
@@ -3568,7 +3568,7 @@ rd_view_ui(Rng2F32 rect)
ui_spacer(ui_em(1.5f, 1));
if(ui_clicked(rd_icon_buttonf(RD_IconKind_StepInto, 0, "Step Into %S", target_name)))
{
rd_cmd(RD_CmdKind_LaunchAndInit, .cfg = target_cfg->id);
rd_cmd(RD_CmdKind_LaunchAndStepInto, .cfg = target_cfg->id);
}
}
}break;
@@ -7625,10 +7625,14 @@ rd_window_frame(void)
String8 cmds[] =
{
rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string,
rd_cmd_kind_info_table[RD_CmdKind_LaunchAndRun].string,
rd_cmd_kind_info_table[RD_CmdKind_LaunchAndStepInto].string,
};
U32 codepoints[] =
{
'a',
'r',
's',
};
Assert(ArrayCount(codepoints) == ArrayCount(cmds));
rd_cmd_list_menu_buttons(ArrayCount(cmds), cmds, codepoints);
@@ -8575,6 +8579,12 @@ rd_window_frame(void)
{
MemoryCopyStruct(rd_regs(), view_regs);
}
// rjf: is not anchored? -> darken rest of screen
if(!is_anchored)
{
UI_TagF("inactive") UI_Transparency(1-open_t) UI_Rect(content_rect) ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_Floating, ui_key_zero());
}
}
}
@@ -13945,7 +13955,7 @@ rd_frame(void)
//- rjf: default cases
case RD_CmdKind_Run:
case RD_CmdKind_LaunchAndRun:
case RD_CmdKind_LaunchAndInit:
case RD_CmdKind_LaunchAndStepInto:
case RD_CmdKind_StepInto:
case RD_CmdKind_StepOver:
case RD_CmdKind_Restart:
@@ -15108,97 +15118,42 @@ rd_frame(void)
}break;
case RD_CmdKind_Switch:
{
#if 0 // TODO(rjf): @cfg (opening recent files)
RD_Window *ws = rd_window_from_handle(rd_regs()->window);
RD_Panel *src_panel = rd_panel_from_handle(rd_regs()->panel);
RD_View *src_view = rd_view_from_handle(rd_regs()->view);
RD_ViewRuleKind src_view_kind = rd_view_rule_kind_from_string(src_view->spec->string);
RD_Entity *recent_file = rd_entity_from_handle(rd_regs()->entity);
if(!rd_entity_is_nil(recent_file))
{
String8 recent_file_path = recent_file->string;
RD_Panel *existing_panel = &rd_nil_panel;
RD_View *existing_view = &rd_nil_view;
for(RD_Panel *panel = ws->root_panel; !rd_panel_is_nil(panel); panel = rd_panel_rec_depth_first_pre(panel).next)
{
if(!rd_panel_is_nil(panel->first))
{
continue;
}
for(RD_View *v = panel->first_tab_view; !rd_view_is_nil(v); v = v->order_next)
{
if(rd_view_is_project_filtered(v)) { continue; }
String8 v_path = rd_file_path_from_eval_string(scratch.arena, str8(v->query_buffer, v->query_string_size));
RD_ViewRuleKind v_kind = rd_view_rule_kind_from_string(v->spec->string);
if(str8_match(v_path, recent_file_path, StringMatchFlag_CaseInsensitive) && v_kind == src_view_kind)
{
existing_panel = panel;
existing_view = v;
goto done_existing_view_search__switch;
}
}
}
done_existing_view_search__switch:;
if(rd_view_is_nil(existing_view))
{
rd_cmd(RD_CmdKind_OpenTab,
.string = rd_eval_string_from_file_path(scratch.arena, recent_file_path),
.params_tree = md_tree_from_string(scratch.arena, rd_view_rule_kind_info_table[RD_ViewRuleKind_PendingFile].string)->first);
}
else
{
rd_cmd(RD_CmdKind_FocusPanel, .panel = rd_handle_from_panel(existing_panel));
existing_panel->selected_tab_view = rd_handle_from_view(existing_view);
}
}
#endif
RD_Cfg *recent_file = rd_cfg_from_id(rd_regs()->cfg);
RD_Cfg *path_root = rd_cfg_child_from_string(recent_file, str8_lit("path"));
String8 path = path_root->first->string;
rd_cmd(RD_CmdKind_FindCodeLocation, .file_path = path, .cursor = txt_pt(0, 0), .vaddr = 0);
}break;
case RD_CmdKind_SwitchToPartnerFile:
{
#if 0 // TODO(rjf): @cfg (opening partner files)
RD_Panel *panel = rd_panel_from_handle(rd_regs()->panel);
RD_View *view = rd_selected_tab_from_panel(panel);
String8 file_path = rd_regs()->file_path;
String8 file_full_path = path_normalized_from_string(scratch.arena, file_path);
String8 file_folder = str8_chop_last_slash(file_full_path);
String8 file_name = str8_skip_last_slash(str8_chop_last_dot(file_full_path));
String8 file_ext = str8_skip_last_dot(file_full_path);
String8 partner_ext_candidates[] =
{
String8 file_path = rd_file_path_from_eval_string(scratch.arena, str8(view->query_buffer, view->query_string_size));
String8 file_full_path = path_normalized_from_string(scratch.arena, file_path);
String8 file_folder = str8_chop_last_slash(file_full_path);
String8 file_name = str8_skip_last_slash(str8_chop_last_dot(file_full_path));
String8 file_ext = str8_skip_last_dot(file_full_path);
String8 partner_ext_candidates[] =
str8_lit_comp("h"),
str8_lit_comp("hpp"),
str8_lit_comp("hxx"),
str8_lit_comp("c"),
str8_lit_comp("cc"),
str8_lit_comp("cxx"),
str8_lit_comp("cpp"),
};
for(U64 idx = 0; idx < ArrayCount(partner_ext_candidates); idx += 1)
{
if(!str8_match(partner_ext_candidates[idx], file_ext, StringMatchFlag_CaseInsensitive))
{
str8_lit_comp("h"),
str8_lit_comp("hpp"),
str8_lit_comp("hxx"),
str8_lit_comp("c"),
str8_lit_comp("cc"),
str8_lit_comp("cxx"),
str8_lit_comp("cpp"),
};
for(U64 idx = 0; idx < ArrayCount(partner_ext_candidates); idx += 1)
{
if(!str8_match(partner_ext_candidates[idx], file_ext, StringMatchFlag_CaseInsensitive))
String8 candidate = push_str8f(scratch.arena, "%S.%S", file_name, partner_ext_candidates[idx]);
String8 candidate_path = push_str8f(scratch.arena, "%S/%S", file_folder, candidate);
FileProperties candidate_props = os_properties_from_file_path(candidate_path);
if(candidate_props.modified != 0)
{
String8 candidate = push_str8f(scratch.arena, "%S.%S", file_name, partner_ext_candidates[idx]);
String8 candidate_path = push_str8f(scratch.arena, "%S/%S", file_folder, candidate);
FileProperties candidate_props = os_properties_from_file_path(candidate_path);
if(candidate_props.modified != 0)
{
RD_Entity *recent_file = rd_entity_from_name_and_kind(candidate_path, RD_EntityKind_RecentFile);
if(!rd_entity_is_nil(recent_file))
{
rd_cmd(RD_CmdKind_Switch, .entity = rd_handle_from_entity(recent_file));
}
else
{
rd_cmd(RD_CmdKind_RecordFileInProject, .file_path = candidate_path);
rd_cmd(RD_CmdKind_OpenTab, .string = rd_eval_string_from_file_path(scratch.arena, candidate_path), .params_tree = md_tree_from_string(scratch.arena, view->spec->string)->first);
}
break;
}
rd_cmd(RD_CmdKind_FindCodeLocation, .file_path = candidate_path, .cursor = txt_pt(0, 0), .vaddr = 0);
break;
}
}
}
#endif
}break;
case RD_CmdKind_RecordFileInProject:
if(rd_regs()->file_path.size != 0)
@@ -16068,6 +16023,10 @@ Z(getting_started)
vs->last_frame_index_built = 0;
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(dst_tab, str8_lit("expression"));
rd_cfg_new_replace(expr, rd_eval_string_from_file_path(scratch.arena, file_path));
rd_cfg_new_replace(rd_cfg_child_from_string(dst_tab, str8_lit("cursor_line")), str8_lit("1"));
rd_cfg_new_replace(rd_cfg_child_from_string(dst_tab, str8_lit("cursor_column")), str8_lit("1"));
rd_cfg_new_replace(rd_cfg_child_from_string(dst_tab, str8_lit("mark_line")), str8_lit("1"));
rd_cfg_new_replace(rd_cfg_child_from_string(dst_tab, str8_lit("mark_column")), str8_lit("1"));
}
else if(dst_panel != &rd_nil_panel_node && dst_tab == &rd_nil_cfg)
{
+65 -64
View File
@@ -1057,6 +1057,70 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
{
if(0){}
// rjf: folder / file rows
else if(info.eval.space.kind == E_SpaceKind_FileSystem)
{
E_Type *type = e_type_from_key__cached(info.eval.irtree.type_key);
if(type->kind == E_TypeKind_Set)
{
String8 file_path = e_string_from_id(info.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,
.flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_IsNonCode,
.pct = 1.f,
.fstrs = fstrs);
if(str8_match(type->name, str8_lit("file"), 0))
{
info.can_expand = 0;
}
}
else
{
info.cell_style_key = str8_lit("expr_and_eval");
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *style = rd_cfg_child_from_string(view, info.cell_style_key);
RD_Cfg *w_cfg = style->first;
F32 next_pct = 0;
#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, .default_pct = 0.25f, .pct = take_pct());
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.75f, .pct = take_pct());
#undef take_pct
}
}
// rjf: singular button for unattached processes
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaUnattachedProcess)
{
E_Type *type = e_type_from_key__cached(info.eval.irtree.type_key);
if(str8_match(type->name, str8_lit("unattached_process"), 0))
{
U64 pid = info.eval.value.u128.u64[0];
String8 name = e_string_from_id(info.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, &params,
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, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &fstrs, &params, push_str8f(arena, "(PID: %I64u)", pid));
dr_fstrs_push_new(arena, &fstrs, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &fstrs, &params, name);
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button, .pct = 1.f, .fstrs = fstrs);
}
}
// rjf: lister rows
else if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("lister")) != &rd_nil_cfg)
{
info.can_expand = 0;
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button, .pct = 1.f);
}
// rjf: top-level cfg rows
else if(is_top_level && evalled_cfg != &rd_nil_cfg)
{
@@ -1147,32 +1211,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .pct = 1.f);
}
// rjf: singular button for unattached processes
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaUnattachedProcess)
{
E_Type *type = e_type_from_key__cached(info.eval.irtree.type_key);
if(str8_match(type->name, str8_lit("unattached_process"), 0))
{
U64 pid = info.eval.value.u128.u64[0];
String8 name = e_string_from_id(info.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, &params,
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, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &fstrs, &params, push_str8f(arena, "(PID: %I64u)", pid));
dr_fstrs_push_new(arena, &fstrs, &params, str8_lit(" "));
dr_fstrs_push_new(arena, &fstrs, &params, name);
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button, .pct = 1.f, .fstrs = fstrs);
}
}
// rjf: singular button for commands
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCmd)
{
@@ -1189,37 +1227,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
}
}
// rjf: folder / file rows
else if(info.eval.space.kind == E_SpaceKind_FileSystem)
{
E_Type *type = e_type_from_key__cached(info.eval.irtree.type_key);
if(type->kind == E_TypeKind_Set)
{
String8 file_path = e_string_from_id(info.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,
.flags = RD_WatchCellFlag_Button|RD_WatchCellFlag_IsNonCode,
.pct = 1.f,
.fstrs = fstrs);
if(str8_match(type->name, str8_lit("file"), 0))
{
info.can_expand = 0;
}
}
else
{
info.cell_style_key = str8_lit("expr_and_eval");
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *style = rd_cfg_child_from_string(view, info.cell_style_key);
RD_Cfg *w_cfg = style->first;
F32 next_pct = 0;
#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, .default_pct = 0.25f, .pct = take_pct());
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, .default_pct = 0.75f, .pct = take_pct());
#undef take_pct
}
}
// rjf: singular cell for view ui
else if(info.view_ui_rule != &rd_nil_view_ui_rule)
{
@@ -1249,13 +1256,6 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
#undef take_pct
}
// rjf: lister rows
else if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("lister")) != &rd_nil_cfg)
{
info.can_expand = 0;
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = RD_WatchCellFlag_Button, .pct = 1.f);
}
// rjf: procedures collections get only expr/value/view-rule
else if(block_type->kind == E_TypeKind_Set && str8_match(block_type->name, str8_lit("procedures"), 0))
{
@@ -1526,6 +1526,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
if(e_type_key_match(cfg_type, result.eval.irtree.type_key))
{
result.cfg = cfg;
result.fstrs = rd_title_fstrs_from_cfg(arena, cfg);
}
}
else if(result.eval.space.kind == RD_EvalSpaceKind_MetaCmd)