mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-26 17:30:09 +00:00
get off cfg node duplicates of mdesk trees; use md trees for params consistently across view rules, tabs, etc.
This commit is contained in:
+147
-154
@@ -578,10 +578,10 @@ df_cmd_params_copy(Arena *arena, DF_CmdParams *src)
|
||||
dst.entity_list = df_push_handle_list_copy(arena, src->entity_list);
|
||||
dst.string = push_str8_copy(arena, src->string);
|
||||
dst.file_path = push_str8_copy(arena, src->file_path);
|
||||
if(src->cfg_node != 0) {dst.cfg_node = df_cfg_tree_copy(arena, src->cfg_node);}
|
||||
if(dst.cmd_spec == 0) {dst.cmd_spec = &df_g_nil_cmd_spec;}
|
||||
if(dst.view_spec == 0) {dst.view_spec = &df_g_nil_view_spec;}
|
||||
if(dst.cfg_node == 0) {dst.cfg_node = &df_g_nil_cfg_node;}
|
||||
if(src->params_tree != 0) {dst.params_tree = md_tree_copy(arena, src->params_tree);}
|
||||
if(dst.cmd_spec == 0) {dst.cmd_spec = &df_g_nil_cmd_spec;}
|
||||
if(dst.view_spec == 0) {dst.view_spec = &df_g_nil_view_spec;}
|
||||
if(dst.params_tree == 0) {dst.params_tree= &md_nil_node;}
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -766,6 +766,8 @@ df_gfx_view_rule_spec_from_string(String8 string)
|
||||
////////////////////////////////
|
||||
//~ rjf: View State Functions
|
||||
|
||||
//- rjf: allocation/releasing
|
||||
|
||||
internal DF_View *
|
||||
df_view_alloc(void)
|
||||
{
|
||||
@@ -792,8 +794,8 @@ df_view_alloc(void)
|
||||
view->spec = &df_g_nil_view_spec;
|
||||
view->project_path_arena = arena_alloc();
|
||||
view->project_path = str8_zero();
|
||||
view->cfg_arena = arena_alloc();
|
||||
view->cfg_root = &df_g_nil_cfg_node;
|
||||
view->params_arena = arena_alloc();
|
||||
view->params_root = &md_nil_node;
|
||||
view->query_cursor = view->query_mark = txt_pt(1, 1);
|
||||
view->query_string_size = 0;
|
||||
df_gfx_state->allocated_view_count += 1;
|
||||
@@ -820,19 +822,21 @@ df_view_release(DF_View *view)
|
||||
}
|
||||
view->first_arena_ext = view->last_arena_ext = 0;
|
||||
arena_release(view->project_path_arena);
|
||||
arena_release(view->cfg_arena);
|
||||
arena_release(view->params_arena);
|
||||
arena_release(view->arena);
|
||||
view->generation += 1;
|
||||
df_gfx_state->allocated_view_count -= 1;
|
||||
df_gfx_state->free_view_count += 1;
|
||||
}
|
||||
|
||||
//- rjf: equipment
|
||||
|
||||
internal void
|
||||
df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8 query, DF_CfgNode *cfg_root)
|
||||
df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8 query, MD_Node *params)
|
||||
{
|
||||
// rjf: fill cfg tree
|
||||
arena_clear(view->cfg_arena);
|
||||
view->cfg_root = df_cfg_tree_copy(view->cfg_arena, cfg_root);
|
||||
// rjf: fill params tree
|
||||
arena_clear(view->params_arena);
|
||||
view->params_root = md_tree_copy(view->params_arena, params);
|
||||
|
||||
// rjf: fill query buffer
|
||||
view->query_string_size = Min(sizeof(view->query_buffer), query.size);
|
||||
@@ -843,7 +847,23 @@ df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8
|
||||
if(view->spec != spec || spec == &df_g_nil_view_spec)
|
||||
{
|
||||
DF_ViewSetupFunctionType *view_setup = spec->info.setup_hook;
|
||||
df_view_clear_user_state(view);
|
||||
{
|
||||
for(DF_ArenaExt *ext = view->first_arena_ext; ext != 0; ext = ext->next)
|
||||
{
|
||||
arena_release(ext->arena);
|
||||
}
|
||||
for(DF_View *tchild = view->first_transient, *next = 0; !df_view_is_nil(tchild); tchild = next)
|
||||
{
|
||||
next = tchild->order_next;
|
||||
df_view_release(tchild);
|
||||
}
|
||||
view->first_transient = view->last_transient = &df_g_nil_view;
|
||||
view->first_arena_ext = view->last_arena_ext = 0;
|
||||
view->transient_view_slots_count = 0;
|
||||
view->transient_view_slots = 0;
|
||||
arena_clear(view->arena);
|
||||
view->user_data = 0;
|
||||
}
|
||||
MemoryZeroStruct(&view->scroll_pos);
|
||||
view->spec = spec;
|
||||
if(spec->info.flags & DF_ViewSpecFlag_ProjectSpecific)
|
||||
@@ -857,7 +877,7 @@ df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8
|
||||
}
|
||||
view->is_filtering = 0;
|
||||
view->is_filtering_t = 0;
|
||||
view_setup(window, view, view->cfg_root, str8(view->query_buffer, view->query_string_size));
|
||||
view_setup(window, view, view->params_root, str8(view->query_buffer, view->query_string_size));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -869,25 +889,7 @@ df_view_equip_loading_info(DF_View *view, B32 is_loading, U64 progress_v, U64 pr
|
||||
view->loading_progress_v_target = progress_target;
|
||||
}
|
||||
|
||||
internal void
|
||||
df_view_clear_user_state(DF_View *view)
|
||||
{
|
||||
for(DF_ArenaExt *ext = view->first_arena_ext; ext != 0; ext = ext->next)
|
||||
{
|
||||
arena_release(ext->arena);
|
||||
}
|
||||
for(DF_View *tchild = view->first_transient, *next = 0; !df_view_is_nil(tchild); tchild = next)
|
||||
{
|
||||
next = tchild->order_next;
|
||||
df_view_release(tchild);
|
||||
}
|
||||
view->first_transient = view->last_transient = &df_g_nil_view;
|
||||
view->first_arena_ext = view->last_arena_ext = 0;
|
||||
view->transient_view_slots_count = 0;
|
||||
view->transient_view_slots = 0;
|
||||
arena_clear(view->arena);
|
||||
view->user_data = 0;
|
||||
}
|
||||
//- rjf: user state extensions
|
||||
|
||||
internal void *
|
||||
df_view_get_or_push_user_state(DF_View *view, U64 size)
|
||||
@@ -913,7 +915,7 @@ df_view_push_arena_ext(DF_View *view)
|
||||
//~ rjf: Expand-Keyed Transient View Functions
|
||||
|
||||
internal DF_View *
|
||||
df_transient_view_from_expand_key(DF_View *owner_view, DF_Window *window, DF_ViewSpec *spec, String8 query, DF_CfgNode *cfg_root, DF_ExpandKey key)
|
||||
df_transient_view_from_expand_key(DF_View *owner_view, DF_Window *window, DF_ViewSpec *spec, String8 query, MD_Node *params, DF_ExpandKey key)
|
||||
{
|
||||
if(owner_view->transient_view_slots_count == 0)
|
||||
{
|
||||
@@ -947,7 +949,7 @@ df_transient_view_from_expand_key(DF_View *owner_view, DF_Window *window, DF_Vie
|
||||
node->first_frame_index_touched = node->last_frame_index_touched = df_frame_index();
|
||||
view = node->view;
|
||||
DLLPushBack_NPZ(&df_g_nil_view, owner_view->first_transient, owner_view->last_transient, view, order_next, order_prev);
|
||||
df_view_equip_spec(window, view, spec, query, cfg_root);
|
||||
df_view_equip_spec(window, view, spec, query, params);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
@@ -1558,87 +1560,87 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
if(df_view_is_nil(watch))
|
||||
{
|
||||
watch = df_view_alloc();
|
||||
df_view_equip_spec(ws, watch, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Watch), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, watch, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Watch), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(locals))
|
||||
{
|
||||
locals = df_view_alloc();
|
||||
df_view_equip_spec(ws, locals, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Locals), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, locals, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Locals), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(regs))
|
||||
{
|
||||
regs = df_view_alloc();
|
||||
df_view_equip_spec(ws, regs, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Registers), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, regs, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Registers), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(globals))
|
||||
{
|
||||
globals = df_view_alloc();
|
||||
df_view_equip_spec(ws, globals, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Globals), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, globals, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Globals), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(tlocals))
|
||||
{
|
||||
tlocals = df_view_alloc();
|
||||
df_view_equip_spec(ws, tlocals, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_ThreadLocals), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, tlocals, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_ThreadLocals), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(types))
|
||||
{
|
||||
types = df_view_alloc();
|
||||
df_view_equip_spec(ws, types, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Types), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, types, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Types), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(procs))
|
||||
{
|
||||
procs = df_view_alloc();
|
||||
df_view_equip_spec(ws, procs, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Procedures), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, procs, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Procedures), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(callstack))
|
||||
{
|
||||
callstack = df_view_alloc();
|
||||
df_view_equip_spec(ws, callstack, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_CallStack), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, callstack, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_CallStack), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(breakpoints))
|
||||
{
|
||||
breakpoints = df_view_alloc();
|
||||
df_view_equip_spec(ws, breakpoints, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Breakpoints), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, breakpoints, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Breakpoints), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(watch_pins))
|
||||
{
|
||||
watch_pins = df_view_alloc();
|
||||
df_view_equip_spec(ws, watch_pins, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_WatchPins), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, watch_pins, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_WatchPins), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(output))
|
||||
{
|
||||
output = df_view_alloc();
|
||||
df_view_equip_spec(ws, output, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Output), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, output, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Output), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(targets))
|
||||
{
|
||||
targets = df_view_alloc();
|
||||
df_view_equip_spec(ws, targets, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Targets), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, targets, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Targets), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(scheduler))
|
||||
{
|
||||
scheduler = df_view_alloc();
|
||||
df_view_equip_spec(ws, scheduler, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Scheduler), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, scheduler, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Scheduler), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(modules))
|
||||
{
|
||||
modules = df_view_alloc();
|
||||
df_view_equip_spec(ws, modules, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Modules), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, modules, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Modules), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(df_view_is_nil(disasm))
|
||||
{
|
||||
disasm = df_view_alloc();
|
||||
df_view_equip_spec(ws, disasm, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Disassembly), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, disasm, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Disassembly), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(layout == Layout_Default && df_view_is_nil(memory))
|
||||
{
|
||||
memory = df_view_alloc();
|
||||
df_view_equip_spec(ws, memory, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Memory), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, memory, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Memory), str8_zero(), &md_nil_node);
|
||||
}
|
||||
if(code_views.count == 0 && df_view_is_nil(getting_started))
|
||||
{
|
||||
getting_started = df_view_alloc();
|
||||
df_view_equip_spec(ws, getting_started, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_GettingStarted), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, getting_started, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_GettingStarted), str8_zero(), &md_nil_node);
|
||||
}
|
||||
|
||||
//- rjf: apply layout
|
||||
@@ -2104,7 +2106,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
query = params.string;
|
||||
}
|
||||
df_view_equip_spec(ws, view, spec, query, params.cfg_node);
|
||||
df_view_equip_spec(ws, view, spec, query, params.params_tree);
|
||||
df_panel_insert_tab_view(panel, panel->last_tab_view, view);
|
||||
df_panel_notify_mutation(ws, panel);
|
||||
}
|
||||
@@ -3196,7 +3198,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
DF_View *view = df_view_alloc();
|
||||
String8 file_path_query = df_eval_string_from_file_path(scratch.arena, file_path);
|
||||
df_view_equip_spec(ws, view, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Code), file_path_query, &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Code), file_path_query, &md_nil_node);
|
||||
df_panel_insert_tab_view(dst_panel, dst_panel->last_tab_view, view);
|
||||
dst_view = view;
|
||||
}
|
||||
@@ -3244,7 +3246,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
if(!df_panel_is_nil(dst_panel) && df_view_is_nil(view_w_disasm))
|
||||
{
|
||||
DF_View *view = df_view_alloc();
|
||||
df_view_equip_spec(ws, view, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Disassembly), str8_zero(), &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, df_view_spec_from_gfx_view_kind(DF_GfxViewKind_Disassembly), str8_zero(), &md_nil_node);
|
||||
df_panel_insert_tab_view(dst_panel, dst_panel->last_tab_view, view);
|
||||
dst_view = view;
|
||||
}
|
||||
@@ -3438,7 +3440,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
df_push_interact_regs();
|
||||
DF_ViewCmdFunctionType *do_view_cmds_function = view->spec->info.cmd_hook;
|
||||
do_view_cmds_function(ws, panel, view, view->cfg_root, str8(view->query_buffer, view->query_string_size), cmds);
|
||||
do_view_cmds_function(ws, panel, view, view->params_root, str8(view->query_buffer, view->query_string_size), cmds);
|
||||
DF_InteractRegs *view_regs = df_pop_interact_regs();
|
||||
if(panel == ws->focused_panel)
|
||||
{
|
||||
@@ -3664,7 +3666,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
DF_ViewSpec *view_spec = view->spec;
|
||||
DF_ViewUIFunctionType *build_view_ui_function = view_spec->info.ui_hook;
|
||||
build_view_ui_function(ws, &df_g_nil_panel, view, view->cfg_root, str8(view->query_buffer, view->query_string_size), view_preview_container->rect);
|
||||
build_view_ui_function(ws, &df_g_nil_panel, view, view->params_root, str8(view->query_buffer, view->query_string_size), view_preview_container->rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5960,7 +5962,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
|
||||
// rjf: construct & push new view
|
||||
DF_View *view = df_view_alloc();
|
||||
df_view_equip_spec(ws, view, view_spec, default_query, &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, view_spec, default_query, &md_nil_node);
|
||||
if(cmd_spec->info.query.flags & DF_CmdQueryFlag_SelectOldInput)
|
||||
{
|
||||
view->query_mark = txt_pt(1, 1);
|
||||
@@ -6121,7 +6123,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
DF_ViewSpec *view_spec = view->spec;
|
||||
DF_ViewUIFunctionType *build_view_ui_function = view_spec->info.ui_hook;
|
||||
build_view_ui_function(ws, &df_g_nil_panel, view, view->cfg_root, str8(view->query_buffer, view->query_string_size), query_container_content_rect);
|
||||
build_view_ui_function(ws, &df_g_nil_panel, view, view->params_root, str8(view->query_buffer, view->query_string_size), query_container_content_rect);
|
||||
}
|
||||
|
||||
//- rjf: query submission
|
||||
@@ -7270,7 +7272,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
//- rjf: build empty view
|
||||
UI_Parent(view_container_box) if(df_view_is_nil(df_selected_tab_from_panel(panel)))
|
||||
{
|
||||
DF_VIEW_UI_FUNCTION_NAME(Empty)(ws, panel, &df_g_nil_view, &df_g_nil_cfg_node, str8_zero(), content_rect);
|
||||
DF_VIEW_UI_FUNCTION_NAME(Empty)(ws, panel, &df_g_nil_view, &md_nil_node, str8_zero(), content_rect);
|
||||
}
|
||||
|
||||
//- rjf: build tab view
|
||||
@@ -7278,7 +7280,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
DF_View *view = df_selected_tab_from_panel(panel);
|
||||
DF_ViewUIFunctionType *build_view_ui_function = view->spec->info.ui_hook;
|
||||
build_view_ui_function(ws, panel, view, view->cfg_root, str8(view->query_buffer, view->query_string_size), content_rect);
|
||||
build_view_ui_function(ws, panel, view, view->params_root, str8(view->query_buffer, view->query_string_size), content_rect);
|
||||
}
|
||||
|
||||
//- rjf: fill with per-view states, after the view has a chance to run
|
||||
@@ -9435,26 +9437,26 @@ df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source)
|
||||
scratch_end(scratch);
|
||||
}
|
||||
{
|
||||
DF_CfgNodeRec rec = {0};
|
||||
for(DF_CfgNode *n = view->cfg_root; n != 0 && n != &df_g_nil_cfg_node; n = rec.next)
|
||||
MD_NodeRec rec = {0};
|
||||
for(MD_Node *n = view->params_root; n != 0 && n != &md_nil_node; n = rec.next)
|
||||
{
|
||||
rec = df_cfg_node_rec__depth_first_pre(n, view->cfg_root);
|
||||
if(n != view->cfg_root)
|
||||
rec = md_node_rec_depth_first_pre(n, view->params_root);
|
||||
if(n != view->params_root)
|
||||
{
|
||||
str8_list_pushf(arena, &strs, "%S", n->string);
|
||||
if(n->first != &df_g_nil_cfg_node)
|
||||
if(n->first != &md_nil_node)
|
||||
{
|
||||
str8_list_pushf(arena, &strs, ":{");
|
||||
}
|
||||
for(S32 pop_idx = 0; pop_idx < rec.pop_count; pop_idx += 1)
|
||||
{
|
||||
if(pop_idx == rec.pop_count-1 && rec.next == &df_g_nil_cfg_node)
|
||||
if(pop_idx == rec.pop_count-1 && rec.next == &md_nil_node)
|
||||
{
|
||||
break;
|
||||
}
|
||||
str8_list_pushf(arena, &strs, "}");
|
||||
}
|
||||
if(rec.pop_count != 0 || n->next != &df_g_nil_cfg_node)
|
||||
if(rec.pop_count != 0 || n->next != &md_nil_node)
|
||||
{
|
||||
str8_list_pushf(arena, &strs, " ");
|
||||
}
|
||||
@@ -13398,27 +13400,27 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
{
|
||||
DF_CfgVal *code_font_val = df_cfg_val_from_string(table, str8_lit("code_font"));
|
||||
DF_CfgVal *main_font_val = df_cfg_val_from_string(table, str8_lit("main_font"));
|
||||
DF_CfgNode *code_font_cfg = code_font_val->last;
|
||||
DF_CfgNode *main_font_cfg = main_font_val->last;
|
||||
String8 code_font_relative_path = code_font_cfg->first->string;
|
||||
String8 main_font_relative_path = main_font_cfg->first->string;
|
||||
if(code_font_cfg != &df_g_nil_cfg_node)
|
||||
MD_Node *code_font_node = code_font_val->last->root;
|
||||
MD_Node *main_font_node = main_font_val->last->root;
|
||||
String8 code_font_relative_path = code_font_node->first->string;
|
||||
String8 main_font_relative_path = main_font_node->first->string;
|
||||
if(!md_node_is_nil(code_font_node))
|
||||
{
|
||||
arena_clear(df_gfx_state->cfg_code_font_path_arena);
|
||||
df_gfx_state->cfg_code_font_path = push_str8_copy(df_gfx_state->cfg_code_font_path_arena, code_font_relative_path);
|
||||
}
|
||||
if(main_font_cfg != &df_g_nil_cfg_node)
|
||||
if(!md_node_is_nil(main_font_node))
|
||||
{
|
||||
arena_clear(df_gfx_state->cfg_main_font_path_arena);
|
||||
df_gfx_state->cfg_main_font_path = push_str8_copy(df_gfx_state->cfg_main_font_path_arena, main_font_relative_path);
|
||||
}
|
||||
String8 code_font_path = path_absolute_dst_from_relative_dst_src(scratch.arena, code_font_relative_path, cfg_folder);
|
||||
String8 main_font_path = path_absolute_dst_from_relative_dst_src(scratch.arena, main_font_relative_path, cfg_folder);
|
||||
if(os_file_path_exists(code_font_path) && code_font_cfg != &df_g_nil_cfg_node && code_font_relative_path.size != 0)
|
||||
if(os_file_path_exists(code_font_path) && !md_node_is_nil(code_font_node) && code_font_relative_path.size != 0)
|
||||
{
|
||||
df_gfx_state->cfg_font_tags[DF_FontSlot_Code] = f_tag_from_path(code_font_path);
|
||||
}
|
||||
if(os_file_path_exists(main_font_path) && main_font_cfg != &df_g_nil_cfg_node && main_font_relative_path.size != 0)
|
||||
if(os_file_path_exists(main_font_path) && !md_node_is_nil(main_font_node) && main_font_relative_path.size != 0)
|
||||
{
|
||||
df_gfx_state->cfg_font_tags[DF_FontSlot_Main] = f_tag_from_path(main_font_path);
|
||||
}
|
||||
@@ -13434,12 +13436,12 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
|
||||
//- rjf: build windows & panel layouts
|
||||
DF_CfgVal *windows = df_cfg_val_from_string(table, str8_lit("window"));
|
||||
for(DF_CfgNode *window_node = windows->first;
|
||||
window_node != &df_g_nil_cfg_node;
|
||||
window_node = window_node->next)
|
||||
for(DF_CfgTree *window_tree = windows->first;
|
||||
window_tree != &df_g_nil_cfg_tree;
|
||||
window_tree = window_tree->next)
|
||||
{
|
||||
// rjf: skip wrong source
|
||||
if(window_node->source != src)
|
||||
if(window_tree->source != src)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -13453,35 +13455,35 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
F32 dpi = 0.f;
|
||||
DF_SettingVal setting_vals[DF_SettingCode_COUNT] = {0};
|
||||
{
|
||||
for(DF_CfgNode *n = window_node->first; n != &df_g_nil_cfg_node; n = n->next)
|
||||
for(MD_EachNode(n, window_tree->root->first))
|
||||
{
|
||||
if(n->flags & DF_CfgNodeFlag_Identifier &&
|
||||
n->first == &df_g_nil_cfg_node &&
|
||||
if(n->flags & MD_NodeFlag_Identifier &&
|
||||
md_node_is_nil(n->first) &&
|
||||
str8_match(n->string, str8_lit("split_x"), StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
top_level_split_axis = Axis2_X;
|
||||
}
|
||||
if(n->flags & DF_CfgNodeFlag_Identifier &&
|
||||
n->first == &df_g_nil_cfg_node &&
|
||||
if(n->flags & MD_NodeFlag_Identifier &&
|
||||
md_node_is_nil(n->first) &&
|
||||
str8_match(n->string, str8_lit("split_y"), StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
top_level_split_axis = Axis2_Y;
|
||||
}
|
||||
if(n->flags & DF_CfgNodeFlag_Identifier &&
|
||||
n->first == &df_g_nil_cfg_node &&
|
||||
if(n->flags & MD_NodeFlag_Identifier &&
|
||||
md_node_is_nil(n->first) &&
|
||||
str8_match(n->string, str8_lit("fullscreen"), StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
is_fullscreen = 1;
|
||||
}
|
||||
if(n->flags & DF_CfgNodeFlag_Identifier &&
|
||||
n->first == &df_g_nil_cfg_node &&
|
||||
if(n->flags & MD_NodeFlag_Identifier &&
|
||||
md_node_is_nil(n->first) &&
|
||||
str8_match(n->string, str8_lit("maximized"), StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
is_maximized = 1;
|
||||
}
|
||||
}
|
||||
DF_CfgNode *monitor_cfg = df_cfg_node_child_from_string(window_node, str8_lit("monitor"), StringMatchFlag_CaseInsensitive);
|
||||
String8 preferred_monitor_name = monitor_cfg->first->string;
|
||||
MD_Node *monitor_node = md_child_from_string(window_tree->root, str8_lit("monitor"), 0);
|
||||
String8 preferred_monitor_name = monitor_node->first->string;
|
||||
for(U64 idx = 0; idx < monitors.count; idx += 1)
|
||||
{
|
||||
String8 monitor_name = os_name_from_monitor(scratch.arena, monitors.v[idx]);
|
||||
@@ -13492,10 +13494,10 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
}
|
||||
}
|
||||
Vec2F32 preferred_monitor_size = os_dim_from_monitor(preferred_monitor);
|
||||
DF_CfgNode *size_cfg = df_cfg_node_child_from_string(window_node, str8_lit("size"), StringMatchFlag_CaseInsensitive);
|
||||
MD_Node *size_node = md_child_from_string(window_tree->root, str8_lit("size"), 0);
|
||||
{
|
||||
String8 x_string = size_cfg->first->string;
|
||||
String8 y_string = size_cfg->first->next->string;
|
||||
String8 x_string = size_node->first->string;
|
||||
String8 y_string = size_node->first->next->string;
|
||||
U64 x_u64 = 0;
|
||||
U64 y_u64 = 0;
|
||||
if(!try_u64_from_str8_c_rules(x_string, &x_u64))
|
||||
@@ -13509,16 +13511,16 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
size.x = (F32)x_u64;
|
||||
size.y = (F32)y_u64;
|
||||
}
|
||||
DF_CfgNode *dpi_cfg = df_cfg_node_child_from_string(window_node, str8_lit("dpi"), StringMatchFlag_CaseInsensitive);
|
||||
String8 dpi_cfg_string = df_string_from_cfg_node_children(scratch.arena, dpi_cfg);
|
||||
dpi = f64_from_str8(dpi_cfg_string);
|
||||
MD_Node *dpi_node = md_child_from_string(window_tree->root, str8_lit("dpi"), 0);
|
||||
String8 dpi_string = md_string_from_children(scratch.arena, dpi_node);
|
||||
dpi = f64_from_str8(dpi_string);
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
DF_CfgNode *cfg = df_cfg_node_child_from_string(window_node, df_g_setting_code_lower_string_table[code], StringMatchFlag_CaseInsensitive);
|
||||
if(cfg != &df_g_nil_cfg_node)
|
||||
MD_Node *code_node = md_child_from_string(window_tree->root, df_g_setting_code_lower_string_table[code], 0);
|
||||
if(!md_node_is_nil(code_node))
|
||||
{
|
||||
S64 val_s64 = 0;
|
||||
try_s64_from_str8_c_rules(cfg->first->string, &val_s64);
|
||||
try_s64_from_str8_c_rules(code_node->first->string, &val_s64);
|
||||
setting_vals[code].set = 1;
|
||||
setting_vals[code].s32 = (S32)val_s64;
|
||||
setting_vals[code].s32 = clamp_1s32(df_g_setting_code_s32_range_table[code], setting_vals[code].s32);
|
||||
@@ -13527,7 +13529,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
}
|
||||
|
||||
// rjf: open window
|
||||
DF_Window *ws = df_window_open(size, preferred_monitor, window_node->source);
|
||||
DF_Window *ws = df_window_open(size, preferred_monitor, window_tree->source);
|
||||
if(dpi != 0.f) { ws->last_dpi = dpi; }
|
||||
for(EachEnumVal(DF_SettingCode, code))
|
||||
{
|
||||
@@ -13539,12 +13541,12 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
MemoryCopy(ws->setting_vals, setting_vals, sizeof(setting_vals[0])*ArrayCount(setting_vals));
|
||||
|
||||
// rjf: build panel tree
|
||||
DF_CfgNode *cfg_panels = df_cfg_node_child_from_string(window_node, str8_lit("panels"), StringMatchFlag_CaseInsensitive);
|
||||
MD_Node *panel_tree = md_child_from_string(window_tree->root, str8_lit("panels"), 0);
|
||||
DF_Panel *panel_parent = ws->root_panel;
|
||||
panel_parent->split_axis = top_level_split_axis;
|
||||
DF_CfgNodeRec rec = {0};
|
||||
for(DF_CfgNode *n = cfg_panels, *next = &df_g_nil_cfg_node;
|
||||
n != &df_g_nil_cfg_node;
|
||||
MD_NodeRec rec = {0};
|
||||
for(MD_Node *n = panel_tree, *next = &md_nil_node;
|
||||
!md_node_is_nil(n);
|
||||
n = next)
|
||||
{
|
||||
// rjf: assume we're just moving to the next one initially...
|
||||
@@ -13552,7 +13554,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
|
||||
// rjf: grab root panel
|
||||
DF_Panel *panel = &df_g_nil_panel;
|
||||
if(n == cfg_panels)
|
||||
if(n == panel_tree)
|
||||
{
|
||||
panel = ws->root_panel;
|
||||
panel->pct_of_parent = 1.f;
|
||||
@@ -13560,7 +13562,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
|
||||
// rjf: allocate & insert non-root panels - these will have a numeric string, determining
|
||||
// pct of parent
|
||||
if(n->flags & DF_CfgNodeFlag_Numeric)
|
||||
if(n->flags & MD_NodeFlag_Numeric)
|
||||
{
|
||||
panel = df_panel_alloc(ws);
|
||||
df_panel_insert(panel_parent, panel_parent->last, panel);
|
||||
@@ -13573,9 +13575,9 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
{
|
||||
// rjf: determine if this panel has panel children
|
||||
B32 has_panel_children = 0;
|
||||
for(DF_CfgNode *child = n->first; child != &df_g_nil_cfg_node; child = child->next)
|
||||
for(MD_EachNode(child, n->first))
|
||||
{
|
||||
if(child->flags & DF_CfgNodeFlag_Numeric)
|
||||
if(child->flags & MD_NodeFlag_Numeric)
|
||||
{
|
||||
has_panel_children = 1;
|
||||
break;
|
||||
@@ -13583,9 +13585,9 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
}
|
||||
|
||||
// rjf: apply panel options
|
||||
for(DF_CfgNode *op = n->first; op != &df_g_nil_cfg_node; op = op->next)
|
||||
for(MD_EachNode(op, n->first))
|
||||
{
|
||||
if(op->first == &df_g_nil_cfg_node && str8_match(op->string, str8_lit("tabs_on_bottom"), StringMatchFlag_CaseInsensitive))
|
||||
if(md_node_is_nil(op->first) && str8_match(op->string, str8_lit("tabs_on_bottom"), 0))
|
||||
{
|
||||
panel->tab_side = Side_Max;
|
||||
}
|
||||
@@ -13593,7 +13595,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
|
||||
// rjf: apply panel views/tabs/commands
|
||||
DF_View *selected_view = &df_g_nil_view;
|
||||
for(DF_CfgNode *op = n->first; op != &df_g_nil_cfg_node; op = op->next)
|
||||
for(MD_EachNode(op, n->first))
|
||||
{
|
||||
DF_ViewSpec *view_spec = df_view_spec_from_string(op->string);
|
||||
if(view_spec == &df_g_nil_view_spec || has_panel_children != 0)
|
||||
@@ -13611,22 +13613,22 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
view = df_view_alloc();
|
||||
|
||||
// rjf: check if this view is selected
|
||||
view_is_selected = df_cfg_node_child_from_string(op, str8_lit("selected"), StringMatchFlag_CaseInsensitive) != &df_g_nil_cfg_node;
|
||||
view_is_selected = !md_node_is_nil(md_child_from_string(op, str8_lit("selected"), 0));
|
||||
|
||||
// rjf: read project path
|
||||
String8 project_path = str8_lit("");
|
||||
{
|
||||
DF_CfgNode *project_cfg_node = df_cfg_node_child_from_string(op, str8_lit("project"), StringMatchFlag_CaseInsensitive);
|
||||
if(project_cfg_node != &df_g_nil_cfg_node)
|
||||
MD_Node *project_node = md_child_from_string(op, str8_lit("project"), 0);
|
||||
if(!md_node_is_nil(project_node))
|
||||
{
|
||||
project_path = path_absolute_dst_from_relative_dst_src(scratch.arena, project_cfg_node->first->string, cfg_folder);
|
||||
project_path = path_absolute_dst_from_relative_dst_src(scratch.arena, project_node->first->string, cfg_folder);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: read view query string
|
||||
String8 view_query = str8_lit("");
|
||||
{
|
||||
String8 escaped_query = df_cfg_node_child_from_string(op, str8_lit("query"), StringMatchFlag_CaseInsensitive)->first->string;
|
||||
String8 escaped_query = md_child_from_string(op, str8_lit("query"), 0)->first->string;
|
||||
view_query = df_cfg_raw_from_escaped_string(scratch.arena, escaped_query);
|
||||
}
|
||||
|
||||
@@ -13672,11 +13674,11 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
next = n->first;
|
||||
panel_parent = panel;
|
||||
}
|
||||
else for(DF_CfgNode *p = n;
|
||||
p != &df_g_nil_cfg_node && p != cfg_panels;
|
||||
else for(MD_Node *p = n;
|
||||
p != &md_nil_node && p != panel_tree;
|
||||
p = p->parent, panel_parent = panel_parent->parent)
|
||||
{
|
||||
if(p->next != &df_g_nil_cfg_node)
|
||||
if(p->next != &md_nil_node)
|
||||
{
|
||||
next = p->next;
|
||||
break;
|
||||
@@ -13726,34 +13728,30 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
df_clear_bindings();
|
||||
}
|
||||
DF_CfgVal *keybindings = df_cfg_val_from_string(table, str8_lit("keybindings"));
|
||||
for(DF_CfgNode *keybinding_set = keybindings->first;
|
||||
keybinding_set != &df_g_nil_cfg_node;
|
||||
for(DF_CfgTree *keybinding_set = keybindings->first;
|
||||
keybinding_set != &df_g_nil_cfg_tree;
|
||||
keybinding_set = keybinding_set->next)
|
||||
{
|
||||
for(DF_CfgNode *keybind = keybinding_set->first;
|
||||
keybind != &df_g_nil_cfg_node;
|
||||
keybind = keybind->next)
|
||||
for(MD_EachNode(keybind, keybinding_set->root->first))
|
||||
{
|
||||
DF_CmdSpec *cmd_spec = &df_g_nil_cmd_spec;
|
||||
OS_Key key = OS_Key_Null;
|
||||
DF_CfgNode *ctrl_cfg = &df_g_nil_cfg_node;
|
||||
DF_CfgNode *shift_cfg = &df_g_nil_cfg_node;
|
||||
DF_CfgNode *alt_cfg = &df_g_nil_cfg_node;
|
||||
for(DF_CfgNode *child = keybind->first;
|
||||
child != &df_g_nil_cfg_node;
|
||||
child = child->next)
|
||||
MD_Node *ctrl_node = &md_nil_node;
|
||||
MD_Node *shift_node = &md_nil_node;
|
||||
MD_Node *alt_node = &md_nil_node;
|
||||
for(MD_EachNode(child, keybind->first))
|
||||
{
|
||||
if(str8_match(child->string, str8_lit("ctrl"), StringMatchFlag_CaseInsensitive))
|
||||
if(str8_match(child->string, str8_lit("ctrl"), 0))
|
||||
{
|
||||
ctrl_cfg = child;
|
||||
ctrl_node = child;
|
||||
}
|
||||
else if(str8_match(child->string, str8_lit("shift"), StringMatchFlag_CaseInsensitive))
|
||||
else if(str8_match(child->string, str8_lit("shift"), 0))
|
||||
{
|
||||
shift_cfg = child;
|
||||
shift_node = child;
|
||||
}
|
||||
else if(str8_match(child->string, str8_lit("alt"), StringMatchFlag_CaseInsensitive))
|
||||
else if(str8_match(child->string, str8_lit("alt"), 0))
|
||||
{
|
||||
alt_cfg = child;
|
||||
alt_node = child;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -13780,9 +13778,9 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
if(!df_cmd_spec_is_nil(cmd_spec) && key != OS_Key_Null)
|
||||
{
|
||||
OS_EventFlags flags = 0;
|
||||
if(ctrl_cfg != &df_g_nil_cfg_node) { flags |= OS_EventFlag_Ctrl; }
|
||||
if(shift_cfg != &df_g_nil_cfg_node) { flags |= OS_EventFlag_Shift; }
|
||||
if(alt_cfg != &df_g_nil_cfg_node) { flags |= OS_EventFlag_Alt; }
|
||||
if(!md_node_is_nil(ctrl_node)) { flags |= OS_EventFlag_Ctrl; }
|
||||
if(!md_node_is_nil(shift_node)) { flags |= OS_EventFlag_Shift; }
|
||||
if(!md_node_is_nil(alt_node)) { flags |= OS_EventFlag_Alt; }
|
||||
DF_Binding binding = {key, flags};
|
||||
df_bind_spec(cmd_spec, binding);
|
||||
}
|
||||
@@ -13798,7 +13796,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
B32 preset_applied = 0;
|
||||
if(color_preset != &df_g_nil_cfg_val)
|
||||
{
|
||||
String8 color_preset_name = color_preset->last->first->string;
|
||||
String8 color_preset_name = color_preset->last->root->first->string;
|
||||
DF_ThemePreset preset = (DF_ThemePreset)0;
|
||||
B32 found_preset = 0;
|
||||
for(DF_ThemePreset p = (DF_ThemePreset)0; p < DF_ThemePreset_COUNT; p = (DF_ThemePreset)(p+1))
|
||||
@@ -13821,13 +13819,11 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
//- rjf: apply individual theme colors
|
||||
B8 theme_color_hit[DF_ThemeColor_COUNT] = {0};
|
||||
DF_CfgVal *colors = df_cfg_val_from_string(table, str8_lit("colors"));
|
||||
for(DF_CfgNode *colors_set = colors->first;
|
||||
colors_set != &df_g_nil_cfg_node;
|
||||
for(DF_CfgTree *colors_set = colors->first;
|
||||
colors_set != &df_g_nil_cfg_tree;
|
||||
colors_set = colors_set->next)
|
||||
{
|
||||
for(DF_CfgNode *color = colors_set->first;
|
||||
color != &df_g_nil_cfg_node;
|
||||
color = color->next)
|
||||
for(MD_EachNode(color, colors_set->root->first))
|
||||
{
|
||||
String8 saved_color_name = color->string;
|
||||
String8List candidate_color_names = {0};
|
||||
@@ -13854,7 +13850,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
if(color_code != DF_ThemeColor_Null)
|
||||
{
|
||||
theme_color_hit[color_code] = 1;
|
||||
DF_CfgNode *hex_cfg = color->first;
|
||||
MD_Node *hex_cfg = color->first;
|
||||
String8 hex_string = hex_cfg->string;
|
||||
U64 hex_val = 0;
|
||||
try_u64_from_str8_c_rules(hex_string, &hex_val);
|
||||
@@ -13924,20 +13920,17 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
{
|
||||
String8 name = df_g_setting_code_lower_string_table[code];
|
||||
DF_CfgVal *code_cfg_val = df_cfg_val_from_string(table, name);
|
||||
DF_CfgNode *root_node = code_cfg_val->last;
|
||||
if(root_node->source == src)
|
||||
DF_CfgTree *code_tree = code_cfg_val->last;
|
||||
if(code_tree->source == src)
|
||||
{
|
||||
DF_CfgNode *val_node = root_node->first;
|
||||
MD_Node *val_node = code_tree->root->first;
|
||||
S64 val = 0;
|
||||
if(try_s64_from_str8_c_rules(val_node->string, &val))
|
||||
{
|
||||
df_gfx_state->cfg_setting_vals[src][code].set = 1;
|
||||
df_gfx_state->cfg_setting_vals[src][code].s32 = (S32)val;
|
||||
}
|
||||
if(val_node != &df_g_nil_cfg_node)
|
||||
{
|
||||
setting_codes_hit[code] = 1;
|
||||
}
|
||||
setting_codes_hit[code] = !md_node_is_nil(val_node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13954,7 +13947,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
||||
}
|
||||
|
||||
//- rjf: if config opened 0 windows, we need to do some sensible default
|
||||
if(src == DF_CfgSrc_User && windows->first == &df_g_nil_cfg_node)
|
||||
if(src == DF_CfgSrc_User && windows->first == &df_g_nil_cfg_tree)
|
||||
{
|
||||
OS_Handle preferred_monitor = os_primary_monitor();
|
||||
Vec2F32 monitor_dim = os_dim_from_monitor(preferred_monitor);
|
||||
|
||||
+14
-10
@@ -83,17 +83,17 @@ typedef struct DF_View DF_View;
|
||||
typedef struct DF_Panel DF_Panel;
|
||||
typedef struct DF_Window DF_Window;
|
||||
|
||||
#define DF_VIEW_SETUP_FUNCTION_SIG(name) void name(DF_Window *ws, struct DF_View *view, DF_CfgNode *cfg, String8 string)
|
||||
#define DF_VIEW_SETUP_FUNCTION_SIG(name) void name(DF_Window *ws, struct DF_View *view, MD_Node *params, String8 string)
|
||||
#define DF_VIEW_SETUP_FUNCTION_NAME(name) df_view_setup_##name
|
||||
#define DF_VIEW_SETUP_FUNCTION_DEF(name) internal DF_VIEW_SETUP_FUNCTION_SIG(DF_VIEW_SETUP_FUNCTION_NAME(name))
|
||||
typedef DF_VIEW_SETUP_FUNCTION_SIG(DF_ViewSetupFunctionType);
|
||||
|
||||
#define DF_VIEW_CMD_FUNCTION_SIG(name) void name(struct DF_Window *ws, struct DF_Panel *panel, struct DF_View *view, DF_CfgNode *cfg, String8 string, struct DF_CmdList *cmds)
|
||||
#define DF_VIEW_CMD_FUNCTION_SIG(name) void name(struct DF_Window *ws, struct DF_Panel *panel, struct DF_View *view, MD_Node *params, String8 string, struct DF_CmdList *cmds)
|
||||
#define DF_VIEW_CMD_FUNCTION_NAME(name) df_view_cmds_##name
|
||||
#define DF_VIEW_CMD_FUNCTION_DEF(name) internal DF_VIEW_CMD_FUNCTION_SIG(DF_VIEW_CMD_FUNCTION_NAME(name))
|
||||
typedef DF_VIEW_CMD_FUNCTION_SIG(DF_ViewCmdFunctionType);
|
||||
|
||||
#define DF_VIEW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, struct DF_Panel *panel, struct DF_View *view, DF_CfgNode *cfg, String8 string, Rng2F32 rect)
|
||||
#define DF_VIEW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, struct DF_Panel *panel, struct DF_View *view, MD_Node *params, String8 string, Rng2F32 rect)
|
||||
#define DF_VIEW_UI_FUNCTION_NAME(name) df_view_ui_##name
|
||||
#define DF_VIEW_UI_FUNCTION_DEF(name) internal DF_VIEW_UI_FUNCTION_SIG(DF_VIEW_UI_FUNCTION_NAME(name))
|
||||
typedef DF_VIEW_UI_FUNCTION_SIG(DF_ViewUIFunctionType);
|
||||
@@ -231,9 +231,9 @@ struct DF_View
|
||||
B32 is_filtering;
|
||||
F32 is_filtering_t;
|
||||
|
||||
// rjf: configuration tree state
|
||||
Arena *cfg_arena;
|
||||
DF_CfgNode *cfg_root;
|
||||
// rjf: params tree state
|
||||
Arena *params_arena;
|
||||
MD_Node *params_root;
|
||||
|
||||
// rjf: text query state
|
||||
TxtPt query_cursor;
|
||||
@@ -339,7 +339,7 @@ enum
|
||||
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name) df_gfx_view_rule_line_stringize__##name
|
||||
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(name) internal DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name))
|
||||
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, E_Eval eval, struct DF_CfgNode *cfg)
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, E_Eval eval, MD_Node *params)
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name) df_gfx_view_rule_row_ui__##name
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name))
|
||||
|
||||
@@ -948,11 +948,15 @@ internal DF_GfxViewRuleSpec *df_gfx_view_rule_spec_from_string(String8 string);
|
||||
////////////////////////////////
|
||||
//~ rjf: View State Functions
|
||||
|
||||
//- rjf: allocation/releasing
|
||||
internal DF_View *df_view_alloc(void);
|
||||
internal void df_view_release(DF_View *view);
|
||||
internal void df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8 query, DF_CfgNode *cfg_root);
|
||||
|
||||
//- rjf: equipment
|
||||
internal void df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8 query, MD_Node *params);
|
||||
internal void df_view_equip_loading_info(DF_View *view, B32 is_loading, U64 progress_v, U64 progress_target);
|
||||
internal void df_view_clear_user_state(DF_View *view);
|
||||
|
||||
//- rjf: user state extensions
|
||||
internal void *df_view_get_or_push_user_state(DF_View *view, U64 size);
|
||||
internal Arena *df_view_push_arena_ext(DF_View *view);
|
||||
#define df_view_user_state(view, type) (type *)df_view_get_or_push_user_state((view), sizeof(type))
|
||||
@@ -960,7 +964,7 @@ internal Arena *df_view_push_arena_ext(DF_View *view);
|
||||
////////////////////////////////
|
||||
//~ rjf: Expand-Keyed Transient View Functions
|
||||
|
||||
internal DF_View *df_transient_view_from_expand_key(DF_View *owner_view, DF_Window *window, DF_ViewSpec *spec, String8 query, DF_CfgNode *cfg_root, DF_ExpandKey key);
|
||||
internal DF_View *df_transient_view_from_expand_key(DF_View *owner_view, DF_Window *window, DF_ViewSpec *spec, String8 query, MD_Node *params, DF_ExpandKey key);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Rule Instance State Functions
|
||||
|
||||
@@ -331,7 +331,7 @@ DF_GfxViewRuleTable:
|
||||
{"rgba" - - x x "" }
|
||||
{"text" - - - x "code" }
|
||||
{"disasm" - - - x "disassembly" }
|
||||
{"bitmap" - - x x "bitmap" }
|
||||
{"bitmap" - - - x "bitmap" }
|
||||
{"geo" - - x x "geometry" }
|
||||
}
|
||||
|
||||
|
||||
+17
-161
@@ -173,6 +173,7 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(default)
|
||||
|
||||
DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array)
|
||||
{
|
||||
#if 0
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
E_TypeKey type_key = eval.type_key;
|
||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
||||
@@ -203,6 +204,7 @@ DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array)
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
#endif
|
||||
return eval;
|
||||
}
|
||||
|
||||
@@ -656,23 +658,6 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
////////////////////////////////
|
||||
//~ rjf: "text"
|
||||
|
||||
internal DF_TxtTopologyInfo
|
||||
df_vr_txt_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_TxtTopologyInfo result = zero_struct;
|
||||
{
|
||||
StringJoin join = {0};
|
||||
join.sep = str8_lit(" ");
|
||||
DF_CfgNode *lang_cfg = df_cfg_node_child_from_string(cfg, str8_lit("lang"), 0);
|
||||
String8 lang_string = {0};
|
||||
lang_string = lang_cfg->first->string;
|
||||
result.lang = txt_lang_kind_from_extension(lang_string);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(text)
|
||||
{
|
||||
DF_EvalVizBlock *vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Canvas, key, df_expand_key_make(df_hash_from_expand_key(key), 1), depth);
|
||||
@@ -684,132 +669,9 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(text)
|
||||
df_eval_viz_block_end(out, vb);
|
||||
}
|
||||
|
||||
#if 0
|
||||
DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: get & initialize state
|
||||
//
|
||||
DF_VR_TextState *state = df_view_rule_block_user_state(key, DF_VR_TextState);
|
||||
if(!state->initialized)
|
||||
{
|
||||
state->initialized = 1;
|
||||
state->cursor = state->mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack evaluation / view rule params
|
||||
//
|
||||
Rng1U64 range = df_range_from_eval_cfg(eval, cfg);
|
||||
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(cfg);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: evaluation info -> text visualization info
|
||||
//
|
||||
String8 data = {0};
|
||||
TXT_TextInfo info = {0};
|
||||
TXT_LineTokensSlice line_tokens_slice = {0};
|
||||
U128 text_key = df_key_from_eval_space_range(eval.space, range);
|
||||
{
|
||||
U128 text_hash = {0};
|
||||
info = txt_text_info_from_key_lang(txt_scope, text_key, top.lang, &text_hash);
|
||||
data = hs_data_from_hash(hs_scope, text_hash);
|
||||
line_tokens_slice = txt_line_tokens_slice_from_info_data_line_range(scratch.arena, &info, data, r1s64(1, info.lines_count));
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: info -> code slice info
|
||||
//
|
||||
DF_CodeSliceParams code_slice_params = {0};
|
||||
{
|
||||
code_slice_params.flags = DF_CodeSliceFlag_LineNums;
|
||||
code_slice_params.line_num_range = r1s64(1, info.lines_count);
|
||||
code_slice_params.line_text = push_array(scratch.arena, String8, info.lines_count);
|
||||
code_slice_params.line_ranges = push_array(scratch.arena, Rng1U64, info.lines_count);
|
||||
code_slice_params.line_tokens = push_array(scratch.arena, TXT_TokenArray, info.lines_count);
|
||||
code_slice_params.line_bps = push_array(scratch.arena, DF_EntityList, info.lines_count);
|
||||
code_slice_params.line_ips = push_array(scratch.arena, DF_EntityList, info.lines_count);
|
||||
code_slice_params.line_pins = push_array(scratch.arena, DF_EntityList, info.lines_count);
|
||||
code_slice_params.line_vaddrs = push_array(scratch.arena, U64, info.lines_count);
|
||||
code_slice_params.line_infos = push_array(scratch.arena, DF_LineList, info.lines_count);
|
||||
for(U64 line_idx = 0; line_idx < info.lines_count; line_idx += 1)
|
||||
{
|
||||
code_slice_params.line_text[line_idx] = str8_substr(data, info.lines_ranges[line_idx]);
|
||||
code_slice_params.line_ranges[line_idx] = info.lines_ranges[line_idx];
|
||||
code_slice_params.line_tokens[line_idx] = line_tokens_slice.line_tokens[line_idx];
|
||||
}
|
||||
code_slice_params.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
code_slice_params.font_size = ui_top_font_size();
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(ws, DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.line_height_px = ui_top_font_size()*1.5f;
|
||||
code_slice_params.priority_margin_width_px = 0;
|
||||
code_slice_params.catchall_margin_width_px = 0;
|
||||
code_slice_params.line_num_width_px = ui_top_font_size()*5.f;
|
||||
code_slice_params.line_text_max_width_px = ui_top_font_size()*2.f*info.lines_max_size;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build UI
|
||||
//
|
||||
if(info.lines_count != 0)
|
||||
{
|
||||
//- rjf: build top-level container
|
||||
UI_Box *container = &ui_g_nil_box;
|
||||
UI_PrefWidth(ui_px(dim.x, 1.f)) UI_PrefHeight(ui_px(dim.y, 1.f))
|
||||
{
|
||||
container = ui_build_box_from_stringf(UI_BoxFlag_AllowOverflow|UI_BoxFlag_Clip, "###text_container");
|
||||
}
|
||||
|
||||
//- rjf: build code slice
|
||||
UI_WidthFill UI_HeightFill UI_Parent(container)
|
||||
{
|
||||
DF_CodeSliceSignal slice_sig = df_code_slice(ws, &code_slice_params, &state->cursor, &state->mark, &state->preferred_column, str8_lit("###slice"));
|
||||
}
|
||||
}
|
||||
|
||||
txt_scope_close(txt_scope);
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "disasm"
|
||||
|
||||
internal DF_DisasmTopologyInfo
|
||||
df_vr_disasm_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_DisasmTopologyInfo result = zero_struct;
|
||||
{
|
||||
StringJoin join = {0};
|
||||
join.sep = str8_lit(" ");
|
||||
DF_CfgNode *size_cfg = df_cfg_node_child_from_string(cfg, str8_lit("size"), 0);
|
||||
DF_CfgNode *arch_cfg = df_cfg_node_child_from_string(cfg, str8_lit("arch"), 0);
|
||||
String8List size_expr_strs = {0};
|
||||
String8 arch_string = {0};
|
||||
for(DF_CfgNode *child = size_cfg->first; child != &df_g_nil_cfg_node; child = child->next)
|
||||
{
|
||||
str8_list_push(scratch.arena, &size_expr_strs, child->string);
|
||||
}
|
||||
arch_string = arch_cfg->first->string;
|
||||
String8 size_expr = str8_list_join(scratch.arena, &size_expr_strs, &join);
|
||||
E_Eval size_eval = e_eval_from_string(scratch.arena, size_expr);
|
||||
E_Eval size_val_eval = e_value_eval_from_eval(size_eval);
|
||||
if(str8_match(arch_string, str8_lit("x64"), StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
result.arch = Architecture_x64;
|
||||
}
|
||||
result.size_cap = size_val_eval.value.u64;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(disasm)
|
||||
{
|
||||
DF_EvalVizBlock *vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Canvas, key, df_expand_key_make(df_hash_from_expand_key(key), 1), depth);
|
||||
@@ -941,6 +803,18 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(graph)
|
||||
////////////////////////////////
|
||||
//~ rjf: "bitmap"
|
||||
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_EvalVizBlock *vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Canvas, key, df_expand_key_make(df_hash_from_expand_key(key), 1), depth);
|
||||
vb->string = string;
|
||||
vb->expr = expr;
|
||||
vb->visual_idx_range = r1u64(0, 8);
|
||||
vb->semantic_idx_range = r1u64(0, 1);
|
||||
vb->cfg_table = cfg_table;
|
||||
df_eval_viz_block_end(out, vb);
|
||||
}
|
||||
|
||||
#if 0
|
||||
internal Vec2F32
|
||||
df_bitmap_view_state__screen_from_canvas_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 cvs)
|
||||
{
|
||||
@@ -1057,27 +931,7 @@ internal UI_BOX_CUSTOM_DRAW(df_vr_bitmap_box_draw)
|
||||
indicator_color, 3.f, 4.f, 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_EvalVizBlock *vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Canvas, key, df_expand_key_make(df_hash_from_expand_key(key), 1), depth);
|
||||
vb->string = string;
|
||||
vb->expr = expr;
|
||||
vb->visual_idx_range = r1u64(0, 8);
|
||||
vb->semantic_idx_range = r1u64(0, 1);
|
||||
vb->cfg_table = cfg_table;
|
||||
df_eval_viz_block_end(out, vb);
|
||||
}
|
||||
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
DF_BitmapTopologyInfo topology = df_vr_bitmap_topology_info_from_cfg(cfg);
|
||||
U64 expected_size = topology.width*topology.height*r_tex2d_format_bytes_per_pixel_table[topology.fmt];
|
||||
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
ui_labelf("0x%I64x -> Bitmap (%I64u x %I64u)", base_vaddr, topology.width, topology.height);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
|
||||
@@ -1202,6 +1056,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
////////////////////////////////
|
||||
//~ rjf: "geo"
|
||||
|
||||
#if 0
|
||||
internal DF_GeoTopologyInfo
|
||||
df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
@@ -1244,6 +1099,7 @@ df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
internal UI_BOX_CUSTOM_DRAW(df_vr_geo_box_draw)
|
||||
{
|
||||
|
||||
@@ -17,28 +17,6 @@ struct DF_VR_RGBAState
|
||||
internal Vec4F32 df_vr_rgba_from_eval(E_Eval eval, DF_Entity *process);
|
||||
internal void df_vr_eval_commit_rgba(E_Eval eval, Vec4F32 rgba);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "text"
|
||||
|
||||
typedef struct DF_TxtTopologyInfo DF_TxtTopologyInfo;
|
||||
struct DF_TxtTopologyInfo
|
||||
{
|
||||
TXT_LangKind lang;
|
||||
};
|
||||
|
||||
typedef struct DF_VR_TextState DF_VR_TextState;
|
||||
struct DF_VR_TextState
|
||||
{
|
||||
B32 initialized;
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
S64 preferred_column;
|
||||
U64 last_open_frame_idx;
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "disasm"
|
||||
|
||||
@@ -60,8 +38,6 @@ struct DF_VR_DisasmState
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "bitmap"
|
||||
|
||||
@@ -101,11 +77,13 @@ struct DF_VR_BitmapBoxDrawData
|
||||
F32 ui_per_bmp_px;
|
||||
};
|
||||
|
||||
#if 0
|
||||
internal Vec2F32 df_bitmap_view_state__screen_from_canvas_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 cvs);
|
||||
internal Rng2F32 df_bitmap_view_state__screen_from_canvas_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 cvs);
|
||||
internal Vec2F32 df_bitmap_view_state__canvas_from_screen_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 scr);
|
||||
internal Rng2F32 df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 scr);
|
||||
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "geo"
|
||||
@@ -140,6 +118,8 @@ struct DF_VR_GeoBoxDrawData
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
#if 0
|
||||
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
#endif
|
||||
|
||||
#endif // DF_VIEW_RULES_H
|
||||
|
||||
+39
-129
@@ -2045,12 +2045,12 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
if(row->expand_ui_rule_spec != &df_g_nil_gfx_view_rule_spec && row->expand_ui_rule_spec != 0)
|
||||
{
|
||||
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
||||
p.string = e_string_from_expr(scratch.arena, row->expr);
|
||||
p.view_spec = df_view_spec_from_string(row->expand_ui_rule_spec->info.view_spec_name);
|
||||
p.cfg_node = row->expand_ui_rule_node;
|
||||
p.string = e_string_from_expr(scratch.arena, row->expr);
|
||||
p.view_spec = df_view_spec_from_string(row->expand_ui_rule_spec->info.view_spec_name);
|
||||
p.params_tree = row->expand_ui_rule_params;
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_String);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_ViewSpec);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_CfgNode);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_ParamsTree);
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_OpenTab));
|
||||
}
|
||||
}
|
||||
@@ -2709,7 +2709,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//- rjf: unpack
|
||||
DF_WatchViewPoint pt = {0, row->parent_key, row->key};
|
||||
DF_ViewSpec *canvas_view_spec = df_view_spec_from_string(row->expand_ui_rule_spec->info.view_spec_name);
|
||||
DF_View *canvas_view = df_transient_view_from_expand_key(view, ws, canvas_view_spec, e_string_from_expr(scratch.arena, row->expr), row->expand_ui_rule_node, row->key);
|
||||
DF_View *canvas_view = df_transient_view_from_expand_key(view, ws, canvas_view_spec, e_string_from_expr(scratch.arena, row->expr), row->expand_ui_rule_params, row->key);
|
||||
Vec2F32 canvas_dim = v2f32(scroll_list_params.dim_px.x - ui_top_font_size()*1.5f,
|
||||
(row->skipped_size_in_rows+row->size_in_rows+row->chopped_size_in_rows)*scroll_list_params.row_height_px);
|
||||
Rng2F32 canvas_rect = r2f32p(rect.x0,
|
||||
@@ -2746,12 +2746,9 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
DF_ViewSpec *canvas_view_spec = df_view_spec_from_string(row->expand_ui_rule_spec->info.view_spec_name);
|
||||
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
||||
p.string = e_string_from_expr(scratch.arena, row->expr);
|
||||
p.view_spec = canvas_view_spec;
|
||||
p.cfg_node = row->expand_ui_rule_node;
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_String);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_ViewSpec);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_CfgNode);
|
||||
p.string = e_string_from_expr(scratch.arena, row->expr);
|
||||
p.view_spec = canvas_view_spec;
|
||||
p.params_tree = row->expand_ui_rule_params;
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_OpenTab));
|
||||
}
|
||||
}
|
||||
@@ -2774,7 +2771,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//- rjf: build
|
||||
UI_PermissionFlags(UI_PermissionFlag_Clicks|UI_PermissionFlag_ScrollX)
|
||||
{
|
||||
canvas_view_spec->info.ui_hook(ws, &df_g_nil_panel, canvas_view, canvas_view->cfg_root, str8(canvas_view->query_buffer, canvas_view->query_string_size), canvas_rect);
|
||||
canvas_view_spec->info.ui_hook(ws, &df_g_nil_panel, canvas_view, canvas_view->params_root, str8(canvas_view->query_buffer, canvas_view->query_string_size), canvas_rect);
|
||||
}
|
||||
|
||||
//- rjf: pop interaction registers
|
||||
@@ -2844,7 +2841,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
String8 cell_error_tooltip_string = {0};
|
||||
DF_AutoCompListerFlags cell_autocomp_flags = 0;
|
||||
DF_GfxViewRuleRowUIFunctionType *cell_ui_hook = 0;
|
||||
DF_CfgNode *cell_ui_node = &df_g_nil_cfg_node;
|
||||
MD_Node *cell_ui_params = &md_nil_node;
|
||||
Vec4F32 cell_base_color = ui_top_palette()->text;
|
||||
DF_IconKind cell_icon = DF_IconKind_Null;
|
||||
switch(col->kind)
|
||||
@@ -2911,7 +2908,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
if(row->value_ui_rule_spec != &df_g_nil_gfx_view_rule_spec && row->value_ui_rule_spec != 0)
|
||||
{
|
||||
cell_ui_hook = row->value_ui_rule_spec->info.row_ui;
|
||||
cell_ui_node = row->value_ui_rule_node;
|
||||
cell_ui_params = row->value_ui_rule_params;
|
||||
}
|
||||
cell_can_edit = df_type_key_is_editable(cell_eval.type_key);
|
||||
}break;
|
||||
@@ -2947,7 +2944,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
if(spec != &df_g_nil_gfx_view_rule_spec && spec->info.flags & DF_GfxViewRuleSpecInfoFlag_RowUI)
|
||||
{
|
||||
cell_ui_hook = spec->info.row_ui;
|
||||
cell_ui_node = val->last;
|
||||
cell_ui_params = val->last->root;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2993,7 +2990,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###val_%I64x", row_hash);
|
||||
UI_Parent(box)
|
||||
{
|
||||
cell_ui_hook(ws, row->key, cell_eval, cell_ui_node);
|
||||
cell_ui_hook(ws, row->key, cell_eval, cell_ui_params);
|
||||
}
|
||||
sig = ui_signal_from_box(box);
|
||||
}
|
||||
@@ -3845,7 +3842,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
if(query_normalized_with_opt_slash_props.flags & FilePropertyFlag_IsFolder)
|
||||
{
|
||||
String8 new_path = push_str8f(scratch.arena, "%S%S/", path_query.path, path_query.search);
|
||||
df_view_equip_spec(ws, view, view->spec, new_path, &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, view->spec, new_path, &md_nil_node);
|
||||
}
|
||||
|
||||
// rjf: is a file -> complete view
|
||||
@@ -3875,7 +3872,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
{
|
||||
String8 existing_path = str8_chop_last_slash(path_query.path);
|
||||
String8 new_path = push_str8f(scratch.arena, "%S/%S/", existing_path, files[0].filename);
|
||||
df_view_equip_spec(ws, view, view->spec, new_path, &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, view->spec, new_path, &md_nil_node);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4005,7 +4002,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
String8 new_path = str8_chop_last_slash(str8_chop_last_slash(path_query.path));
|
||||
new_path = path_normalized_from_string(scratch.arena, new_path);
|
||||
String8 new_cmd = push_str8f(scratch.arena, "%S%s", new_path, new_path.size != 0 ? "/" : "");
|
||||
df_view_equip_spec(ws, view, view->spec, new_cmd, &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, view->spec, new_cmd, &md_nil_node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4087,7 +4084,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
if(file->props.flags & FilePropertyFlag_IsFolder)
|
||||
{
|
||||
String8 new_cmd = push_str8f(scratch.arena, "%S%s", new_path, new_path.size != 0 ? "/" : "");
|
||||
df_view_equip_spec(ws, view, view->spec, new_cmd, &df_g_nil_cfg_node);
|
||||
df_view_equip_spec(ws, view, view->spec, new_cmd, &md_nil_node);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4437,7 +4434,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
DI_KeyList dbgi_keys_list = df_push_active_dbgi_key_list(scratch.arena);
|
||||
DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list);
|
||||
FZY_Params params = {RDI_SectionKind_Procedures, dbgi_keys};
|
||||
FZY_Params fuzzy_search_params = {RDI_SectionKind_Procedures, dbgi_keys};
|
||||
U64 endt_us = os_now_microseconds()+200;
|
||||
|
||||
//- rjf: grab rdis, make type graphs for each
|
||||
@@ -4463,7 +4460,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
//- rjf: query -> raddbg, filtered items
|
||||
U128 fuzzy_search_key = {(U64)view, df_hash_from_string(str8_struct(&view))};
|
||||
B32 items_stale = 0;
|
||||
FZY_ItemArray items = fzy_items_from_key_params_query(fzy_scope, fuzzy_search_key, ¶ms, string, endt_us, &items_stale);
|
||||
FZY_ItemArray items = fzy_items_from_key_params_query(fzy_scope, fuzzy_search_key, &fuzzy_search_params, string, endt_us, &items_stale);
|
||||
if(items_stale)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
@@ -6514,8 +6511,6 @@ DF_VIEW_SETUP_FUNCTION_DEF(PendingFile)
|
||||
{
|
||||
DF_PendingFileViewState *pves = df_view_user_state(view, DF_PendingFileViewState);
|
||||
pves->deferred_cmd_arena = df_view_push_arena_ext(view);
|
||||
pves->complete_cfg_arena = df_view_push_arena_ext(view);
|
||||
pves->complete_cfg_root = df_cfg_tree_copy(pves->complete_cfg_arena, cfg);
|
||||
}
|
||||
|
||||
DF_VIEW_CMD_FUNCTION_DEF(PendingFile)
|
||||
@@ -6569,23 +6564,23 @@ DF_VIEW_CMD_FUNCTION_DEF(PendingFile)
|
||||
MemoryZeroStruct(&pves->deferred_cmds);
|
||||
}
|
||||
|
||||
//- rjf: if entity is ready, move cfg tree to scratch for new command
|
||||
DF_CfgNode *cfg_root = &df_g_nil_cfg_node;
|
||||
//- rjf: if entity is ready, move params tree to scratch for new command
|
||||
MD_Node *params_copy = &md_nil_node;
|
||||
if(file_is_ready)
|
||||
{
|
||||
cfg_root = df_cfg_tree_copy(scratch.arena, pves->complete_cfg_root);
|
||||
params_copy = md_tree_copy(scratch.arena, params);
|
||||
}
|
||||
|
||||
//- rjf: if entity is ready, replace this view with the correct one, if any viewer is specified
|
||||
if(file_is_ready && viewer_kind != DF_GfxViewKind_Null)
|
||||
{
|
||||
DF_ViewSpec *view_spec = df_view_spec_from_string(cfg_root->string);
|
||||
DF_ViewSpec *view_spec = df_view_spec_from_string(params_copy->string);
|
||||
if(view_spec == &df_g_nil_view_spec)
|
||||
{
|
||||
view_spec = df_view_spec_from_gfx_view_kind(viewer_kind);
|
||||
}
|
||||
String8 query = df_eval_string_from_file_path(scratch.arena, file_path);
|
||||
df_view_equip_spec(ws, view, view_spec, query, cfg_root);
|
||||
df_view_equip_spec(ws, view, view_spec, query, params_copy);
|
||||
df_panel_notify_mutation(ws, panel);
|
||||
}
|
||||
|
||||
@@ -6610,24 +6605,8 @@ DF_VIEW_UI_FUNCTION_DEF(PendingFile)
|
||||
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Code)
|
||||
{
|
||||
// rjf: set up state
|
||||
DF_CodeViewState *cv = df_view_user_state(view, DF_CodeViewState);
|
||||
df_code_view_init(cv, view);
|
||||
|
||||
// rjf: deserialize cursor
|
||||
DF_CfgNode *cursor_cfg = df_cfg_node_child_from_string(cfg, str8_lit("cursor"), StringMatchFlag_CaseInsensitive);
|
||||
if(cursor_cfg != &df_g_nil_cfg_node)
|
||||
{
|
||||
TxtPt cursor = txt_pt(1, 1);
|
||||
cursor.line = s64_from_str8(cursor_cfg->first->string, 10);
|
||||
cursor.column = s64_from_str8(cursor_cfg->first->first->string, 10);
|
||||
if(cursor.line == 0) { cursor.line = 1; }
|
||||
if(cursor.column == 0) { cursor.column = 1; }
|
||||
cv->center_cursor = 1;
|
||||
view->cursor = view->mark = cursor;
|
||||
}
|
||||
|
||||
// rjf: default to loading
|
||||
df_view_equip_loading_info(view, 1, 0, 0);
|
||||
view->loading_t = view->loading_t_target = 1.f;
|
||||
}
|
||||
@@ -6639,9 +6618,9 @@ DF_VIEW_CMD_FUNCTION_DEF(Code)
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
E_Eval eval = e_eval_from_string(scratch.arena, string);
|
||||
Rng1U64 range = df_range_from_eval_cfg(eval, cfg);
|
||||
Rng1U64 range = df_range_from_eval_params(eval, params);
|
||||
df_interact_regs()->text_key = df_key_from_eval_space_range(eval.space, range, 1);
|
||||
df_interact_regs()->lang_kind = df_lang_kind_from_eval_cfg(eval, cfg);
|
||||
df_interact_regs()->lang_kind = df_lang_kind_from_eval_params(eval, params);
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, df_interact_regs()->text_key, df_interact_regs()->lang_kind, &hash);
|
||||
String8 data = hs_data_from_hash(hs_scope, hash);
|
||||
@@ -6712,9 +6691,9 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
//
|
||||
String8 path = df_file_path_from_eval_string(scratch.arena, string);
|
||||
E_Eval eval = e_eval_from_string(scratch.arena, string);
|
||||
Rng1U64 range = df_range_from_eval_cfg(eval, cfg);
|
||||
Rng1U64 range = df_range_from_eval_params(eval, params);
|
||||
df_interact_regs()->text_key = df_key_from_eval_space_range(eval.space, range, 1);
|
||||
df_interact_regs()->lang_kind = df_lang_kind_from_eval_cfg(eval, cfg);
|
||||
df_interact_regs()->lang_kind = df_lang_kind_from_eval_params(eval, params);
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, df_interact_regs()->text_key, df_interact_regs()->lang_kind, &hash);
|
||||
String8 data = hs_data_from_hash(hs_scope, hash);
|
||||
@@ -8064,7 +8043,7 @@ internal UI_BOX_CUSTOM_DRAW(df_bitmap_view_canvas_box_draw)
|
||||
{
|
||||
DF_BitmapViewState *bvs = (DF_BitmapViewState *)user_data;
|
||||
Rng2F32 rect_scrn = box->rect;
|
||||
Rng2F32 rect_cvs = df_bitmap_view_state__canvas_from_screen_rect(bvs, rect_scrn, rect_scrn);
|
||||
Rng2F32 rect_cvs = df_bitmap_canvas_from_screen_rect(bvs, rect_scrn, rect_scrn);
|
||||
F32 grid_cell_size_cvs = box->font_size*10.f;
|
||||
F32 grid_line_thickness_px = Max(2.f, box->font_size*0.1f);
|
||||
Vec4F32 grid_line_color = df_rgba_from_theme_color(DF_ThemeColor_TextWeak);
|
||||
@@ -8076,7 +8055,7 @@ internal UI_BOX_CUSTOM_DRAW(df_bitmap_view_canvas_box_draw)
|
||||
{
|
||||
Vec2F32 p_cvs = {0};
|
||||
p_cvs.v[axis] = v;
|
||||
Vec2F32 p_scr = df_bitmap_view_state__screen_from_canvas_pos(bvs, rect_scrn, p_cvs);
|
||||
Vec2F32 p_scr = df_bitmap_screen_from_canvas_pos(bvs, rect_scrn, p_cvs);
|
||||
Rng2F32 rect = {0};
|
||||
rect.p0.v[axis] = p_scr.v[axis] - grid_line_thickness_px/2;
|
||||
rect.p1.v[axis] = p_scr.v[axis] + grid_line_thickness_px/2;
|
||||
@@ -8090,15 +8069,7 @@ internal UI_BOX_CUSTOM_DRAW(df_bitmap_view_canvas_box_draw)
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Bitmap)
|
||||
{
|
||||
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
|
||||
DF_CfgNode *view_center_cfg = df_cfg_node_child_from_string(cfg, str8_lit("view_center"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CfgNode *zoom_cfg = df_cfg_node_child_from_string(cfg, str8_lit("zoom"), StringMatchFlag_CaseInsensitive);
|
||||
bvs->view_center_pos.x = (F32)f64_from_str8(view_center_cfg->first->string);
|
||||
bvs->view_center_pos.y = (F32)f64_from_str8(view_center_cfg->first->next->string);
|
||||
bvs->zoom = (F32)f64_from_str8(zoom_cfg->first->string);
|
||||
if(bvs->zoom == 0)
|
||||
{
|
||||
bvs->zoom = 1.f;
|
||||
}
|
||||
bvs->zoom = 1.f;
|
||||
}
|
||||
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Bitmap)
|
||||
@@ -8116,8 +8087,8 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap)
|
||||
//- rjf: evaluate expression
|
||||
//
|
||||
E_Eval eval = e_eval_from_string(scratch.arena, string);
|
||||
Vec2S32 dim = df_dim2s32_from_eval_cfg(eval, cfg);
|
||||
R_Tex2DFormat fmt = df_tex2dformat_from_eval_cfg(eval, cfg);
|
||||
Vec2S32 dim = df_dim2s32_from_eval_params(eval, params);
|
||||
R_Tex2DFormat fmt = df_tex2dformat_from_eval_params(eval, params);
|
||||
U64 base_offset = df_base_offset_from_eval(eval);
|
||||
U64 expected_size = dim.x*dim.y*r_tex2d_format_bytes_per_pixel_table[fmt];
|
||||
Rng1U64 offset_range = r1u64(base_offset, base_offset + expected_size);
|
||||
@@ -8167,9 +8138,9 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap)
|
||||
F32 new_zoom = bvs->zoom - bvs->zoom*canvas_sig.scroll.y/10.f;
|
||||
new_zoom = Clamp(1.f/256.f, new_zoom, 256.f);
|
||||
Vec2F32 mouse_scr_pre = sub_2f32(ui_mouse(), rect.p0);
|
||||
Vec2F32 mouse_cvs = df_bitmap_view_state__canvas_from_screen_pos(bvs, canvas_rect, mouse_scr_pre);
|
||||
Vec2F32 mouse_cvs = df_bitmap_canvas_from_screen_pos(bvs, canvas_rect, mouse_scr_pre);
|
||||
bvs->zoom = new_zoom;
|
||||
Vec2F32 mouse_scr_pst = df_bitmap_view_state__screen_from_canvas_pos(bvs, canvas_rect, mouse_cvs);
|
||||
Vec2F32 mouse_scr_pst = df_bitmap_screen_from_canvas_pos(bvs, canvas_rect, mouse_cvs);
|
||||
Vec2F32 drift_scr = sub_2f32(mouse_scr_pst, mouse_scr_pre);
|
||||
bvs->view_center_pos = add_2f32(bvs->view_center_pos, scale_2f32(drift_scr, 1.f/new_zoom));
|
||||
}
|
||||
@@ -8185,7 +8156,7 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap)
|
||||
//- rjf: calculate image coordinates
|
||||
//
|
||||
Rng2F32 img_rect_cvs = r2f32p(-topology.dim.x/2, -topology.dim.y/2, +topology.dim.x/2, +topology.dim.y/2);
|
||||
Rng2F32 img_rect_scr = df_bitmap_view_state__screen_from_canvas_rect(bvs, canvas_rect, img_rect_cvs);
|
||||
Rng2F32 img_rect_scr = df_bitmap_screen_from_canvas_rect(bvs, canvas_rect, img_rect_cvs);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: image-region canvas interaction
|
||||
@@ -8194,7 +8165,7 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap)
|
||||
if(ui_hovering(canvas_sig) && !ui_dragging(canvas_sig))
|
||||
{
|
||||
Vec2F32 mouse_scr = sub_2f32(ui_mouse(), rect.p0);
|
||||
Vec2F32 mouse_cvs = df_bitmap_view_state__canvas_from_screen_pos(bvs, canvas_rect, mouse_scr);
|
||||
Vec2F32 mouse_cvs = df_bitmap_canvas_from_screen_pos(bvs, canvas_rect, mouse_scr);
|
||||
if(contains_2f32(img_rect_cvs, mouse_cvs))
|
||||
{
|
||||
mouse_bmp = v2s32((S32)(mouse_cvs.x-img_rect_cvs.x0), (S32)(mouse_cvs.y-img_rect_cvs.y0));
|
||||
@@ -8397,69 +8368,8 @@ DF_VIEW_UI_FUNCTION_DEF(ExceptionFilters)
|
||||
////////////////////////////////
|
||||
//~ rjf: Settings @view_hook_impl
|
||||
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Settings) {}
|
||||
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Settings)
|
||||
{
|
||||
for(DF_CmdNode *n = cmds->first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Cmd *cmd = &n->cmd;
|
||||
|
||||
// rjf: mismatched window/panel => skip
|
||||
if(df_window_from_handle(cmd->params.window) != ws ||
|
||||
df_panel_from_handle(cmd->params.panel) != panel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: process
|
||||
DF_CoreCmdKind core_cmd_kind = df_core_cmd_kind_from_string(cmd->spec->info.string);
|
||||
switch(core_cmd_kind)
|
||||
{
|
||||
default:break;
|
||||
case DF_CoreCmdKind_PickFile:
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 path = cmd->params.file_path;
|
||||
String8 data = os_data_from_file_path(scratch.arena, path);
|
||||
DF_CfgTable cfg_table = {0};
|
||||
df_cfg_table_push_unparsed_string(scratch.arena, &cfg_table, data, DF_CfgSrc_User);
|
||||
DF_CfgVal *colors = df_cfg_val_from_string(&cfg_table, str8_lit("colors"));
|
||||
for(DF_CfgNode *colors_set = colors->first;
|
||||
colors_set != &df_g_nil_cfg_node;
|
||||
colors_set = colors_set->next)
|
||||
{
|
||||
for(DF_CfgNode *color = colors_set->first;
|
||||
color != &df_g_nil_cfg_node;
|
||||
color = color->next)
|
||||
{
|
||||
String8 color_name = color->string;
|
||||
DF_ThemeColor color_code = DF_ThemeColor_Null;
|
||||
for(DF_ThemeColor c = DF_ThemeColor_Null; c < DF_ThemeColor_COUNT; c = (DF_ThemeColor)(c+1))
|
||||
{
|
||||
if(str8_match(df_g_theme_color_cfg_string_table[c], color_name, StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
color_code = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(color_code != DF_ThemeColor_Null)
|
||||
{
|
||||
DF_CfgNode *hex_cfg = color->first;
|
||||
String8 hex_string = hex_cfg->string;
|
||||
U64 hex_val = 0;
|
||||
try_u64_from_str8_c_rules(hex_string, &hex_val);
|
||||
Vec4F32 color_rgba = rgba_from_u32((U32)hex_val);
|
||||
df_gfx_state->cfg_theme_target.colors[color_code] = color_rgba;
|
||||
}
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Settings){}
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Settings){}
|
||||
DF_VIEW_UI_FUNCTION_DEF(Settings)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
@@ -101,8 +101,6 @@ struct DF_PendingFileViewState
|
||||
{
|
||||
Arena *deferred_cmd_arena;
|
||||
DF_CmdList deferred_cmds;
|
||||
Arena *complete_cfg_arena;
|
||||
DF_CfgNode *complete_cfg_root;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -224,7 +224,7 @@ DF_GfxViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[15] =
|
||||
{ str8_lit_comp("rgba"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(rgba) , str8_lit_comp("") },
|
||||
{ str8_lit_comp("text"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("code") },
|
||||
{ str8_lit_comp("disasm"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("disassembly") },
|
||||
{ str8_lit_comp("bitmap"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(bitmap) , str8_lit_comp("bitmap") },
|
||||
{ str8_lit_comp("bitmap"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("bitmap") },
|
||||
{ str8_lit_comp("geo"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(geo) , str8_lit_comp("geometry") },
|
||||
};
|
||||
|
||||
|
||||
@@ -270,7 +270,6 @@ DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(omit);
|
||||
DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(no_addr);
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(checkbox);
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba);
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(bitmap);
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(geo);
|
||||
C_LINKAGE_BEGIN
|
||||
extern DF_StringBindingPair df_g_default_binding_table[110];
|
||||
|
||||
Reference in New Issue
Block a user