diff --git a/src/base/base_string.c b/src/base/base_string.c index f0f5fdfc..0781a367 100644 --- a/src/base/base_string.c +++ b/src/base/base_string.c @@ -1657,6 +1657,45 @@ rgba_from_hex_string_4f32(String8 hex_string) return rgba; } +//////////////////////////////// +//~ rjf: String Fuzzy Matching + +internal FuzzyMatchRangeList +fuzzy_match_find(Arena *arena, String8List needles, String8 haystack) +{ + FuzzyMatchRangeList result = {0}; + for(String8Node *needle_n = needles.first; needle_n != 0; needle_n = needle_n->next) + { + U64 find_pos = 0; + for(;find_pos < haystack.size;) + { + find_pos = str8_find_needle(haystack, find_pos, needle_n->string, StringMatchFlag_CaseInsensitive); + B32 is_in_gathered_ranges = 0; + for(FuzzyMatchRangeNode *n = result.first; n != 0; n = n->next) + { + if(n->range.min <= find_pos && find_pos < n->range.max) + { + is_in_gathered_ranges = 1; + find_pos = n->range.max; + break; + } + } + if(!is_in_gathered_ranges) + { + break; + } + } + if(find_pos < haystack.size) + { + Rng1U64 range = r1u64(find_pos, find_pos+needle_n->string.size); + FuzzyMatchRangeNode *n = push_array(arena, FuzzyMatchRangeNode, 1); + n->range = range; + SLLQueuePush(result.first, result.last, n); + result.count += 1; + } + } + return result; +} //////////////////////////////// //~ NOTE(allen): Serialization Helpers diff --git a/src/base/base_string.h b/src/base/base_string.h index cb443c18..85592b5e 100644 --- a/src/base/base_string.h +++ b/src/base/base_string.h @@ -128,6 +128,24 @@ struct UnicodeDecode U32 codepoint; }; +//////////////////////////////// +//~ rjf: String Fuzzy Matching Types + +typedef struct FuzzyMatchRangeNode FuzzyMatchRangeNode; +struct FuzzyMatchRangeNode +{ + FuzzyMatchRangeNode *next; + Rng1U64 range; +}; + +typedef struct FuzzyMatchRangeList FuzzyMatchRangeList; +struct FuzzyMatchRangeList +{ + FuzzyMatchRangeNode *first; + FuzzyMatchRangeNode *last; + U64 count; +}; + //////////////////////////////// //~ rjf: Character Classification & Conversion Functions @@ -318,6 +336,11 @@ internal String8 string_from_elapsed_time(Arena *arena, DateTime dt); internal String8 hex_string_from_rgba_4f32(Arena *arena, Vec4F32 rgba); internal Vec4F32 rgba_from_hex_string_4f32(String8 hex_string); +//////////////////////////////// +//~ rjf: String Fuzzy Matching + +internal FuzzyMatchRangeList fuzzy_match_find(Arena *arena, String8List needles, String8 haystack); + //////////////////////////////// //~ NOTE(allen): Serialization Helpers diff --git a/src/dbgi/dbgi.c b/src/dbgi/dbgi.c index 8f000613..392f1cd4 100644 --- a/src/dbgi/dbgi.c +++ b/src/dbgi/dbgi.c @@ -336,6 +336,39 @@ dbgi_parse_from_exe_path(DBGI_Scope *scope, String8 exe_path, U64 endt_us) return parse; } +//////////////////////////////// +//~ rjf: Fuzzy Search Cache Functions + +internal DBGI_FuzzySearchResult * +dbgi_fuzzy_search_result_from_key_exe_query(U128 key, String8 exe_path, String8 query, U64 endt_us) +{ + DBGI_FuzzySearchResult *result = &dbgi_fuzzy_search_result_nil; + { + U64 slot_idx = key.u64[1]%dbgi_shared->fuzzy_search_slots_count; + U64 stripe_idx = slot_idx%dbgi_shared->fuzzy_search_stripes_count; + DBGI_FuzzySearchSlot *slot = &dbgi_shared->fuzzy_search_slots[slot_idx]; + DBGI_FuzzySearchStripe *stripe = &dbgi_shared->fuzzy_search_stripes[stripe_idx]; + OS_MutexScopeR(stripe->rw_mutex) for(;;) + { + DBGI_FuzzySearchNode *node = 0; + for(DBGI_FuzzySearchNode *n = slot->first; n != 0; n = n->next) + { + if(u128_match(n->key, key)) + { + node = n; + break; + } + } + if(node == 0) OS_MutexScopeRWPromote(stripe->rw_mutex) + { + node = push_array(stripe->arena, DBGI_FuzzySearchNode, 1); + DLLPushBack(slot->first, slot->last, node); + } + } + } + return result; +} + //////////////////////////////// //~ rjf: Analysis Threads diff --git a/src/dbgi/dbgi.h b/src/dbgi/dbgi.h index 715cd433..78a45844 100644 --- a/src/dbgi/dbgi.h +++ b/src/dbgi/dbgi.h @@ -158,6 +158,72 @@ struct DBGI_EventList U64 count; }; +//////////////////////////////// +//~ rjf: Fuzzy Search Cache Types + +typedef struct DBGI_FuzzySearchItem DBGI_FuzzySearchItem; +struct DBGI_FuzzySearchItem +{ + U64 function_idx; + FuzzyMatchRangeList match_ranges; +}; + +typedef struct DBGI_FuzzySearchItemChunk DBGI_FuzzySearchItemChunk; +struct DBGI_FuzzySearchItemChunk +{ + DBGI_FuzzySearchItem *v; + U64 count; + U64 cap; +}; + +typedef struct DBGI_FuzzySearchItemChunkList DBGI_FuzzySearchItemChunkList; +struct DBGI_FuzzySearchItemChunkList +{ + DBGI_FuzzySearchItemChunk *first; + DBGI_FuzzySearchItemChunk *last; + U64 chunk_count; + U64 total_count; +}; + +typedef struct DBGI_FuzzySearchItemArray DBGI_FuzzySearchItemArray; +struct DBGI_FuzzySearchItemArray +{ + DBGI_FuzzySearchItem *v; + U64 count; +}; + +typedef struct DBGI_FuzzySearchResult DBGI_FuzzySearchResult; +struct DBGI_FuzzySearchResult +{ + DBGI_FuzzySearchItemArray items; +}; + +typedef struct DBGI_FuzzySearchNode DBGI_FuzzySearchNode; +struct DBGI_FuzzySearchNode +{ + DBGI_FuzzySearchNode *next; + DBGI_FuzzySearchNode *prev; + Arena *arena; + U128 key; + U64 gen; + DBGI_FuzzySearchResult v[2]; +}; + +typedef struct DBGI_FuzzySearchSlot DBGI_FuzzySearchSlot; +struct DBGI_FuzzySearchSlot +{ + DBGI_FuzzySearchNode *first; + DBGI_FuzzySearchNode *last; +}; + +typedef struct DBGI_FuzzySearchStripe DBGI_FuzzySearchStripe; +struct DBGI_FuzzySearchStripe +{ + Arena *arena; + OS_Handle rw_mutex; + OS_Handle cv; +}; + //////////////////////////////// //~ rjf: Cross-Thread Shared State @@ -179,6 +245,12 @@ struct DBGI_Shared DBGI_BinarySlot *binary_slots; DBGI_BinaryStripe *binary_stripes; + // rjf: fuzzy search cache table + U64 fuzzy_search_slots_count; + U64 fuzzy_search_stripes_count; + DBGI_FuzzySearchSlot *fuzzy_search_slots; + DBGI_FuzzySearchStripe *fuzzy_search_stripes; + // rjf: user -> parse ring OS_Handle u2p_ring_mutex; OS_Handle u2p_ring_cv; @@ -187,6 +259,14 @@ struct DBGI_Shared U64 u2p_ring_write_pos; U64 u2p_ring_read_pos; + // rjf: user -> fuzzy ring + OS_Handle u2f_ring_mutex; + OS_Handle u2f_ring_cv; + U64 u2f_ring_size; + U8 *u2f_ring_base; + U64 u2f_ring_write_pos; + U64 u2f_ring_read_pos; + // rjf: parse -> user event ring OS_Handle p2u_ring_mutex; OS_Handle p2u_ring_cv; @@ -198,6 +278,8 @@ struct DBGI_Shared // rjf: threads U64 parse_thread_count; OS_Handle *parse_threads; + U64 fuzzy_thread_count; + OS_Handle *fuzzy_threads; }; //////////////////////////////// @@ -206,6 +288,7 @@ struct DBGI_Shared global DBGI_Shared *dbgi_shared = 0; thread_static DBGI_ThreadCtx *dbgi_tctx = 0; global DBGI_Parse dbgi_parse_nil = {0}; +global DBGI_FuzzySearchResult dbgi_fuzzy_search_result_nil = {0}; //////////////////////////////// //~ rjf: Main Layer Initialization @@ -242,6 +325,11 @@ internal void dbgi_binary_open(String8 exe_path); internal void dbgi_binary_close(String8 exe_path); internal DBGI_Parse *dbgi_parse_from_exe_path(DBGI_Scope *scope, String8 exe_path, U64 endt_us); +//////////////////////////////// +//~ rjf: Fuzzy Search Cache Functions + +internal DBGI_FuzzySearchResult *dbgi_fuzzy_search_result_from_key_exe_query(U128 key, String8 exe_path, String8 query, U64 endt_us); + //////////////////////////////// //~ rjf: Parse Threads @@ -253,4 +341,12 @@ internal DBGI_EventList dbgi_p2u_pop_events(Arena *arena, U64 endt_us); internal void dbgi_parse_thread_entry_point(void *p); +//////////////////////////////// +//~ rjf: Fuzzy Searching Threads + +internal void dbgi_u2f_enqueue_req(U128 key, String8 exe_path, String8 query); +internal void dbgi_u2f_dequeue_req(Arena *arena, U128 *key_out, String8 *exe_path_out, String8 *query_out); + +internal void dbgi_fuzzy_thread__entry_point(void *p); + #endif //DBGI_H diff --git a/src/df/core/df_core.h b/src/df/core/df_core.h index 4fe4602a..0869e50c 100644 --- a/src/df/core/df_core.h +++ b/src/df/core/df_core.h @@ -70,24 +70,6 @@ struct DF_ExpandTreeTable DF_ExpandNode *free_node; }; -//////////////////////////////// -//~ rjf: Fuzzy Matching - -typedef struct DF_FuzzyMatchRangeNode DF_FuzzyMatchRangeNode; -struct DF_FuzzyMatchRangeNode -{ - DF_FuzzyMatchRangeNode *next; - Rng1U64 range; -}; - -typedef struct DF_FuzzyMatchRangeList DF_FuzzyMatchRangeList; -struct DF_FuzzyMatchRangeList -{ - DF_FuzzyMatchRangeNode *first; - DF_FuzzyMatchRangeNode *last; - U64 count; -}; - //////////////////////////////// //~ rjf: Control Context Types diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index ae5e2a8e..3b2d0da7 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -65,43 +65,6 @@ df_path_query_from_string(String8 string) return path_query; } -internal DF_FuzzyMatchRangeList -df_fuzzy_match_find(Arena *arena, String8List needles, String8 haystack) -{ - DF_FuzzyMatchRangeList result = {0}; - for(String8Node *needle_n = needles.first; needle_n != 0; needle_n = needle_n->next) - { - U64 find_pos = 0; - for(;find_pos < haystack.size;) - { - find_pos = str8_find_needle(haystack, find_pos, needle_n->string, StringMatchFlag_CaseInsensitive); - B32 is_in_gathered_ranges = 0; - for(DF_FuzzyMatchRangeNode *n = result.first; n != 0; n = n->next) - { - if(n->range.min <= find_pos && find_pos < n->range.max) - { - is_in_gathered_ranges = 1; - find_pos = n->range.max; - break; - } - } - if(!is_in_gathered_ranges) - { - break; - } - } - if(find_pos < haystack.size) - { - Rng1U64 range = r1u64(find_pos, find_pos+needle_n->string.size); - DF_FuzzyMatchRangeNode *n = push_array(arena, DF_FuzzyMatchRangeNode, 1); - n->range = range; - SLLQueuePush(result.first, result.last, n); - result.count += 1; - } - } - return result; -} - //////////////////////////////// //~ rjf: View Type Functions @@ -3791,7 +3754,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D { item.string = n->string; item.kind_string = str8_lit("Local"); - item.matches = df_fuzzy_match_find(scratch.arena, search_needles, n->string); + item.matches = fuzzy_match_find(scratch.arena, search_needles, n->string); } if(search_needles.node_count == 0 || item.matches.count != 0) { @@ -3815,7 +3778,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D { item.string = reg_names[idx]; item.kind_string = str8_lit("Register"); - item.matches = df_fuzzy_match_find(scratch.arena, search_needles, reg_names[idx]); + item.matches = fuzzy_match_find(scratch.arena, search_needles, reg_names[idx]); } if(search_needles.node_count == 0 || item.matches.count != 0) { @@ -3831,7 +3794,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D { item.string = alias_names[idx]; item.kind_string = str8_lit("Reg. Alias"); - item.matches = df_fuzzy_match_find(scratch.arena, search_needles, alias_names[idx]); + item.matches = fuzzy_match_find(scratch.arena, search_needles, alias_names[idx]); } if(search_needles.node_count == 0 || item.matches.count != 0) { @@ -3850,7 +3813,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D { item.string = spec->info.string; item.kind_string = str8_lit("View Rule"); - item.matches = df_fuzzy_match_find(scratch.arena, search_needles, spec->info.string); + item.matches = fuzzy_match_find(scratch.arena, search_needles, spec->info.string); } if(search_needles.node_count == 0 || item.matches.count != 0) { @@ -8194,14 +8157,14 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source) //~ rjf: UI Helpers internal void -df_box_equip_fuzzy_match_range_list_vis(UI_Box *box, DF_FuzzyMatchRangeList range_list) +df_box_equip_fuzzy_match_range_list_vis(UI_Box *box, FuzzyMatchRangeList range_list) { UI_Parent(box) { String8 display_string = ui_box_display_string(box); F_Metrics metrics = f_metrics_from_tag_size(box->font, box->font_size); F32 line_height = f_line_height_from_metrics(&metrics); - for(DF_FuzzyMatchRangeNode *match_n = range_list.first; match_n != 0; match_n = match_n->next) + for(FuzzyMatchRangeNode *match_n = range_list.first; match_n != 0; match_n = match_n->next) { Rng1F32 match_pixel_range = { diff --git a/src/df/gfx/df_gfx.h b/src/df/gfx/df_gfx.h index 7d8039cf..ea2baaa9 100644 --- a/src/df/gfx/df_gfx.h +++ b/src/df/gfx/df_gfx.h @@ -483,7 +483,7 @@ struct DF_AutoCompListerItem { String8 string; String8 kind_string; - DF_FuzzyMatchRangeList matches; + FuzzyMatchRangeList matches; }; typedef struct DF_AutoCompListerItemChunkNode DF_AutoCompListerItemChunkNode; @@ -804,7 +804,6 @@ global DF_DragDropPayload df_g_drag_drop_payload = {0}; //~ rjf: Basic Helpers internal DF_PathQuery df_path_query_from_string(String8 string); -internal DF_FuzzyMatchRangeList df_fuzzy_match_find(Arena *arena, String8List needles, String8 haystack); //////////////////////////////// //~ rjf: View Type Functions @@ -999,7 +998,7 @@ internal String8List df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF //////////////////////////////// //~ rjf: UI Helpers -internal void df_box_equip_fuzzy_match_range_list_vis(UI_Box *box, DF_FuzzyMatchRangeList range_list); +internal void df_box_equip_fuzzy_match_range_list_vis(UI_Box *box, FuzzyMatchRangeList range_list); //////////////////////////////// //~ rjf: UI Widgets: Fancy Buttons diff --git a/src/df/gfx/df_gfx.mdesk b/src/df/gfx/df_gfx.mdesk index 716a7773..8470c18f 100644 --- a/src/df/gfx/df_gfx.mdesk +++ b/src/df/gfx/df_gfx.mdesk @@ -187,6 +187,7 @@ DF_GfxViewTable: { FileSystem "file_system" "File System" Null FileOutline 0 0 0 0 "" } { SystemProcesses "system_processes" "System Processes" Null Null 0 0 0 0 "" } { EntityLister "entity_lister" "Entity List" EntityKindName Null 0 0 0 0 "" } + { SymbolLister "symbol_lister" "Symbols" Null Null 0 0 0 0 "" } { Target "target" "Target" EntityName Target 1 0 0 0 "" } { Targets "targets" "Targets" Null Target 0 1 0 1 "Displays a list of all targets, as well as controls for enabling, disabling, launching, editing, or deleting each target. For more information on targets, read the `Targets` section." } { FilePathMap "file_path_map" "File Path Map" Null FileOutline 0 1 0 1 "Displays a table of *path maps*. Each path map is a pair of file or folder paths, one being a 'source' path, and one being a 'destination' path. These pairs are used by the debugger when automatically searching for specific files - for instance, when attempting to snap to a source code location specified by debug info. If debug info refers to a path on the machine on which a target executable was originally built, but that path is not valid on the debugger machine, but some alternative path exists, then path maps may be used to redirect the debugger from the debug info's specified paths to the associated appropriate debugger machine file paths." } @@ -281,6 +282,7 @@ DF_CmdParamSlot2ViewSpecMap: {FilePath "file_system" } {CmdSpec "commands" } {ID "system_processes" } + {String "symbol_lister" } } //////////////////////////////// diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 75690bb2..9e720359 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -179,9 +179,9 @@ df_cmd_lister_item_list_from_needle(Arena *arena, String8 needle) String8 cmd_display_name = spec->info.display_name; String8 cmd_desc = spec->info.description; String8 cmd_tags = spec->info.search_tags; - DF_FuzzyMatchRangeList name_matches = df_fuzzy_match_find(arena, search_needles, cmd_display_name); - DF_FuzzyMatchRangeList desc_matches = df_fuzzy_match_find(arena, search_needles, cmd_desc); - DF_FuzzyMatchRangeList tags_matches = df_fuzzy_match_find(arena, search_needles, cmd_tags); + FuzzyMatchRangeList name_matches = fuzzy_match_find(arena, search_needles, cmd_display_name); + FuzzyMatchRangeList desc_matches = fuzzy_match_find(arena, search_needles, cmd_desc); + FuzzyMatchRangeList tags_matches = fuzzy_match_find(arena, search_needles, cmd_tags); if(name_matches.count == search_needles.node_count || desc_matches.count == search_needles.node_count || tags_matches.count > 0 || @@ -276,12 +276,12 @@ df_process_info_list_from_query(Arena *arena, String8 query) } // rjf: gather fuzzy matches - DF_FuzzyMatchRangeList attached_match_ranges = {0}; - DF_FuzzyMatchRangeList name_match_ranges = df_fuzzy_match_find(arena, needles, info.name); - DF_FuzzyMatchRangeList pid_match_ranges = df_fuzzy_match_find(arena, needles, push_str8f(scratch.arena, "%i", info.pid)); + FuzzyMatchRangeList attached_match_ranges = {0}; + FuzzyMatchRangeList name_match_ranges = fuzzy_match_find(arena, needles, info.name); + FuzzyMatchRangeList pid_match_ranges = fuzzy_match_find(arena, needles, push_str8f(scratch.arena, "%i", info.pid)); if(is_attached) { - attached_match_ranges = df_fuzzy_match_find(arena, needles, str8_lit("[attached]")); + attached_match_ranges = fuzzy_match_find(arena, needles, str8_lit("[attached]")); } // rjf: determine if this item is filtered out @@ -355,7 +355,7 @@ df_entity_lister_item_list_from_needle(Arena *arena, DF_EntityKind kind, DF_Enti if(!(entity->flags & omit_flags)) { String8 display_string = df_display_string_from_entity(scratch.arena, entity); - DF_FuzzyMatchRangeList match_rngs = df_fuzzy_match_find(arena, search_needles, display_string); + FuzzyMatchRangeList match_rngs = fuzzy_match_find(arena, search_needles, display_string); if(match_rngs.count != 0 || needle.size == 0) { DF_EntityListerItemNode *item_n = push_array(arena, DF_EntityListerItemNode, 1); @@ -2119,7 +2119,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem) OS_FileIter *it = os_file_iter_begin(scratch.arena, path_query.path, 0); for(OS_FileInfo info = {0}; os_file_iter_next(scratch.arena, it, &info);) { - DF_FuzzyMatchRangeList match_ranges = df_fuzzy_match_find(fs->cached_files_arena, search_needles, info.name); + FuzzyMatchRangeList match_ranges = fuzzy_match_find(fs->cached_files_arena, search_needles, info.name); B32 fits_search = (search_needles.node_count == 0 || match_ranges.count == search_needles.node_count); B32 fits_dir_only = !!(info.props.flags & FilePropertyFlag_IsFolder) || !dir_selection; if(fits_search && fits_dir_only) @@ -2785,6 +2785,28 @@ DF_VIEW_UI_FUNCTION_DEF(EntityLister) ProfEnd(); } +//////////////////////////////// +//~ rjf: SymbolLister @view_hook_impl + +DF_VIEW_SETUP_FUNCTION_DEF(SymbolLister) +{ +} + +DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(SymbolLister) +{ + return str8_lit(""); +} + +DF_VIEW_CMD_FUNCTION_DEF(SymbolLister) +{ +} + +DF_VIEW_UI_FUNCTION_DEF(SymbolLister) +{ + String8 query = str8(view->query_buffer, view->query_string_size); + +} + //////////////////////////////// //~ rjf: Target @view_hook_impl diff --git a/src/df/gfx/df_views.h b/src/df/gfx/df_views.h index 1517afe7..c2a1aed6 100644 --- a/src/df/gfx/df_views.h +++ b/src/df/gfx/df_views.h @@ -22,7 +22,7 @@ struct DF_FileInfo { String8 filename; FileProperties props; - DF_FuzzyMatchRangeList match_ranges; + FuzzyMatchRangeList match_ranges; }; typedef struct DF_FileInfoNode DF_FileInfoNode; @@ -66,9 +66,9 @@ struct DF_CmdListerItem DF_CmdSpec *cmd_spec; U64 registrar_idx; U64 ordering_idx; - DF_FuzzyMatchRangeList name_match_ranges; - DF_FuzzyMatchRangeList desc_match_ranges; - DF_FuzzyMatchRangeList tags_match_ranges; + FuzzyMatchRangeList name_match_ranges; + FuzzyMatchRangeList desc_match_ranges; + FuzzyMatchRangeList tags_match_ranges; }; typedef struct DF_CmdListerItemNode DF_CmdListerItemNode; @@ -113,7 +113,7 @@ typedef struct DF_EntityListerItem DF_EntityListerItem; struct DF_EntityListerItem { DF_Entity *entity; - DF_FuzzyMatchRangeList name_match_ranges; + FuzzyMatchRangeList name_match_ranges; }; typedef struct DF_EntityListerItemNode DF_EntityListerItemNode; @@ -146,9 +146,9 @@ struct DF_ProcessInfo { DEMON_ProcessInfo info; B32 is_attached; - DF_FuzzyMatchRangeList attached_match_ranges; - DF_FuzzyMatchRangeList name_match_ranges; - DF_FuzzyMatchRangeList pid_match_ranges; + FuzzyMatchRangeList attached_match_ranges; + FuzzyMatchRangeList name_match_ranges; + FuzzyMatchRangeList pid_match_ranges; }; typedef struct DF_ProcessInfoNode DF_ProcessInfoNode; diff --git a/src/df/gfx/generated/df_gfx.meta.h b/src/df/gfx/generated/df_gfx.meta.h index fbaeb839..4323645b 100644 --- a/src/df/gfx/generated/df_gfx.meta.h +++ b/src/df/gfx/generated/df_gfx.meta.h @@ -14,6 +14,7 @@ DF_GfxViewKind_Commands, DF_GfxViewKind_FileSystem, DF_GfxViewKind_SystemProcesses, DF_GfxViewKind_EntityLister, +DF_GfxViewKind_SymbolLister, DF_GfxViewKind_Target, DF_GfxViewKind_Targets, DF_GfxViewKind_FilePathMap, @@ -113,6 +114,7 @@ DF_VIEW_SETUP_FUNCTION_DEF(Commands); DF_VIEW_SETUP_FUNCTION_DEF(FileSystem); DF_VIEW_SETUP_FUNCTION_DEF(SystemProcesses); DF_VIEW_SETUP_FUNCTION_DEF(EntityLister); +DF_VIEW_SETUP_FUNCTION_DEF(SymbolLister); DF_VIEW_SETUP_FUNCTION_DEF(Target); DF_VIEW_SETUP_FUNCTION_DEF(Targets); DF_VIEW_SETUP_FUNCTION_DEF(FilePathMap); @@ -137,6 +139,7 @@ DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Commands); DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(FileSystem); DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(SystemProcesses); DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(EntityLister); +DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(SymbolLister); DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Target); DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Targets); DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(FilePathMap); @@ -161,6 +164,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Commands); DF_VIEW_CMD_FUNCTION_DEF(FileSystem); DF_VIEW_CMD_FUNCTION_DEF(SystemProcesses); DF_VIEW_CMD_FUNCTION_DEF(EntityLister); +DF_VIEW_CMD_FUNCTION_DEF(SymbolLister); DF_VIEW_CMD_FUNCTION_DEF(Target); DF_VIEW_CMD_FUNCTION_DEF(Targets); DF_VIEW_CMD_FUNCTION_DEF(FilePathMap); @@ -185,6 +189,7 @@ DF_VIEW_UI_FUNCTION_DEF(Commands); DF_VIEW_UI_FUNCTION_DEF(FileSystem); DF_VIEW_UI_FUNCTION_DEF(SystemProcesses); DF_VIEW_UI_FUNCTION_DEF(EntityLister); +DF_VIEW_UI_FUNCTION_DEF(SymbolLister); DF_VIEW_UI_FUNCTION_DEF(Target); DF_VIEW_UI_FUNCTION_DEF(Targets); DF_VIEW_UI_FUNCTION_DEF(FilePathMap); @@ -899,6 +904,7 @@ DF_CmdParamSlot_EntityList, DF_CmdParamSlot_FilePath, DF_CmdParamSlot_CmdSpec, DF_CmdParamSlot_ID, +DF_CmdParamSlot_String, }; String8 df_g_cmd_param_slot_2_view_spec_dst_map[] = @@ -908,6 +914,7 @@ str8_lit_comp("entity_lister"), str8_lit_comp("file_system"), str8_lit_comp("commands"), str8_lit_comp("system_processes"), +str8_lit_comp("symbol_lister"), }; DF_StringBindingPair df_g_default_binding_table[] = @@ -1034,6 +1041,7 @@ DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[] = {(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("file_system"), str8_lit_comp("File System"), DF_NameKind_Null, DF_IconKind_FileOutline, DF_VIEW_SETUP_FUNCTION_NAME(FileSystem), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(FileSystem), DF_VIEW_CMD_FUNCTION_NAME(FileSystem), DF_VIEW_UI_FUNCTION_NAME(FileSystem)}, {(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("system_processes"), str8_lit_comp("System Processes"), DF_NameKind_Null, DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(SystemProcesses), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(SystemProcesses), DF_VIEW_CMD_FUNCTION_NAME(SystemProcesses), DF_VIEW_UI_FUNCTION_NAME(SystemProcesses)}, {(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("entity_lister"), str8_lit_comp("Entity List"), DF_NameKind_EntityKindName, DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(EntityLister), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(EntityLister), DF_VIEW_CMD_FUNCTION_NAME(EntityLister), DF_VIEW_UI_FUNCTION_NAME(EntityLister)}, +{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("symbol_lister"), str8_lit_comp("Symbols"), DF_NameKind_Null, DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(SymbolLister), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(SymbolLister), DF_VIEW_CMD_FUNCTION_NAME(SymbolLister), DF_VIEW_UI_FUNCTION_NAME(SymbolLister)}, {(0|1*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("target"), str8_lit_comp("Target"), DF_NameKind_EntityName, DF_IconKind_Target, DF_VIEW_SETUP_FUNCTION_NAME(Target), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Target), DF_VIEW_CMD_FUNCTION_NAME(Target), DF_VIEW_UI_FUNCTION_NAME(Target)}, {(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("targets"), str8_lit_comp("Targets"), DF_NameKind_Null, DF_IconKind_Target, DF_VIEW_SETUP_FUNCTION_NAME(Targets), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Targets), DF_VIEW_CMD_FUNCTION_NAME(Targets), DF_VIEW_UI_FUNCTION_NAME(Targets)}, {(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath), str8_lit_comp("file_path_map"), str8_lit_comp("File Path Map"), DF_NameKind_Null, DF_IconKind_FileOutline, DF_VIEW_SETUP_FUNCTION_NAME(FilePathMap), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(FilePathMap), DF_VIEW_CMD_FUNCTION_NAME(FilePathMap), DF_VIEW_UI_FUNCTION_NAME(FilePathMap)}, diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 36dc4a6d..f9c4e5bb 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -2553,13 +2553,16 @@ ui_signal_from_box(UI_Box *box) } } } - Vec2F32 max_view_off_target = + if(box->flags & UI_BoxFlag_ViewClamp) { - ClampBot(0, box->view_bounds.x - box->fixed_size.x), - ClampBot(0, box->view_bounds.y - box->fixed_size.y), - }; - box->view_off_target.x = Clamp(0, box->view_off_target.x, max_view_off_target.x); - box->view_off_target.y = Clamp(0, box->view_off_target.y, max_view_off_target.y); + Vec2F32 max_view_off_target = + { + ClampBot(0, box->view_bounds.x - box->fixed_size.x), + ClampBot(0, box->view_bounds.y - box->fixed_size.y), + }; + box->view_off_target.x = Clamp(0, box->view_off_target.x, max_view_off_target.x); + box->view_off_target.y = Clamp(0, box->view_off_target.y, max_view_off_target.y); + } } //- rjf: focus + clicks