mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
auto-fill ctrl+f query from selection; fix single-cell copy/paste in watch views; tweaks/fixes
This commit is contained in:
@@ -384,8 +384,6 @@ struct DF_CoreViewRuleSpec
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity Types
|
||||
|
||||
typedef U32 DF_EntitySubKind;
|
||||
|
||||
typedef U32 DF_EntityFlags;
|
||||
enum
|
||||
{
|
||||
@@ -433,7 +431,6 @@ struct DF_Entity
|
||||
|
||||
// rjf: metadata
|
||||
DF_EntityKind kind;
|
||||
DF_EntitySubKind subkind;
|
||||
DF_EntityFlags flags;
|
||||
DF_EntityID id;
|
||||
U64 generation;
|
||||
|
||||
+67
-75
@@ -3572,99 +3572,91 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
////////////////////////////
|
||||
//- rjf: developer menu
|
||||
//
|
||||
if(ws->dev_menu_is_open)
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
UI_PaneF(r2f32p(30, 30, 30+ui_top_font_size()*100, ui_top_font_size()*150), "###dev_ctx_menu")
|
||||
if(ws->dev_menu_is_open) UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
{
|
||||
//- rjf: toggles
|
||||
for(U64 idx = 0; idx < ArrayCount(DEV_toggle_table); idx += 1)
|
||||
ui_set_next_flags(UI_BoxFlag_ViewScrollY|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_ViewClamp);
|
||||
UI_PaneF(r2f32p(30, 30, 30+ui_top_font_size()*100, ui_top_font_size()*150), "###dev_ctx_menu")
|
||||
{
|
||||
if(ui_clicked(df_icon_button(*DEV_toggle_table[idx].value_ptr ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow, 0, DEV_toggle_table[idx].name)))
|
||||
//- rjf: toggles
|
||||
for(U64 idx = 0; idx < ArrayCount(DEV_toggle_table); idx += 1)
|
||||
{
|
||||
*DEV_toggle_table[idx].value_ptr ^= 1;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: stats & info
|
||||
{
|
||||
//- rjf: draw per-window stats
|
||||
for(DF_Window *window = df_gfx_state->first_window; window != 0; window = window->next)
|
||||
{
|
||||
// rjf: calc ui hash chain length
|
||||
F64 avg_ui_hash_chain_length = 0;
|
||||
if(ui_clicked(df_icon_button(*DEV_toggle_table[idx].value_ptr ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow, 0, DEV_toggle_table[idx].name)))
|
||||
{
|
||||
F64 chain_count = 0;
|
||||
F64 chain_length_sum = 0;
|
||||
for(U64 idx = 0; idx < ws->ui->box_table_size; idx += 1)
|
||||
{
|
||||
F64 chain_length = 0;
|
||||
for(UI_Box *b = ws->ui->box_table[idx].hash_first; !ui_box_is_nil(b); b = b->hash_next)
|
||||
{
|
||||
chain_length += 1;
|
||||
}
|
||||
if(chain_length > 0)
|
||||
{
|
||||
chain_length_sum += chain_length;
|
||||
chain_count += 1;
|
||||
}
|
||||
}
|
||||
avg_ui_hash_chain_length = chain_length_sum / chain_count;
|
||||
}
|
||||
ui_labelf("Target Hz: %.2f", 1.f/df_dt());
|
||||
ui_labelf("Ctrl Run Index: %I64u", ctrl_run_gen());
|
||||
ui_labelf("Ctrl Mem Gen Index: %I64u", ctrl_mem_gen());
|
||||
ui_labelf("Window %p", window);
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
UI_Row
|
||||
{
|
||||
ui_spacer(ui_em(2.f, 1.f));
|
||||
ui_labelf("Box Count: %I64u", window->ui->last_build_box_count);
|
||||
}
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
UI_Row
|
||||
{
|
||||
ui_spacer(ui_em(2.f, 1.f));
|
||||
ui_labelf("Average UI Hash Chain Length: %f", avg_ui_hash_chain_length);
|
||||
*DEV_toggle_table[idx].value_ptr ^= 1;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: draw entity file tree
|
||||
#if 0
|
||||
DF_EntityRec rec = {0};
|
||||
S32 indent = 0;
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("Entity File Tree:");
|
||||
for(DF_Entity *e = df_entity_root(); !df_entity_is_nil(e); e = rec.next)
|
||||
//- rjf: stats & info
|
||||
{
|
||||
switch(e->kind)
|
||||
//- rjf: draw per-window stats
|
||||
for(DF_Window *window = df_gfx_state->first_window; window != 0; window = window->next)
|
||||
{
|
||||
default:{}break;
|
||||
case DF_EntityKind_File:
|
||||
case DF_EntityKind_OverrideFileLink:
|
||||
// rjf: calc ui hash chain length
|
||||
F64 avg_ui_hash_chain_length = 0;
|
||||
{
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
UI_Row
|
||||
F64 chain_count = 0;
|
||||
F64 chain_length_sum = 0;
|
||||
for(U64 idx = 0; idx < ws->ui->box_table_size; idx += 1)
|
||||
{
|
||||
ui_spacer(ui_em(2.f*indent, 1.f));
|
||||
if(e->kind == DF_EntityKind_File)
|
||||
F64 chain_length = 0;
|
||||
for(UI_Box *b = ws->ui->box_table[idx].hash_first; !ui_box_is_nil(b); b = b->hash_next)
|
||||
{
|
||||
ui_label(e->name);
|
||||
chain_length += 1;
|
||||
}
|
||||
if(e->kind == DF_EntityKind_OverrideFileLink)
|
||||
if(chain_length > 0)
|
||||
{
|
||||
DF_Entity *dst = df_entity_from_handle(e->entity_handle);
|
||||
ui_labelf("[link] %S -> %S", e->name, dst->name);
|
||||
chain_length_sum += chain_length;
|
||||
chain_count += 1;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
avg_ui_hash_chain_length = chain_length_sum / chain_count;
|
||||
}
|
||||
ui_labelf("Target Hz: %.2f", 1.f/df_dt());
|
||||
ui_labelf("Ctrl Run Index: %I64u", ctrl_run_gen());
|
||||
ui_labelf("Ctrl Mem Gen Index: %I64u", ctrl_mem_gen());
|
||||
ui_labelf("Window %p", window);
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
UI_Row
|
||||
{
|
||||
ui_spacer(ui_em(2.f, 1.f));
|
||||
ui_labelf("Box Count: %I64u", window->ui->last_build_box_count);
|
||||
}
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
UI_Row
|
||||
{
|
||||
ui_spacer(ui_em(2.f, 1.f));
|
||||
ui_labelf("Average UI Hash Chain Length: %f", avg_ui_hash_chain_length);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: draw entity tree
|
||||
DF_EntityRec rec = {0};
|
||||
S32 indent = 0;
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("Entity Tree:");
|
||||
for(DF_Entity *e = df_entity_root(); !df_entity_is_nil(e); e = rec.next)
|
||||
{
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
ui_set_next_pref_height(ui_children_sum(1));
|
||||
UI_Row
|
||||
{
|
||||
ui_spacer(ui_em(2.f*indent, 1.f));
|
||||
if(e->kind == DF_EntityKind_OverrideFileLink)
|
||||
{
|
||||
DF_Entity *dst = df_entity_from_handle(e->entity_handle);
|
||||
ui_labelf("[link] %S -> %S", e->name, dst->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_labelf("%S: %S", df_g_entity_kind_display_string_table[e->kind], e->name);
|
||||
}
|
||||
}
|
||||
rec = df_entity_rec_df_pre(e, df_entity_root());
|
||||
indent += rec.push_count;
|
||||
indent -= rec.pop_count;
|
||||
}
|
||||
rec = df_entity_rec_df_pre(e, df_entity_root());
|
||||
indent += rec.push_count;
|
||||
indent -= rec.pop_count;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-5
@@ -1264,11 +1264,18 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
String8 cell_string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, parse_ctx.type_graph, parse_ctx.rdi, row, (DF_WatchViewColumnKind)x, 0);
|
||||
cell_string = str8_skip_chop_whitespace(cell_string);
|
||||
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
|
||||
str8_list_pushf(scratch.arena, &strs, "%s%S%s%s",
|
||||
comma_pos < cell_string.size ? "\"" : "",
|
||||
cell_string,
|
||||
comma_pos < cell_string.size ? "\"" : "",
|
||||
x+1 <= selection_tbl.max.x ? "," : "");
|
||||
if(selection_tbl.min.x != selection_tbl.max.x || selection_tbl.min.y != selection_tbl.max.y)
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &strs, "%s%S%s%s",
|
||||
comma_pos < cell_string.size ? "\"" : "",
|
||||
cell_string,
|
||||
comma_pos < cell_string.size ? "\"" : "",
|
||||
x+1 <= selection_tbl.max.x ? "," : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_push(scratch.arena, &strs, cell_string);
|
||||
}
|
||||
}
|
||||
if(y+1 <= selection_tbl.max.y)
|
||||
{
|
||||
@@ -6298,6 +6305,13 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
os_set_clipboard_text(text);
|
||||
}
|
||||
|
||||
//- rjf: selected text on single line, no query? -> set search text
|
||||
if(!txt_pt_match(tv->cursor, tv->mark) && tv->cursor.line == tv->mark.line && search_query.size == 0)
|
||||
{
|
||||
String8 text = txt_string_from_info_data_txt_rng(&text_info, data, txt_rng(tv->cursor, tv->mark));
|
||||
df_set_search_string(text);
|
||||
}
|
||||
|
||||
//- rjf: toggle cursor watch
|
||||
if(sig.toggle_cursor_watch)
|
||||
{
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
// [ ] "Browse..." buttons should adopt a more relevant starting search path,
|
||||
// if possible
|
||||
//
|
||||
// [ ] highlighted text & ctrl+f -> auto-fill search query
|
||||
// [x] highlighted text & ctrl+f -> auto-fill search query
|
||||
// [ ] double click on procedure in procedures tab to jump to source
|
||||
// [ ] double-click any part of frame in callstack view -> snap to function
|
||||
|
||||
|
||||
@@ -908,11 +908,13 @@ ui_pane_beginf(Rng2F32 rect, char *fmt, ...)
|
||||
return box;
|
||||
}
|
||||
|
||||
internal void
|
||||
internal UI_Signal
|
||||
ui_pane_end(void)
|
||||
{
|
||||
ui_pop_pref_width();
|
||||
ui_pop_parent();
|
||||
UI_Box *box = ui_pop_parent();
|
||||
UI_Signal sig = ui_signal_from_box(box);
|
||||
return sig;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -130,7 +130,7 @@ internal void ui_named_column_end(void);
|
||||
|
||||
internal UI_Box *ui_pane_begin(Rng2F32 rect, String8 string);
|
||||
internal UI_Box *ui_pane_beginf(Rng2F32 rect, char *fmt, ...);
|
||||
internal void ui_pane_end(void);
|
||||
internal UI_Signal ui_pane_end(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Tables
|
||||
|
||||
+1
-1
@@ -1417,7 +1417,7 @@ ui_end_build(void)
|
||||
String8 box_display_string = ui_box_display_string(b);
|
||||
Vec2F32 text_pos = ui_box_text_position(b);
|
||||
Vec2F32 drawn_text_dim = b->display_string_runs.dim;
|
||||
B32 text_is_truncated = (drawn_text_dim.x + text_pos.x > rect.x1);
|
||||
B32 text_is_truncated = (drawn_text_dim.x + text_pos.x >= rect.x1);
|
||||
B32 mouse_is_hovering = contains_2f32(r2f32p(text_pos.x,
|
||||
rect.y0,
|
||||
Min(text_pos.x+drawn_text_dim.x, rect.x1),
|
||||
|
||||
Reference in New Issue
Block a user