mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-20 10:54:59 -07:00
begin sketching out new autocompletion lister path
This commit is contained in:
@@ -52,7 +52,7 @@ str8_lit_comp(""),
|
||||
str8_lit_comp(""),
|
||||
};
|
||||
|
||||
RD_VocabInfo rd_vocab_info_table[327] =
|
||||
RD_VocabInfo rd_vocab_info_table[329] =
|
||||
{
|
||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
|
||||
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
|
||||
@@ -308,6 +308,8 @@ RD_VocabInfo rd_vocab_info_table[327] =
|
||||
{str8_lit_comp("cut"), str8_lit_comp(""), str8_lit_comp("Cut"), str8_lit_comp(""), RD_IconKind_Clipboard},
|
||||
{str8_lit_comp("paste"), str8_lit_comp(""), str8_lit_comp("Paste"), str8_lit_comp(""), RD_IconKind_Clipboard},
|
||||
{str8_lit_comp("insert_text"), str8_lit_comp(""), str8_lit_comp("Insert Text"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("move_next"), str8_lit_comp(""), str8_lit_comp("Move Next"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("move_prev"), str8_lit_comp(""), str8_lit_comp("Move Previous"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("goto_line"), str8_lit_comp(""), str8_lit_comp("Go To Line"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("goto_address"), str8_lit_comp(""), str8_lit_comp("Go To Address"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
{str8_lit_comp("center_cursor"), str8_lit_comp(""), str8_lit_comp("Center Cursor"), str8_lit_comp(""), RD_IconKind_Null},
|
||||
@@ -457,7 +459,7 @@ Rng1U64 rd_reg_slot_range_table[43] =
|
||||
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
|
||||
};
|
||||
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[219] =
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[221] =
|
||||
{
|
||||
{0},
|
||||
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
@@ -605,6 +607,8 @@ RD_CmdKindInfo rd_cmd_kind_info_table[219] =
|
||||
{ str8_lit_comp("cut"), str8_lit_comp("Copies the active selection to the clipboard, then deletes it."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("paste"), str8_lit_comp("Pastes the current contents of the clipboard."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("insert_text"), str8_lit_comp("Inserts the text that was used to cause this command."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("move_next"), str8_lit_comp("Moves the cursor or selection to the next element."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("move_prev"), str8_lit_comp("Moves the cursor or selection to the previous element."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("goto_line"), str8_lit_comp("Jumps to a line number in the current code file."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Cursor, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("goto_address"), str8_lit_comp("Jumps to an address in the current memory or disassembly view."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Vaddr, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
{ str8_lit_comp("center_cursor"), str8_lit_comp("Snaps the current code view to center the cursor."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}},
|
||||
@@ -680,7 +684,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[219] =
|
||||
{ str8_lit_comp("memory"), str8_lit_comp("Opens a Memory tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
|
||||
};
|
||||
|
||||
struct {String8 string; RD_Binding binding;} rd_default_binding_table[109] =
|
||||
struct {String8 string; RD_Binding binding;} rd_default_binding_table[111] =
|
||||
{
|
||||
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_Modifier_Shift }},
|
||||
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_Modifier_Alt}},
|
||||
@@ -772,6 +776,8 @@ struct {String8 string; RD_Binding binding;} rd_default_binding_table[109] =
|
||||
{str8_lit_comp("paste"), {OS_Key_V, 0 |OS_Modifier_Ctrl }},
|
||||
{str8_lit_comp("paste"), {OS_Key_Insert, 0 |OS_Modifier_Shift }},
|
||||
{str8_lit_comp("insert_text"), {OS_Key_Null, 0 }},
|
||||
{str8_lit_comp("move_next"), {OS_Key_Tab, 0 }},
|
||||
{str8_lit_comp("move_prev"), {OS_Key_Tab, 0 |OS_Modifier_Shift }},
|
||||
{str8_lit_comp("goto_line"), {OS_Key_G, 0 |OS_Modifier_Ctrl }},
|
||||
{str8_lit_comp("goto_address"), {OS_Key_G, 0 |OS_Modifier_Alt}},
|
||||
{str8_lit_comp("search"), {OS_Key_F, 0 |OS_Modifier_Ctrl }},
|
||||
|
||||
@@ -202,6 +202,8 @@ RD_CmdKind_Copy,
|
||||
RD_CmdKind_Cut,
|
||||
RD_CmdKind_Paste,
|
||||
RD_CmdKind_InsertText,
|
||||
RD_CmdKind_MoveNext,
|
||||
RD_CmdKind_MovePrev,
|
||||
RD_CmdKind_GoToLine,
|
||||
RD_CmdKind_GoToAddress,
|
||||
RD_CmdKind_CenterCursor,
|
||||
@@ -678,7 +680,7 @@ Z(getting_started)\
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 rd_tab_fast_path_view_name_table[20];
|
||||
extern String8 rd_tab_fast_path_query_name_table[20];
|
||||
extern RD_VocabInfo rd_vocab_info_table[327];
|
||||
extern RD_VocabInfo rd_vocab_info_table[329];
|
||||
extern RD_NameSchemaInfo rd_name_schema_info_table[23];
|
||||
extern Rng1U64 rd_reg_slot_range_table[43];
|
||||
extern String8 rd_binding_version_remap_old_name_table[8];
|
||||
|
||||
@@ -889,6 +889,10 @@ RD_CmdTable: // | | | |
|
||||
{Paste 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Clipboard "paste" "Paste" "Pastes the current contents of the clipboard." "" "" }
|
||||
{InsertText 0 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "insert_text" "Insert Text" "Inserts the text that was used to cause this command." "" "" }
|
||||
|
||||
//- rjf: secondary navigation
|
||||
{MoveNext 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "move_next" "Move Next" "Moves the cursor or selection to the next element." "" "" }
|
||||
{MovePrev 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "move_prev" "Move Previous" "Moves the cursor or selection to the previous element." "" "" }
|
||||
|
||||
//- rjf: code navigation
|
||||
{GoToLine 1 1 0 0 "" Cursor null Nil Null 0 0 0 0 1 0 1 Null "goto_line" "Go To Line" "Jumps to a line number in the current code file." "" "" }
|
||||
{GoToAddress 1 1 0 0 "" Vaddr null Nil Null 0 0 0 0 1 0 1 Null "goto_address" "Go To Address" "Jumps to an address in the current memory or disassembly view." "" "" }
|
||||
@@ -1149,6 +1153,10 @@ RD_DefaultBindingTable:
|
||||
{ "paste" Insert 0 shift 0 }
|
||||
{ "insert_text" Null 0 0 0 }
|
||||
|
||||
//- rjf: secondary navigation
|
||||
{ "move_next" Tab 0 0 0 }
|
||||
{ "move_prev" Tab 0 shift 0 }
|
||||
|
||||
//- rjf: code navigation
|
||||
{ "goto_line" G ctrl 0 0 }
|
||||
{ "goto_address" G 0 0 alt }
|
||||
|
||||
+108
-35
@@ -4902,19 +4902,20 @@ rd_view_ui(Rng2F32 rect)
|
||||
{
|
||||
ui_pop_background_color();
|
||||
}
|
||||
#if 0 // TODO(rjf): @cfg (autocompletion)
|
||||
if(ui_is_focus_active() &&
|
||||
selection_tbl.min.x == selection_tbl.max.x && selection_tbl.min.y == selection_tbl.max.y &&
|
||||
txt_pt_match(cell_edit_state->cursor, cell_edit_state->mark))
|
||||
{
|
||||
String8 input = str8(cell_edit_state->input_buffer, cell_edit_state->input_size);
|
||||
rd_set_autocomp_regs(.ui_key = sig.box->key, .string = input, .cursor = cell_edit_state->cursor);
|
||||
#if 0 // TODO(rjf): @cfg (autocompletion)
|
||||
rd_set_autocomp_lister_query(.ui_key = sig.box->key,
|
||||
.off_px = v2f32(0, dim_2f32(sig.box->rect).y),
|
||||
.string = input,
|
||||
.cursor = cell_edit_state->cursor,
|
||||
.lister_flags = cell_autocomp_flags);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4993,7 +4994,8 @@ rd_view_ui(Rng2F32 rect)
|
||||
}
|
||||
|
||||
// rjf: this watch window is a lister? -> move cursor & accept
|
||||
if(rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg)
|
||||
if(rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg ||
|
||||
rd_cfg_child_from_string(view, str8_lit("expr_lister")) != &rd_nil_cfg)
|
||||
{
|
||||
ewv->next_cursor = ewv->next_mark = cell_pt;
|
||||
rd_cmd(RD_CmdKind_Accept);
|
||||
@@ -5501,14 +5503,6 @@ rd_store_view_expr_string(String8 string)
|
||||
rd_cfg_new_replace(expr, string);
|
||||
}
|
||||
|
||||
internal void
|
||||
rd_store_view_filter(String8 string)
|
||||
{
|
||||
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
|
||||
RD_Cfg *filter = rd_cfg_child_from_string_or_alloc(view, str8_lit("filter"));
|
||||
rd_cfg_new_replace(filter, string);
|
||||
}
|
||||
|
||||
internal void
|
||||
rd_store_view_loading_info(B32 is_loading, U64 progress_u64, U64 progress_u64_target)
|
||||
{
|
||||
@@ -5653,8 +5647,9 @@ rd_window_state_from_cfg(RD_Cfg *cfg)
|
||||
ws->r = r_window_equip(ws->os);
|
||||
ws->ui = ui_state_alloc();
|
||||
ws->drop_completion_arena = arena_alloc();
|
||||
ws->hover_eval_arena = arena_alloc();
|
||||
ws->query_arena = arena_alloc();
|
||||
ws->hover_eval_arena = arena_alloc();
|
||||
ws->autocomp_arena = arena_alloc();
|
||||
ws->last_dpi = os_dpi_from_window(ws->os);
|
||||
OS_Handle zero_monitor = {0};
|
||||
if(!os_handle_match(zero_monitor, preferred_monitor))
|
||||
@@ -6585,10 +6580,9 @@ rd_window_frame(void)
|
||||
FloatingViewTask *next;
|
||||
RD_Cfg *view;
|
||||
Rng2F32 rect;
|
||||
String8 view_name;
|
||||
String8 expr;
|
||||
B32 is_focused;
|
||||
B32 is_anchored;
|
||||
B32 only_secondary_navigation;
|
||||
B32 reset_open;
|
||||
UI_Signal signal; // NOTE(rjf): output, from build
|
||||
B32 pressed;
|
||||
@@ -6600,7 +6594,57 @@ rd_window_frame(void)
|
||||
FloatingViewTask *last_floating_view_task = 0;
|
||||
RD_Font(RD_FontSlot_Code)
|
||||
{
|
||||
//- rjf: try to add hover eval first
|
||||
//- rjf: add autocompletion view task
|
||||
if(ws->autocomp_regs != 0 && ws->autocomp_last_frame_index+1 >= rd_state->frame_index)
|
||||
{
|
||||
// rjf: build view
|
||||
RD_Cfg *root = rd_immediate_cfg_from_keyf("autocomp_view_%I64x", window->id);
|
||||
RD_Cfg *view = rd_cfg_child_from_string_or_alloc(root, str8_lit("watch"));
|
||||
rd_cfg_child_from_string_or_alloc(view, str8_lit("expr_lister"));
|
||||
RD_Cfg *query = rd_cfg_child_from_string_or_alloc(view, str8_lit("query"));
|
||||
RD_Cfg *input = rd_cfg_child_from_string_or_alloc(query, str8_lit("input"));
|
||||
rd_cfg_new_replace(input, ws->autocomp_regs->string);
|
||||
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
|
||||
rd_cfg_new_replacef(expr, "query:locals, query:procedures, query:types");
|
||||
|
||||
// rjf: determine container size
|
||||
EV_BlockTree predicted_block_tree = {0};
|
||||
RD_RegsScope(.view = view->id, .tab = 0)
|
||||
{
|
||||
String8 expr = rd_expr_from_cfg(view);
|
||||
E_Eval list_eval = e_eval_from_string(expr);
|
||||
predicted_block_tree = ev_block_tree_from_eval(scratch.arena, rd_view_eval_view(), rd_view_query_input(), list_eval);
|
||||
}
|
||||
F32 row_height_px = ui_top_px_height();
|
||||
U64 max_row_count = (U64)floor_f32(ui_top_font_size()*30.f / row_height_px);
|
||||
U64 needed_row_count = Min(max_row_count, predicted_block_tree.total_row_count - 1);
|
||||
F32 width_px = floor_f32(40.f*ui_top_font_size());
|
||||
F32 height_px = needed_row_count*row_height_px;
|
||||
|
||||
// rjf: determine list top-level rect
|
||||
Rng2F32 rect = r2f32p(0, 0, 0, 0);
|
||||
if(!ui_key_match(ui_key_zero(), ws->autocomp_regs->ui_key))
|
||||
{
|
||||
UI_Box *anchor_box = ui_box_from_key(ws->autocomp_regs->ui_key);
|
||||
rect.x0 = anchor_box->rect.x0;
|
||||
rect.y0 = anchor_box->rect.y1;
|
||||
rect.x1 = rect.x0 + width_px;
|
||||
rect.y1 = rect.y0 + height_px;
|
||||
}
|
||||
|
||||
// rjf: push task
|
||||
{
|
||||
FloatingViewTask *t = push_array(scratch.arena, FloatingViewTask, 1);
|
||||
SLLQueuePush(first_floating_view_task, last_floating_view_task, t);
|
||||
t->view = view;
|
||||
t->rect = rect;
|
||||
t->is_focused = 1;
|
||||
t->is_anchored = 1;
|
||||
t->only_secondary_navigation = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try to add hover eval
|
||||
{
|
||||
B32 build_hover_eval = (hover_eval_is_open && !rd_drag_is_active());
|
||||
|
||||
@@ -6668,15 +6712,8 @@ rd_window_frame(void)
|
||||
EV_ExpandRule *expand_rule = ev_expand_rule_from_type_key(hover_eval.irtree.type_key);
|
||||
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(expand_rule->string);
|
||||
|
||||
// rjf: determine view name
|
||||
String8 view_name = str8_lit("watch");
|
||||
if(view_ui_rule != &rd_nil_view_ui_rule)
|
||||
{
|
||||
view_name = view_ui_rule->name;
|
||||
}
|
||||
|
||||
// rjf: build view
|
||||
RD_Cfg *root = rd_immediate_cfg_from_keyf("hover_eval_view");
|
||||
RD_Cfg *root = rd_immediate_cfg_from_keyf("hover_eval_view_%I64x", ws->cfg_id);
|
||||
RD_Cfg *view = rd_view_from_eval(root, hover_eval);
|
||||
rd_cfg_child_from_string_or_alloc(view, str8_lit("explicit_root"));
|
||||
|
||||
@@ -6715,8 +6752,6 @@ rd_window_frame(void)
|
||||
hover_eval_floating_view_task = t;
|
||||
t->view = view;
|
||||
t->rect = rect;
|
||||
t->view_name = view_name;
|
||||
t->expr = hover_eval_expr;
|
||||
t->is_focused = ws->hover_eval_focused;
|
||||
t->is_anchored = 1;
|
||||
}
|
||||
@@ -6864,8 +6899,6 @@ rd_window_frame(void)
|
||||
query_floating_view_task = t;
|
||||
t->view = view;
|
||||
t->rect = rect;
|
||||
t->view_name = str8_lit("watch");
|
||||
t->expr = query_expr;
|
||||
t->is_focused = 1;
|
||||
t->is_anchored = query_is_anchored;
|
||||
t->reset_open = reset_open;
|
||||
@@ -6888,17 +6921,11 @@ rd_window_frame(void)
|
||||
// rjf: unpack
|
||||
RD_Cfg *view = t->view;
|
||||
Rng2F32 rect = t->rect;
|
||||
String8 view_name = t->view_name;
|
||||
String8 expr = t->expr;
|
||||
B32 is_focused = t->is_focused;
|
||||
B32 is_anchored = t->is_anchored;
|
||||
B32 only_secondary_navigation = t->only_secondary_navigation;
|
||||
F32 open_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "floating_view_open_%p", view), 1.f, .rate = is_anchored ? fast_open_rate : slow_open_rate, .reset = t->reset_open, .initial = 0.f);
|
||||
|
||||
// rjf: build cfg tree
|
||||
RD_Cfg *expr_root = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
|
||||
rd_cfg_child_from_string_or_alloc(view, str8_lit("selected"));
|
||||
rd_cfg_new_replace(expr_root, expr);
|
||||
|
||||
// rjf: push view regs
|
||||
rd_push_regs(.view = view->id);
|
||||
{
|
||||
@@ -6916,6 +6943,9 @@ rd_window_frame(void)
|
||||
|
||||
// rjf: build
|
||||
UI_Focus(is_focused ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_PermissionFlags(only_secondary_navigation ?
|
||||
UI_PermissionFlag_KeyboardSecondary|UI_PermissionFlag_Clicks|UI_PermissionFlag_ScrollX|UI_PermissionFlag_ScrollY :
|
||||
UI_PermissionFlag_All)
|
||||
{
|
||||
// rjf: build top-level container box
|
||||
UI_Box *container = &ui_nil_box;
|
||||
@@ -9600,6 +9630,22 @@ rd_set_hover_eval(Vec2F32 pos, String8 string)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Autocompletion Lister
|
||||
|
||||
internal void
|
||||
rd_set_autocomp_regs_(RD_Regs *regs)
|
||||
{
|
||||
RD_Cfg *window_cfg = rd_cfg_from_id(rd_regs()->window);
|
||||
RD_WindowState *ws = rd_window_state_from_cfg(window_cfg);
|
||||
if(ws->autocomp_last_frame_index < rd_state->frame_index)
|
||||
{
|
||||
ws->autocomp_last_frame_index = rd_state->frame_index;
|
||||
arena_clear(ws->autocomp_arena);
|
||||
ws->autocomp_regs = rd_regs_copy(ws->autocomp_arena, regs);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Lister Functions
|
||||
|
||||
@@ -11503,8 +11549,9 @@ rd_frame(void)
|
||||
arena_release(lister->arena);
|
||||
}
|
||||
arena_release(ws->drop_completion_arena);
|
||||
arena_release(ws->hover_eval_arena);
|
||||
arena_release(ws->query_arena);
|
||||
arena_release(ws->hover_eval_arena);
|
||||
arena_release(ws->autocomp_arena);
|
||||
arena_release(ws->arena);
|
||||
DLLRemove_NPZ(&rd_nil_window_state, rd_state->first_window_state, rd_state->last_window_state, ws, order_next, order_prev);
|
||||
DLLRemove_NP(rd_state->window_state_slots[slot_idx].first, rd_state->window_state_slots[slot_idx].last, ws, hash_next, hash_prev);
|
||||
@@ -15094,6 +15141,8 @@ rd_frame(void)
|
||||
RD_Cfg *window_query = rd_immediate_cfg_from_keyf("window_query_%p", window);
|
||||
rd_cfg_release_all_children(window_query);
|
||||
view = rd_cfg_child_from_string_or_alloc(window_query, str8_lit("watch"));
|
||||
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
|
||||
rd_cfg_new_replace(expr, rd_regs()->expr);
|
||||
}
|
||||
|
||||
// rjf: non-floating -> embed in tab parameter
|
||||
@@ -16244,6 +16293,30 @@ rd_frame(void)
|
||||
evt.string = rd_regs()->string;
|
||||
ui_event_list_push(scratch.arena, &ws->ui_events, &evt);
|
||||
}break;
|
||||
|
||||
//- rjf: secondary navigation
|
||||
case RD_CmdKind_MoveNext:
|
||||
{
|
||||
RD_Cfg *window = rd_cfg_from_id(rd_regs()->window);
|
||||
RD_WindowState *ws = rd_window_state_from_cfg(window);
|
||||
UI_Event evt = zero_struct;
|
||||
evt.kind = UI_EventKind_Navigate;
|
||||
evt.flags = UI_EventFlag_Secondary;
|
||||
evt.delta_unit = UI_EventDeltaUnit_Char;
|
||||
evt.delta_2s32 = v2s32(+0, +1);
|
||||
ui_event_list_push(scratch.arena, &ws->ui_events, &evt);
|
||||
}break;
|
||||
case RD_CmdKind_MovePrev:
|
||||
{
|
||||
RD_Cfg *window = rd_cfg_from_id(rd_regs()->window);
|
||||
RD_WindowState *ws = rd_window_state_from_cfg(window);
|
||||
UI_Event evt = zero_struct;
|
||||
evt.kind = UI_EventKind_Navigate;
|
||||
evt.flags = UI_EventFlag_Secondary;
|
||||
evt.delta_unit = UI_EventDeltaUnit_Char;
|
||||
evt.delta_2s32 = v2s32(+0, -1);
|
||||
ui_event_list_push(scratch.arena, &ws->ui_events, &evt);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,6 +543,11 @@ struct RD_WindowState
|
||||
U64 hover_eval_firstt_us;
|
||||
U64 hover_eval_lastt_us;
|
||||
|
||||
// rjf: autocompletion state
|
||||
U64 autocomp_last_frame_index;
|
||||
Arena *autocomp_arena;
|
||||
RD_Regs *autocomp_regs;
|
||||
|
||||
// rjf: error state
|
||||
U8 error_buffer[512];
|
||||
U64 error_string_size;
|
||||
@@ -988,7 +993,6 @@ internal Arena *rd_push_view_arena(void);
|
||||
|
||||
//- rjf: storing view-attached state
|
||||
internal void rd_store_view_expr_string(String8 string);
|
||||
internal void rd_store_view_filter(String8 string);
|
||||
internal void rd_store_view_loading_info(B32 is_loading, U64 progress_u64, U64 progress_u64_target);
|
||||
internal void rd_store_view_scroll_pos(UI_ScrollPt2 pos);
|
||||
internal void rd_store_view_param(String8 key, String8 value);
|
||||
@@ -1015,6 +1019,12 @@ internal String8 rd_value_string_from_eval(Arena *arena, String8 filter, EV_Stri
|
||||
|
||||
internal void rd_set_hover_eval(Vec2F32 pos, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Autocompletion Lister
|
||||
|
||||
internal void rd_set_autocomp_regs_(RD_Regs *regs);
|
||||
#define rd_set_autocomp_regs(...) rd_set_autocomp_regs_(&(RD_Regs){rd_regs_lit_init_top __VA_ARGS__})
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Lister Functions
|
||||
|
||||
|
||||
@@ -1160,6 +1160,15 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
.pct = 1.f);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: @watch_row_build_cells expr lister rows
|
||||
//
|
||||
else if(rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("expr_lister")) != &rd_nil_cfg)
|
||||
{
|
||||
info.can_expand = 0;
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, .flags = RD_WatchCellFlag_Expr|RD_WatchCellFlag_NoEval|RD_WatchCellFlag_Button|RD_WatchCellFlag_Indented, .pct = 1.f);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: @watch_row_build_cells lister rows
|
||||
//
|
||||
|
||||
+12
-4
@@ -565,14 +565,22 @@ ui_next_event(UI_Event **ev)
|
||||
{
|
||||
good = 0;
|
||||
}
|
||||
if(!(perms & UI_PermissionFlag_Keyboard) &&
|
||||
(n->v.kind == UI_EventKind_Press ||
|
||||
n->v.kind == UI_EventKind_Release) &&
|
||||
if((n->v.kind == UI_EventKind_Press ||
|
||||
n->v.kind == UI_EventKind_Release ||
|
||||
n->v.kind == UI_EventKind_Navigate ||
|
||||
n->v.kind == UI_EventKind_Edit) &&
|
||||
(n->v.key != OS_Key_LeftMouseButton &&
|
||||
n->v.key != OS_Key_MiddleMouseButton &&
|
||||
n->v.key != OS_Key_RightMouseButton))
|
||||
{
|
||||
good = 0;
|
||||
if((perms & UI_PermissionFlag_Keyboard) == UI_PermissionFlag_KeyboardSecondary)
|
||||
{
|
||||
good = !!(n->v.flags & UI_EventFlag_Secondary);
|
||||
}
|
||||
else if(!(perms & UI_PermissionFlag_Keyboard))
|
||||
{
|
||||
good = 0;
|
||||
}
|
||||
}
|
||||
else if(!(perms & UI_PermissionFlag_Text) && (n->v.kind == UI_EventKind_Text))
|
||||
{
|
||||
|
||||
+10
-7
@@ -49,15 +49,17 @@ UI_MouseButtonKind;
|
||||
typedef U32 UI_PermissionFlags;
|
||||
enum
|
||||
{
|
||||
UI_PermissionFlag_ClicksLeft = (1<<0),
|
||||
UI_PermissionFlag_ClicksMiddle = (1<<1),
|
||||
UI_PermissionFlag_ClicksRight = (1<<2),
|
||||
UI_PermissionFlag_ScrollX = (1<<3),
|
||||
UI_PermissionFlag_ScrollY = (1<<4),
|
||||
UI_PermissionFlag_Keyboard = (1<<5),
|
||||
UI_PermissionFlag_Text = (1<<6),
|
||||
UI_PermissionFlag_ClicksLeft = (1<<0),
|
||||
UI_PermissionFlag_ClicksMiddle = (1<<1),
|
||||
UI_PermissionFlag_ClicksRight = (1<<2),
|
||||
UI_PermissionFlag_ScrollX = (1<<3),
|
||||
UI_PermissionFlag_ScrollY = (1<<4),
|
||||
UI_PermissionFlag_KeyboardPrimary = (1<<5),
|
||||
UI_PermissionFlag_KeyboardSecondary= (1<<6),
|
||||
UI_PermissionFlag_Text = (1<<7),
|
||||
|
||||
//- rjf bundles
|
||||
UI_PermissionFlag_Keyboard = (UI_PermissionFlag_KeyboardPrimary|UI_PermissionFlag_KeyboardSecondary),
|
||||
UI_PermissionFlag_Clicks = (UI_PermissionFlag_ClicksLeft|UI_PermissionFlag_ClicksMiddle|UI_PermissionFlag_ClicksRight),
|
||||
UI_PermissionFlag_All = 0xffffffff,
|
||||
};
|
||||
@@ -118,6 +120,7 @@ enum
|
||||
UI_EventFlag_CapAtLine = (1<<6),
|
||||
UI_EventFlag_ExplicitDirectional = (1<<7),
|
||||
UI_EventFlag_Reorder = (1<<8),
|
||||
UI_EventFlag_Secondary = (1<<9),
|
||||
};
|
||||
|
||||
typedef enum UI_EventDeltaUnit
|
||||
|
||||
Reference in New Issue
Block a user