mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-09 19:11:38 -07:00
rd: progress on reintroducing watch window editability
This commit is contained in:
@@ -828,6 +828,10 @@ ev_vnum_from_num(EV_BlockRangeList *block_ranges, U64 num)
|
||||
base_num = next_base_num;
|
||||
base_vnum += dim_1u64(n->v.range);
|
||||
}
|
||||
if(vnum == 0)
|
||||
{
|
||||
vnum = base_vnum;
|
||||
}
|
||||
}
|
||||
return vnum;
|
||||
}
|
||||
@@ -991,8 +995,8 @@ ev_row_from_num(Arena *arena, EV_View *view, String8 filter, EV_BlockRangeList *
|
||||
internal EV_WindowedRowList
|
||||
ev_rows_from_num_range(Arena *arena, EV_View *view, String8 filter, EV_BlockRangeList *block_ranges, Rng1U64 num_range)
|
||||
{
|
||||
Rng1U64 vidx_range = r1u64(ev_vnum_from_num(block_ranges, num_range.min), ev_vnum_from_num(block_ranges, num_range.max)+1);
|
||||
EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(arena, view, filter, block_ranges, vidx_range);
|
||||
Rng1U64 vnum_range = r1u64(ev_vnum_from_num(block_ranges, num_range.min), ev_vnum_from_num(block_ranges, num_range.max)+1);
|
||||
EV_WindowedRowList rows = ev_windowed_row_list_from_block_range_list(arena, view, filter, block_ranges, vnum_range);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
+207
-134
@@ -5627,118 +5627,6 @@ rd_window_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: bottom bar
|
||||
//
|
||||
ProfScope("build bottom bar")
|
||||
{
|
||||
B32 is_running = d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < d_frame_index();
|
||||
CTRL_Event stop_event = d_ctrl_last_stop_event();
|
||||
UI_Palette *positive_scheme = rd_palette_from_code(RD_PaletteCode_PositivePopButton);
|
||||
UI_Palette *running_scheme = rd_palette_from_code(RD_PaletteCode_NeutralPopButton);
|
||||
UI_Palette *negative_scheme = rd_palette_from_code(RD_PaletteCode_NegativePopButton);
|
||||
UI_Palette *palette = running_scheme;
|
||||
if(!is_running)
|
||||
{
|
||||
switch(stop_event.cause)
|
||||
{
|
||||
default:
|
||||
case CTRL_EventCause_Finished:
|
||||
{
|
||||
palette = positive_scheme;
|
||||
}break;
|
||||
case CTRL_EventCause_UserBreakpoint:
|
||||
case CTRL_EventCause_InterruptedByException:
|
||||
case CTRL_EventCause_InterruptedByTrap:
|
||||
case CTRL_EventCause_InterruptedByHalt:
|
||||
{
|
||||
palette = negative_scheme;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if(ws->error_t > 0.01f)
|
||||
{
|
||||
UI_Palette *blended_scheme = push_array(ui_build_arena(), UI_Palette, 1);
|
||||
MemoryCopyStruct(blended_scheme, palette);
|
||||
for EachEnumVal(UI_ColorCode, code)
|
||||
{
|
||||
for(U64 idx = 0; idx < 4; idx += 1)
|
||||
{
|
||||
blended_scheme->colors[code].v[idx] += (negative_scheme->colors[code].v[idx] - blended_scheme->colors[code].v[idx]) * ws->error_t;
|
||||
}
|
||||
}
|
||||
palette = blended_scheme;
|
||||
}
|
||||
UI_Flags(UI_BoxFlag_DrawBackground) UI_CornerRadius(0)
|
||||
UI_Palette(palette)
|
||||
UI_Pane(bottom_bar_rect, str8_lit("###bottom_bar")) UI_WidthFill UI_Row
|
||||
UI_Flags(0)
|
||||
{
|
||||
// rjf: developer frame-time indicator
|
||||
if(DEV_updating_indicator)
|
||||
{
|
||||
F32 animation_t = pow_f32(sin_f32(rd_state->time_in_seconds/2.f), 2.f);
|
||||
ui_spacer(ui_em(0.3f, 1.f));
|
||||
ui_spacer(ui_em(1.5f*animation_t, 1.f));
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("*");
|
||||
ui_spacer(ui_em(1.5f*(1-animation_t), 1.f));
|
||||
}
|
||||
|
||||
// rjf: status
|
||||
{
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
if(is_running)
|
||||
{
|
||||
ui_label(str8_lit("Running"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DR_FancyStringList explanation_fstrs = rd_stop_explanation_fstrs_from_ctrl_event(scratch.arena, &stop_event);
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(box, &explanation_fstrs);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
|
||||
// rjf: bind change visualization
|
||||
if(rd_state->bind_change_active)
|
||||
{
|
||||
RD_CmdKindInfo *info = rd_cmd_kind_info_from_string(rd_state->bind_change_cmd_name);
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
UI_Flags(UI_BoxFlag_DrawBackground)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_CornerRadius(4)
|
||||
RD_Palette(RD_PaletteCode_NeutralPopButton)
|
||||
ui_labelf("Currently rebinding \"%S\" hotkey", info->display_name);
|
||||
}
|
||||
|
||||
// rjf: error visualization
|
||||
else if(ws->error_t >= 0.01f)
|
||||
{
|
||||
ws->error_t -= rd_state->frame_dt/8.f;
|
||||
rd_request_frame();
|
||||
String8 error_string = str8(ws->error_buffer, ws->error_string_size);
|
||||
if(error_string.size != 0)
|
||||
{
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
UI_CornerRadius(4)
|
||||
UI_Row
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
RD_Font(RD_FontSlot_Icons)
|
||||
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Icons))
|
||||
ui_label(rd_icon_kind_text_table[RD_IconKind_WarningBig]);
|
||||
rd_label(error_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: build hover eval
|
||||
//
|
||||
@@ -5807,7 +5695,11 @@ rd_window_frame(void)
|
||||
rd_cfg_new(expr, ws->hover_eval_string);
|
||||
EV_BlockTree predicted_block_tree = ev_block_tree_from_string(scratch.arena, rd_view_eval_view(), str8_zero(), ws->hover_eval_string);
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
U64 max_row_count = (U64)floor_f32(ui_top_font_size()*40.f / row_height_px);
|
||||
U64 max_row_count = (U64)floor_f32(ui_top_font_size()*10.f / row_height_px);
|
||||
if(ws->hover_eval_focused)
|
||||
{
|
||||
max_row_count *= 3;
|
||||
}
|
||||
U64 needed_row_count = Min(max_row_count, predicted_block_tree.total_row_count);
|
||||
F32 num_rows_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "hover_eval_num_rows_t"), (F32)needed_row_count);
|
||||
UI_Focus(ws->hover_eval_focused ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
@@ -5859,7 +5751,7 @@ rd_window_frame(void)
|
||||
{
|
||||
ws->hover_eval_focused = 1;
|
||||
}
|
||||
if(ui_mouse_over(sig))
|
||||
if(ui_mouse_over(sig) || ws->hover_eval_focused)
|
||||
{
|
||||
ws->hover_eval_last_frame_idx = rd_state->frame_index;
|
||||
}
|
||||
@@ -5867,6 +5759,22 @@ rd_window_frame(void)
|
||||
{
|
||||
rd_request_frame();
|
||||
}
|
||||
if(ws->hover_eval_focused)
|
||||
{
|
||||
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
||||
{
|
||||
if(evt->kind == UI_EventKind_Press &&
|
||||
evt->key == OS_Key_LeftMouseButton &&
|
||||
!contains_2f32(container->rect, evt->pos))
|
||||
{
|
||||
ws->hover_eval_focused = 0;
|
||||
MemoryZeroStruct(&ws->hover_eval_string);
|
||||
arena_clear(ws->hover_eval_arena);
|
||||
rd_request_frame();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6163,6 +6071,118 @@ rd_window_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: bottom bar
|
||||
//
|
||||
ProfScope("build bottom bar")
|
||||
{
|
||||
B32 is_running = d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < d_frame_index();
|
||||
CTRL_Event stop_event = d_ctrl_last_stop_event();
|
||||
UI_Palette *positive_scheme = rd_palette_from_code(RD_PaletteCode_PositivePopButton);
|
||||
UI_Palette *running_scheme = rd_palette_from_code(RD_PaletteCode_NeutralPopButton);
|
||||
UI_Palette *negative_scheme = rd_palette_from_code(RD_PaletteCode_NegativePopButton);
|
||||
UI_Palette *palette = running_scheme;
|
||||
if(!is_running)
|
||||
{
|
||||
switch(stop_event.cause)
|
||||
{
|
||||
default:
|
||||
case CTRL_EventCause_Finished:
|
||||
{
|
||||
palette = positive_scheme;
|
||||
}break;
|
||||
case CTRL_EventCause_UserBreakpoint:
|
||||
case CTRL_EventCause_InterruptedByException:
|
||||
case CTRL_EventCause_InterruptedByTrap:
|
||||
case CTRL_EventCause_InterruptedByHalt:
|
||||
{
|
||||
palette = negative_scheme;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if(ws->error_t > 0.01f)
|
||||
{
|
||||
UI_Palette *blended_scheme = push_array(ui_build_arena(), UI_Palette, 1);
|
||||
MemoryCopyStruct(blended_scheme, palette);
|
||||
for EachEnumVal(UI_ColorCode, code)
|
||||
{
|
||||
for(U64 idx = 0; idx < 4; idx += 1)
|
||||
{
|
||||
blended_scheme->colors[code].v[idx] += (negative_scheme->colors[code].v[idx] - blended_scheme->colors[code].v[idx]) * ws->error_t;
|
||||
}
|
||||
}
|
||||
palette = blended_scheme;
|
||||
}
|
||||
UI_Flags(UI_BoxFlag_DrawBackground) UI_CornerRadius(0)
|
||||
UI_Palette(palette)
|
||||
UI_Pane(bottom_bar_rect, str8_lit("###bottom_bar")) UI_WidthFill UI_Row
|
||||
UI_Flags(0)
|
||||
{
|
||||
// rjf: developer frame-time indicator
|
||||
if(DEV_updating_indicator)
|
||||
{
|
||||
F32 animation_t = pow_f32(sin_f32(rd_state->time_in_seconds/2.f), 2.f);
|
||||
ui_spacer(ui_em(0.3f, 1.f));
|
||||
ui_spacer(ui_em(1.5f*animation_t, 1.f));
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("*");
|
||||
ui_spacer(ui_em(1.5f*(1-animation_t), 1.f));
|
||||
}
|
||||
|
||||
// rjf: status
|
||||
{
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
if(is_running)
|
||||
{
|
||||
ui_label(str8_lit("Running"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DR_FancyStringList explanation_fstrs = rd_stop_explanation_fstrs_from_ctrl_event(scratch.arena, &stop_event);
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(box, &explanation_fstrs);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
|
||||
// rjf: bind change visualization
|
||||
if(rd_state->bind_change_active)
|
||||
{
|
||||
RD_CmdKindInfo *info = rd_cmd_kind_info_from_string(rd_state->bind_change_cmd_name);
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
UI_Flags(UI_BoxFlag_DrawBackground)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_CornerRadius(4)
|
||||
RD_Palette(RD_PaletteCode_NeutralPopButton)
|
||||
ui_labelf("Currently rebinding \"%S\" hotkey", info->display_name);
|
||||
}
|
||||
|
||||
// rjf: error visualization
|
||||
else if(ws->error_t >= 0.01f)
|
||||
{
|
||||
ws->error_t -= rd_state->frame_dt/8.f;
|
||||
rd_request_frame();
|
||||
String8 error_string = str8(ws->error_buffer, ws->error_string_size);
|
||||
if(error_string.size != 0)
|
||||
{
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
UI_CornerRadius(4)
|
||||
UI_Row
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
RD_Font(RD_FontSlot_Icons)
|
||||
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Icons))
|
||||
ui_label(rd_icon_kind_text_table[RD_IconKind_WarningBig]);
|
||||
rd_label(error_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: panel non-leaf UI (drag boundaries, drag/drop sites)
|
||||
//
|
||||
@@ -8167,6 +8187,44 @@ E_LOOKUP_RANGE_FUNCTION_DEF(watches)
|
||||
}
|
||||
}
|
||||
|
||||
E_LOOKUP_ID_FROM_NUM_FUNCTION_DEF(watches)
|
||||
{
|
||||
U64 id = 0;
|
||||
RD_CfgArray *cfgs = (RD_CfgArray *)user_data;
|
||||
if(1 <= num && num <= cfgs->count)
|
||||
{
|
||||
U64 idx = (num-1);
|
||||
id = cfgs->v[idx]->id;
|
||||
}
|
||||
else if(num == cfgs->count+1)
|
||||
{
|
||||
id = max_U64;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
E_LOOKUP_NUM_FROM_ID_FUNCTION_DEF(watches)
|
||||
{
|
||||
U64 num = 0;
|
||||
RD_CfgArray *cfgs = (RD_CfgArray *)user_data;
|
||||
if(id != 0 && id != max_U64)
|
||||
{
|
||||
for EachIndex(idx, cfgs->count)
|
||||
{
|
||||
if(cfgs->v[idx]->id == id)
|
||||
{
|
||||
num = idx+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(id == max_U64)
|
||||
{
|
||||
num = cfgs->count + 1;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
E_LOOKUP_INFO_FUNCTION_DEF(locals)
|
||||
{
|
||||
E_LookupInfo result = {0};
|
||||
@@ -8727,7 +8785,8 @@ rd_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 defaul
|
||||
CTRL_Entity *process = ctrl_process_from_entity(entity);
|
||||
if(process == &ctrl_entity_nil)
|
||||
{
|
||||
process = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->process);
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread);
|
||||
process = ctrl_process_from_entity(thread);
|
||||
}
|
||||
String8 symbol_name = d_symbol_name_from_process_vaddr(arena, process, value_eval.value.u64, 1);
|
||||
|
||||
@@ -12336,30 +12395,44 @@ rd_frame(void)
|
||||
e_auto_hook_map_insert_new(scratch.arena, ctx->auto_hook_map, .type_key = type_key, .tag_expr_string = name);
|
||||
}
|
||||
|
||||
//- rjf: add macro for collections with specific lookup rules
|
||||
struct
|
||||
//- rjf: add macro for watches group
|
||||
{
|
||||
String8 name;
|
||||
E_LookupInfoFunctionType *lookup_info;
|
||||
E_LookupRangeFunctionType *lookup_range;
|
||||
}
|
||||
collection_infos[] =
|
||||
{
|
||||
#define Collection(name) {str8_lit_comp(#name), E_LOOKUP_INFO_FUNCTION_NAME(name), E_LOOKUP_RANGE_FUNCTION_NAME(name)}
|
||||
Collection(watches),
|
||||
Collection(locals),
|
||||
Collection(registers),
|
||||
#undef Collection
|
||||
};
|
||||
for EachElement(idx, collection_infos)
|
||||
{
|
||||
String8 collection_name = collection_infos[idx].name;
|
||||
String8 collection_name = str8_lit("watches");
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name,
|
||||
.info = collection_infos[idx].lookup_info,
|
||||
.range = collection_infos[idx].lookup_range);
|
||||
.info = E_LOOKUP_INFO_FUNCTION_NAME(watches),
|
||||
.range = E_LOOKUP_RANGE_FUNCTION_NAME(watches),
|
||||
.id_from_num = E_LOOKUP_ID_FROM_NUM_FUNCTION_NAME(watches),
|
||||
.num_from_id = E_LOOKUP_NUM_FROM_ID_FUNCTION_NAME(watches));
|
||||
}
|
||||
|
||||
//- rjf: add macro for collections with specific lookup rules (but no unique id rules)
|
||||
{
|
||||
struct
|
||||
{
|
||||
String8 name;
|
||||
E_LookupInfoFunctionType *lookup_info;
|
||||
E_LookupRangeFunctionType *lookup_range;
|
||||
}
|
||||
collection_infos[] =
|
||||
{
|
||||
#define Collection(name) {str8_lit_comp(#name), E_LOOKUP_INFO_FUNCTION_NAME(name), E_LOOKUP_RANGE_FUNCTION_NAME(name)}
|
||||
Collection(locals),
|
||||
Collection(registers),
|
||||
#undef Collection
|
||||
};
|
||||
for EachElement(idx, collection_infos)
|
||||
{
|
||||
String8 collection_name = collection_infos[idx].name;
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name,
|
||||
.info = collection_infos[idx].lookup_info,
|
||||
.range = collection_infos[idx].lookup_range);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: add macros for debug info table collections
|
||||
|
||||
+46
-42
@@ -1108,7 +1108,7 @@ rd_watch_view_row_info_from_row(EV_Row *row)
|
||||
//- rjf: row * cell -> string
|
||||
|
||||
internal RD_WatchRowCellInfo
|
||||
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
||||
rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_flags, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px)
|
||||
{
|
||||
RD_WatchRowCellInfo result = {0};
|
||||
switch(cell->kind)
|
||||
@@ -1117,6 +1117,10 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, RD_WatchRowInfo *row_info
|
||||
// expression tree.
|
||||
case RD_WatchCellKind_Expr:
|
||||
{
|
||||
if(row->string.size != 0 || row->expr == &e_expr_nil)
|
||||
{
|
||||
result.can_edit = 1;
|
||||
}
|
||||
result.string = row->string;
|
||||
if(result.string.size == 0)
|
||||
{
|
||||
@@ -1204,8 +1208,9 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, RD_WatchRowInfo *row_info
|
||||
}
|
||||
|
||||
//- rjf: evaluate wrapped expression
|
||||
result.eval = e_eval_from_expr(scratch.arena, root_expr);
|
||||
result.string = rd_value_string_from_eval(arena, 0, 10, font, font_size, max_size_px, result.eval);
|
||||
result.eval = e_eval_from_expr(scratch.arena, root_expr);
|
||||
result.string = rd_value_string_from_eval(arena, string_flags, 10, font, font_size, max_size_px, result.eval);
|
||||
result.can_edit = (ev_type_key_is_editable(result.eval.type_key) && result.eval.mode == E_Mode_Offset);
|
||||
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
@@ -1215,6 +1220,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, RD_WatchRowInfo *row_info
|
||||
{
|
||||
EV_View *ev_view = rd_view_eval_view();
|
||||
result.string = ev_view_rule_from_key(ev_view, row->key);
|
||||
result.can_edit = 1;
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
@@ -1507,7 +1513,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
S64 num_possible_visible_rows = (S64)(dim_2f32(rect).y/row_height_px);
|
||||
F32 row_string_max_size_px = dim_2f32(rect).x;
|
||||
EV_StringFlags string_flags = 0;
|
||||
EV_StringFlags string_flags = EV_StringFlag_ReadOnlyDisplayRules;
|
||||
String8 filter = rd_view_filter();
|
||||
String8 expr = rd_view_expr_string();
|
||||
if(expr.size == 0)
|
||||
@@ -1572,10 +1578,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
{
|
||||
MemoryZeroStruct(&block_tree);
|
||||
MemoryZeroStruct(&block_ranges);
|
||||
if(implicit_root)
|
||||
{
|
||||
ev_key_set_expansion(eval_view, ev_key_root(), ev_key_make(ev_hash_from_key(ev_key_root()), 1), 1);
|
||||
}
|
||||
ev_key_set_expansion(eval_view, ev_key_root(), ev_key_make(ev_hash_from_key(ev_key_root()), 1), 1);
|
||||
block_tree = ev_block_tree_from_string(scratch.arena, eval_view, filter, expr);
|
||||
block_ranges = ev_block_range_list_from_tree(scratch.arena, &block_tree);
|
||||
}
|
||||
@@ -1769,7 +1772,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||
if(cell_info.can_edit)
|
||||
{
|
||||
any_edits_started = 1;
|
||||
@@ -1779,6 +1782,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
U64 hash = ev_hash_from_key(pt.key);
|
||||
U64 slot_idx = hash%ewv->text_edit_state_slots_count;
|
||||
RD_WatchViewTextEditState *edit_state = push_array(ewv->text_edit_arena, RD_WatchViewTextEditState, 1);
|
||||
SLLStackPush_N(ewv->text_edit_state_slots[slot_idx], edit_state, pt_hash_next);
|
||||
edit_state->pt = pt;
|
||||
edit_state->cursor = txt_pt(1, string.size+1);
|
||||
edit_state->mark = txt_pt(1, 1);
|
||||
@@ -2045,7 +2049,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||
String8 cell_string = cell_info.string;
|
||||
cell_string = str8_skip_chop_whitespace(cell_string);
|
||||
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
|
||||
@@ -2302,65 +2306,65 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
}
|
||||
|
||||
// rjf: determine collection info for the block
|
||||
RD_EntityKind collection_entity_kind = RD_EntityKind_Nil;
|
||||
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, selection_block->expr);
|
||||
E_Type *type = e_type_from_key__cached(irtree.type_key);
|
||||
#if 0 // TODO(rjf): @cfg
|
||||
for EachElement(idx, rd_collection_name_table)
|
||||
String8 group_cfg_name = {0};
|
||||
{
|
||||
if(str8_match(type->name, rd_collection_name_table[idx], 0))
|
||||
E_IRTreeAndType block_irtree = e_irtree_and_type_from_expr(scratch.arena, selection_block->expr);
|
||||
E_TypeKey block_type_key = block_irtree.type_key;
|
||||
E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key);
|
||||
if(block_type_kind == E_TypeKind_Set)
|
||||
{
|
||||
collection_entity_kind = rd_collection_entity_kind_table[idx];
|
||||
break;
|
||||
E_Type *block_type = e_type_from_key__cached(block_type_key);
|
||||
group_cfg_name = rd_singular_from_code_name_plural(block_type->name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// rjf: map selection endpoints to entities
|
||||
#if 0 // TODO(rjf): @cfg
|
||||
RD_Entity *first_entity = &rd_nil_entity;
|
||||
RD_Entity *last_entity = &rd_nil_entity;
|
||||
if(collection_entity_kind != RD_EntityKind_Nil)
|
||||
// rjf: map selection endpoints to cfgs
|
||||
RD_Cfg *first_cfg = &rd_nil_cfg;
|
||||
RD_Cfg *last_cfg = &rd_nil_cfg;
|
||||
if(group_cfg_name.size != 0)
|
||||
{
|
||||
first_entity = rd_entity_from_id(selection_keys_in_block[0].child_id);
|
||||
last_entity = rd_entity_from_id(selection_keys_in_block[1].child_id);
|
||||
first_cfg = rd_cfg_from_id(selection_keys_in_block[0].child_id);
|
||||
last_cfg = rd_cfg_from_id(selection_keys_in_block[1].child_id);
|
||||
}
|
||||
|
||||
// rjf: reorder
|
||||
if(!rd_entity_is_nil(first_entity) && !rd_entity_is_nil(last_entity))
|
||||
if(first_cfg != &rd_nil_cfg && last_cfg != &rd_nil_cfg)
|
||||
{
|
||||
RD_Entity *first_entity_prev = &rd_nil_entity;
|
||||
RD_Entity *last_entity_next = &rd_nil_entity;
|
||||
for(RD_Entity *prev = first_entity->prev; !rd_entity_is_nil(prev); prev = prev->prev)
|
||||
RD_Cfg *first_cfg_prev = &rd_nil_cfg;
|
||||
RD_Cfg *last_cfg_next = &rd_nil_cfg;
|
||||
for(RD_Cfg *prev = first_cfg->prev; prev != &rd_nil_cfg; prev = prev->prev)
|
||||
{
|
||||
if(prev->kind == collection_entity_kind)
|
||||
if(str8_match(prev->string, first_cfg->string, 0))
|
||||
{
|
||||
first_entity_prev = prev;
|
||||
first_cfg_prev = prev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(RD_Entity *next = last_entity->next; !rd_entity_is_nil(next); next = next->next)
|
||||
for(RD_Cfg *next = last_cfg->next; next != &rd_nil_cfg; next = next->next)
|
||||
{
|
||||
if(next->kind == collection_entity_kind)
|
||||
if(str8_match(next->string, last_cfg->string, 0))
|
||||
{
|
||||
last_entity_next = next;
|
||||
last_cfg_next = next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(evt->delta_2s32.y < 0 && !rd_entity_is_nil(first_entity) && !rd_entity_is_nil(first_entity_prev))
|
||||
if(evt->delta_2s32.y < 0 && first_cfg != &rd_nil_cfg && first_cfg_prev != &rd_nil_cfg)
|
||||
{
|
||||
state_dirty = 1;
|
||||
snap_to_cursor = 1;
|
||||
rd_entity_change_parent(first_entity_prev, first_entity_prev->parent, first_entity_prev->parent, last_entity);
|
||||
RD_Cfg *parent = first_cfg_prev->parent;
|
||||
rd_cfg_unhook(parent, first_cfg_prev);
|
||||
rd_cfg_insert_child(parent, last_cfg, first_cfg_prev);
|
||||
}
|
||||
if(evt->delta_2s32.y > 0 && !rd_entity_is_nil(last_entity) && !rd_entity_is_nil(last_entity_next))
|
||||
if(evt->delta_2s32.y > 0 && last_cfg != &rd_nil_cfg && last_cfg_next != &rd_nil_cfg)
|
||||
{
|
||||
state_dirty = 1;
|
||||
snap_to_cursor = 1;
|
||||
rd_entity_change_parent(last_entity_next, last_entity_next->parent, last_entity_next->parent, first_entity_prev);
|
||||
RD_Cfg *parent = last_cfg_next->parent;
|
||||
rd_cfg_unhook(parent, last_cfg_next);
|
||||
rd_cfg_insert_child(parent, first_cfg_prev, last_cfg_next);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2592,7 +2596,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
RD_WatchPt cell_pt = {row->block->key, row->key, cell_id};
|
||||
RD_WatchViewTextEditState *cell_edit_state = rd_watch_view_text_edit_state_from_pt(ewv, cell_pt);
|
||||
B32 cell_selected = (row_selected && selection_tbl.min.x <= cell_x && cell_x <= selection_tbl.max.x);
|
||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||
RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, &row_info, cell, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
|
||||
|
||||
//- rjf: determine cell's palette
|
||||
ProfBegin("determine cell's palette");
|
||||
@@ -3971,7 +3975,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, Rng2F32 rect)
|
||||
//
|
||||
if(next_row_expanded != row_expanded)
|
||||
{
|
||||
if(!ev_key_match(ev_key_root(), row->key) || !implicit_root)
|
||||
if(!ev_key_match(ev_key_root(), row->key))
|
||||
{
|
||||
ev_key_set_expansion(eval_view, row->block->key, row->key, next_row_expanded);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ internal RD_WatchViewRowInfo rd_watch_view_row_info_from_row(EV_Row *row);
|
||||
#endif
|
||||
|
||||
//- rjf: row * cell -> info
|
||||
internal RD_WatchRowCellInfo rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px);
|
||||
internal RD_WatchRowCellInfo rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_flags, RD_WatchRowInfo *row_info, RD_WatchCell *cell, FNT_Tag font, F32 font_size, F32 max_size_px);
|
||||
|
||||
//- rjf: row/column -> exprs / strings
|
||||
#if 0 // TODO(rjf): @cfg
|
||||
|
||||
Reference in New Issue
Block a user