fixes with path map application; further completeness of file drop completion menu; fix of set-next-statement

This commit is contained in:
Ryan Fleury
2024-10-10 12:03:11 -07:00
parent ba5f2021f6
commit 0d50157239
2 changed files with 81 additions and 41 deletions
-1
View File
@@ -543,7 +543,6 @@ os_w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HDROP drop = (HDROP)wParam; HDROP drop = (HDROP)wParam;
POINT drop_pt = {0}; POINT drop_pt = {0};
DragQueryPoint(drop, &drop_pt); DragQueryPoint(drop, &drop_pt);
ScreenToClient(window->hwnd, &drop_pt);
U64 num_files_dropped = DragQueryFile(drop, 0xffffffff, 0, 0); U64 num_files_dropped = DragQueryFile(drop, 0xffffffff, 0, 0);
OS_Event *event = os_w32_push_event(OS_EventKind_FileDrop, window); OS_Event *event = os_w32_push_event(OS_EventKind_FileDrop, window);
event->pos = v2f32((F32)drop_pt.x, (F32)drop_pt.y); event->pos = v2f32((F32)drop_pt.x, (F32)drop_pt.y);
+43 -2
View File
@@ -1530,6 +1530,9 @@ internal String8
rd_mapped_from_file_path(Arena *arena, String8 file_path) rd_mapped_from_file_path(Arena *arena, String8 file_path)
{ {
Temp scratch = scratch_begin(&arena, 1); Temp scratch = scratch_begin(&arena, 1);
String8 result = file_path;
if(file_path.size != 0)
{
String8 file_path__normalized = path_normalized_from_string(scratch.arena, file_path); String8 file_path__normalized = path_normalized_from_string(scratch.arena, file_path);
String8List file_path_parts = str8_split_path(scratch.arena, file_path__normalized); String8List file_path_parts = str8_split_path(scratch.arena, file_path__normalized);
RD_EntityList maps = rd_query_cached_entity_list_with_kind(RD_EntityKind_FilePathMap); RD_EntityList maps = rd_query_cached_entity_list_with_kind(RD_EntityKind_FilePathMap);
@@ -1562,7 +1565,6 @@ rd_mapped_from_file_path(Arena *arena, String8 file_path)
best_map_remaining_suffix_first = file_path_part_n; best_map_remaining_suffix_first = file_path_part_n;
} }
} }
String8 result = file_path;
if(best_map_dst.size != 0) if(best_map_dst.size != 0)
{ {
String8 best_map_dst__normalized = path_normalized_from_string(scratch.arena, best_map_dst); String8 best_map_dst__normalized = path_normalized_from_string(scratch.arena, best_map_dst);
@@ -1574,6 +1576,7 @@ rd_mapped_from_file_path(Arena *arena, String8 file_path)
StringJoin join = {.sep = str8_lit("/")}; StringJoin join = {.sep = str8_lit("/")};
result = str8_list_join(arena, &best_map_dst_parts, &join); result = str8_list_join(arena, &best_map_dst_parts, &join);
} }
}
scratch_end(scratch); scratch_end(scratch);
return result; return result;
} }
@@ -4453,6 +4456,44 @@ rd_window_frame(RD_Window *ws)
} }
ui_ctx_menu_close(); ui_ctx_menu_close();
} }
if(ws->drop_completion_paths.node_count == 1)
{
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Play, 0, "Add File%s As Target%s And Run",
(ws->drop_completion_paths.node_count > 1) ? "s" : "",
(ws->drop_completion_paths.node_count > 1) ? "s" : "")))
{
for(String8Node *n = ws->drop_completion_paths.first; n != 0; n = n->next)
{
rd_cmd(RD_CmdKind_AddTarget, .file_path = n->string);
}
CTRL_EntityList processes = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
if(processes.count != 0)
{
rd_cmd(RD_CmdKind_KillAll);
}
rd_cmd(RD_CmdKind_Run);
ui_ctx_menu_close();
}
}
if(ws->drop_completion_paths.node_count == 1)
{
if(ui_clicked(rd_icon_buttonf(RD_IconKind_StepInto, 0, "Add File%s As Target%s And Step Into",
(ws->drop_completion_paths.node_count > 1) ? "s" : "",
(ws->drop_completion_paths.node_count > 1) ? "s" : "")))
{
for(String8Node *n = ws->drop_completion_paths.first; n != 0; n = n->next)
{
rd_cmd(RD_CmdKind_AddTarget, .file_path = n->string);
}
CTRL_EntityList processes = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
if(processes.count != 0)
{
rd_cmd(RD_CmdKind_KillAll);
}
rd_cmd(RD_CmdKind_StepInto);
ui_ctx_menu_close();
}
}
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Target, 0, "View File%s", if(ui_clicked(rd_icon_buttonf(RD_IconKind_Target, 0, "View File%s",
(ws->drop_completion_paths.node_count > 1) ? "s" : ""))) (ws->drop_completion_paths.node_count > 1) ? "s" : "")))
{ {
@@ -14968,7 +15009,7 @@ rd_frame(void)
} }
} }
} }
d_cmd(D_CmdKind_SetThreadIP, .vaddr = new_rip_vaddr); rd_cmd(RD_CmdKind_SetThreadIP, .vaddr = new_rip_vaddr);
}break; }break;
//- rjf: targets //- rjf: targets