Commit c33aace2 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

Enabled visual feedback when clicking on the empty symbol gatom to edit its value

* Before empty symbol gatom had no feedback when being clicked on and one had to start typing trusting that the object is indeed properly activated.

* Now, the object draws ... as soon as an empty (and only empty) symbol gatom is selected, so that it has text to highlight thereby letting the user know that the object is ready to receive their input. In case the symbol gatom already has content, then that content gets highlighted which serves the same purpose.

* This does not affect the float gatom.
parent c4495143
Pipeline #2912 failed with stage
in 224 minutes and 30 seconds
......@@ -1112,7 +1112,7 @@ static void gatom_key(void *z, t_floatarg f)
t_gatom *x = (t_gatom *)z;
int c = f;
//post("gatom_key <%c> %d", c, x->a_shift);
//post("gatom_key %f %d", f, x->a_shift);
int len = strlen(x->a_buf);
t_atom at;
char sbuf[ATOMBUFSIZE + 4];
......@@ -1139,7 +1139,11 @@ static void gatom_key(void *z, t_floatarg f)
else if (x->a_atom.a_type == A_SYMBOL)
//post("gatom_key release");
if (strcmp(x->a_buf, x->a_atom.a_w.w_symbol->s_name))
// 20200923: we also check for empty a_buf to ensure that
// the ... is deleted. This was created when the object was originally
// clicked on below, but only if the current gatom is symbol type and
// is empty.
if (x->a_buf[0] == 0 || strcmp(x->a_buf, x->a_atom.a_w.w_symbol->s_name))
strcpy(x->a_buf, x->a_atom.a_w.w_symbol->s_name);
gatom_retext(x, 1, 1);
......@@ -1256,6 +1260,16 @@ static void gatom_click(t_gatom *x,
x->a_shift = shift;
if (x->a_atom.a_type == A_SYMBOL && !strlen(x->a_atom.a_w.w_symbol->s_name))
char sbuf[ATOMBUFSIZE + 4];
t_atom at;
sprintf(sbuf, "%s...", x->a_buf);
SETSYMBOL(&at, gensym(sbuf));
binbuf_add(x->a_text.te_binbuf, 1, &at);
glist_retext(x->a_glist, &x->a_text);
glist_grab(x->a_glist, &x->a_text.te_g, gatom_motion, gatom_key,
xpos, ypos);
//post("a_shift_clicked=%d", x->a_shift_clicked);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment