hook up fancy-cell edit button to double-click action, ensure double-click starts edits in listers for editable cells

This commit is contained in:
Ryan Fleury
2025-05-05 05:32:26 -07:00
parent 19acf2cdee
commit da8e583f93
2 changed files with 19 additions and 2 deletions
+6 -1
View File
@@ -5057,12 +5057,16 @@ rd_view_ui(Rng2F32 rect)
ui_kill_action();
}
// rjf: this watch window is a lister? -> move cursor & accept
// rjf: this watch window is a lister? -> move cursor & edit or accept
if(rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg ||
rd_cfg_child_from_string(view, str8_lit("autocomplete")) != &rd_nil_cfg)
{
ewv->next_cursor = ewv->next_mark = cell_pt;
rd_cmd(RD_CmdKind_Accept);
if(cell_info.flags & RD_WatchCellFlag_CanEdit)
{
rd_cmd(RD_CmdKind_Edit);
}
}
// rjf: has a command name? -> push command
@@ -5117,6 +5121,7 @@ rd_view_ui(Rng2F32 rect)
else if(!(sig.f & UI_SignalFlag_KeyboardPressed) && cell_info.flags & RD_WatchCellFlag_CanEdit)
{
ewv->next_cursor = ewv->next_mark = cell_pt;
rd_cmd(RD_CmdKind_Accept);
rd_cmd(RD_CmdKind_Edit);
}
+13 -1
View File
@@ -3415,6 +3415,7 @@ rd_cell(RD_CellParams *params, String8 string)
//////////////////////////////
//- rjf: build edit-button, if line edit is embedded, and has no string
//
B32 edit_started = 0;
if(!is_focus_active && !is_focus_active_disabled && build_lhs_name_desc && build_line_edit && value_name_fstrs.total_size == 0)
{
UI_TagF(".")
@@ -3427,7 +3428,6 @@ rd_cell(RD_CellParams *params, String8 string)
UI_Padding(ui_pct(1, 0))
UI_PrefHeight(ui_em(2.f, 1.f))
UI_CornerRadius(ui_top_font_size()*0.5f)
UI_HoverCursor(OS_Cursor_HandPoint)
RD_Font(RD_FontSlot_Icons)
UI_TextAlignment(UI_TextAlign_Center)
{
@@ -3440,6 +3440,10 @@ rd_cell(RD_CellParams *params, String8 string)
UI_BoxFlag_Clickable,
"%S##edit", rd_icon_kind_text_table[RD_IconKind_Pencil]);
UI_Signal sig = ui_signal_from_box(edit_start_box);
if(ui_pressed(sig))
{
edit_started = 1;
}
}
ui_spacer(ui_em(1.f, 1.f));
}
@@ -3719,6 +3723,14 @@ rd_cell(RD_CellParams *params, String8 string)
scratch_end(scratch);
}
//////////////////////////////
//- rjf: click-driven "start editing"
//
if(edit_started)
{
sig.f |= UI_SignalFlag_DoubleClicked;
}
//////////////////////////////
//- rjf: compute editable fancy strings
//