mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 22:38:41 +00:00
expand ui events to contain semantic 'controls' info, to eliminate most hardcoded escs/returns/f2s/etc; formalize these things as proper commands; keyboard-driven expansions; other various fixes
This commit is contained in:
@@ -251,6 +251,11 @@ DF_CoreCmdTable:// | | |
|
|||||||
{WriteUserData 1 Null Nil 0 0 0 0 0 0 Null "write_user_data" "Write User Data" "Writes user data to the active user file." "" }
|
{WriteUserData 1 Null Nil 0 0 0 0 0 0 Null "write_user_data" "Write User Data" "Writes user data to the active user file." "" }
|
||||||
{WriteProfileData 1 Null Nil 0 0 0 0 0 0 Null "write_profile_data" "Write Profile Data" "Writes profile data to the active profile file." "" }
|
{WriteProfileData 1 Null Nil 0 0 0 0 0 0 Null "write_profile_data" "Write Profile Data" "Writes profile data to the active profile file." "" }
|
||||||
|
|
||||||
|
//- rjf: meta controls
|
||||||
|
{Edit 0 Null Nil 0 0 0 0 0 0 Pencil "edit" "Edit" "Edits the current selection." "" }
|
||||||
|
{Accept 0 Null Nil 0 0 0 0 0 0 CheckFilled "accept" "Accept" "Accepts current changes, or answers prompts in the affirmative." "" }
|
||||||
|
{Cancel 0 Null Nil 0 0 0 0 0 0 X "cancel" "Cancel" "Rejects current changes, exits temporary menus, or answers prompts in the negative." "" }
|
||||||
|
|
||||||
//- rjf: directional movement & text controls
|
//- rjf: directional movement & text controls
|
||||||
{MoveLeft 0 Null Nil 0 0 0 0 0 0 Null "move_left" "Move Left" "Moves the cursor or selection left." "" }
|
{MoveLeft 0 Null Nil 0 0 0 0 0 0 Null "move_left" "Move Left" "Moves the cursor or selection left." "" }
|
||||||
{MoveRight 0 Null Nil 0 0 0 0 0 0 Null "move_right" "Move Right" "Moves the cursor or selection right." "" }
|
{MoveRight 0 Null Nil 0 0 0 0 0 0 Null "move_right" "Move Right" "Moves the cursor or selection right." "" }
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ DF_CoreCmdKind_Null,
|
|||||||
DF_CoreCmdKind_Null,
|
DF_CoreCmdKind_Null,
|
||||||
};
|
};
|
||||||
|
|
||||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[215] =
|
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[218] =
|
||||||
{
|
{
|
||||||
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
||||||
@@ -317,6 +317,9 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[215] =
|
|||||||
{ str8_lit_comp("apply_profile_data"), str8_lit_comp("Applies profile data from the active profile file."), str8_lit_comp(""), str8_lit_comp("Apply Profile Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp("apply_profile_data"), str8_lit_comp("Applies profile data from the active profile file."), str8_lit_comp(""), str8_lit_comp("Apply Profile Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
{ str8_lit_comp("write_user_data"), str8_lit_comp("Writes user data to the active user file."), str8_lit_comp(""), str8_lit_comp("Write User Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp("write_user_data"), str8_lit_comp("Writes user data to the active user file."), str8_lit_comp(""), str8_lit_comp("Write User Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
{ str8_lit_comp("write_profile_data"), str8_lit_comp("Writes profile data to the active profile file."), str8_lit_comp(""), str8_lit_comp("Write Profile Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp("write_profile_data"), str8_lit_comp("Writes profile data to the active profile file."), str8_lit_comp(""), str8_lit_comp("Write Profile Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
|
{ str8_lit_comp("edit"), str8_lit_comp("Edits the current selection."), str8_lit_comp(""), str8_lit_comp("Edit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Pencil},
|
||||||
|
{ str8_lit_comp("accept"), str8_lit_comp("Accepts current changes, or answers prompts in the affirmative."), str8_lit_comp(""), str8_lit_comp("Accept"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_CheckFilled},
|
||||||
|
{ str8_lit_comp("cancel"), str8_lit_comp("Rejects current changes, exits temporary menus, or answers prompts in the negative."), str8_lit_comp(""), str8_lit_comp("Cancel"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
||||||
{ str8_lit_comp("move_left"), str8_lit_comp("Moves the cursor or selection left."), str8_lit_comp(""), str8_lit_comp("Move Left"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp("move_left"), str8_lit_comp("Moves the cursor or selection left."), str8_lit_comp(""), str8_lit_comp("Move Left"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
{ str8_lit_comp("move_right"), str8_lit_comp("Moves the cursor or selection right."), str8_lit_comp(""), str8_lit_comp("Move Right"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp("move_right"), str8_lit_comp("Moves the cursor or selection right."), str8_lit_comp(""), str8_lit_comp("Move Right"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
{ str8_lit_comp("move_up"), str8_lit_comp("Moves the cursor or selection up."), str8_lit_comp(""), str8_lit_comp("Move Up"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
{ str8_lit_comp("move_up"), str8_lit_comp("Moves the cursor or selection up."), str8_lit_comp(""), str8_lit_comp("Move Up"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ DF_CoreCmdKind_ApplyUserData,
|
|||||||
DF_CoreCmdKind_ApplyProfileData,
|
DF_CoreCmdKind_ApplyProfileData,
|
||||||
DF_CoreCmdKind_WriteUserData,
|
DF_CoreCmdKind_WriteUserData,
|
||||||
DF_CoreCmdKind_WriteProfileData,
|
DF_CoreCmdKind_WriteProfileData,
|
||||||
|
DF_CoreCmdKind_Edit,
|
||||||
|
DF_CoreCmdKind_Accept,
|
||||||
|
DF_CoreCmdKind_Cancel,
|
||||||
DF_CoreCmdKind_MoveLeft,
|
DF_CoreCmdKind_MoveLeft,
|
||||||
DF_CoreCmdKind_MoveRight,
|
DF_CoreCmdKind_MoveRight,
|
||||||
DF_CoreCmdKind_MoveUp,
|
DF_CoreCmdKind_MoveUp,
|
||||||
|
|||||||
+62
-10
@@ -2107,6 +2107,29 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
//- rjf: meta controls
|
||||||
|
case DF_CoreCmdKind_Edit:
|
||||||
|
{
|
||||||
|
UI_Event evt = zero_struct;
|
||||||
|
evt.kind = UI_EventKind_Press;
|
||||||
|
evt.slot = UI_EventActionSlot_Edit;
|
||||||
|
ui_event_list_push(ui_build_arena(), &events, &evt);
|
||||||
|
}break;
|
||||||
|
case DF_CoreCmdKind_Accept:
|
||||||
|
{
|
||||||
|
UI_Event evt = zero_struct;
|
||||||
|
evt.kind = UI_EventKind_Press;
|
||||||
|
evt.slot = UI_EventActionSlot_Accept;
|
||||||
|
ui_event_list_push(ui_build_arena(), &events, &evt);
|
||||||
|
}break;
|
||||||
|
case DF_CoreCmdKind_Cancel:
|
||||||
|
{
|
||||||
|
UI_Event evt = zero_struct;
|
||||||
|
evt.kind = UI_EventKind_Press;
|
||||||
|
evt.slot = UI_EventActionSlot_Cancel;
|
||||||
|
ui_event_list_push(ui_build_arena(), &events, &evt);
|
||||||
|
}break;
|
||||||
|
|
||||||
//- rjf: directional movement & text controls
|
//- rjf: directional movement & text controls
|
||||||
//
|
//
|
||||||
// NOTE(rjf): These all get funneled into a separate intermediate that
|
// NOTE(rjf): These all get funneled into a separate intermediate that
|
||||||
@@ -4175,14 +4198,14 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
UI_BackgroundColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBackground))
|
UI_BackgroundColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBackground))
|
||||||
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_ActionText))
|
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_ActionText))
|
||||||
UI_BorderColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBorder))
|
UI_BorderColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBorder))
|
||||||
if(ui_clicked(ui_buttonf("OK")) || (ui_key_match(bg_box->default_nav_focus_hot_key, ui_key_zero()) && ui_key_press(0, OS_Key_Return)))
|
if(ui_clicked(ui_buttonf("OK")) || (ui_key_match(bg_box->default_nav_focus_hot_key, ui_key_zero()) && ui_slot_press(UI_EventActionSlot_Accept)))
|
||||||
{
|
{
|
||||||
DF_CmdParams p = df_cmd_params_zero();
|
DF_CmdParams p = df_cmd_params_zero();
|
||||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ConfirmAccept));
|
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ConfirmAccept));
|
||||||
}
|
}
|
||||||
UI_CornerRadius10(ui_top_font_size()*0.25f)
|
UI_CornerRadius10(ui_top_font_size()*0.25f)
|
||||||
UI_CornerRadius11(ui_top_font_size()*0.25f)
|
UI_CornerRadius11(ui_top_font_size()*0.25f)
|
||||||
if(ui_clicked(ui_buttonf("Cancel")) || ui_key_press(0, OS_Key_Esc))
|
if(ui_clicked(ui_buttonf("Cancel")) || ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
DF_CmdParams p = df_cmd_params_zero();
|
DF_CmdParams p = df_cmd_params_zero();
|
||||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ConfirmCancel));
|
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ConfirmCancel));
|
||||||
@@ -4441,7 +4464,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
for(U64 idx = 0; idx < item_array.count; idx += 1)
|
for(U64 idx = 0; idx < item_array.count; idx += 1)
|
||||||
{
|
{
|
||||||
DF_AutoCompListerItem *item = &item_array.v[idx];
|
DF_AutoCompListerItem *item = &item_array.v[idx];
|
||||||
UI_Box *item_box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawHotEffects|UI_BoxFlag_DrawActiveEffects|UI_BoxFlag_Clickable, "autocomp_%I64x", idx);
|
UI_Box *item_box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawHotEffects|UI_BoxFlag_DrawActiveEffects|UI_BoxFlag_MouseClickable, "autocomp_%I64x", idx);
|
||||||
UI_Parent(item_box)
|
UI_Parent(item_box)
|
||||||
{
|
{
|
||||||
UI_WidthFill
|
UI_WidthFill
|
||||||
@@ -5579,14 +5602,14 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
|
|
||||||
//- rjf: query submission
|
//- rjf: query submission
|
||||||
if((ui_is_focus_active() || (window_is_focused && !ui_any_ctx_menu_is_open() && !ws->menu_bar_focused && !ws->query_view_selected)) &&
|
if((ui_is_focus_active() || (window_is_focused && !ui_any_ctx_menu_is_open() && !ws->menu_bar_focused && !ws->query_view_selected)) &&
|
||||||
ui_key_press(0, OS_Key_Esc))
|
ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
DF_CmdParams params = df_cmd_params_from_window(ws);
|
DF_CmdParams params = df_cmd_params_from_window(ws);
|
||||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CancelQuery));
|
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CancelQuery));
|
||||||
}
|
}
|
||||||
if(ui_is_focus_active())
|
if(ui_is_focus_active())
|
||||||
{
|
{
|
||||||
if(ui_key_press(0, OS_Key_Return))
|
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
DF_View *view = ws->query_view_stack_top;
|
DF_View *view = ws->query_view_stack_top;
|
||||||
@@ -5621,6 +5644,10 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
ui_build_box_from_key(UI_BoxFlag_DrawBackground, ui_key_zero());
|
ui_build_box_from_key(UI_BoxFlag_DrawBackground, ui_key_zero());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ws->query_view_selected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: build hover eval
|
//- rjf: build hover eval
|
||||||
@@ -6507,7 +6534,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
DF_View *view = df_view_from_handle(panel->selected_tab_view);
|
DF_View *view = df_view_from_handle(panel->selected_tab_view);
|
||||||
UI_Focus(UI_FocusKind_On)
|
UI_Focus(UI_FocusKind_On)
|
||||||
{
|
{
|
||||||
if(view->is_filtering && ui_is_focus_active() && ui_key_press(0, OS_Key_Return))
|
if(view->is_filtering && ui_is_focus_active() && ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
||||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ApplyFilter));
|
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ApplyFilter));
|
||||||
@@ -6745,7 +6772,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((view->query_string_size != 0 || view->is_filtering) && ui_is_focus_active() && ui_key_press(0, OS_Key_Esc))
|
if((view->query_string_size != 0 || view->is_filtering) && ui_is_focus_active() && ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
||||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ClearFilter));
|
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_ClearFilter));
|
||||||
@@ -7316,7 +7343,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: drag/drop cancelling
|
//- rjf: drag/drop cancelling
|
||||||
//
|
//
|
||||||
if(df_drag_is_active() && ui_key_press(0, OS_Key_Esc))
|
if(df_drag_is_active() && ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
df_drag_kill();
|
df_drag_kill();
|
||||||
ui_kill_action();
|
ui_kill_action();
|
||||||
@@ -7399,7 +7426,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- rjf: hover eval cancelling
|
//- rjf: hover eval cancelling
|
||||||
//
|
//
|
||||||
if(ws->hover_eval_string.size != 0 && ui_key_press(0, OS_Key_Esc))
|
if(ws->hover_eval_string.size != 0 && ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
MemoryZeroStruct(&ws->hover_eval_string);
|
MemoryZeroStruct(&ws->hover_eval_string);
|
||||||
arena_clear(ws->hover_eval_arena);
|
arena_clear(ws->hover_eval_arena);
|
||||||
@@ -12423,7 +12450,7 @@ df_line_edit(DF_LineEditFlags flags, S32 depth, FuzzyMatchRangeList *matches, Tx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(is_focus_hot && ui_key_press(0, OS_Key_F2))
|
if(is_focus_hot && ui_slot_press(UI_EventActionSlot_Edit))
|
||||||
{
|
{
|
||||||
start_editing_via_typing = 1;
|
start_editing_via_typing = 1;
|
||||||
}
|
}
|
||||||
@@ -13636,6 +13663,31 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
|
|||||||
df_bind_spec(cmd_spec, pair->binding);
|
df_bind_spec(cmd_spec, pair->binding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- rjf: always ensure that the meta controls have bindings
|
||||||
|
if(src == DF_CfgSrc_User)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
DF_CmdSpec *spec;
|
||||||
|
OS_Key fallback_key;
|
||||||
|
}
|
||||||
|
meta_ctrls[] =
|
||||||
|
{
|
||||||
|
{ df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Edit), OS_Key_F2 },
|
||||||
|
{ df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Accept), OS_Key_Return },
|
||||||
|
{ df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Cancel), OS_Key_Esc },
|
||||||
|
};
|
||||||
|
for(U64 idx = 0; idx < ArrayCount(meta_ctrls); idx += 1)
|
||||||
|
{
|
||||||
|
DF_BindingList bindings = df_bindings_from_spec(scratch.arena, meta_ctrls[idx].spec);
|
||||||
|
if(bindings.count == 0)
|
||||||
|
{
|
||||||
|
DF_Binding binding = {meta_ctrls[idx].fallback_key, 0};
|
||||||
|
df_bind_spec(meta_ctrls[idx].spec, binding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
//- rjf: writing config changes
|
//- rjf: writing config changes
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ DF_DefaultBindingTable:
|
|||||||
{ "load_user" O ctrl shift alt }
|
{ "load_user" O ctrl shift alt }
|
||||||
{ "load_profile" O ctrl 0 alt }
|
{ "load_profile" O ctrl 0 alt }
|
||||||
|
|
||||||
|
//- rjf: meta controls
|
||||||
|
{ "edit" F2 0 0 0 }
|
||||||
|
{ "accept" Return 0 0 0 }
|
||||||
|
{ "cancel" Esc 0 0 0 }
|
||||||
|
|
||||||
//- rjf: directional movement & text controls
|
//- rjf: directional movement & text controls
|
||||||
{ "move_left" Left 0 0 0 }
|
{ "move_left" Left 0 0 0 }
|
||||||
{ "move_right" Right 0 0 0 }
|
{ "move_right" Right 0 0 0 }
|
||||||
|
|||||||
+52
-25
@@ -504,7 +504,7 @@ df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalView *ev, TG_Graph
|
|||||||
default:{}break;
|
default:{}break;
|
||||||
case DF_WatchViewColumnKind_Expr: {result = editable ? row->edit_expr : row->display_expr;}break;
|
case DF_WatchViewColumnKind_Expr: {result = editable ? row->edit_expr : row->display_expr;}break;
|
||||||
case DF_WatchViewColumnKind_Value: {result = editable ? row->edit_value : row->display_value;}break;
|
case DF_WatchViewColumnKind_Value: {result = editable ? row->edit_value : row->display_value;}break;
|
||||||
case DF_WatchViewColumnKind_Type: {result = tg_string_from_key(arena, graph, rdi, row->eval.type_key);}break;
|
case DF_WatchViewColumnKind_Type: {result = !tg_key_match(row->eval.type_key, tg_key_zero()) ? tg_string_from_key(arena, graph, rdi, row->eval.type_key) : str8_zero();}break;
|
||||||
case DF_WatchViewColumnKind_ViewRule:{result = df_eval_view_rule_from_key(ev, row->key);}break;
|
case DF_WatchViewColumnKind_ViewRule:{result = df_eval_view_rule_from_key(ev, row->key);}break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1023,7 +1023,8 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
if(!ewv->text_editing &&
|
if(!ewv->text_editing &&
|
||||||
(evt->kind == UI_EventKind_Text ||
|
(evt->kind == UI_EventKind_Text ||
|
||||||
evt->flags & UI_EventFlag_Paste ||
|
evt->flags & UI_EventFlag_Paste ||
|
||||||
(evt->kind == UI_EventKind_Press && (evt->key == OS_Key_Return || evt->key == OS_Key_F2))))
|
(evt->kind == UI_EventKind_Press && (evt->slot == UI_EventActionSlot_Accept || evt->slot == UI_EventActionSlot_Edit))) &&
|
||||||
|
selection_tbl.min.x == selection_tbl.max.x)
|
||||||
{
|
{
|
||||||
Vec2S64 selection_dim = dim_2s64(selection_tbl);
|
Vec2S64 selection_dim = dim_2s64(selection_tbl);
|
||||||
ewv->text_editing = 1;
|
ewv->text_editing = 1;
|
||||||
@@ -1062,7 +1063,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
//
|
//
|
||||||
if(ewv->text_editing)
|
if(ewv->text_editing)
|
||||||
{
|
{
|
||||||
B32 editing_complete = ((evt->kind == UI_EventKind_Press && (evt->key == OS_Key_Esc || evt->key == OS_Key_Return)) ||
|
B32 editing_complete = ((evt->kind == UI_EventKind_Press && (evt->slot == UI_EventActionSlot_Cancel || evt->slot == UI_EventActionSlot_Accept)) ||
|
||||||
(evt->kind == UI_EventKind_Navigate && evt->delta_2s32.y != 0));
|
(evt->kind == UI_EventKind_Navigate && evt->delta_2s32.y != 0));
|
||||||
if(editing_complete ||
|
if(editing_complete ||
|
||||||
((evt->kind == UI_EventKind_Edit ||
|
((evt->kind == UI_EventKind_Edit ||
|
||||||
@@ -1096,7 +1097,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: cancel? -> revert to initial string
|
// rjf: cancel? -> revert to initial string
|
||||||
if(editing_complete && evt->key == OS_Key_Esc)
|
if(editing_complete && evt->slot == UI_EventActionSlot_Cancel)
|
||||||
{
|
{
|
||||||
string = str8(edit_state->initial_buffer, edit_state->initial_size);
|
string = str8(edit_state->initial_buffer, edit_state->initial_size);
|
||||||
}
|
}
|
||||||
@@ -1137,7 +1138,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case DF_WatchViewColumnKind_Value:
|
case DF_WatchViewColumnKind_Value:
|
||||||
if(editing_complete)
|
if(editing_complete && evt->slot != UI_EventActionSlot_Cancel)
|
||||||
{
|
{
|
||||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||||
r1s64(ui_scroll_list_row_from_item(&row_blocks, y-1),
|
r1s64(ui_scroll_list_row_from_item(&row_blocks, y-1),
|
||||||
@@ -1190,7 +1191,13 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1)
|
for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1)
|
||||||
{
|
{
|
||||||
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);
|
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);
|
||||||
str8_list_pushf(scratch.arena, &strs, "%S%s", cell_string, x+1 <= selection_tbl.max.x ? " " : "");
|
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(y+1 <= selection_tbl.max.y)
|
if(y+1 <= selection_tbl.max.y)
|
||||||
{
|
{
|
||||||
@@ -1201,12 +1208,33 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
|||||||
os_set_clipboard_text(string);
|
os_set_clipboard_text(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//- rjf: [table] do cell-granularity expansions
|
||||||
|
//
|
||||||
|
if(!ewv->text_editing && evt->slot == UI_EventActionSlot_Accept && selection_tbl.min.x <= 0)
|
||||||
|
{
|
||||||
|
taken = 1;
|
||||||
|
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||||
|
r1s64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y-1),
|
||||||
|
ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y-1)+1), &blocks);
|
||||||
|
DF_EvalVizRow *row = rows.first;
|
||||||
|
for(S64 y = selection_tbl.min.y; y <= selection_tbl.max.y && row != 0; y += 1, row = row->next)
|
||||||
|
{
|
||||||
|
if(row->flags & DF_EvalVizRowFlag_CanExpand)
|
||||||
|
{
|
||||||
|
B32 is_expanded = df_expand_key_is_set(&eval_view->expand_tree_table, row->key);
|
||||||
|
df_expand_set_expansion(eval_view->arena, &eval_view->expand_tree_table, row->parent_key, row->key, !is_expanded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
//- rjf: [table] do cell-granularity deletions
|
//- rjf: [table] do cell-granularity deletions
|
||||||
//
|
//
|
||||||
if(!ewv->text_editing && evt->flags & UI_EventFlag_Delete)
|
if(!ewv->text_editing && evt->flags & UI_EventFlag_Delete)
|
||||||
{
|
{
|
||||||
taken = 1;
|
taken = 1;
|
||||||
|
state_dirty = 1;
|
||||||
for(S64 y = selection_tbl.min.y; y <= selection_tbl.max.y; y += 1)
|
for(S64 y = selection_tbl.min.y; y <= selection_tbl.max.y; y += 1)
|
||||||
{
|
{
|
||||||
DF_WatchViewPoint pt = df_watch_view_point_from_tbl(&blocks, v2s64(0, y));
|
DF_WatchViewPoint pt = df_watch_view_point_from_tbl(&blocks, v2s64(0, y));
|
||||||
@@ -2405,7 +2433,7 @@ DF_VIEW_UI_FUNCTION_DEF(Commands)
|
|||||||
df_cmd_lister_item_array_sort_by_strength__in_place(cmd_array);
|
df_cmd_lister_item_array_sort_by_strength__in_place(cmd_array);
|
||||||
|
|
||||||
//- rjf: submit best match when hitting enter w/ no selection
|
//- rjf: submit best match when hitting enter w/ no selection
|
||||||
if(cv->selected_cmd_spec == &df_g_nil_cmd_spec && ui_key_press(0, OS_Key_Return))
|
if(cv->selected_cmd_spec == &df_g_nil_cmd_spec && ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||||
if(cmd_array.count > 0)
|
if(cmd_array.count > 0)
|
||||||
@@ -2750,7 +2778,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: submit best match when hitting enter w/ no selection
|
//- rjf: submit best match when hitting enter w/ no selection
|
||||||
if(ps->cursor.y == 0 && ui_key_press(0, OS_Key_Return))
|
if(ps->cursor.y == 0 && ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
FileProperties query_normalized_with_opt_slash_props = os_properties_from_file_path(query_normalized_with_opt_slash);
|
FileProperties query_normalized_with_opt_slash_props = os_properties_from_file_path(query_normalized_with_opt_slash);
|
||||||
FileProperties path_query_path_props = os_properties_from_file_path(path_query.path);
|
FileProperties path_query_path_props = os_properties_from_file_path(path_query.path);
|
||||||
@@ -3095,7 +3123,7 @@ DF_VIEW_UI_FUNCTION_DEF(SystemProcesses)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: submit best match when hitting enter w/ no selection
|
//- rjf: submit best match when hitting enter w/ no selection
|
||||||
if(sp->selected_pid == 0 && process_info_array.count > 0 && ui_key_press(0, OS_Key_Return))
|
if(sp->selected_pid == 0 && process_info_array.count > 0 && ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
DF_ProcessInfo *info = &process_info_array.v[0];
|
DF_ProcessInfo *info = &process_info_array.v[0];
|
||||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||||
@@ -3257,7 +3285,7 @@ DF_VIEW_UI_FUNCTION_DEF(EntityLister)
|
|||||||
df_entity_lister_item_array_sort_by_strength__in_place(ent_arr);
|
df_entity_lister_item_array_sort_by_strength__in_place(ent_arr);
|
||||||
|
|
||||||
//- rjf: submit best match when hitting enter w/ no selection
|
//- rjf: submit best match when hitting enter w/ no selection
|
||||||
if(df_entity_is_nil(df_entity_from_handle(fev->selected_entity_handle)) && ent_arr.count != 0 && ui_key_press(0, OS_Key_Return))
|
if(df_entity_is_nil(df_entity_from_handle(fev->selected_entity_handle)) && ent_arr.count != 0 && ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
DF_Entity *ent = ent_arr.v[0].entity;
|
DF_Entity *ent = ent_arr.v[0].entity;
|
||||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||||
@@ -3415,7 +3443,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: submit best match when hitting enter w/ no selection
|
//- rjf: submit best match when hitting enter w/ no selection
|
||||||
if(slv->cursor.y == 0 && items.count != 0 && ui_key_press(0, OS_Key_Return))
|
if(slv->cursor.y == 0 && items.count != 0 && ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
RDI_Procedure *procedure = rdi_element_from_idx(rdi, procedures, items.v[0].idx);
|
RDI_Procedure *procedure = rdi_element_from_idx(rdi, procedures, items.v[0].idx);
|
||||||
U64 name_size = 0;
|
U64 name_size = 0;
|
||||||
@@ -3629,23 +3657,23 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_F2))
|
if(ui_slot_press(UI_EventActionSlot_Edit))
|
||||||
{
|
{
|
||||||
edit_begin = 1;
|
edit_begin = 1;
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_Return))
|
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
edit_begin = 1;
|
edit_begin = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tv->input_editing)
|
if(tv->input_editing)
|
||||||
{
|
{
|
||||||
if(ui_key_press(0, OS_Key_Esc))
|
if(ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 0;
|
edit_commit = 0;
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_Return))
|
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 1;
|
edit_commit = 1;
|
||||||
@@ -4114,19 +4142,19 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_F2))
|
if(ui_slot_press(UI_EventActionSlot_Edit))
|
||||||
{
|
{
|
||||||
edit_begin = 1;
|
edit_begin = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fpms->input_editing)
|
if(fpms->input_editing)
|
||||||
{
|
{
|
||||||
if(ui_key_press(0, OS_Key_Esc))
|
if(ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 0;
|
edit_commit = 0;
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_Return))
|
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 1;
|
edit_commit = 1;
|
||||||
@@ -4437,19 +4465,19 @@ DF_VIEW_UI_FUNCTION_DEF(AutoViewRules)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_F2))
|
if(ui_slot_press(UI_EventActionSlot_Edit))
|
||||||
{
|
{
|
||||||
edit_begin = 1;
|
edit_begin = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(avrs->input_editing)
|
if(avrs->input_editing)
|
||||||
{
|
{
|
||||||
if(ui_key_press(0, OS_Key_Esc))
|
if(ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 0;
|
edit_commit = 0;
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_Return))
|
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 1;
|
edit_commit = 1;
|
||||||
@@ -5269,20 +5297,19 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_F2) ||
|
if(ui_slot_press(UI_EventActionSlot_Edit))
|
||||||
ui_key_press(0, OS_Key_Return))
|
|
||||||
{
|
{
|
||||||
edit_begin = 1;
|
edit_begin = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mv->txt_editing && ui_is_focus_active())
|
if(mv->txt_editing && ui_is_focus_active())
|
||||||
{
|
{
|
||||||
if(ui_key_press(0, OS_Key_Esc))
|
if(ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 0;
|
edit_commit = 0;
|
||||||
}
|
}
|
||||||
if(ui_key_press(0, OS_Key_Return))
|
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||||
{
|
{
|
||||||
edit_end = 1;
|
edit_end = 1;
|
||||||
edit_commit = 1;
|
edit_commit = 1;
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ str8_lit_comp("goto_name"),
|
|||||||
str8_lit_comp("function_breakpoint"),
|
str8_lit_comp("function_breakpoint"),
|
||||||
};
|
};
|
||||||
|
|
||||||
DF_StringBindingPair df_g_default_binding_table[99] =
|
DF_StringBindingPair df_g_default_binding_table[102] =
|
||||||
{
|
{
|
||||||
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_EventFlag_Shift }},
|
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_EventFlag_Shift }},
|
||||||
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_EventFlag_Alt}},
|
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_EventFlag_Alt}},
|
||||||
@@ -644,6 +644,9 @@ DF_StringBindingPair df_g_default_binding_table[99] =
|
|||||||
{str8_lit_comp("switch_to_partner_file"), {OS_Key_O, 0 |OS_EventFlag_Alt}},
|
{str8_lit_comp("switch_to_partner_file"), {OS_Key_O, 0 |OS_EventFlag_Alt}},
|
||||||
{str8_lit_comp("load_user"), {OS_Key_O, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Shift |OS_EventFlag_Alt}},
|
{str8_lit_comp("load_user"), {OS_Key_O, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Shift |OS_EventFlag_Alt}},
|
||||||
{str8_lit_comp("load_profile"), {OS_Key_O, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Alt}},
|
{str8_lit_comp("load_profile"), {OS_Key_O, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Alt}},
|
||||||
|
{str8_lit_comp("edit"), {OS_Key_F2, 0 }},
|
||||||
|
{str8_lit_comp("accept"), {OS_Key_Return, 0 }},
|
||||||
|
{str8_lit_comp("cancel"), {OS_Key_Esc, 0 }},
|
||||||
{str8_lit_comp("move_left"), {OS_Key_Left, 0 }},
|
{str8_lit_comp("move_left"), {OS_Key_Left, 0 }},
|
||||||
{str8_lit_comp("move_right"), {OS_Key_Right, 0 }},
|
{str8_lit_comp("move_right"), {OS_Key_Right, 0 }},
|
||||||
{str8_lit_comp("move_up"), {OS_Key_Up, 0 }},
|
{str8_lit_comp("move_up"), {OS_Key_Up, 0 }},
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ extern Vec4F32* df_g_theme_preset_colors_table[9];
|
|||||||
extern DF_CmdParamSlot df_g_cmd_param_slot_2_view_spec_src_map[7];
|
extern DF_CmdParamSlot df_g_cmd_param_slot_2_view_spec_src_map[7];
|
||||||
extern String8 df_g_cmd_param_slot_2_view_spec_dst_map[7];
|
extern String8 df_g_cmd_param_slot_2_view_spec_dst_map[7];
|
||||||
extern String8 df_g_cmd_param_slot_2_view_spec_cmd_map[7];
|
extern String8 df_g_cmd_param_slot_2_view_spec_cmd_map[7];
|
||||||
extern DF_StringBindingPair df_g_default_binding_table[99];
|
extern DF_StringBindingPair df_g_default_binding_table[102];
|
||||||
extern String8 df_g_binding_version_remap_old_name_table[3];
|
extern String8 df_g_binding_version_remap_old_name_table[3];
|
||||||
extern String8 df_g_binding_version_remap_new_name_table[3];
|
extern String8 df_g_binding_version_remap_new_name_table[3];
|
||||||
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
|
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
|
|||||||
event->key != OS_Key_Delete &&
|
event->key != OS_Key_Delete &&
|
||||||
event->key != OS_Key_LeftMouseButton &&
|
event->key != OS_Key_LeftMouseButton &&
|
||||||
event->key != OS_Key_RightMouseButton &&
|
event->key != OS_Key_RightMouseButton &&
|
||||||
|
event->key != OS_Key_MiddleMouseButton &&
|
||||||
event->key != OS_Key_Ctrl &&
|
event->key != OS_Key_Ctrl &&
|
||||||
event->key != OS_Key_Alt &&
|
event->key != OS_Key_Alt &&
|
||||||
event->key != OS_Key_Shift)
|
event->key != OS_Key_Shift)
|
||||||
|
|||||||
+20
-3
@@ -582,6 +582,23 @@ ui_text(U32 character)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal B32
|
||||||
|
ui_slot_press(UI_EventActionSlot slot)
|
||||||
|
{
|
||||||
|
UI_EventList *list = ui_events();
|
||||||
|
B32 result = 0;
|
||||||
|
for(UI_EventNode *n = list->first; n != 0; n = n->next)
|
||||||
|
{
|
||||||
|
if(n->v.kind == UI_EventKind_Press && n->v.slot == slot)
|
||||||
|
{
|
||||||
|
result = 1;
|
||||||
|
ui_eat_event(list, n);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: drag data
|
//- rjf: drag data
|
||||||
|
|
||||||
internal Vec2F32
|
internal Vec2F32
|
||||||
@@ -926,7 +943,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, F
|
|||||||
//- rjf: some child has the active focus -> accept escape keys to pop from the active key stack
|
//- rjf: some child has the active focus -> accept escape keys to pop from the active key stack
|
||||||
if(!ui_key_match(ui_key_zero(), nav_root->default_nav_focus_active_key))
|
if(!ui_key_match(ui_key_zero(), nav_root->default_nav_focus_active_key))
|
||||||
{
|
{
|
||||||
for(;ui_key_press(0, OS_Key_Esc);)
|
for(;ui_slot_press(UI_EventActionSlot_Cancel);)
|
||||||
{
|
{
|
||||||
UI_Box *prev_focus_root = nav_root;
|
UI_Box *prev_focus_root = nav_root;
|
||||||
for(UI_Box *focus_root = ui_box_from_key(nav_root->default_nav_focus_active_key);
|
for(UI_Box *focus_root = ui_box_from_key(nav_root->default_nav_focus_active_key);
|
||||||
@@ -1074,7 +1091,7 @@ ui_end_build(void)
|
|||||||
ProfBeginFunction();
|
ProfBeginFunction();
|
||||||
|
|
||||||
//- rjf: escape -> close context menu
|
//- rjf: escape -> close context menu
|
||||||
if(ui_state->ctx_menu_open != 0 && ui_key_press(0, OS_Key_Esc))
|
if(ui_state->ctx_menu_open != 0 && ui_slot_press(UI_EventActionSlot_Cancel))
|
||||||
{
|
{
|
||||||
ui_ctx_menu_close();
|
ui_ctx_menu_close();
|
||||||
}
|
}
|
||||||
@@ -2561,7 +2578,7 @@ ui_signal_from_box(UI_Box *box)
|
|||||||
if(box->flags & UI_BoxFlag_KeyboardClickable &&
|
if(box->flags & UI_BoxFlag_KeyboardClickable &&
|
||||||
is_focus_hot &&
|
is_focus_hot &&
|
||||||
evt->kind == UI_EventKind_Press &&
|
evt->kind == UI_EventKind_Press &&
|
||||||
evt->key == OS_Key_Return)
|
evt->slot == UI_EventActionSlot_Accept)
|
||||||
{
|
{
|
||||||
sig.f |= UI_SignalFlag_KeyboardPressed;
|
sig.f |= UI_SignalFlag_KeyboardPressed;
|
||||||
taken = 1;
|
taken = 1;
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ UI_FocusKind;
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Events
|
//~ rjf: Events
|
||||||
|
|
||||||
|
// TODO(rjf): clean all this up
|
||||||
|
|
||||||
typedef enum UI_EventKind
|
typedef enum UI_EventKind
|
||||||
{
|
{
|
||||||
UI_EventKind_Null,
|
UI_EventKind_Null,
|
||||||
@@ -74,6 +76,16 @@ typedef enum UI_EventKind
|
|||||||
}
|
}
|
||||||
UI_EventKind;
|
UI_EventKind;
|
||||||
|
|
||||||
|
typedef enum UI_EventActionSlot
|
||||||
|
{
|
||||||
|
UI_EventActionSlot_Null,
|
||||||
|
UI_EventActionSlot_Accept,
|
||||||
|
UI_EventActionSlot_Cancel,
|
||||||
|
UI_EventActionSlot_Edit,
|
||||||
|
UI_EventActionSlot_COUNT
|
||||||
|
}
|
||||||
|
UI_EventActionSlot;
|
||||||
|
|
||||||
typedef U32 UI_EventFlags;
|
typedef U32 UI_EventFlags;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -103,6 +115,7 @@ typedef struct UI_Event UI_Event;
|
|||||||
struct UI_Event
|
struct UI_Event
|
||||||
{
|
{
|
||||||
UI_EventKind kind;
|
UI_EventKind kind;
|
||||||
|
UI_EventActionSlot slot;
|
||||||
UI_EventFlags flags;
|
UI_EventFlags flags;
|
||||||
UI_EventDeltaUnit delta_unit;
|
UI_EventDeltaUnit delta_unit;
|
||||||
OS_Key key;
|
OS_Key key;
|
||||||
@@ -641,6 +654,7 @@ internal F32 ui_dt(void);
|
|||||||
internal B32 ui_key_press(OS_EventFlags mods, OS_Key key);
|
internal B32 ui_key_press(OS_EventFlags mods, OS_Key key);
|
||||||
internal B32 ui_key_release(OS_EventFlags mods, OS_Key key);
|
internal B32 ui_key_release(OS_EventFlags mods, OS_Key key);
|
||||||
internal B32 ui_text(U32 character);
|
internal B32 ui_text(U32 character);
|
||||||
|
internal B32 ui_slot_press(UI_EventActionSlot slot);
|
||||||
|
|
||||||
//- rjf: drag data
|
//- rjf: drag data
|
||||||
internal Vec2F32 ui_drag_start_mouse(void);
|
internal Vec2F32 ui_drag_start_mouse(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user