tooltip coverage for all command evaluations, major top-bar simplification, anchored tooltips

This commit is contained in:
Ryan Fleury
2025-05-01 14:09:05 -07:00
parent e3f68622f7
commit b20f003e7f
7 changed files with 144 additions and 242 deletions
File diff suppressed because one or more lines are too long
+21 -11
View File
@@ -286,6 +286,16 @@ RD_VocabTable:
x:
{
@default(2) @display_name('Project Tab Width') 'tab_width': @range[1, 32] u64,
//- rjf: theme
@display_name('Project Theme Preset') @description("The selected built-in project theme preset.")
'theme_preset': string,
@no_expand @display_name('Project Theme File') @description("The path from which project's theme data is loaded, overriding the preset.")
'theme_file': path,
@display_name('Project Theme Colors') @description("Additional theme colors which are applied on top of the project's theme file or preset.")
'theme_colors': query,
//- rjf: exception settings
@default(1) @display_name("Break On Win32 Control-C Exceptions") @description("Code: 0x40010005")
win32_ctrl_c: bool;
@default(1) @display_name("Break On Win32 Control-Break Exceptions") @description("Code: 0x40010008")
@@ -756,8 +766,8 @@ RD_CmdTable: // | | | |
{SelectUnwind 0 1 0 0 "query:call_stack" Null null Nil Null 0 0 0 0 0 0 0 Null "select_unwind" "Select Unwind" "Selects an unwind frame number for the selected thread." "" "" }
{UpOneFrame 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 UpArrow "up_one_frame" "Up One Frame" "Selects the call stack frame above the currently selected." "" "" }
{DownOneFrame 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 DownArrow "down_one_frame" "Down One Frame" "Selects the call stack frame below the currently selected." "callstack,unwind" "" }
{SelectEntity 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioHollow "select_entity" "Select Entity" "Selects a control entity." "" "" }
{DeselectEntity 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioFilled "deselect_entity" "Deselect Entity" "Deselects a control entity." "" "" }
{SelectEntity 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioHollow "select_entity" "Select" "Selects a control entity." "" "" }
{DeselectEntity 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioFilled "deselect_entity" "Deselect" "Deselects a control entity." "" "" }
//- rjf: font sizes
{IncWindowFontSize 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "inc_window_font_size" "Increase Window Font Size" "Increases the window's font size by one point." "" "" }
@@ -924,15 +934,15 @@ RD_CmdTable: // | | | |
{ToggleWatchExpressionAtMouse 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Binoculars "toggle_watch_expr_at_mouse" "Toggle Watch Expression At Mouse" "Adds or removes the expression that the mouse is currently over to an opened watch view." "" "" }
//- rjf: general config operations
{EnableCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CheckHollow "enable_cfg" "Enable Config Tree" "Enables a config tree." "" "" }
{DisableCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CheckFilled "disable_cfg" "Disable Config Tree" "Disables a config tree." "" "" }
{SelectCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioHollow "select_cfg" "Select Config Tree" "Selects a config tree, disabling all others of the same kind." "" "" }
{DeselectCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioFilled "deselect_cfg" "Deselect Config Tree" "Deselects a config tree." "" "" }
{RemoveCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Trash "remove_cfg" "Remove Config Tree" "Removes a config tree." "" "" }
{NameCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "name_cfg" "Name Config Tree" "Equips a config tree with a label." "" "" }
{ConditionCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "condition_cfg" "Condition Config Tree" "Equips a config tree with a condition string." "" "" }
{DuplicateCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Duplicate "duplicate_cfg" "Duplicate Config Tree" "Duplicates a config tree." "" "" }
{RelocateCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "relocate_cfg" "Relocate Config Tree" "Relocates a config tree." "" "" }
{EnableCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CheckHollow "enable_cfg" "Enable" "Enables a config tree." "" "" }
{DisableCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CheckFilled "disable_cfg" "Disable" "Disables a config tree." "" "" }
{SelectCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioHollow "select_cfg" "Select" "Selects a config tree, disabling all others of the same kind." "" "" }
{DeselectCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 RadioFilled "deselect_cfg" "Deselect" "Deselects a config tree." "" "" }
{RemoveCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Trash "remove_cfg" "Remove" "Removes a config tree." "" "" }
{NameCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "name_cfg" "Name" "Equips a config tree with a label." "" "" }
{ConditionCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "condition_cfg" "Condition" "Equips a config tree with a condition string." "" "" }
{DuplicateCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Duplicate "duplicate_cfg" "Duplicate" "Duplicates a config tree." "" "" }
{RelocateCfg 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Null "relocate_cfg" "Relocate" "Relocates a config tree." "" "" }
//- rjf: breakpoints
{AddBreakpoint 1 1 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 CircleFilled "add_breakpoint" "Add Breakpoint" "Places a breakpoint at a given location (file path and line number, address, or symbol name)." "" "" }
+59 -187
View File
@@ -2780,7 +2780,7 @@ rd_view_ui(Rng2F32 rect)
UI_Padding(ui_pct(1, 0))
{
ui_labelf("use");
UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenPalette].string, str8_zero());
UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenPalette].string, str8_zero(), 1);
ui_labelf("to search for commands and options");
}
}
@@ -4979,6 +4979,12 @@ rd_view_ui(Rng2F32 rect)
RD_RegsScope(.ctrl_entity = cell_info.entity->handle, .no_rich_tooltip = 1) rd_set_hover_regs(RD_RegSlot_CtrlEntity);
}
// rjf: hover -> rich hover commands (mini only)
if(ui_hovering(sig) && cell_info.cmd_name.size != 0 && cell->px != 0)
{
RD_RegsScope(.cmd_name = cell_info.cmd_name, .ui_key = sig.box->key) rd_set_hover_regs(RD_RegSlot_CmdName);
}
// rjf: dragging -> drag/drop
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()) &&
(!cell_selected || !ewv->text_editing))
@@ -6135,10 +6141,28 @@ rd_window_frame(void)
RD_RegSlot slot = ((rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()) ? rd_state->drag_drop_regs_slot : rd_state->hover_regs_slot);
RD_Regs *regs = (((rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()) ? rd_state->drag_drop_regs : rd_state->hover_regs));
CTRL_Entity *ctrl_entity = &ctrl_entity_nil;
ui_state->tooltip_anchor_key = regs->ui_key;
ui_state->tooltip_can_overflow_window = rd_drag_is_active();
switch(slot)
{
default:{}break;
////////////////////////
//- rjf: command tooltips
//
case RD_RegSlot_CmdName:
UI_Tooltip
{
String8 cmd_name = regs->cmd_name;
DR_FStrList fstrs = rd_title_fstrs_from_code_name(scratch.arena, cmd_name);
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(5, 1))
{
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
ui_box_equip_display_fstrs(box, &fstrs);
rd_cmd_binding_buttons(cmd_name, str8_zero(), 0);
}
}break;
////////////////////////
//- rjf: file path tooltips
//
@@ -6294,13 +6318,16 @@ rd_window_frame(void)
UI_Row
{
rd_code_label(1.f, 0, ui_color_from_name(str8_lit("text")), rd_state->drag_drop_regs->expr);
ui_spacer(ui_em(2.f, 1.f));
E_Eval eval = e_eval_from_string(rd_state->drag_drop_regs->expr);
if(eval.irtree.mode != E_Mode_Null)
{
EV_StringParams string_params = {.flags = EV_StringFlag_ReadOnlyDisplayRules, .radix = 10};
String8 value_string = rd_value_string_from_eval(scratch.arena, str8_zero(), &string_params, ui_top_font(), ui_top_font_size(), ui_top_font_size()*20.f, eval);
rd_code_label(1.f, 0, ui_color_from_name(str8_lit("text")), value_string);
if(value_string.size != 0)
{
ui_spacer(ui_em(2.f, 1.f));
rd_code_label(1.f, 0, ui_color_from_name(str8_lit("text")), value_string);
}
}
}
}break;
@@ -6584,6 +6611,7 @@ rd_window_frame(void)
UI_Focus(UI_FocusKind_On)
UI_BlurSize(10*rd_state->popup_t)
UI_Transparency(1-rd_state->popup_t)
UI_TagF("floating")
{
bg_box = ui_build_box_from_stringf(UI_BoxFlag_FixedSize|
UI_BoxFlag_Floating|
@@ -6591,7 +6619,8 @@ rd_window_frame(void)
UI_BoxFlag_Scroll|
UI_BoxFlag_DefaultFocusNav|
UI_BoxFlag_DisableFocusOverlay|
UI_BoxFlag_DrawBackgroundBlur, "###popup_%p", ws);
UI_BoxFlag_DrawBackgroundBlur|
UI_BoxFlag_DrawBackground, "###popup_%p", ws);
}
if(rd_state->popup_active) UI_Parent(bg_box) UI_Transparency(1-rd_state->popup_t)
{
@@ -7420,7 +7449,7 @@ rd_window_frame(void)
ui_labelf("Search for commands and options by pressing ");
UI_Flags(UI_BoxFlag_DrawBorder)
UI_TextAlignment(UI_TextAlign_Center)
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenPalette].string, str8_zero());
rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenPalette].string, str8_zero(), 1);
}
ui_spacer(ui_em(1.f, 1.f));
UI_TagF("pop")
@@ -7577,198 +7606,41 @@ rd_window_frame(void)
Temp scratch = scratch_begin(0, 0);
RD_CfgList targets = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("target"));
CTRL_EntityArray processes = ctrl_entity_array_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
B32 have_targets = (targets.count != 0);
B32 can_send_signal = !d_ctrl_targets_running();
B32 can_play = (have_targets && (can_send_signal || d_ctrl_last_run_frame_idx()+4 > d_frame_index()));
B32 can_pause = (!can_send_signal);
B32 can_stop = (processes.count != 0);
B32 can_step = (processes.count != 0 && can_send_signal);
//- rjf: play button
if(can_play || !have_targets || processes.count == 0)
UI_TextAlignment(UI_TextAlign_Center)
UI_Flags((can_play ? 0 : UI_BoxFlag_Disabled))
UI_TagF(can_play ? "good" : "weak")
typedef struct CenterButtonTask CenterButtonTask;
struct CenterButtonTask
{
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_Play]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
if(ui_hovering(sig) && !can_play)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Disabled: %s", have_targets ? "Targets are currently running" : "No active targets exist");
}
if(ui_hovering(sig) && can_play)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
{
if(can_stop)
{
ui_labelf("Resume all processes");
}
else
{
ui_labelf("Launch all active targets:");
for(RD_CfgNode *n = targets.first; n != 0; n = n->next)
{
RD_Cfg *target = n->v;
B32 target_is_enabled = !rd_disabled_from_cfg(target);
if(target_is_enabled)
{
DR_FStrList title_fstrs = rd_title_fstrs_from_cfg(ui_build_arena(), target);
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
ui_box_equip_display_fstrs(box, &title_fstrs);
}
}
}
}
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_Run);
}
}
//- rjf: restart button
else UI_TextAlignment(UI_TextAlign_Center)
UI_TagF("good")
String8 cmd_name;
String8 tag;
B32 is_enabled;
};
CenterButtonTask center_button_tasks[] =
{
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_Redo]);
{rd_cmd_kind_info_table[RD_CmdKind_Run].string, str8_lit("good"), (can_send_signal || d_ctrl_last_run_frame_idx()+4 > d_frame_index())},
{rd_cmd_kind_info_table[RD_CmdKind_Restart].string, str8_lit("good"), processes.count != 0},
{rd_cmd_kind_info_table[RD_CmdKind_Halt].string, str8_lit("weak"), !can_send_signal},
{rd_cmd_kind_info_table[RD_CmdKind_KillAll].string, str8_lit("bad"), processes.count != 0},
{rd_cmd_kind_info_table[RD_CmdKind_StepOver].string, str8_lit("weak"), can_send_signal},
{rd_cmd_kind_info_table[RD_CmdKind_StepInto].string, str8_lit("weak"), can_send_signal},
{rd_cmd_kind_info_table[RD_CmdKind_StepOut].string, str8_lit("weak"), processes.count != 0 && can_send_signal},
};
UI_TextAlignment(UI_TextAlign_Center)
for EachElement(idx, center_button_tasks)
UI_Flags(center_button_tasks[idx].is_enabled ? 0 : UI_BoxFlag_Disabled)
UI_Tag(center_button_tasks[idx].is_enabled ? center_button_tasks[idx].tag : str8_lit(""))
{
String8 cmd_name = center_button_tasks[idx].cmd_name;
UI_Signal sig = ui_button(rd_icon_kind_text_table[rd_icon_kind_from_code_name(cmd_name)]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
if(ui_hovering(sig))
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
{
ui_labelf("Restart");
}
RD_RegsScope(.cmd_name = cmd_name, .ui_key = sig.box->key) rd_set_hover_regs(RD_RegSlot_CmdName);
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_Restart);
rd_push_cmd(cmd_name, rd_regs());
}
}
//- rjf: pause button
UI_TextAlignment(UI_TextAlign_Center) UI_Flags(can_pause ? 0 : UI_BoxFlag_Disabled)
UI_TagF("weak")
{
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_Pause]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
if(ui_hovering(sig) && !can_pause)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Disabled: Already halted");
}
if(ui_hovering(sig) && can_pause)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Halt all attached processes");
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_Halt);
}
}
//- rjf: stop button
UI_TextAlignment(UI_TextAlign_Center) UI_Flags(can_stop ? 0 : UI_BoxFlag_Disabled)
UI_TagF(can_stop ? "bad" : "weak")
{
UI_Signal sig = {0};
{
sig = ui_button(rd_icon_kind_text_table[RD_IconKind_Stop]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
}
if(ui_hovering(sig) && !can_stop)
{
UI_Tooltip RD_Font(RD_FontSlot_Main) ui_labelf("Disabled: No processes are running");
}
if(ui_hovering(sig) && can_stop)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Kill all attached processes");
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_KillAll);
}
}
//- rjf: step over button
UI_TextAlignment(UI_TextAlign_Center) UI_Flags((can_play ? 0 : UI_BoxFlag_Disabled))
UI_TagF("weak")
{
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_StepOver]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
if(ui_hovering(sig))
{
if(can_play)
{
UI_Tooltip RD_Font(RD_FontSlot_Main) ui_labelf("Step Over");
}
else
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Disabled: %s", have_targets ? "Targets are currently running" : "No active targets exist");
}
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_StepOver);
}
}
//- rjf: step into button
UI_TextAlignment(UI_TextAlign_Center) UI_Flags((can_play ? 0 : UI_BoxFlag_Disabled))
UI_TagF("weak")
{
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_StepInto]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
if(ui_hovering(sig))
{
if(can_play)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Step Into");
}
else
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Disabled: %s", have_targets ? "Targets are currently running" : "No active targets exist");
}
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_StepInto);
}
}
//- rjf: step out button
UI_TextAlignment(UI_TextAlign_Center) UI_Flags(can_step ? 0 : UI_BoxFlag_Disabled)
UI_TagF("weak")
{
UI_Signal sig = ui_button(rd_icon_kind_text_table[RD_IconKind_StepOut]);
os_window_push_custom_title_bar_client_area(ws->os, sig.box->rect);
if(ui_hovering(sig) && !can_step && can_pause)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Disabled: Running");
}
if(ui_hovering(sig) && !can_step && !can_stop)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Disabled: No processes are running");
}
if(ui_hovering(sig) && can_step)
{
UI_Tooltip RD_Font(RD_FontSlot_Main)
ui_labelf("Step Out");
}
if(ui_clicked(sig))
{
rd_cmd(RD_CmdKind_StepOut);
}
}
scratch_end(scratch);
}
@@ -15917,7 +15789,7 @@ rd_frame(void)
//- rjf: animate confirmation
//
{
F32 rate = rd_setting_b32_from_name(str8_lit("menu_animations")) ? 1 - pow_f32(2, (-10.f * rd_state->frame_dt)) : 1.f;
F32 rate = rd_setting_b32_from_name(str8_lit("menu_animations")) ? 1 - pow_f32(2, (-30.f * rd_state->frame_dt)) : 1.f;
B32 popup_open = rd_state->popup_active;
rd_state->popup_t += rate * ((F32)!!popup_open-rd_state->popup_t);
if(abs_f32(rd_state->popup_t - (F32)!!popup_open) > 0.005f)
+33 -31
View File
@@ -714,7 +714,7 @@ rd_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U64 progress_v_t
//~ rjf: UI Widgets: Fancy Buttons
internal void
rd_cmd_binding_buttons(String8 name, String8 filter)
rd_cmd_binding_buttons(String8 name, String8 filter, B32 add_new)
{
Temp scratch = scratch_begin(0, 0);
RD_KeyMapNodePtrList key_map_nodes = rd_key_map_node_ptr_list_from_name(scratch.arena, name);
@@ -722,6 +722,7 @@ rd_cmd_binding_buttons(String8 name, String8 filter)
//- rjf: build buttons for each binding
UI_CornerRadius(ui_top_font_size()*0.5f) for(RD_KeyMapNodePtr *n = key_map_nodes.first; n != 0; n = n->next)
{
ui_spacer(ui_em(1.f, 1.f));
RD_Binding binding = n->v->binding;
B32 rebinding_active_for_this_binding = (rd_state->bind_change_active &&
str8_match(rd_state->bind_change_cmd_name, name, 0) &&
@@ -826,40 +827,41 @@ rd_cmd_binding_buttons(String8 name, String8 filter)
rd_state->bind_change_active = 0;
}
}
//- rjf: space
ui_spacer(ui_em(1.f, 1.f));
}
//- rjf: build "add new binding" button
B32 adding_new_binding = (rd_state->bind_change_active &&
str8_match(rd_state->bind_change_cmd_name, name, 0) &&
rd_state->bind_change_binding_id == 0);
RD_Font(RD_FontSlot_Icons) UI_TagF(adding_new_binding ? "pop" : "") UI_CornerRadius(ui_top_font_size()*0.5f)
if(add_new)
{
ui_set_next_text_alignment(UI_TextAlign_Center);
ui_set_next_group_key(ui_key_zero());
ui_set_next_pref_width(ui_text_dim(ui_top_font_size()*1.5f, 1));
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
UI_BoxFlag_Clickable|
UI_BoxFlag_DrawActiveEffects|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_DrawBackground,
"%S###add_binding", rd_icon_kind_text_table[RD_IconKind_Add]);
UI_Signal sig = ui_signal_from_box(box);
if(ui_clicked(sig))
B32 adding_new_binding = (rd_state->bind_change_active &&
str8_match(rd_state->bind_change_cmd_name, name, 0) &&
rd_state->bind_change_binding_id == 0);
ui_spacer(ui_em(1.f, 1.f));
RD_Font(RD_FontSlot_Icons) UI_TagF(adding_new_binding ? "pop" : "") UI_CornerRadius(ui_top_font_size()*0.5f)
{
if(!rd_state->bind_change_active && ui_clicked(sig))
ui_set_next_text_alignment(UI_TextAlign_Center);
ui_set_next_group_key(ui_key_zero());
ui_set_next_pref_width(ui_text_dim(ui_top_font_size()*1.5f, 1));
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|
UI_BoxFlag_Clickable|
UI_BoxFlag_DrawActiveEffects|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_DrawBackground,
"%S###add_binding", rd_icon_kind_text_table[RD_IconKind_Add]);
UI_Signal sig = ui_signal_from_box(box);
if(ui_clicked(sig))
{
arena_clear(rd_state->bind_change_arena);
rd_state->bind_change_active = 1;
rd_state->bind_change_cmd_name = push_str8_copy(rd_state->bind_change_arena, name);
rd_state->bind_change_binding_id = 0;
}
else if(rd_state->bind_change_active && ui_clicked(sig))
{
rd_state->bind_change_active = 0;
if(!rd_state->bind_change_active && ui_clicked(sig))
{
arena_clear(rd_state->bind_change_arena);
rd_state->bind_change_active = 1;
rd_state->bind_change_cmd_name = push_str8_copy(rd_state->bind_change_arena, name);
rd_state->bind_change_binding_id = 0;
}
else if(rd_state->bind_change_active && ui_clicked(sig))
{
rd_state->bind_change_active = 0;
}
}
}
}
@@ -913,7 +915,7 @@ rd_cmd_spec_button(String8 name)
UI_TagF("weak")
UI_FastpathCodepoint(0)
{
rd_cmd_binding_buttons(name, str8_zero());
rd_cmd_binding_buttons(name, str8_zero(), 1);
}
}
}
@@ -3473,7 +3475,7 @@ rd_cell(RD_CellParams *params, String8 string)
{
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_Padding(ui_em(1.f, 1.f))
{
rd_cmd_binding_buttons(params->bindings_name, params->search_needle);
rd_cmd_binding_buttons(params->bindings_name, params->search_needle, 1);
}
}
}
+1 -1
View File
@@ -140,7 +140,7 @@ internal void rd_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U6
////////////////////////////////
//~ rjf: UI Widgets: Fancy Buttons
internal void rd_cmd_binding_buttons(String8 name, String8 filter);
internal void rd_cmd_binding_buttons(String8 name, String8 filter, B32 add_new);
internal UI_Signal rd_menu_bar_button(String8 string);
internal UI_Signal rd_cmd_spec_button(String8 name);
internal void rd_cmd_list_menu_buttons(U64 count, String8 *cmd_names, U32 *fastpath_codepoints);
+17
View File
@@ -805,6 +805,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
ui_state->ctx_menu_changed = 0;
ui_state->default_animation_rate = 1 - pow_f32(2, (-60.f * ui_state->animation_dt));
ui_state->tooltip_can_overflow_window = 0;
ui_state->tooltip_anchor_key = ui_key_zero();
ui_state->tags_key_stack_top = ui_state->tags_key_stack_free = 0;
ui_state->tags_cache_slots_count = 512;
ui_state->tags_cache_slots = push_array(ui_build_arena(), UI_TagsCacheSlot, ui_state->tags_cache_slots_count);
@@ -1248,6 +1249,22 @@ ui_end_build(void)
}
}
//- rjf: anchor tooltips
if(!ui_key_match(ui_state->tooltip_anchor_key, ui_key_zero()))
{
UI_Box *anchor_box = ui_box_from_key(ui_state->tooltip_anchor_key);
if(!ui_box_is_nil(anchor_box))
{
ui_state->tooltip_root->rect.x0 = anchor_box->rect.x0;
ui_state->tooltip_root->rect.y0 = anchor_box->rect.y1 + anchor_box->font_size*0.5f;
}
else
{
ui_state->tooltip_root->rect.x0 = 10000;
ui_state->tooltip_root->rect.y0 = 10000;
}
}
//- rjf: ensure special floating roots are within screen bounds
UI_Box *floating_roots[] = {ui_state->tooltip_root, ui_state->ctx_menu_root};
B32 force_contain[] =
+1
View File
@@ -676,6 +676,7 @@ struct UI_State
//- rjf: build state machine state
B32 is_in_open_ctx_menu;
B32 tooltip_can_overflow_window;
UI_Key tooltip_anchor_key;
String8Array current_gen_tags;
U64 current_gen_tags_gen;
UI_TagsKeyStackNode *tags_key_stack_top;