diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html index bfdd112501cabfaf851d05c671ffcc3e90078b96..f9a2392adc5033b7bb3eb3f23b0a7b4e251e02c9 100644 --- a/pd/nw/dialog_iemgui.html +++ b/pd/nw/dialog_iemgui.html @@ -372,12 +372,13 @@ function update_attr(elem) { //Clean up strings to send as symbol arguments to Pd function pd_symbol_carwash(s) { - s = (s === "" || !s) ? "empty" : s; + s = !s ? "empty" : s; if (s.charAt(0) === "$") { s = "#" + s.slice(1); } s = substitute_space(s); s = strip_problem_chars(s); + return s; } function send_params(attrs, create_undo_point) { @@ -391,13 +392,12 @@ function send_params(attrs, create_undo_point) { iemgui_clip_fontsize $id */ -pdgui.post("label is " + attrs["label"]); var send_symbol = attrs["send-symbol"], receive_symbol = attrs["receive-symbol"], label = attrs["label"]; - pd_symbol_carwash(send_symbol); - pd_symbol_carwash(receive_symbol); - pd_symbol_carwash(label); + send_symbol = pd_symbol_carwash(send_symbol); + receive_symbol = pd_symbol_carwash(receive_symbol); + label = pd_symbol_carwash(label); var label_x_offset = attrs["x-offset"]; var label_y_offset = attrs["y-offset"]; @@ -439,7 +439,7 @@ pdgui.post("label is " + attrs["label"]); if (!slot3) { // toggle slot3 = attrs["nonzero-value"]; - if (slot3 === "") { + if (!slot3) { slot3 = 0; } slot4 = 0; @@ -474,7 +474,9 @@ pdgui.post("label is " + attrs["label"]); var font_size = attrs["font-size"]; if (!font_size) { font_size = 0; } - var foreground_color = attrs["foreground-color"]; + // [vu] doesn't have a foreground color + var foreground_color = attrs["foreground-color"] ? + attrs["foreground-color"] : 0; var background_color = attrs["background-color"]; var label_color = attrs["label-color"]; @@ -500,7 +502,9 @@ pdgui.post("label is " + attrs["label"]); background_color, foreground_color, label_color, slot18, // steady on click - 0); + 0, // not sure what this is doing here + create_undo_point ? 1 : 0 // whether we set an undo point + ); } function cancel(revert_changes) { @@ -528,6 +532,8 @@ function ok() { // Steal focus from any active input to make sure it triggers an // onchange event document.querySelector("button").focus(); + // send the old attrs first so we can set an undo point on them + send_params(old_attrs, false); send_params(new_attrs, true); cancel(false); } diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index ee10c366767422457269da4e7f2151c772355967..14aca4280b34f6f6f8451423883f004ecfca9590 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -346,7 +346,8 @@ static void bng_bang2(t_bng *x)/*wird immer gesendet, wenn moeglich*/ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) { - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); x->x_gui.x_h = x->x_gui.x_w = atom_getintarg(0, argc, argv); int fthold = atom_getintarg(2, argc, argv); int ftbreak = atom_getintarg(3, argc, argv); diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index 90dbbcf6fd8e963d14b73ad14c69510e4bd75abd..67ce8061324604ddddee839db49ed701e99b55d9 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -224,7 +224,8 @@ static void my_canvas_get_pos(t_my_canvas *x) static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv) { //printf("cnv_dialog: selected=%d\n",x->x_gui.x_selected); - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); //printf("cnv_dialog: selected=%d\n",x->x_gui.x_selected); x->x_gui.x_h = x->x_gui.x_w = maxi(atom_getintarg(0, argc, argv),1); diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index 7c734cfb24008e74ef6aa298977770f6c04d6667..37e2e71fe0c399dfd8edd9f59ded2fbdb4fbf8e6 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -500,7 +500,8 @@ static void my_numbox_bang(t_my_numbox *x) static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, t_atom *argv) { - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); x->x_gui.x_w = maxi(atom_getintarg(0, argc, argv),1); x->x_gui.x_h = maxi(atom_getintarg(1, argc, argv),8); double min = atom_getfloatarg(2, argc, argv); diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c index 9db6bbf931beec40bd6637e93aa4dc82e6d230f1..90c665871582b8123fbd44fd587c0eed8afd7910 100644 --- a/pd/src/g_radio.c +++ b/pd/src/g_radio.c @@ -273,7 +273,8 @@ static void radio_properties(t_gobj *z, t_glist *owner) static void radio_dialog(t_radio *x, t_symbol *s, int argc, t_atom *argv) { - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(atom_getintarg(0, argc, argv)); x->x_change = !!atom_getintarg(4, argc, argv); diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c index 6c63ec004d3e76d7ecd565e4f144d2c30e046c6d..69b649dda9c3565542d354983abd3a604df47238 100644 --- a/pd/src/g_slider.c +++ b/pd/src/g_slider.c @@ -319,7 +319,8 @@ static void slider_bang(t_slider *x) static void slider_dialog(t_slider *x, t_symbol *s, int argc, t_atom *argv) { - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); int w = atom_getintarg(0, argc, argv); int h = atom_getintarg(1, argc, argv); double min = atom_getfloatarg(2, argc, argv); diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 70cf31b3ec0b562c91bf2e33a8fcaa06f804405a..b3e813423ba38ee136817b9a169285cd2ca3184c 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -263,7 +263,8 @@ static void toggle_bang(t_toggle *x) static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv) { - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(atom_getintarg(0, argc, argv)); t_float nonzero = atom_getfloatarg(2, argc, argv); diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index 9a0810bfc04705d0d6251ef450244fa6465493e7..480f6384406d5cccb707dc6cd77b91a201736c53 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -529,7 +529,8 @@ static void vu_properties(t_gobj *z, t_glist *owner) static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) { - canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + if (atom_getintarg(19, argc, argv)) + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); int w = atom_getintarg(0, argc, argv); int h = atom_getintarg(1, argc, argv);