fix go-to-location path to adjust for no file entities; write single deserialization path for all entities, instead of handwritten special casedo nes

This commit is contained in:
Ryan Fleury
2024-08-14 15:08:48 -07:00
parent 33fe9ba485
commit bb9e5057d7
9 changed files with 313 additions and 403 deletions
+8 -28
View File
@@ -3681,9 +3681,9 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
UI_Row
{
ui_spacer(ui_em(2.f*indent, 1.f));
if(e->kind == DF_EntityKind_OverrideFileLink)
DF_Entity *dst = df_entity_from_handle(e->entity_handle);
if(!df_entity_is_nil(dst))
{
DF_Entity *dst = df_entity_from_handle(e->entity_handle);
ui_labelf("[link] %S -> %S", e->name, dst->name);
}
else
@@ -4085,35 +4085,15 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
}
}
// rjf: go-to-text-location
if(entity->flags & DF_EntityFlag_HasTextPoint)
// rjf: go-to-location
{
DF_Entity *file_ancestor = df_entity_ancestor_from_kind(entity, DF_EntityKind_File);
if(!df_entity_is_nil(file_ancestor) && ui_clicked(df_icon_buttonf(ws, DF_IconKind_FileOutline, 0, "Go To Location")))
{
Temp scratch = scratch_begin(&arena, 1);
DF_CmdParams params = df_cmd_params_from_window(ws);
params.file_path = df_full_path_from_entity(scratch.arena, file_ancestor);
params.text_point = entity->text_point;
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_FilePath);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_TextPoint);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
ui_ctx_menu_close();
scratch_end(scratch);
}
}
// rjf: go-to-vaddr-location
if(entity->flags & DF_EntityFlag_HasVAddr)
{
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
if(entity->vaddr != 0 && !df_entity_is_nil(thread) && ui_clicked(df_icon_buttonf(ws, DF_IconKind_FileOutline, 0, "Go To Location")))
DF_Entity *loc = df_entity_child_from_kind(entity, DF_EntityKind_Location);
if(!df_entity_is_nil(loc) && ui_clicked(df_icon_buttonf(ws, DF_IconKind_FileOutline, 0, "Go To Location")))
{
DF_CmdParams params = df_cmd_params_from_window(ws);
params.entity = df_handle_from_entity(df_entity_ancestor_from_kind(thread, DF_EntityKind_Process));
params.vaddr = entity->vaddr;
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_Entity);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_VirtualAddr);
params.file_path = loc->name;
params.text_point = loc->text_point;
params.vaddr = loc->vaddr;
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
ui_ctx_menu_close();
}
+5 -4
View File
@@ -4849,7 +4849,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DF_EntityList maps_list = df_query_cached_entity_list_with_kind(DF_EntityKind_OverrideFileLink);
DF_EntityList maps_list = df_query_cached_entity_list_with_kind(DF_EntityKind_FilePathMap);
DF_EntityArray maps = df_entity_array_from_list(scratch.arena, &maps_list);
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
@@ -4940,9 +4940,10 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
{
U64 map_idx = row_idx-1;
DF_Entity *map = (map_idx < maps.count ? maps.v[map_idx] : &df_g_nil_entity);
DF_Entity *map_link = df_entity_from_handle(map->entity_handle);
String8 map_src_path = df_full_path_from_entity(scratch.arena, map);
String8 map_dst_path = df_full_path_from_entity(scratch.arena, map_link);
DF_Entity *map_src = df_entity_child_from_kind(map, DF_EntityKind_Source);
DF_Entity *map_dst = df_entity_child_from_kind(map, DF_EntityKind_Dest);
String8 map_src_path = map_src->name;
String8 map_dst_path = map_dst->name;
B32 row_selected = (fpms->cursor.y == row_idx);
//- rjf: src