rewrite ui box -> signal path for less lossy event processing & correctness; also extend to use all 3 mouse buttons. eliminate ui signal bitfields, just use flags & helper macros everywhere.

This commit is contained in:
Ryan Fleury
2024-02-07 16:46:57 -08:00
parent b9cec99cd4
commit c637ad6ede
7 changed files with 655 additions and 285 deletions
+139 -136
View File
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -546,7 +546,7 @@ DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba)
//- rjf: hover color box -> show components
UI_Signal sig = ui_signal_from_box(color_box);
if(sig.hovering)
if(ui_hovering(sig))
{
ui_do_color_tooltip_hsva(hsva);
}
@@ -587,12 +587,12 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
UI_PrefWidth(ui_px(dim.y, 1.f))
{
UI_Signal sv_sig = ui_sat_val_pickerf(hsva.x, &hsva.y, &hsva.z, "sat_val_picker");
commit = commit || sv_sig.released;
commit = commit || ui_released(sv_sig);
}
UI_PrefWidth(ui_em(3.f, 1.f))
{
UI_Signal h_sig = ui_hue_pickerf(&hsva.x, hsva.y, hsva.z, "hue_picker");
commit = commit || h_sig.released;
commit = commit || ui_released(h_sig);
}
UI_PrefWidth(ui_children_sum(1)) UI_Column UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
{
@@ -916,7 +916,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
draw_data->texture = texture;
draw_data->src = r2f32(v2f32(0, 0), v2f32((F32)topology_info.width, (F32)topology_info.height));
draw_data->loaded_t = state->loaded_t;
draw_data->hovered = sig.hovering;
draw_data->hovered = ui_hovering(sig);
draw_data->mouse_px = mouse_bitmap_px_off;
draw_data->ui_per_bmp_px = ui_per_bmp_px;
ui_box_equip_custom_draw(box, df_view_rule_hooks__bitmap_box_draw, draw_data);
@@ -933,11 +933,11 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
df_gfx_request_frame();
}
}
if(sig.hovering && r_handle_match(texture, r_handle_zero())) UI_Tooltip
if(ui_hovering(sig) && r_handle_match(texture, r_handle_zero())) UI_Tooltip
{
ui_labelf("Texture not loaded.");
}
if(sig.hovering && !r_handle_match(texture, r_handle_zero()))
if(ui_hovering(sig) && !r_handle_match(texture, r_handle_zero()))
{
if(dim.y > (F32)topology_info.height)
{
@@ -1169,9 +1169,9 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(geo)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_Clickable, "geo_box");
UI_Signal sig = ui_signal_from_box(box);
if(sig.dragging)
if(ui_dragging(sig))
{
if(sig.pressed)
if(ui_pressed(sig))
{
Vec2F32 data = v2f32(state->yaw_target, state->pitch_target);
ui_store_drag_struct(&data);
+106 -106
View File
@@ -1228,7 +1228,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
}
}
UI_Signal sig = ui_signal_from_box(vector);
if(sig.pressed)
if(ui_pressed(sig))
{
edit_commit = edit_commit || (!row_selected && ewv->input_editing);
next_cursor_tbl = v2s64(DF_EvalWatchViewColumnKind_Expr, (semantic_idx+1));
@@ -1340,8 +1340,8 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
row->expr,
"###row_%I64x", row_hash);
}
edit_commit = edit_commit || sig.commit;
if(sig.hovering && is_inherited) UI_Tooltip
edit_commit = edit_commit || ui_committed(sig);
if(is_inherited && ui_hovering(sig)) UI_Tooltip
{
String8List inheritance_chain_type_names = {0};
for(TG_KeyNode *n = row->inherited_type_key_chain.first; n != 0; n = n->next)
@@ -1360,13 +1360,13 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1.f, df_rgba_from_theme_color(DF_ThemeColor_CodeType), inheritance_type);
}
}
if(sig.hovering && DEV_eval_watch_key_tooltips) UI_Tooltip UI_Font(df_font_from_slot(DF_FontSlot_Code))
if(DEV_eval_watch_key_tooltips && ui_hovering(sig)) UI_Tooltip UI_Font(df_font_from_slot(DF_FontSlot_Code))
{
ui_labelf("Parent Key: %I64x, %I64x", row->parent_key.parent_hash, row->parent_key.child_num);
ui_labelf("Hover Key: %I64x, %I64x", row->key.parent_hash, row->key.child_num);
ui_labelf("Cursor Key: %I64x, %I64x", ewv->cursor.key.parent_hash, ewv->cursor.key.child_num);
}
if(sig.hovering && row->depth == 0 && DEV_eval_compiler_tooltips) UI_Tooltip
if(DEV_eval_compiler_tooltips && row->depth == 0 && ui_hovering(sig)) UI_Tooltip
{
Temp scratch = scratch_begin(0, 0);
String8 string = row->expr;
@@ -1415,7 +1415,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
}
// rjf: press -> commit if editing & select
if(sig.pressed)
if(ui_pressed(sig))
{
edit_commit = edit_commit || (!cell_selected && ewv->input_editing);
next_cursor_tbl = v2s64(DF_EvalWatchViewColumnKind_Expr, (semantic_idx+1));
@@ -1429,7 +1429,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
}
// rjf: double-click -> start editing
if(sig.double_clicked && !ewv->input_editing && can_edit_expr)
if(ui_double_clicked(sig) && !ewv->input_editing && can_edit_expr)
{
ui_kill_action();
ewv->input_editing = 1;
@@ -1515,18 +1515,18 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
if(value_is_simple)
{
sig = df_line_editf(DF_LineEditFlag_CodeContents|DF_LineEditFlag_NoBackground, 0, 0, &ewv->input_cursor, &ewv->input_mark, ewv->input_buffer, sizeof(ewv->input_buffer), &ewv->input_size, 0, row->display_value, "%S###val_%I64x", row->display_value, row_hash);
edit_commit = (edit_commit || sig.commit);
edit_commit = (edit_commit || ui_committed(sig));
}
}
// rjf: bad & hovering -> display
if(row_is_bad && sig.hovering) UI_Tooltip
if(row_is_bad && ui_hovering(sig)) UI_Tooltip
{
UI_PrefWidth(ui_children_sum(1)) df_error_label(str8_lit("Could not read process memory successfully."));
}
// rjf: press -> focus & commit if editing & not selected
if(sig.pressed)
if(ui_pressed(sig))
{
pressed = 1;
edit_commit = edit_commit || (ewv->input_editing && !cell_selected);
@@ -1534,7 +1534,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
}
// rjf: double-click -> start editing
if(sig.double_clicked && value_is_simple)
if(ui_double_clicked(sig) && value_is_simple)
{
ui_kill_action();
ewv->input_editing = 1;
@@ -1562,7 +1562,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeType), string);
}
UI_Signal sig = ui_signal_from_box(box);
if(sig.pressed)
if(ui_pressed(sig))
{
pressed = 1;
edit_commit = edit_commit || (ewv->input_editing && !cell_selected);
@@ -1596,11 +1596,11 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
{
rule_editing_active = ui_is_focus_active();
sig = df_line_editf(DF_LineEditFlag_CodeContents|DF_LineEditFlag_NoBackground, 0, 0, &ewv->input_cursor, &ewv->input_mark, ewv->input_buffer, sizeof(ewv->input_buffer), &ewv->input_size, 0, view_rule, "###view_rule_%I64x", row_hash);
edit_commit = edit_commit || sig.commit;
edit_commit = edit_commit || ui_committed(sig);
}
// rjf: press -> commit if not selected, select this cell
if(sig.pressed)
if(ui_pressed(sig))
{
pressed = 1;
edit_commit = edit_commit || (ewv->input_editing && !cell_selected);
@@ -1608,7 +1608,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
}
// rjf: double-click -> begin editing
if(sig.double_clicked && !ewv->input_editing)
if(ui_double_clicked(sig) && !ewv->input_editing)
{
ui_kill_action();
ewv->input_editing = 1;
@@ -1832,7 +1832,7 @@ DF_VIEW_UI_FUNCTION_DEF(Empty)
UI_BackgroundColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBackground))
UI_BorderColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBorder))
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_ActionText))
if(df_icon_buttonf(DF_IconKind_Add, 0, "Add Target").clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_Add, 0, "Add Target")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_AddTarget);
@@ -1857,7 +1857,7 @@ DF_VIEW_UI_FUNCTION_DEF(Empty)
UI_BorderColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBorder))
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_ActionText))
{
if(df_icon_buttonf(DF_IconKind_Play, 0, "Launch %S", target_name).clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_Play, 0, "Launch %S", target_name)))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.entity = df_handle_from_entity(target);
@@ -1865,7 +1865,7 @@ DF_VIEW_UI_FUNCTION_DEF(Empty)
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_LaunchAndRun));
}
ui_spacer(ui_em(1.5f, 1));
if(df_icon_buttonf(DF_IconKind_Play, 0, "Step Into %S", target_name).clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_Play, 0, "Step Into %S", target_name)))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.entity = df_handle_from_entity(target);
@@ -2082,14 +2082,14 @@ DF_VIEW_UI_FUNCTION_DEF(Commands)
//- rjf: interact
UI_Signal sig = ui_signal_from_box(box);
if(sig.clicked)
if(ui_clicked(sig))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = item->cmd_spec;
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_CmdSpec);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CompleteQuery));
}
if(sig.right_clicked)
if(ui_right_clicked(sig))
{
ui_ctx_menu_open(item_ctx_menu_key, ui_key_zero(), sub_2f32(ui_mouse(), v2f32(2, 2)));
}
@@ -2382,7 +2382,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
UI_Signal sig = ui_sort_header(sorting,
fs->cached_files_sort_side == Side_Min,
kinds[idx].string);
if(sig.clicked)
if(ui_clicked(sig))
{
if(fs->sort_kind != kinds[idx].kind)
{
@@ -2454,7 +2454,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
}
// rjf: click => up one directory
if(sig.clicked)
if(ui_clicked(sig))
{
String8 new_path = str8_chop_last_slash(str8_chop_last_slash(path_query.path));
if(new_path.size != 0)
@@ -2536,7 +2536,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
}
// rjf: click => activate this file
if(file_sig.clicked)
if(ui_clicked(file_sig))
{
String8 existing_path = str8_chop_last_slash(path_query.path);
String8 new_path = push_str8f(scratch.arena, "%S/%S/", existing_path, file->filename);
@@ -2704,7 +2704,7 @@ DF_VIEW_UI_FUNCTION_DEF(SystemProcesses)
}
// rjf: click => activate this specific process
if(sig.clicked)
if(ui_clicked(sig))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.id = info->info.pid;
@@ -2854,7 +2854,7 @@ DF_VIEW_UI_FUNCTION_DEF(EntityLister)
UI_Box *name_label = ui_build_box_from_stringf(UI_BoxFlag_DrawText, "%S##label_%p", display_string, ent);
ui_box_equip_fuzzy_match_ranges(name_label, &item.name_match_ranges);
}
if(ui_signal_from_box(box).clicked)
if(ui_clicked(ui_signal_from_box(box)))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.entity = df_handle_from_entity(ent);
@@ -2992,14 +2992,14 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
}
}
UI_Signal sig = ui_signal_from_box(box);
if(sig.clicked)
if(ui_clicked(sig))
{
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
p.string = name;
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_String);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CompleteQuery));
}
if(sig.hovering) UI_Tooltip
if(ui_hovering(sig)) UI_Tooltip
{
U64 binary_voff = df_voff_from_binary_symbol_name(binary, name);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(binary, binary_voff);
@@ -3246,18 +3246,18 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
UI_FocusActive((value_selected && tv->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
{
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &tv->input_cursor, &tv->input_mark, tv->input_buffer, sizeof(tv->input_buffer), &tv->input_size, 0, kv_info[idx].current_text, "###kv_editor_%i", (S32)idx);
edit_commit = edit_commit || sig.commit;
edit_commit = edit_commit || ui_committed(sig);
}
// rjf: focus panel on press
if(sig.pressed)
if(ui_pressed(sig))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
// rjf: begin editing on double-click
if(!tv->input_editing && sig.double_clicked)
if(!tv->input_editing && ui_double_clicked(sig))
{
ui_kill_action();
tv->input_editing = 1;
@@ -3268,7 +3268,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
}
// rjf: press on non-selected => commit edit, change selected cell
if(sig.pressed && !value_selected)
if(ui_pressed(sig) && !value_selected)
{
edit_end = 1;
edit_commit = tv->input_editing;
@@ -3276,7 +3276,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
}
// rjf: apply commit deltas
if(sig.commit)
if(ui_committed(sig))
{
next_cursor.y += 1;
}
@@ -3293,7 +3293,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
{
UI_FocusHot((row_selected && next_cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
UI_TextAlignment(UI_TextAlign_Center)
if(ui_buttonf("Browse...").clicked)
if(ui_clicked(ui_buttonf("Browse...")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(kv_info[idx].fill_with_file ? DF_CoreCmdKind_PickFile : DF_CoreCmdKind_PickFolder);
@@ -3427,7 +3427,7 @@ DF_VIEW_UI_FUNCTION_DEF(Targets)
UI_Signal add_sig = {0};
UI_FocusHot(cursor.y == 1 ? UI_FocusKind_On : UI_FocusKind_Off)
add_sig = df_icon_buttonf(DF_IconKind_Add, 0, "Add New Target");
if(add_sig.clicked)
if(ui_clicked(add_sig))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_AddTarget);
@@ -3450,13 +3450,13 @@ DF_VIEW_UI_FUNCTION_DEF(Targets)
UI_FocusHot((row_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
{
UI_Signal sig = df_icon_buttonf(target->b32 ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow, 0, "###ebl_%p", target);
if(sig.clicked && sig.event_flags == 0)
if(ui_clicked(sig) && sig.event_flags == 0)
{
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
p.entity = df_handle_from_entity(target);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectTarget));
}
else if(sig.clicked && sig.event_flags == OS_EventFlag_Ctrl)
else if(ui_clicked(sig) && sig.event_flags == OS_EventFlag_Ctrl)
{
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
p.entity = df_handle_from_entity(target);
@@ -3493,11 +3493,11 @@ DF_VIEW_UI_FUNCTION_DEF(Targets)
{
sig = df_icon_buttonf(ctrls[ctrl_idx].icon, 0, "###%p_ctrl_%i", target, (int)ctrl_idx);
}
if(sig.hovering) UI_Tooltip
if(ui_hovering(sig)) UI_Tooltip
{
ui_label(ctrls[ctrl_idx].text);
}
if(sig.clicked)
if(ui_clicked(sig))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.entity = df_handle_from_entity(target);
@@ -3700,18 +3700,18 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
UI_FocusActive((value_selected && fpms->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
{
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &fpms->input_cursor, &fpms->input_mark, fpms->input_buffer, sizeof(fpms->input_buffer), &fpms->input_size, 0, map_src_path, "###src_editor_%p", map);
edit_commit = edit_commit || sig.commit;
edit_commit = edit_commit || ui_committed(sig);
}
// rjf: focus panel on press
if(sig.pressed)
if(ui_pressed(sig))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
// rjf: begin editing on double-click
if(!fpms->input_editing && sig.double_clicked)
if(!fpms->input_editing && ui_double_clicked(sig))
{
fpms->input_editing = 1;
fpms->input_size = Min(sizeof(fpms->input_buffer), map_src_path.size);
@@ -3721,7 +3721,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
}
// rjf: press on non-selected => commit edit, change selected cell
if(sig.pressed && !value_selected)
if(ui_pressed(sig) && !value_selected)
{
edit_end = 1;
edit_commit = fpms->input_editing;
@@ -3740,7 +3740,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
//- rjf: browse button
UI_FocusHot((row_selected && fpms->cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
UI_PrefWidth(ui_text_dim(10, 1))
if(ui_buttonf("Browse...").clicked)
if(ui_clicked(ui_buttonf("Browse...")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFileOrFolder);
@@ -3774,18 +3774,18 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
UI_FocusActive((value_selected && fpms->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
{
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &fpms->input_cursor, &fpms->input_mark, fpms->input_buffer, sizeof(fpms->input_buffer), &fpms->input_size, 0, map_dst_path, "###dst_editor_%p", map);
edit_commit = edit_commit || sig.commit;
edit_commit = edit_commit || ui_committed(sig);
}
// rjf: focus panel on press
if(sig.pressed)
if(ui_pressed(sig))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
// rjf: begin editing on double-click
if(!fpms->input_editing && sig.double_clicked)
if(!fpms->input_editing && ui_double_clicked(sig))
{
fpms->input_editing = 1;
fpms->input_size = Min(sizeof(fpms->input_buffer), map_dst_path.size);
@@ -3795,7 +3795,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
}
// rjf: press on non-selected => commit edit, change selected cell
if(sig.pressed && !value_selected)
if(ui_pressed(sig) && !value_selected)
{
edit_end = 1;
edit_commit = fpms->input_editing;
@@ -3815,7 +3815,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
{
UI_FocusHot((row_selected && fpms->cursor.x == 3) ? UI_FocusKind_On : UI_FocusKind_Off)
UI_PrefWidth(ui_text_dim(10, 1))
if(ui_buttonf("Browse...").clicked)
if(ui_clicked(ui_buttonf("Browse...")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFileOrFolder);
@@ -4009,11 +4009,11 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
}
sig = df_icon_buttonf(frozen ? DF_IconKind_Locked : DF_IconKind_Unlocked, 0, "###lock_%p", entity);
}
if(frozen_by_solo_mode && sig.hovering) UI_Tooltip
if(frozen_by_solo_mode && ui_hovering(sig)) UI_Tooltip
{
ui_label(str8_lit("This thread is frozen during stepping operations because it isn't selected, and Solo Stepping Mode is enabled."));
}
if(sig.clicked)
if(ui_clicked(sig))
{
DF_CoreCmdKind cmd_kind = frozen ? DF_CoreCmdKind_ThawEntity : DF_CoreCmdKind_FreezeEntity;
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
@@ -4040,7 +4040,7 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
{
UI_PrefWidth(ui_text_dim(10, 1))
UI_TextAlignment(UI_TextAlign_Center)
if(ui_buttonf("Detach").clicked)
if(ui_clicked(ui_buttonf("Detach")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.entity = df_handle_from_entity(entity);
@@ -4052,7 +4052,7 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
}
UI_TableCellSized(ui_em(2.25f, 1.f)) UI_FocusHot((row_is_selected && cursor.x == 3) ? UI_FocusKind_On : UI_FocusKind_Off)
{
if(df_icon_buttonf(DF_IconKind_Redo, 0, "###retry").clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_Redo, 0, "###retry")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
df_handle_list_push(scratch.arena, &params.entity_list, df_handle_from_entity(entity));
@@ -4065,7 +4065,7 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
UI_BackgroundColor(df_rgba_from_theme_color(DF_ThemeColor_FailureBackground))
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_FailureText))
UI_BorderColor(df_rgba_from_theme_color(DF_ThemeColor_FailureBorder))
if(df_icon_buttonf(DF_IconKind_X, 0, "###kill").clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_X, 0, "###kill")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
df_handle_list_push(scratch.arena, &params.entity_list, df_handle_from_entity(entity));
@@ -4220,13 +4220,13 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawText, "%S###selection_%i", selected_string,
(int)frame_idx);
UI_Signal sig = ui_signal_from_box(box);
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(0, (S64)frame_idx+1);
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
if(sig.double_clicked || sig.keyboard_clicked)
if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed)
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.index = frame_idx;
@@ -4242,7 +4242,7 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_Clickable, "(No Module)###moduleless_frame_%I64x", frame_idx);
UI_Signal sig = ui_signal_from_box(box);
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(1, (S64)frame_idx+1);
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
@@ -4271,13 +4271,13 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
}
UI_Box *box = ui_build_box_from_string(UI_BoxFlag_DrawText|UI_BoxFlag_Clickable, symbol);
UI_Signal sig = ui_signal_from_box(box);
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(2, (S64)frame_idx+1);
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
if(sig.double_clicked || sig.keyboard_clicked)
if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed)
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.index = frame_idx;
@@ -4292,13 +4292,13 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_Clickable, "0x%I64x", rip_vaddr);
UI_Signal sig = ui_signal_from_box(box);
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(3, (S64)frame_idx+1);
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
if(sig.double_clicked || sig.keyboard_clicked)
if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed)
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.index = frame_idx;
@@ -4532,7 +4532,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
{
UI_Box *range_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawText, "[0x%I64x, 0x%I64x)###vaddr_range_%p", entity->vaddr_rng.min, entity->vaddr_rng.max, entity);
UI_Signal sig = ui_signal_from_box(range_box);
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(1, (S64)idx+1);
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
@@ -4567,11 +4567,11 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
{
UI_TextColor(!dbgi_is_valid ? df_rgba_from_theme_color(DF_ThemeColor_FailureBackground) : ui_top_text_color())
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &mv->txt_cursor, &mv->txt_mark, mv->txt_buffer, sizeof(mv->txt_buffer), &mv->txt_size, 0, dbgi->dbg_path, "###dbg_path_%p", entity);
edit_commit = (edit_commit || sig.commit);
edit_commit = (edit_commit || ui_committed(sig));
}
// rjf: press -> focus
if(sig.pressed)
if(ui_pressed(sig))
{
edit_commit = (mv->txt_editing && !txt_is_selected);
next_cursor = v2s64(2, (S64)idx+1);
@@ -4580,7 +4580,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
}
// rjf: double-click -> begin editing
if(sig.double_clicked && !mv->txt_editing)
if(ui_double_clicked(sig) && !mv->txt_editing)
{
ui_kill_action();
mv->txt_editing = 1;
@@ -4599,7 +4599,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
// rjf: build browse button
UI_FocusHot(brw_is_selected ? UI_FocusKind_On : UI_FocusKind_Off) UI_PrefWidth(ui_text_dim(10, 1))
{
if(ui_buttonf("Browse...").clicked || (brw_is_selected && edit_begin))
if(ui_clicked(ui_buttonf("Browse...")) || (brw_is_selected && edit_begin))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFile);
@@ -4800,7 +4800,7 @@ DF_VIEW_UI_FUNCTION_DEF(PendingEntity)
UI_CornerRadius(ui_top_font_size()/3)
UI_PrefWidth(ui_text_dim(10, 1))
UI_Focus(UI_FocusKind_On)
if(ui_buttonf("Find alternative...").clicked)
if(ui_clicked(ui_buttonf("Find alternative...")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFile);
@@ -5242,7 +5242,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
UI_CornerRadius(ui_top_font_size()/3)
UI_PrefWidth(ui_text_dim(10, 1))
UI_Focus(UI_FocusKind_On)
if(ui_buttonf("Find alternative...").clicked)
if(ui_clicked(ui_buttonf("Find alternative...")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFile);
@@ -5461,7 +5461,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
}
//- rjf: hover eval
if(!sig.base.dragging && sig.mouse_expr_rng.min.line != 0 && sig.base.event_flags == 0)
if(!ui_dragging(sig.base) && sig.mouse_expr_rng.min.line != 0 && sig.base.event_flags == 0)
{
TxtRng expr_rng = sig.mouse_expr_rng;
String8 expr = txti_string_from_handle_txt_rng(scratch.arena, txti_handle, expr_rng);
@@ -5476,20 +5476,20 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
}
//- rjf: press code slice? -> focus panel
if(sig.base.pressed)
if(ui_pressed(sig.base))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
//- rjf: dragging? -> contain cursor
if(sig.base.dragging && sig.base.event_flags == 0)
if(ui_dragging(sig.base) && sig.base.event_flags == 0)
{
tv->contain_cursor = 1;
}
//- rjf: ctrl+pressed? -> go to name
if(sig.base.pressed && sig.base.event_flags & OS_EventFlag_Ctrl)
if(ui_pressed(sig.base) && sig.base.event_flags & OS_EventFlag_Ctrl)
{
ui_kill_action();
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
@@ -5826,7 +5826,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_Clickable, "%S###file_ood_warning", df_g_icon_kind_text_table[DF_IconKind_WarningBig]);
}
UI_Signal sig = ui_signal_from_box(box);
if(sig.hovering) UI_Tooltip
if(ui_hovering(sig)) UI_Tooltip
{
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(1, 1))
{
@@ -6369,7 +6369,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
}
//- rjf: hover eval
if(!sig.base.dragging && sig.mouse_expr_rng.min.line != 0 && contains_1s64(visible_line_num_range, sig.mouse_expr_rng.min.line) && sig.mouse_expr_rng.max.line == sig.mouse_expr_rng.min.line && sig.base.event_flags == 0)
if(!ui_dragging(sig.base) && sig.mouse_expr_rng.min.line != 0 && contains_1s64(visible_line_num_range, sig.mouse_expr_rng.min.line) && sig.mouse_expr_rng.max.line == sig.mouse_expr_rng.min.line && sig.base.event_flags == 0)
{
U64 line_idx = sig.mouse_expr_rng.min.line-visible_line_num_range.min;
String8 expr = str8_substr(code_slice_params.line_text[line_idx], r1u64(sig.mouse_expr_rng.min.column-1, sig.mouse_expr_rng.max.column-1));
@@ -6386,14 +6386,14 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
}
//- rjf: press code slice? -> focus panel
if(sig.base.pressed)
if(ui_pressed(sig.base))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
//- rjf: dragging? -> contain cursor
if(sig.base.dragging && sig.base.event_flags == 0)
if(ui_dragging(sig.base) && sig.base.event_flags == 0)
{
dv->contain_cursor = 1;
}
@@ -7264,7 +7264,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
}
//- rjf: hover eval
if(!sig.base.dragging && sig.mouse_expr_rng.min.line != 0)
if(!ui_dragging(sig.base) && sig.mouse_expr_rng.min.line != 0)
{
TxtRng expr_rng = sig.mouse_expr_rng;
String8 expr = txti_string_from_handle_txt_rng(scratch.arena, txti_handle, expr_rng);
@@ -7279,14 +7279,14 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
}
//- rjf: press code slice? -> focus panel
if(sig.base.pressed)
if(ui_pressed(sig.base))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
//- rjf: dragging? -> contain cursor
if(sig.base.dragging)
if(ui_dragging(sig.base))
{
tv->contain_cursor = 1;
}
@@ -8040,7 +8040,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
UI_Signal sig = ui_signal_from_box(row_container_box);
// rjf: calculate hovered byte
if(sig.hovering || sig.dragging)
if(ui_hovering(sig) || ui_dragging(sig))
{
Vec2F32 mouse_rel = sub_2f32(ui_mouse(), row_container_box->rect.p0);
U64 row_idx = ClampBot(0, mouse_rel.y) / row_height_px;
@@ -8067,25 +8067,25 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
}
// rjf: press -> focus panel
if(sig.pressed)
if(ui_pressed(sig))
{
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
// rjf: click & drag -> select
if(sig.dragging && mouse_hover_byte_num != 0)
if(ui_dragging(sig) && mouse_hover_byte_num != 0)
{
mv->contain_cursor = 1;
mv->cursor = mouse_hover_byte_num-1;
if(sig.pressed)
if(ui_pressed(sig))
{
mv->mark = mv->cursor;
}
}
// rjf: ctrl+scroll -> change font size
if(sig.hovering)
if(ui_hovering(sig))
{
for(OS_Event *event = ui_events()->first, *next = 0; event != 0; event = next)
{
@@ -8429,7 +8429,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
{
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
{
if(df_icon_buttonf(entity->b32 ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow, 0, "###ebl_%p", entity).clicked)
if(ui_clicked(df_icon_buttonf(entity->b32 ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow, 0, "###ebl_%p", entity)))
{
df_entity_equip_b32(entity, !entity->b32);
}
@@ -8467,7 +8467,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
}
}
UI_Signal sig = ui_signal_from_box(box);
if(sig.double_clicked || sig.keyboard_clicked)
if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed)
{
DF_CmdParams params = df_cmd_params_from_window(ws);
params.file_path = df_full_path_from_entity(scratch.arena, file_parent);
@@ -8476,7 +8476,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_TextPoint);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
}
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(2, (S64)(idx));
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
@@ -8492,7 +8492,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), hit_count_string);
}
UI_Signal sig = ui_signal_from_box(box);
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(3, (S64)(idx));
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
@@ -8501,7 +8501,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
}
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 4) ? UI_FocusKind_On : UI_FocusKind_Off)
{
if(df_icon_buttonf(DF_IconKind_Trash, 0, "###del_%p", entity).clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_Trash, 0, "###del_%p", entity)))
{
df_entity_mark_for_deletion(entity);
}
@@ -8613,7 +8613,7 @@ DF_VIEW_UI_FUNCTION_DEF(WatchPins)
}
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawText, "%S###loc_%p", loc_string, entity);
UI_Signal sig = ui_signal_from_box(box);
if(sig.double_clicked || sig.keyboard_clicked)
if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed)
{
DF_CmdParams params = df_cmd_params_from_window(ws);
params.file_path = df_full_path_from_entity(scratch.arena, file_parent);
@@ -8622,7 +8622,7 @@ DF_VIEW_UI_FUNCTION_DEF(WatchPins)
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_TextPoint);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
}
if(sig.pressed)
if(ui_pressed(sig))
{
next_cursor = v2s64(1, (S64)(idx));
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
@@ -8631,7 +8631,7 @@ DF_VIEW_UI_FUNCTION_DEF(WatchPins)
}
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 2) ? UI_FocusKind_On : UI_FocusKind_Off)
{
if(df_icon_buttonf(DF_IconKind_Trash, 0, "###del_%p", entity).clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_Trash, 0, "###del_%p", entity)))
{
df_entity_mark_for_deletion(entity);
}
@@ -8760,7 +8760,7 @@ DF_VIEW_UI_FUNCTION_DEF(ExceptionFilters)
{
DF_ExceptionFiltersOption *opt = &opts.v[row];
UI_Signal sig = df_icon_buttonf(opt->is_enabled ? DF_IconKind_CheckFilled : DF_IconKind_CheckHollow, &opt->matches, "%S", opt->name);
if(sig.clicked)
if(ui_clicked(sig))
{
if(opt->exception_code_kind != CTRL_ExceptionCodeKind_Null)
{
@@ -8884,7 +8884,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
ui_set_next_background_color(bg_color);
ui_set_next_text_color(tx_color);
ui_set_next_border_color(bd_color);
if(ui_buttonf("%S", df_g_theme_preset_display_string_table[preset]).clicked)
if(ui_clicked(ui_buttonf("%S", df_g_theme_preset_display_string_table[preset])))
{
MemoryCopy(df_gfx_state->cfg_theme_target.colors, colors, sizeof(df_gfx_state->cfg_theme_target.colors));
}
@@ -8966,7 +8966,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("Hex");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, hex_string, "###hex_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_rgba = rgba_from_hex_string_4f32(string);
@@ -8979,7 +8979,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("R");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, r_string, "###r_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_rgba = v4f32((F32)f64_from_str8(string), rgba.y, rgba.z, rgba.w);
@@ -8991,7 +8991,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("G");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, g_string, "###g_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_rgba = v4f32(rgba.x, (F32)f64_from_str8(string), rgba.z, rgba.w);
@@ -9003,7 +9003,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("B");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, b_string, "###b_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_rgba = v4f32(rgba.x, rgba.y, (F32)f64_from_str8(string), rgba.w);
@@ -9016,7 +9016,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("H");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, h_string, "###h_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_hsva = v4f32((F32)f64_from_str8(string), hsva.y, hsva.z, hsva.w);
@@ -9027,7 +9027,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("S");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, s_string, "###s_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_hsva = v4f32(hsva.x, (F32)f64_from_str8(string), hsva.z, hsva.w);
@@ -9038,7 +9038,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("V");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, v_string, "###v_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_hsva = v4f32(hsva.x, hsva.y, (F32)f64_from_str8(string), hsva.w);
@@ -9050,7 +9050,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(4.5f, 1.f)) ui_labelf("A");
UI_Signal sig = df_line_editf(DF_LineEditFlag_Border, 0, 0, &sv->txt_cursor, &sv->txt_mark, sv->txt_buffer, sizeof(sv->txt_buffer), &sv->txt_size, 0, a_string, "###a_edit");
if(sig.commit)
if(ui_committed(sig))
{
String8 string = str8(sv->txt_buffer, sv->txt_size);
Vec4F32 new_hsva = v4f32(hsva.x, hsva.y, hsva.z, (F32)f64_from_str8(string));
@@ -9075,7 +9075,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
UI_FocusHot((sv->cursor.y == 1 && sv->cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
{
UI_Signal preset_sig = df_icon_buttonf(DF_IconKind_Palette, 0, "Apply Preset");
if(preset_sig.clicked)
if(ui_clicked(preset_sig))
{
ui_ctx_menu_open(preset_ctx_menu_key, preset_sig.box->key, v2f32(0, dim_2f32(preset_sig.box->rect).y));
}
@@ -9084,7 +9084,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
// rjf: load-from-file
UI_FocusHot((sv->cursor.y == 1 && sv->cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
{
if(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Load From File").clicked)
if(ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Load From File")))
{
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFile);
@@ -9147,7 +9147,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
ui_set_next_corner_radius_11(ui_top_font_size()/4.f);
UI_Box *color_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground, "###color_box");
UI_Signal color_sig = ui_signal_from_box(color_box);
if(color_sig.hovering)
if(ui_hovering(color_sig))
{
ui_do_color_tooltip_hsva(hsva);
}
@@ -9155,7 +9155,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
ui_spacer(ui_em(0.3f, 1));
}
UI_Signal color_row_sig = ui_signal_from_box(color_row);
if(color_row_sig.clicked || color_row_sig.right_clicked)
if(ui_clicked(color_row_sig) || ui_right_clicked(color_row_sig))
{
ui_ctx_menu_open(color_ctx_menu_keys[color], color_row->key, v2f32(0, color_row->rect.y1-color_row->rect.y0));
sv->color_ctx_menu_color = color;
@@ -9163,7 +9163,7 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
}
if(color_row_sig.hovering) UI_Tooltip
if(ui_hovering(color_row_sig)) UI_Tooltip
{
ui_label(df_g_theme_color_display_string_table[color]);
}