mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
further memory view fixes / tweaks; rich hover coverage for virtual address ranges in memory views / watch views
This commit is contained in:
+7
-24
@@ -189,6 +189,13 @@ e_space_make(E_SpaceKind kind)
|
||||
return space;
|
||||
}
|
||||
|
||||
internal B32
|
||||
e_space_match(E_Space a, E_Space b)
|
||||
{
|
||||
B32 result = MemoryMatchStruct(&a, &b);
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Map Functions
|
||||
|
||||
@@ -1362,30 +1369,6 @@ e_range_size_from_eval(E_Eval eval)
|
||||
E_TypeKind type_core_kind = e_type_kind_from_key(type_core);
|
||||
B32 got_size = 0;
|
||||
|
||||
// rjf: try getting size from expansions
|
||||
if(!got_size)
|
||||
{
|
||||
E_TypeKey maybe_lens_type_key = e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_Meta);
|
||||
E_TypeKind maybe_lens_type_kind = e_type_kind_from_key(maybe_lens_type_key);
|
||||
if(maybe_lens_type_kind == E_TypeKind_Lens)
|
||||
{
|
||||
E_TypeExpandRule *expand_rule = e_expand_rule_from_type_key(maybe_lens_type_key);
|
||||
if(expand_rule->info != 0)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 element_size = e_type_byte_size_from_key(e_type_key_unwrap(type_core, E_TypeUnwrapFlag_All));
|
||||
E_TypeExpandInfo expand_info = expand_rule->info(scratch.arena, eval, str8_zero());
|
||||
U64 new_result_maybe = expand_info.expr_count * element_size;
|
||||
if(new_result_maybe != 0)
|
||||
{
|
||||
result = new_result_maybe;
|
||||
got_size = 1;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: try getting size from intrinsic type (e.g. arrays/etc.)
|
||||
if(!got_size)
|
||||
{
|
||||
|
||||
@@ -1151,6 +1151,7 @@ internal E_MsgList e_msg_list_copy(Arena *arena, E_MsgList *src);
|
||||
//~ rjf: Space Functions
|
||||
|
||||
internal E_Space e_space_make(E_SpaceKind kind);
|
||||
internal B32 e_space_match(E_Space a, E_Space b);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Map Functions
|
||||
|
||||
@@ -437,7 +437,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[24] =
|
||||
{str8_lit_comp("thread"), str8_lit_comp("x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'call_stack':query}")},
|
||||
};
|
||||
|
||||
Rng1U64 rd_reg_slot_range_table[46] =
|
||||
Rng1U64 rd_reg_slot_range_table[48] =
|
||||
{
|
||||
{0},
|
||||
{OffsetOf(RD_Regs, machine), OffsetOf(RD_Regs, machine) + sizeof(CTRL_Handle)},
|
||||
@@ -453,6 +453,7 @@ Rng1U64 rd_reg_slot_range_table[46] =
|
||||
{OffsetOf(RD_Regs, dst_panel), OffsetOf(RD_Regs, dst_panel) + sizeof(RD_CfgID)},
|
||||
{OffsetOf(RD_Regs, cfg), OffsetOf(RD_Regs, cfg) + sizeof(RD_CfgID)},
|
||||
{OffsetOf(RD_Regs, cfg_list), OffsetOf(RD_Regs, cfg_list) + sizeof(RD_CfgIDList)},
|
||||
{OffsetOf(RD_Regs, eval_space), OffsetOf(RD_Regs, eval_space) + sizeof(E_Space)},
|
||||
{OffsetOf(RD_Regs, unwind_count), OffsetOf(RD_Regs, unwind_count) + sizeof(U64)},
|
||||
{OffsetOf(RD_Regs, inline_depth), OffsetOf(RD_Regs, inline_depth) + sizeof(U64)},
|
||||
{OffsetOf(RD_Regs, file_path), OffsetOf(RD_Regs, file_path) + sizeof(String8)},
|
||||
@@ -468,6 +469,7 @@ Rng1U64 rd_reg_slot_range_table[46] =
|
||||
{OffsetOf(RD_Regs, voff_range), OffsetOf(RD_Regs, voff_range) + sizeof(Rng1U64)},
|
||||
{OffsetOf(RD_Regs, expr), OffsetOf(RD_Regs, expr) + sizeof(String8)},
|
||||
{OffsetOf(RD_Regs, ui_key), OffsetOf(RD_Regs, ui_key) + sizeof(UI_Key)},
|
||||
{OffsetOf(RD_Regs, src_ui_key), OffsetOf(RD_Regs, src_ui_key) + sizeof(UI_Key)},
|
||||
{OffsetOf(RD_Regs, off_px), OffsetOf(RD_Regs, off_px) + sizeof(Vec2F32)},
|
||||
{OffsetOf(RD_Regs, reg_slot), OffsetOf(RD_Regs, reg_slot) + sizeof(RD_RegSlot)},
|
||||
{OffsetOf(RD_Regs, pid), OffsetOf(RD_Regs, pid) + sizeof(U32)},
|
||||
|
||||
@@ -22,6 +22,7 @@ RD_RegSlot_PrevTab,
|
||||
RD_RegSlot_DstPanel,
|
||||
RD_RegSlot_Cfg,
|
||||
RD_RegSlot_CfgList,
|
||||
RD_RegSlot_EvalSpace,
|
||||
RD_RegSlot_UnwindCount,
|
||||
RD_RegSlot_InlineDepth,
|
||||
RD_RegSlot_FilePath,
|
||||
@@ -37,6 +38,7 @@ RD_RegSlot_VaddrRange,
|
||||
RD_RegSlot_VoffRange,
|
||||
RD_RegSlot_Expr,
|
||||
RD_RegSlot_UIKey,
|
||||
RD_RegSlot_SrcUIKey,
|
||||
RD_RegSlot_OffPx,
|
||||
RD_RegSlot_RegSlot,
|
||||
RD_RegSlot_PID,
|
||||
@@ -449,6 +451,7 @@ RD_CfgID prev_tab;
|
||||
RD_CfgID dst_panel;
|
||||
RD_CfgID cfg;
|
||||
RD_CfgIDList cfg_list;
|
||||
E_Space eval_space;
|
||||
U64 unwind_count;
|
||||
U64 inline_depth;
|
||||
String8 file_path;
|
||||
@@ -464,6 +467,7 @@ Rng1U64 vaddr_range;
|
||||
Rng1U64 voff_range;
|
||||
String8 expr;
|
||||
UI_Key ui_key;
|
||||
UI_Key src_ui_key;
|
||||
Vec2F32 off_px;
|
||||
RD_RegSlot reg_slot;
|
||||
U32 pid;
|
||||
@@ -545,6 +549,7 @@ Z(getting_started)\
|
||||
.dst_panel = rd_regs()->dst_panel,\
|
||||
.cfg = rd_regs()->cfg,\
|
||||
.cfg_list = rd_regs()->cfg_list,\
|
||||
.eval_space = rd_regs()->eval_space,\
|
||||
.unwind_count = rd_regs()->unwind_count,\
|
||||
.inline_depth = rd_regs()->inline_depth,\
|
||||
.file_path = rd_regs()->file_path,\
|
||||
@@ -560,6 +565,7 @@ Z(getting_started)\
|
||||
.voff_range = rd_regs()->voff_range,\
|
||||
.expr = rd_regs()->expr,\
|
||||
.ui_key = rd_regs()->ui_key,\
|
||||
.src_ui_key = rd_regs()->src_ui_key,\
|
||||
.off_px = rd_regs()->off_px,\
|
||||
.reg_slot = rd_regs()->reg_slot,\
|
||||
.pid = rd_regs()->pid,\
|
||||
@@ -583,7 +589,7 @@ extern String8 rd_tab_fast_path_view_name_table[24];
|
||||
extern String8 rd_tab_fast_path_query_name_table[24];
|
||||
extern RD_VocabInfo rd_vocab_info_table[345];
|
||||
extern RD_NameSchemaInfo rd_name_schema_info_table[24];
|
||||
extern Rng1U64 rd_reg_slot_range_table[46];
|
||||
extern Rng1U64 rd_reg_slot_range_table[48];
|
||||
extern String8 rd_binding_version_remap_old_name_table[8];
|
||||
extern String8 rd_binding_version_remap_new_name_table[8];
|
||||
extern String8 rd_icon_kind_text_table[75];
|
||||
|
||||
@@ -710,6 +710,9 @@ RD_RegTable:
|
||||
{RD_CfgID cfg Cfg }
|
||||
{RD_CfgIDList cfg_list CfgList }
|
||||
|
||||
// rjf: evaluation space
|
||||
{E_Space eval_space EvalSpace }
|
||||
|
||||
// rjf: frame selection
|
||||
{U64 unwind_count UnwindCount }
|
||||
{U64 inline_depth InlineDepth }
|
||||
@@ -732,6 +735,7 @@ RD_RegTable:
|
||||
|
||||
// rjf: ui context
|
||||
{UI_Key ui_key UIKey }
|
||||
{UI_Key src_ui_key SrcUIKey }
|
||||
{Vec2F32 off_px OffPx }
|
||||
{RD_RegSlot reg_slot RegSlot }
|
||||
|
||||
|
||||
@@ -4439,6 +4439,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
//
|
||||
ProfScope("build table")
|
||||
{
|
||||
UI_Key watch_rich_hover_key = ui_key_from_string(ui_active_seed_key(), str8_lit("###rich_hover"));
|
||||
F32 row_y_px = rect.y0;
|
||||
U64 local_row_idx = 0;
|
||||
U64 global_row_idx = rows.count_before_semantic;
|
||||
@@ -4619,8 +4620,12 @@ rd_view_ui(Rng2F32 rect)
|
||||
//- rjf: determine if cell evaluation's data is fresh and/or bad
|
||||
//
|
||||
ProfBegin("determine if cell evaluation's data is fresh and/or bad");
|
||||
B32 cell_is_rich_hovered = 0;
|
||||
B32 cell_is_fresh = 0;
|
||||
B32 cell_is_bad = 0;
|
||||
U64 cell_vaddr_rng_size = e_type_byte_size_from_key(cell->eval.irtree.type_key);
|
||||
cell_vaddr_rng_size = Min(cell_vaddr_rng_size, 64);
|
||||
Rng1U64 cell_vaddr_rng = r1u64(cell->eval.value.u64, cell->eval.value.u64+cell_vaddr_rng_size);
|
||||
if(!(cell_info.flags & RD_WatchCellFlag_NoEval))
|
||||
{
|
||||
switch(cell->eval.irtree.mode)
|
||||
@@ -4628,13 +4633,17 @@ rd_view_ui(Rng2F32 rect)
|
||||
default:{}break;
|
||||
case E_Mode_Offset:
|
||||
{
|
||||
if(rd_state->hover_regs_slot == RD_RegSlot_VaddrRange &&
|
||||
e_space_match(cell->eval.space, rd_get_hover_regs()->eval_space) &&
|
||||
!ui_key_match(rd_get_hover_regs()->src_ui_key, watch_rich_hover_key))
|
||||
{
|
||||
Rng1U64 intersection = intersect_1u64(cell_vaddr_rng, rd_get_hover_regs()->vaddr_range);
|
||||
cell_is_rich_hovered = (intersection.max > intersection.min);
|
||||
}
|
||||
CTRL_Entity *space_entity = rd_ctrl_entity_from_eval_space(cell->eval.space);
|
||||
if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity && space_entity->kind == CTRL_EntityKind_Process)
|
||||
{
|
||||
U64 size = e_type_byte_size_from_key(cell->eval.irtree.type_key);
|
||||
size = Min(size, 64);
|
||||
Rng1U64 vaddr_rng = r1u64(cell->eval.value.u64, cell->eval.value.u64+size);
|
||||
CTRL_ProcessMemorySlice slice = ctrl_process_memory_slice_from_vaddr_range(scratch.arena, space_entity->handle, vaddr_rng, rd_state->frame_eval_memread_endt_us);
|
||||
CTRL_ProcessMemorySlice slice = ctrl_process_memory_slice_from_vaddr_range(scratch.arena, space_entity->handle, cell_vaddr_rng, rd_state->frame_eval_memread_endt_us);
|
||||
for(U64 idx = 0; idx < (slice.data.size+63)/64; idx += 1)
|
||||
{
|
||||
if(slice.byte_changed_flags[idx] != 0)
|
||||
@@ -4723,6 +4732,13 @@ rd_view_ui(Rng2F32 rect)
|
||||
rgba.w *= ui_anim(ui_key_from_stringf(ui_key_zero(), "###entity_hover_t_%p", entity), 1.f, .rate = entity_hover_t_rate);
|
||||
cell_background_color_override = rgba;
|
||||
}
|
||||
else if(cell_is_rich_hovered)
|
||||
{
|
||||
UI_TagF(".") UI_TagF("pop")
|
||||
{
|
||||
cell_background_color_override = ui_color_from_name(str8_lit("background"));
|
||||
}
|
||||
}
|
||||
else if(cell_is_fresh)
|
||||
{
|
||||
UI_TagF(".") UI_TagF("fresh")
|
||||
@@ -5064,17 +5080,23 @@ rd_view_ui(Rng2F32 rect)
|
||||
}
|
||||
|
||||
// rjf: hover -> rich hover entities
|
||||
if(ui_hovering(sig) && cell_info.entity != &ctrl_entity_nil)
|
||||
else if(ui_hovering(sig) && cell_info.entity != &ctrl_entity_nil)
|
||||
{
|
||||
RD_RegsScope(.ctrl_entity = cell_info.entity->handle, .no_rich_tooltip = 1) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
|
||||
}
|
||||
|
||||
// rjf: hover -> rich hover commands (mini only)
|
||||
if(ui_hovering(sig) && cell_info.cmd_name.size != 0 && cell->px != 0)
|
||||
else if(ui_hovering(sig) && cell_info.cmd_name.size != 0 && cell->px != 0)
|
||||
{
|
||||
RD_RegsScope(.cmd_name = cell_info.cmd_name, .ui_key = sig.box->key) rd_set_hover_regs(RD_RegSlot_CmdName);
|
||||
}
|
||||
|
||||
// rjf: hover -> rich hover address ranges
|
||||
else if(ui_hovering(sig) && !(cell_info.flags & RD_WatchCellFlag_Expr))
|
||||
{
|
||||
RD_RegsScope(.eval_space = cell->eval.space, .vaddr_range = cell_vaddr_rng, .src_ui_key = watch_rich_hover_key) rd_set_hover_regs(RD_RegSlot_VaddrRange);
|
||||
}
|
||||
|
||||
// rjf: dragging -> drag/drop
|
||||
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()) &&
|
||||
(!cell_selected || !ewv->text_editing))
|
||||
@@ -8539,6 +8561,7 @@ rd_window_frame(void)
|
||||
panel_rect_pct.x1*content_rect_dim.x,
|
||||
panel_rect_pct.y1*content_rect_dim.y);
|
||||
panel_rect = pad_2f32(panel_rect, floor_f32(-ui_top_font_size()*0.15f));
|
||||
panel_rect = r2f32p(round_f32(panel_rect.x0), round_f32(panel_rect.y0), round_f32(panel_rect.x1), round_f32(panel_rect.y1));
|
||||
F32 tab_bar_rheight = floor_f32(ui_top_font_size()*3.5f);
|
||||
F32 tab_bar_vheight = floor_f32(ui_top_font_size()*rd_setting_f32_from_name(str8_lit("tab_height")));
|
||||
F32 tab_bar_rv_diff = tab_bar_rheight - tab_bar_vheight;
|
||||
@@ -9706,7 +9729,7 @@ rd_window_frame(void)
|
||||
// rjf: draw border
|
||||
if(b->flags & UI_BoxFlag_DrawBorder)
|
||||
{
|
||||
Vec4F32 border_color = ui_color_from_tags_key_name(box->tags_key, str8_lit("border"));
|
||||
Vec4F32 border_color = b->border_color;
|
||||
Rng2F32 b_border_rect = pad_2f32(b->rect, 1.f);
|
||||
R_Rect2DInst *inst = dr_rect(b_border_rect, border_color, 0, 1.f, border_softness*1.f);
|
||||
MemoryCopyArray(inst->corner_radii, b_corner_radii);
|
||||
@@ -9736,7 +9759,7 @@ rd_window_frame(void)
|
||||
// rjf: draw sides
|
||||
if(b->flags & (UI_BoxFlag_DrawSideTop|UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideRight))
|
||||
{
|
||||
Vec4F32 border_color = ui_color_from_tags_key_name(box->tags_key, str8_lit("border"));
|
||||
Vec4F32 border_color = b->border_color;
|
||||
Rng2F32 r = b->rect;
|
||||
F32 half_thickness = 1.f;
|
||||
F32 softness = 0.f;
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: post-0.9.19 TODO notes
|
||||
//
|
||||
//- bug fixes
|
||||
// [ ] disassembly sometimes has a problem where source line annotations are
|
||||
// periodically removed/inserted... maybe updating on fs change when we
|
||||
// shouldn't, non-deterministic line annotation path?
|
||||
//
|
||||
//- watch improvements
|
||||
// [ ] *ALL* expressions in watch windows need to be editable.
|
||||
//
|
||||
|
||||
+141
-88
@@ -2490,9 +2490,14 @@ typedef struct RD_MemoryViewState RD_MemoryViewState;
|
||||
struct RD_MemoryViewState
|
||||
{
|
||||
Rng1U64 last_view_range;
|
||||
B32 last_view_range_inited;
|
||||
Rng1U64 last_cursor_range;
|
||||
B32 last_cursor_range_inited;
|
||||
U64 last_num_of_columns;
|
||||
B32 last_num_of_columns_inited;
|
||||
B32 center_cursor;
|
||||
B32 contain_cursor;
|
||||
B32 snap_scroll;
|
||||
};
|
||||
|
||||
EV_EXPAND_RULE_INFO_FUNCTION_DEF(memory)
|
||||
@@ -2546,6 +2551,18 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
Vec4F32 selection_color = ui_color_from_name(str8_lit("selection"));
|
||||
Vec4F32 border_color = ui_color_from_name(str8_lit("selection"));
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack rich hover info
|
||||
//
|
||||
UI_Key memory_rich_hover_key = ui_key_from_string(ui_active_seed_key(), str8_lit("###rich_hover"));
|
||||
Rng1U64 rich_hover_range = {0};
|
||||
if(rd_state->hover_regs_slot == RD_RegSlot_VaddrRange &&
|
||||
e_space_match(eval.space, rd_get_hover_regs()->eval_space) &&
|
||||
!ui_key_match(rd_get_hover_regs()->src_ui_key, memory_rich_hover_key))
|
||||
{
|
||||
rich_hover_range = rd_get_hover_regs()->vaddr_range;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: process commands
|
||||
//
|
||||
@@ -2612,8 +2629,9 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
//
|
||||
{
|
||||
Rng1U64 cursor_range = r1u64(cursor_base_vaddr, cursor_base_vaddr+cursor_size);
|
||||
if(mv->last_cursor_range.min != cursor_range.min ||
|
||||
mv->last_cursor_range.max != cursor_range.max)
|
||||
if(mv->last_cursor_range_inited &&
|
||||
(mv->last_cursor_range.min != cursor_range.min ||
|
||||
mv->last_cursor_range.max != cursor_range.max))
|
||||
{
|
||||
mv->contain_cursor = 1;
|
||||
if(track_mark_to_cursor)
|
||||
@@ -2623,6 +2641,17 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: on num of columns rugpull -> update scroll position
|
||||
//
|
||||
if(mv->last_num_of_columns != num_columns && mv->last_num_of_columns_inited)
|
||||
{
|
||||
mv->center_cursor = 1;
|
||||
mv->snap_scroll = 1;
|
||||
}
|
||||
mv->last_num_of_columns_inited = 1;
|
||||
mv->last_num_of_columns = num_columns;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: loop: compute boundaries, take events, repeat
|
||||
//
|
||||
@@ -2732,15 +2761,17 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
|
||||
//- rjf: center cursor if range has changed
|
||||
if(mv->last_view_range.max != view_range.max ||
|
||||
mv->last_view_range.min != view_range.min)
|
||||
if(mv->last_view_range_inited &&
|
||||
(mv->last_view_range.max != view_range.max ||
|
||||
mv->last_view_range.min != view_range.min))
|
||||
{
|
||||
mv->center_cursor = 1;
|
||||
mv->last_view_range = view_range;
|
||||
}
|
||||
mv->last_view_range_inited = 1;
|
||||
mv->last_view_range = view_range;
|
||||
|
||||
//- rjf: center cursor
|
||||
if(mv->center_cursor)
|
||||
if(mv->center_cursor && contains_1u64(view_range, cursor_base_vaddr))
|
||||
{
|
||||
mv->center_cursor = 0;
|
||||
S64 cursor_row_idx = (cursor_base_vaddr - view_range.min) / num_columns;
|
||||
@@ -2750,7 +2781,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
|
||||
//- rjf: contain cursor
|
||||
if(mv->contain_cursor)
|
||||
if(mv->contain_cursor && contains_1u64(view_range, cursor_base_vaddr))
|
||||
{
|
||||
mv->contain_cursor = 0;
|
||||
Rng1S64 viz_range_nonoccluded_rows = {0};
|
||||
@@ -2766,6 +2797,13 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
new_idx = clamp_1s64(scroll_idx_rng, new_idx);
|
||||
ui_scroll_pt_target_idx(&scroll_pos.y, new_idx);
|
||||
}
|
||||
|
||||
//- rjf: snap scroll
|
||||
if(mv->snap_scroll)
|
||||
{
|
||||
mv->snap_scroll = 0;
|
||||
scroll_pos.y.off = 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
@@ -2879,43 +2917,29 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
last_stack_top = f_stack_top;
|
||||
if(dim_1u64(frame_vaddr_range_in_viz) != 0)
|
||||
{
|
||||
U64 f_rip = regs_rip_from_arch_block(thread->arch, f->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, f_rip);
|
||||
DI_Scope *scope = di_scope_open();
|
||||
U64 f_rip_vaddr = regs_rip_from_arch_block(thread->arch, f->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, f_rip_vaddr);
|
||||
U64 f_rip_voff = ctrl_voff_from_vaddr(module, f_rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 rip_voff = ctrl_voff_from_vaddr(module, f_rip);
|
||||
String8 symbol_name = {0};
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, f_rip_voff);
|
||||
String8 procedure_name = {0};
|
||||
procedure_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &procedure_name.size);
|
||||
di_scope_close(scope);
|
||||
if(procedure_name.size != 0)
|
||||
{
|
||||
U64 vaddr = eval.value.u64;
|
||||
CTRL_Entity *process = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
|
||||
annotation->name_string = push_str8_copy(scratch.arena, procedure_name);
|
||||
annotation->kind_string = str8_lit("Call Stack Frame");
|
||||
annotation->color = v4f32(0, 0, 0, 0);
|
||||
annotation->vaddr_range = frame_vaddr_range;
|
||||
for(U64 vaddr = frame_vaddr_range_in_viz.min; vaddr < frame_vaddr_range_in_viz.max; vaddr += 1)
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
|
||||
if(symbol_name.size == 0)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
symbol_name.str = rdi_name_from_procedure(rdi, procedure, &symbol_name.size);
|
||||
}
|
||||
if(symbol_name.size == 0)
|
||||
{
|
||||
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
symbol_name.str = rdi_string_from_idx(rdi, gvar->name_string_idx, &symbol_name.size);
|
||||
}
|
||||
di_scope_close(scope);
|
||||
U64 visible_byte_idx = vaddr - viz_range_bytes.min;
|
||||
SLLQueuePush(visible_memory_annotations[visible_byte_idx].first, visible_memory_annotations[visible_byte_idx].last, annotation);
|
||||
}
|
||||
}
|
||||
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
|
||||
annotation->name_string = symbol_name.size != 0 ? symbol_name : str8_lit("[external code]");
|
||||
annotation->kind_string = str8_lit("Call Stack Frame");
|
||||
annotation->color = symbol_name.size != 0 ? ui_color_from_name(str8_lit("code_symbol")) : ui_color_from_name(str8_lit("text"));
|
||||
annotation->vaddr_range = frame_vaddr_range;
|
||||
for(U64 vaddr = frame_vaddr_range_in_viz.min; vaddr < frame_vaddr_range_in_viz.max; vaddr += 1)
|
||||
{
|
||||
U64 visible_byte_idx = vaddr - viz_range_bytes.min;
|
||||
SLLQueuePush(visible_memory_annotations[visible_byte_idx].first, visible_memory_annotations[visible_byte_idx].last, annotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2945,9 +2969,13 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
//- rjf: fill local variable annotations
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Vec4F32 local_color = ui_color_from_name(str8_lit("code_local"));
|
||||
Vec4F32 color_gen_table[] =
|
||||
{
|
||||
ui_color_from_name(str8_lit("code_local")),
|
||||
mix_4f32(local_color, v4f32(0, 0, 0, 1), 0.2f),
|
||||
mix_4f32(local_color, v4f32(0, 0, 0, 1), 0.4f),
|
||||
mix_4f32(local_color, v4f32(0, 0, 0, 1), 0.6f),
|
||||
mix_4f32(local_color, v4f32(0, 0, 0, 1), 0.8f),
|
||||
};
|
||||
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, rd_regs()->unwind_count);
|
||||
for(E_String2NumMapNode *n = e_ir_ctx->locals_map->first; n != 0; n = n->order_next)
|
||||
@@ -2967,7 +2995,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
annotation->name_string = push_str8_copy(scratch.arena, local_name);
|
||||
annotation->kind_string = str8_lit("Local");
|
||||
annotation->type_string = e_type_string_from_key(scratch.arena, local_eval.irtree.type_key);
|
||||
annotation->color = color_gen_table[(vaddr_rng.min/8)%ArrayCount(color_gen_table)];
|
||||
annotation->color = color_gen_table[(vaddr_rng.min/7)%ArrayCount(color_gen_table)];
|
||||
annotation->vaddr_range = vaddr_rng;
|
||||
}
|
||||
for(U64 vaddr = vaddr_rng_in_visible.min; vaddr < vaddr_rng_in_visible.max; vaddr += 1)
|
||||
@@ -3194,6 +3222,18 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: rich hover
|
||||
if(mouse_hover_byte_num != 0)
|
||||
{
|
||||
Rng1U64 hovered_range = r1u64(mouse_hover_byte_num-1, mouse_hover_byte_num-1 + 1);
|
||||
if(ui_dragging(sig) && !ui_pressed(sig) && dim_1u64(selection) != 0)
|
||||
{
|
||||
hovered_range = selection;
|
||||
}
|
||||
RD_RegsScope(.vaddr_range = hovered_range, .eval_space = eval.space, .src_ui_key = memory_rich_hover_key)
|
||||
rd_set_hover_regs(RD_RegSlot_VaddrRange);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -3211,14 +3251,6 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
break;
|
||||
}
|
||||
UI_BoxFlags row_flags = 0;
|
||||
if(row_range_bytes.min <= selection.min && selection.min < row_range_bytes.max)
|
||||
{
|
||||
row_flags |= UI_BoxFlag_DrawSideTop;
|
||||
}
|
||||
if(row_range_bytes.min <= selection.max && selection.max < row_range_bytes.max)
|
||||
{
|
||||
row_flags |= UI_BoxFlag_DrawSideBottom;
|
||||
}
|
||||
UI_Box *row = ui_build_box_from_stringf(row_flags, "row_%I64x", row_range_bytes.min);
|
||||
UI_Parent(row)
|
||||
{
|
||||
@@ -3257,78 +3289,99 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
// rjf: unpack visual cell info
|
||||
UI_BoxFlags cell_flags = 0;
|
||||
Vec4F32 cell_bg_rgba = {0};
|
||||
Vec4F32 cell_bd_rgba = ui_color_from_name(str8_lit("text"));
|
||||
if(global_byte_num == mouse_hover_byte_num)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawSideTop|UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideRight;
|
||||
cell_flags |= UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawDropShadow;
|
||||
}
|
||||
if(annotation != 0)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = annotation->color;
|
||||
if(contains_1u64(annotation->vaddr_range, mouse_hover_byte_num-1))
|
||||
{
|
||||
cell_bg_rgba.w *= 0.15f;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell_bg_rgba.w *= 0.08f;
|
||||
}
|
||||
cell_bg_rgba.w *= 0.08f;
|
||||
}
|
||||
if(selection.min <= global_byte_idx && global_byte_idx <= selection.max)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = selection_color;
|
||||
}
|
||||
if(selection.min%num_columns == col_idx)
|
||||
if(selection.min == global_byte_idx)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawSideLeft;
|
||||
}
|
||||
if(selection.max%num_columns == col_idx)
|
||||
if(selection.max == global_byte_idx)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawSideRight;
|
||||
}
|
||||
if(row_idx == (selection.min - view_range.min)/num_columns && selection.min <= global_byte_idx && global_byte_idx <= selection.max)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawSideTop;
|
||||
}
|
||||
if(row_idx == (selection.max - view_range.min)/num_columns && selection.min <= global_byte_idx && global_byte_idx <= selection.max)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawSideBottom;
|
||||
}
|
||||
if(contains_1u64(rich_hover_range, global_byte_idx)) UI_TagF("pop")
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = ui_color_from_name(str8_lit("background"));
|
||||
}
|
||||
|
||||
// rjf: build
|
||||
ui_set_next_border_color(cell_bd_rgba);
|
||||
ui_set_next_background_color(cell_bg_rgba);
|
||||
UI_Box *cell_box = ui_build_box_from_key(UI_BoxFlag_DrawText|cell_flags, ui_key_zero());
|
||||
ui_box_equip_display_fstrs(cell_box, &byte_fstrs[byte_value]);
|
||||
{
|
||||
F32 off = 0;
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
{
|
||||
if(global_byte_idx == a->vaddr_range.min) UI_Parent(row_overlay_box)
|
||||
{
|
||||
ui_set_next_background_color(annotation->color);
|
||||
ui_set_next_fixed_x(big_glyph_advance*20.f + col_idx*cell_width_px + -cell_width_px/8.f + off);
|
||||
ui_set_next_fixed_y((row_idx-viz_range_rows.min)*row_height_px + -cell_width_px/8.f);
|
||||
ui_set_next_fixed_width(cell_width_px/4.f);
|
||||
ui_set_next_fixed_height(cell_width_px/4.f);
|
||||
F32 size = cell_width_px/4.f + cell_width_px/8.f*ui_anim(ui_key_from_stringf(ui_active_seed_key(), "###annotation_hovered_%I64x_%I64x", a->vaddr_range.min, a->vaddr_range.max),
|
||||
(F32)!!(a->vaddr_range.min+1 <= mouse_hover_byte_num && mouse_hover_byte_num <= a->vaddr_range.max));
|
||||
ui_set_next_border_color(annotation->color);
|
||||
ui_set_next_fixed_x(big_glyph_advance*20.f + col_idx*cell_width_px + -size*0.5f);
|
||||
ui_set_next_fixed_y((row_idx-viz_range_rows.min)*row_height_px + -size*0.5f);
|
||||
ui_set_next_fixed_width(size);
|
||||
ui_set_next_fixed_height(size);
|
||||
ui_set_next_corner_radius_00(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_01(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_10(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_11(cell_width_px/8.f);
|
||||
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawDropShadow, ui_key_zero());
|
||||
off += cell_width_px/8.f + cell_width_px/16.f;
|
||||
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideTop|UI_BoxFlag_DrawDropShadow, ui_key_zero());
|
||||
}
|
||||
if(global_byte_idx+1 == a->vaddr_range.max) UI_Parent(row_overlay_box)
|
||||
{
|
||||
F32 size = cell_width_px/4.f + cell_width_px/8.f*ui_anim(ui_key_from_stringf(ui_active_seed_key(), "###annotation_hovered_%I64x_%I64x", a->vaddr_range.min, a->vaddr_range.max),
|
||||
(F32)!!(a->vaddr_range.min+1 <= mouse_hover_byte_num && mouse_hover_byte_num <= a->vaddr_range.max));
|
||||
ui_set_next_border_color(annotation->color);
|
||||
ui_set_next_fixed_x(big_glyph_advance*20.f + (col_idx+1)*cell_width_px + -size*0.5f);
|
||||
ui_set_next_fixed_y((row_idx-viz_range_rows.min)*row_height_px + row_height_px + -size*0.5f);
|
||||
ui_set_next_fixed_width(size);
|
||||
ui_set_next_fixed_height(size);
|
||||
ui_set_next_corner_radius_00(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_01(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_10(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_11(cell_width_px/8.f);
|
||||
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawSideRight|UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawDropShadow, ui_key_zero());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(annotation != 0 && mouse_hover_byte_num == global_byte_num) UI_Tooltip UI_FontSize(ui_top_font_size()) UI_PrefHeight(ui_px(ui_top_font_size()*1.75f, 1.f))
|
||||
if(annotation != 0 && mouse_hover_byte_num == global_byte_num)
|
||||
{
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
UI_Tooltip UI_FontSize(ui_top_font_size()) UI_PrefHeight(ui_px(ui_top_font_size()*1.75f, 1.f))
|
||||
{
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(10, 1))
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) ui_label(a->name_string);
|
||||
RD_Font(RD_FontSlot_Main) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(a->kind_string);
|
||||
}
|
||||
if(a->type_string.size != 0)
|
||||
{
|
||||
rd_code_label(1.f, 1, ui_color_from_name(str8_lit("code_type")), a->type_string);
|
||||
}
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(str8_from_memory_size(scratch.arena, dim_1u64(a->vaddr_range)));
|
||||
if(a->next != 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) rd_code_label(1.f, 0, ui_color_from_name(str8_lit("code_default")), a->name_string);
|
||||
UI_TagF("weak") RD_Font(RD_FontSlot_Main) ui_label(a->kind_string);
|
||||
}
|
||||
if(a->type_string.size != 0)
|
||||
{
|
||||
rd_code_label(1.f, 1, ui_color_from_name(str8_lit("code_type")), a->type_string);
|
||||
}
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(str8_from_memory_size(scratch.arena, dim_1u64(a->vaddr_range)));
|
||||
if(a->next != 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3364,7 +3417,6 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
{
|
||||
Vec2F32 text_pos = ui_box_text_position(ascii_box);
|
||||
Vec4F32 color = selection_color;
|
||||
color.w *= 0.2f;
|
||||
dr_rect(r2f32p(text_pos.x + fnt_dim_from_tag_size_string(font, font_size, 0, 0, str8_prefix(ascii_text, selection_in_row.min+0-row_range_bytes.min)).x - font_size/8.f,
|
||||
ascii_box->rect.y0,
|
||||
text_pos.x + fnt_dim_from_tag_size_string(font, font_size, 0, 0, str8_prefix(ascii_text, selection_in_row.max+1-row_range_bytes.min)).x + font_size/4.f,
|
||||
@@ -3424,6 +3476,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
//- rjf: save parameters
|
||||
//
|
||||
mv->last_cursor_range = r1u64(cursor_base_vaddr, cursor_base_vaddr + cursor_size);
|
||||
mv->last_cursor_range_inited = 1;
|
||||
if(cursor_base_vaddr != initial_cursor_base_vaddr)
|
||||
{
|
||||
rd_store_view_param_u64(str8_lit("cursor"), cursor_base_vaddr);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define UI_Tag(v) DeferLoop(ui_push_tag(v), ui_pop_tag())
|
||||
#define UI_BackgroundColor(v) DeferLoop(ui_push_background_color(v), ui_pop_background_color())
|
||||
#define UI_TextColor(v) DeferLoop(ui_push_text_color(v), ui_pop_text_color())
|
||||
#define UI_BorderColor(v) DeferLoop(ui_push_border_color(v), ui_pop_border_color())
|
||||
#define UI_Squish(v) DeferLoop(ui_push_squish(v), ui_pop_squish())
|
||||
#define UI_HoverCursor(v) DeferLoop(ui_push_hover_cursor(v), ui_pop_hover_cursor())
|
||||
#define UI_Font(v) DeferLoop(ui_push_font(v), ui_pop_font())
|
||||
@@ -59,6 +60,7 @@ internal UI_Key ui_top_group_key(void) { UI_StackTopImpl(ui_state, GroupKey, gro
|
||||
internal F32 ui_top_transparency(void) { UI_StackTopImpl(ui_state, Transparency, transparency) }
|
||||
internal Vec4F32 ui_top_background_color(void) { UI_StackTopImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_top_text_color(void) { UI_StackTopImpl(ui_state, TextColor, text_color) }
|
||||
internal Vec4F32 ui_top_border_color(void) { UI_StackTopImpl(ui_state, BorderColor, border_color) }
|
||||
internal F32 ui_top_squish(void) { UI_StackTopImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_top_hover_cursor(void) { UI_StackTopImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal FNT_Tag ui_top_font(void) { UI_StackTopImpl(ui_state, Font, font) }
|
||||
@@ -92,6 +94,7 @@ internal UI_Key ui_bottom_group_key(void) { UI_StackBottomImpl(ui_state, GroupKe
|
||||
internal F32 ui_bottom_transparency(void) { UI_StackBottomImpl(ui_state, Transparency, transparency) }
|
||||
internal Vec4F32 ui_bottom_background_color(void) { UI_StackBottomImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_bottom_text_color(void) { UI_StackBottomImpl(ui_state, TextColor, text_color) }
|
||||
internal Vec4F32 ui_bottom_border_color(void) { UI_StackBottomImpl(ui_state, BorderColor, border_color) }
|
||||
internal F32 ui_bottom_squish(void) { UI_StackBottomImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void) { UI_StackBottomImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal FNT_Tag ui_bottom_font(void) { UI_StackBottomImpl(ui_state, Font, font) }
|
||||
@@ -125,6 +128,7 @@ internal UI_Key ui_push_group_key(UI_Key v) { UI_StackPushImpl(ui_state, GroupKe
|
||||
internal F32 ui_push_transparency(F32 v) { UI_StackPushImpl(ui_state, Transparency, transparency, F32, v) }
|
||||
internal Vec4F32 ui_push_background_color(Vec4F32 v) { UI_StackPushImpl(ui_state, BackgroundColor, background_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextColor, text_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_border_color(Vec4F32 v) { UI_StackPushImpl(ui_state, BorderColor, border_color, Vec4F32, v) }
|
||||
internal F32 ui_push_squish(F32 v) { UI_StackPushImpl(ui_state, Squish, squish, F32, v) }
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v) { UI_StackPushImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
|
||||
internal FNT_Tag ui_push_font(FNT_Tag v) { UI_StackPushImpl(ui_state, Font, font, FNT_Tag, v) }
|
||||
@@ -158,6 +162,7 @@ internal UI_Key ui_pop_group_key(void) { UI_StackPopImpl(ui_state, GroupKey, gro
|
||||
internal F32 ui_pop_transparency(void) { UI_StackPopImpl(ui_state, Transparency, transparency) }
|
||||
internal Vec4F32 ui_pop_background_color(void) { UI_StackPopImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_pop_text_color(void) { UI_StackPopImpl(ui_state, TextColor, text_color) }
|
||||
internal Vec4F32 ui_pop_border_color(void) { UI_StackPopImpl(ui_state, BorderColor, border_color) }
|
||||
internal F32 ui_pop_squish(void) { UI_StackPopImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_pop_hover_cursor(void) { UI_StackPopImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal FNT_Tag ui_pop_font(void) { UI_StackPopImpl(ui_state, Font, font) }
|
||||
@@ -191,6 +196,7 @@ internal UI_Key ui_set_next_group_key(UI_Key v) { UI_StackSetNextImpl(ui_state,
|
||||
internal F32 ui_set_next_transparency(F32 v) { UI_StackSetNextImpl(ui_state, Transparency, transparency, F32, v) }
|
||||
internal Vec4F32 ui_set_next_background_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, BackgroundColor, background_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextColor, text_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_border_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, BorderColor, border_color, Vec4F32, v) }
|
||||
internal F32 ui_set_next_squish(F32 v) { UI_StackSetNextImpl(ui_state, Squish, squish, F32, v) }
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v) { UI_StackSetNextImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
|
||||
internal FNT_Tag ui_set_next_font(FNT_Tag v) { UI_StackSetNextImpl(ui_state, Font, font, FNT_Tag, v) }
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct UI_TransparencyNode UI_TransparencyNode; struct UI_TransparencyNo
|
||||
typedef struct UI_TagNode UI_TagNode; struct UI_TagNode{UI_TagNode *next; String8 v;};
|
||||
typedef struct UI_BackgroundColorNode UI_BackgroundColorNode; struct UI_BackgroundColorNode{UI_BackgroundColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextColorNode UI_TextColorNode; struct UI_TextColorNode{UI_TextColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_BorderColorNode UI_BorderColorNode; struct UI_BorderColorNode{UI_BorderColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_SquishNode UI_SquishNode; struct UI_SquishNode{UI_SquishNode *next; F32 v;};
|
||||
typedef struct UI_HoverCursorNode UI_HoverCursorNode; struct UI_HoverCursorNode{UI_HoverCursorNode *next; OS_Cursor v;};
|
||||
typedef struct UI_FontNode UI_FontNode; struct UI_FontNode{UI_FontNode *next; FNT_Tag v;};
|
||||
@@ -64,6 +65,7 @@ UI_TransparencyNode transparency_nil_stack_top;\
|
||||
UI_TagNode tag_nil_stack_top;\
|
||||
UI_BackgroundColorNode background_color_nil_stack_top;\
|
||||
UI_TextColorNode text_color_nil_stack_top;\
|
||||
UI_BorderColorNode border_color_nil_stack_top;\
|
||||
UI_SquishNode squish_nil_stack_top;\
|
||||
UI_HoverCursorNode hover_cursor_nil_stack_top;\
|
||||
UI_FontNode font_nil_stack_top;\
|
||||
@@ -100,6 +102,7 @@ state->transparency_nil_stack_top.v = 0;\
|
||||
state->tag_nil_stack_top.v = str8_lit("");\
|
||||
state->background_color_nil_stack_top.v = v4f32(0, 0, 0, 0);\
|
||||
state->text_color_nil_stack_top.v = v4f32(0, 0, 0, 0);\
|
||||
state->border_color_nil_stack_top.v = v4f32(0, 0, 0, 0);\
|
||||
state->squish_nil_stack_top.v = 0;\
|
||||
state->hover_cursor_nil_stack_top.v = OS_Cursor_Pointer;\
|
||||
state->font_nil_stack_top.v = fnt_tag_zero();\
|
||||
@@ -138,6 +141,7 @@ struct { UI_TransparencyNode *top; F32 bottom_val; UI_TransparencyNode *free; U6
|
||||
struct { UI_TagNode *top; String8 bottom_val; UI_TagNode *free; U64 gen; B32 auto_pop; } tag_stack;\
|
||||
struct { UI_BackgroundColorNode *top; Vec4F32 bottom_val; UI_BackgroundColorNode *free; U64 gen; B32 auto_pop; } background_color_stack;\
|
||||
struct { UI_TextColorNode *top; Vec4F32 bottom_val; UI_TextColorNode *free; U64 gen; B32 auto_pop; } text_color_stack;\
|
||||
struct { UI_BorderColorNode *top; Vec4F32 bottom_val; UI_BorderColorNode *free; U64 gen; B32 auto_pop; } border_color_stack;\
|
||||
struct { UI_SquishNode *top; F32 bottom_val; UI_SquishNode *free; U64 gen; B32 auto_pop; } squish_stack;\
|
||||
struct { UI_HoverCursorNode *top; OS_Cursor bottom_val; UI_HoverCursorNode *free; U64 gen; B32 auto_pop; } hover_cursor_stack;\
|
||||
struct { UI_FontNode *top; FNT_Tag bottom_val; UI_FontNode *free; U64 gen; B32 auto_pop; } font_stack;\
|
||||
@@ -174,6 +178,7 @@ state->transparency_stack.top = &state->transparency_nil_stack_top; state->trans
|
||||
state->tag_stack.top = &state->tag_nil_stack_top; state->tag_stack.bottom_val = str8_lit(""); state->tag_stack.free = 0; state->tag_stack.auto_pop = 0;\
|
||||
state->background_color_stack.top = &state->background_color_nil_stack_top; state->background_color_stack.bottom_val = v4f32(0, 0, 0, 0); state->background_color_stack.free = 0; state->background_color_stack.auto_pop = 0;\
|
||||
state->text_color_stack.top = &state->text_color_nil_stack_top; state->text_color_stack.bottom_val = v4f32(0, 0, 0, 0); state->text_color_stack.free = 0; state->text_color_stack.auto_pop = 0;\
|
||||
state->border_color_stack.top = &state->border_color_nil_stack_top; state->border_color_stack.bottom_val = v4f32(0, 0, 0, 0); state->border_color_stack.free = 0; state->border_color_stack.auto_pop = 0;\
|
||||
state->squish_stack.top = &state->squish_nil_stack_top; state->squish_stack.bottom_val = 0; state->squish_stack.free = 0; state->squish_stack.auto_pop = 0;\
|
||||
state->hover_cursor_stack.top = &state->hover_cursor_nil_stack_top; state->hover_cursor_stack.bottom_val = OS_Cursor_Pointer; state->hover_cursor_stack.free = 0; state->hover_cursor_stack.auto_pop = 0;\
|
||||
state->font_stack.top = &state->font_nil_stack_top; state->font_stack.bottom_val = fnt_tag_zero(); state->font_stack.free = 0; state->font_stack.auto_pop = 0;\
|
||||
@@ -210,6 +215,7 @@ if(state->transparency_stack.auto_pop) { ui_pop_transparency(); state->transpare
|
||||
if(state->tag_stack.auto_pop) { ui_pop_tag(); state->tag_stack.auto_pop = 0; }\
|
||||
if(state->background_color_stack.auto_pop) { ui_pop_background_color(); state->background_color_stack.auto_pop = 0; }\
|
||||
if(state->text_color_stack.auto_pop) { ui_pop_text_color(); state->text_color_stack.auto_pop = 0; }\
|
||||
if(state->border_color_stack.auto_pop) { ui_pop_border_color(); state->border_color_stack.auto_pop = 0; }\
|
||||
if(state->squish_stack.auto_pop) { ui_pop_squish(); state->squish_stack.auto_pop = 0; }\
|
||||
if(state->hover_cursor_stack.auto_pop) { ui_pop_hover_cursor(); state->hover_cursor_stack.auto_pop = 0; }\
|
||||
if(state->font_stack.auto_pop) { ui_pop_font(); state->font_stack.auto_pop = 0; }\
|
||||
@@ -245,6 +251,7 @@ internal F32 ui_top_transparency(void);
|
||||
internal String8 ui_top_tag(void);
|
||||
internal Vec4F32 ui_top_background_color(void);
|
||||
internal Vec4F32 ui_top_text_color(void);
|
||||
internal Vec4F32 ui_top_border_color(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal FNT_Tag ui_top_font(void);
|
||||
@@ -279,6 +286,7 @@ internal F32 ui_bottom_transparency(void);
|
||||
internal String8 ui_bottom_tag(void);
|
||||
internal Vec4F32 ui_bottom_background_color(void);
|
||||
internal Vec4F32 ui_bottom_text_color(void);
|
||||
internal Vec4F32 ui_bottom_border_color(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal FNT_Tag ui_bottom_font(void);
|
||||
@@ -313,6 +321,7 @@ internal F32 ui_push_transparency(F32 v);
|
||||
internal String8 ui_push_tag(String8 v);
|
||||
internal Vec4F32 ui_push_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_border_color(Vec4F32 v);
|
||||
internal F32 ui_push_squish(F32 v);
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
|
||||
internal FNT_Tag ui_push_font(FNT_Tag v);
|
||||
@@ -347,6 +356,7 @@ internal F32 ui_pop_transparency(void);
|
||||
internal String8 ui_pop_tag(void);
|
||||
internal Vec4F32 ui_pop_background_color(void);
|
||||
internal Vec4F32 ui_pop_text_color(void);
|
||||
internal Vec4F32 ui_pop_border_color(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal FNT_Tag ui_pop_font(void);
|
||||
@@ -381,6 +391,7 @@ internal F32 ui_set_next_transparency(F32 v);
|
||||
internal String8 ui_set_next_tag(String8 v);
|
||||
internal Vec4F32 ui_set_next_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_border_color(Vec4F32 v);
|
||||
internal F32 ui_set_next_squish(F32 v);
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
|
||||
internal FNT_Tag ui_set_next_font(FNT_Tag v);
|
||||
|
||||
@@ -38,6 +38,7 @@ UI_StackTable:
|
||||
{ Tag tag String8 `str8_lit("")` 1 }
|
||||
{ BackgroundColor background_color Vec4F32 `v4f32(0, 0, 0, 0)` }
|
||||
{ TextColor text_color Vec4F32 `v4f32(0, 0, 0, 0)` }
|
||||
{ BorderColor border_color Vec4F32 `v4f32(0, 0, 0, 0)` }
|
||||
|
||||
//- rjf: squish
|
||||
{ Squish squish F32 0 }
|
||||
|
||||
@@ -2606,6 +2606,21 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
box->text_color = ui_color_from_name(str8_lit("text"));
|
||||
}
|
||||
}
|
||||
if(box->flags & (UI_BoxFlag_DrawBorder|
|
||||
UI_BoxFlag_DrawSideRight|
|
||||
UI_BoxFlag_DrawSideLeft|
|
||||
UI_BoxFlag_DrawSideTop|
|
||||
UI_BoxFlag_DrawSideBottom))
|
||||
{
|
||||
if(ui_state->border_color_stack.top != &ui_state->border_color_nil_stack_top)
|
||||
{
|
||||
box->border_color = ui_state->border_color_stack.top->v;
|
||||
}
|
||||
else
|
||||
{
|
||||
box->border_color = ui_color_from_name(str8_lit("border"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: auto-pop all stacks
|
||||
|
||||
@@ -396,6 +396,7 @@ struct UI_Box
|
||||
void *custom_draw_user_data;
|
||||
Vec4F32 background_color;
|
||||
Vec4F32 text_color;
|
||||
Vec4F32 border_color;
|
||||
FNT_Tag font;
|
||||
F32 font_size;
|
||||
F32 tab_size;
|
||||
@@ -969,6 +970,8 @@ internal F32 ui_top_fixed_width(void);
|
||||
internal F32 ui_top_fixed_height(void);
|
||||
internal UI_Size ui_top_pref_width(void);
|
||||
internal UI_Size ui_top_pref_height(void);
|
||||
internal F32 ui_top_min_width(void);
|
||||
internal F32 ui_top_min_height(void);
|
||||
internal UI_PermissionFlags ui_top_permission_flags(void);
|
||||
internal UI_BoxFlags ui_top_flags(void);
|
||||
internal UI_BoxFlags ui_top_omit_flags(void);
|
||||
@@ -980,6 +983,7 @@ internal F32 ui_top_transparency(void);
|
||||
internal String8 ui_top_tag(void);
|
||||
internal Vec4F32 ui_top_background_color(void);
|
||||
internal Vec4F32 ui_top_text_color(void);
|
||||
internal Vec4F32 ui_top_border_color(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal FNT_Tag ui_top_font(void);
|
||||
@@ -1001,6 +1005,8 @@ internal F32 ui_bottom_fixed_width(void);
|
||||
internal F32 ui_bottom_fixed_height(void);
|
||||
internal UI_Size ui_bottom_pref_width(void);
|
||||
internal UI_Size ui_bottom_pref_height(void);
|
||||
internal F32 ui_bottom_min_width(void);
|
||||
internal F32 ui_bottom_min_height(void);
|
||||
internal UI_PermissionFlags ui_bottom_permission_flags(void);
|
||||
internal UI_BoxFlags ui_bottom_flags(void);
|
||||
internal UI_BoxFlags ui_bottom_omit_flags(void);
|
||||
@@ -1012,6 +1018,7 @@ internal F32 ui_bottom_transparency(void);
|
||||
internal String8 ui_bottom_tag(void);
|
||||
internal Vec4F32 ui_bottom_background_color(void);
|
||||
internal Vec4F32 ui_bottom_text_color(void);
|
||||
internal Vec4F32 ui_bottom_border_color(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal FNT_Tag ui_bottom_font(void);
|
||||
@@ -1033,6 +1040,8 @@ internal F32 ui_push_fixed_width(F32 v);
|
||||
internal F32 ui_push_fixed_height(F32 v);
|
||||
internal UI_Size ui_push_pref_width(UI_Size v);
|
||||
internal UI_Size ui_push_pref_height(UI_Size v);
|
||||
internal F32 ui_push_min_width(F32 v);
|
||||
internal F32 ui_push_min_height(F32 v);
|
||||
internal UI_PermissionFlags ui_push_permission_flags(UI_PermissionFlags v);
|
||||
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v);
|
||||
internal UI_BoxFlags ui_push_omit_flags(UI_BoxFlags v);
|
||||
@@ -1044,6 +1053,7 @@ internal F32 ui_push_transparency(F32 v);
|
||||
internal String8 ui_push_tag(String8 v);
|
||||
internal Vec4F32 ui_push_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_border_color(Vec4F32 v);
|
||||
internal F32 ui_push_squish(F32 v);
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
|
||||
internal FNT_Tag ui_push_font(FNT_Tag v);
|
||||
@@ -1065,6 +1075,8 @@ internal F32 ui_pop_fixed_width(void);
|
||||
internal F32 ui_pop_fixed_height(void);
|
||||
internal UI_Size ui_pop_pref_width(void);
|
||||
internal UI_Size ui_pop_pref_height(void);
|
||||
internal F32 ui_pop_min_width(void);
|
||||
internal F32 ui_pop_min_height(void);
|
||||
internal UI_PermissionFlags ui_pop_permission_flags(void);
|
||||
internal UI_BoxFlags ui_pop_flags(void);
|
||||
internal UI_BoxFlags ui_pop_omit_flags(void);
|
||||
@@ -1076,6 +1088,7 @@ internal F32 ui_pop_transparency(void);
|
||||
internal String8 ui_pop_tag(void);
|
||||
internal Vec4F32 ui_pop_background_color(void);
|
||||
internal Vec4F32 ui_pop_text_color(void);
|
||||
internal Vec4F32 ui_pop_border_color(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal FNT_Tag ui_pop_font(void);
|
||||
@@ -1097,6 +1110,8 @@ internal F32 ui_set_next_fixed_width(F32 v);
|
||||
internal F32 ui_set_next_fixed_height(F32 v);
|
||||
internal UI_Size ui_set_next_pref_width(UI_Size v);
|
||||
internal UI_Size ui_set_next_pref_height(UI_Size v);
|
||||
internal F32 ui_set_next_min_width(F32 v);
|
||||
internal F32 ui_set_next_min_height(F32 v);
|
||||
internal UI_PermissionFlags ui_set_next_permission_flags(UI_PermissionFlags v);
|
||||
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v);
|
||||
internal UI_BoxFlags ui_set_next_omit_flags(UI_BoxFlags v);
|
||||
@@ -1108,6 +1123,7 @@ internal F32 ui_set_next_transparency(F32 v);
|
||||
internal String8 ui_set_next_tag(String8 v);
|
||||
internal Vec4F32 ui_set_next_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_border_color(Vec4F32 v);
|
||||
internal F32 ui_set_next_squish(F32 v);
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
|
||||
internal FNT_Tag ui_set_next_font(FNT_Tag v);
|
||||
|
||||
Reference in New Issue
Block a user