diff --git a/src/df/core/df_core.mdesk b/src/df/core/df_core.mdesk index 6806df48..22c750b6 100644 --- a/src/df/core/df_core.mdesk +++ b/src/df/core/df_core.mdesk @@ -221,6 +221,7 @@ DF_CoreCmdTable:// | | | {Reload 0 Entity File 0 0 0 0 0 1 FileOutline "reload" "Reload" "Reloads a loaded file." "code,source,file,reload" } {ReloadActive 0 Null Nil 0 0 0 0 0 0 FileOutline "reload_active" "Reload Active File" "Reloads the active file." "code,source,file,reload" } {Switch 0 Entity File 0 0 0 0 0 1 FileOutline "switch" "Switch" "Switches to a loaded file." "code,source,file" } + {SwitchToPartnerFile 0 Null Nil 0 0 0 0 0 0 FileOutline "switch_to_partner_file" "Switch To Partner File" "Switches to the focused file's partner; or from header to implementation or vice versa." "code,source,file" } //- rjf: override file links {SetFileOverrideLinkSrc 1 Null Nil 0 0 0 0 0 0 Null "set_file_override_link_src" "Set File Override Link Source" "Sets the source path for an override file link." "" } diff --git a/src/df/core/generated/df_core.meta.c b/src/df/core/generated/df_core.meta.c index 2f91d78a..01992214 100644 --- a/src/df/core/generated/df_core.meta.c +++ b/src/df/core/generated/df_core.meta.c @@ -85,6 +85,7 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[] = { str8_lit_comp("reload"), str8_lit_comp("Reloads a loaded file."), str8_lit_comp("code,source,file,reload"), str8_lit_comp("Reload"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_File, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline}, { str8_lit_comp("reload_active"), str8_lit_comp("Reloads the active file."), str8_lit_comp("code,source,file,reload"), str8_lit_comp("Reload Active File"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline}, { str8_lit_comp("switch"), str8_lit_comp("Switches to a loaded file."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_File, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline}, +{ str8_lit_comp("switch_to_partner_file"), str8_lit_comp("Switches to the focused file's partner; or from header to implementation or vice versa."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch To Partner File"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline}, { str8_lit_comp("set_file_override_link_src"), str8_lit_comp("Sets the source path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Source"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null}, { str8_lit_comp("set_file_override_link_dst"), str8_lit_comp("Sets the destination path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Destination"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null}, { str8_lit_comp("set_file_replacement_path"), str8_lit_comp("Sets the path which should be used as the replacement for the passed file."), str8_lit_comp(""), str8_lit_comp("Set File Replacement Path"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null}, diff --git a/src/df/core/generated/df_core.meta.h b/src/df/core/generated/df_core.meta.h index df6a5457..8e787be5 100644 --- a/src/df/core/generated/df_core.meta.h +++ b/src/df/core/generated/df_core.meta.h @@ -135,6 +135,7 @@ DF_CoreCmdKind_Open, DF_CoreCmdKind_Reload, DF_CoreCmdKind_ReloadActive, DF_CoreCmdKind_Switch, +DF_CoreCmdKind_SwitchToPartnerFile, DF_CoreCmdKind_SetFileOverrideLinkSrc, DF_CoreCmdKind_SetFileOverrideLinkDst, DF_CoreCmdKind_SetFileReplacementPath, diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index 19b893ec..f73482dd 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -1865,6 +1865,47 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PendingEntity)); } }break; + case DF_CoreCmdKind_SwitchToPartnerFile: + { + DF_Panel *panel = df_panel_from_handle(params.panel); + DF_View *view = df_view_from_handle(panel->selected_tab_view); + DF_Entity *entity = df_entity_from_handle(view->entity); + DF_GfxViewKind view_kind = df_gfx_view_kind_from_string(view->spec->info.name); + if(view_kind == DF_GfxViewKind_Code && entity->kind == DF_EntityKind_File) + { + String8 file_full_path = df_full_path_from_entity(scratch.arena, entity); + String8 file_folder = str8_chop_last_slash(file_full_path); + String8 file_name = str8_chop_last_dot(entity->name); + String8 file_ext = str8_skip_last_dot(entity->name); + 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)) + { + 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) + { + DF_Entity *candidate = df_entity_from_path(candidate_path, DF_EntityFromPathFlag_OpenAsNeeded); + DF_CmdParams p = df_cmd_params_from_panel(ws, panel); + p.entity = df_handle_from_entity(candidate); + df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Switch)); + break; + } + } + } + } + }break; //- rjf: directional movement & text controls // diff --git a/src/df/gfx/df_gfx.mdesk b/src/df/gfx/df_gfx.mdesk index b9b9537c..d3a0f77c 100644 --- a/src/df/gfx/df_gfx.mdesk +++ b/src/df/gfx/df_gfx.mdesk @@ -83,6 +83,7 @@ DF_DefaultBindingTable: { "open" O ctrl 0 0 } { "reload_active" R ctrl shift 0 } { "switch" I ctrl 0 0 } + { "switch_to_partner_file" O 0 0 alt } //- rjf: setting config paths { "load_user" O ctrl shift alt } diff --git a/src/df/gfx/generated/df_gfx.meta.h b/src/df/gfx/generated/df_gfx.meta.h index c98a637a..be5e428d 100644 --- a/src/df/gfx/generated/df_gfx.meta.h +++ b/src/df/gfx/generated/df_gfx.meta.h @@ -940,6 +940,7 @@ DF_StringBindingPair df_g_default_binding_table[] = {str8_lit_comp("open"), {OS_Key_O, 0 |OS_EventFlag_Ctrl }}, {str8_lit_comp("reload_active"), {OS_Key_R, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Shift }}, {str8_lit_comp("switch"), {OS_Key_I, 0 |OS_EventFlag_Ctrl }}, +{str8_lit_comp("switch_to_partner_file"), {OS_Key_O, 0 |OS_EventFlag_Alt}}, {str8_lit_comp("load_user"), {OS_Key_O, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Shift |OS_EventFlag_Alt}}, {str8_lit_comp("load_profile"), {OS_Key_O, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Alt}}, {str8_lit_comp("move_left"), {OS_Key_Left, 0 }}, diff --git a/src/raddbg/raddbg.c b/src/raddbg/raddbg.c index c6376a68..03935c02 100644 --- a/src/raddbg/raddbg.c +++ b/src/raddbg/raddbg.c @@ -325,7 +325,14 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data) for(OS_Event *ev = leftover_events.first, *next = 0; ev != 0; ev = next) { next = ev->next; - if(ev->timestamp_us+1000000 < os_now_microseconds()) + if(ev->timestamp_us+1000000 < os_now_microseconds() || + ev->kind == OS_EventKind_Text || + (ev->kind == OS_EventKind_Press && ev->key != OS_Key_LeftMouseButton) || + (ev->kind == OS_EventKind_Press && ev->key != OS_Key_RightMouseButton) || + (ev->kind == OS_EventKind_Press && ev->key != OS_Key_MiddleMouseButton) || + (ev->kind == OS_EventKind_Release && ev->key != OS_Key_LeftMouseButton) || + (ev->kind == OS_EventKind_Release && ev->key != OS_Key_RightMouseButton) || + (ev->kind == OS_EventKind_Release && ev->key != OS_Key_MiddleMouseButton)) { os_eat_event(&leftover_events, ev); } diff --git a/src/raddbg/raddbg.h b/src/raddbg/raddbg.h index ef44100d..d0bc585d 100644 --- a/src/raddbg/raddbg.h +++ b/src/raddbg/raddbg.h @@ -10,7 +10,7 @@ // [ ] drag/drop tab cleanup // [ ] target/breakpoint/watch-pin reordering // [ ] watch window reordering -// [ ] query views, cleanup & floating - maybe merge "applies to view" vs. not +// [x] query views, cleanup & floating - maybe merge "applies to view" vs. not // [ ] standard way to filter // [ ] visualize remapped files (via path map) // [ ] hovering truncated string for a short time -> tooltip with full wrapped @@ -34,7 +34,7 @@ // // [ ] it would be nice to have "show in explorer" for right click on source // file tab (opens explorer & selects the file) -// [ ] it would be nice if Alt+o in source file would switch between .h and +// [x] it would be nice if Alt+o in source file would switch between .h and // .c/cpp file (just look for same name in same folder) // // [ ] what's up with decimal number coloring where every group of 3 are in