From 9aa49f522f331ed2c30d5d222ca47132af750ecd Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Thu, 7 Jan 2016 21:40:48 -0500 Subject: [PATCH] update open dialog window height/width/font/fontsize for iemguis as they are resized/repositioned with the mouse --- pd/nw/pdgui.js | 5 +++++ pd/src/g_all_guis.c | 14 ++++++++++---- pd/src/g_bang.c | 2 +- pd/src/g_numbox.c | 6 +++--- pd/src/g_radio.c | 2 +- pd/src/g_slider.c | 4 ++-- pd/src/g_toggle.c | 3 +-- pd/src/g_vumeter.c | 4 ++-- 8 files changed, 25 insertions(+), 15 deletions(-) diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 6bc6599b1..420b6183a 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3201,6 +3201,11 @@ function gui_iemgui_dialog(did, attr_array) { attr_array_to_object(attr_array)); } +function gui_dialog_set_field(did, field_name, value) { + var elem = dialogwin[did].window.document.getElementsByName(field_name)[0]; + elem.value = value; +} + function gui_create_array(did, count) { var attr_array = [{ array_gfxstub: did, diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 7ec07cd51..a0b25113a 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -795,8 +795,14 @@ void scalehandle_free(t_scalehandle *h) { } void properties_set_field_int(long props, const char *gui_field, int value) { - sys_vgui(".gfxstub%lx.%s delete 0 end\n", props, gui_field); - sys_vgui(".gfxstub%lx.%s insert 0 %d\n", props, gui_field, value); + //sys_vgui(".gfxstub%lx.%s delete 0 end\n", props, gui_field); + //sys_vgui(".gfxstub%lx.%s insert 0 %d\n", props, gui_field, value); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, ".gfxstub%lx", props); + gui_vmess("gui_dialog_set_field", "ssi", + tagbuf, + gui_field, + value); }; void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) { @@ -813,8 +819,8 @@ void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) { { int new_x = x->x_ldx + h->h_dragx; int new_y = x->x_ldy + h->h_dragy; - properties_set_field_int(properties,"label.xy.x_entry",new_x); - properties_set_field_int(properties,"label.xy.y_entry",new_y); + properties_set_field_int(properties, "x-offset", new_x); + properties_set_field_int(properties, "y-offset", new_y); } x->x_ldx += dx; x->x_ldy += dy; diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index 37962b947..cdf9d72f3 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -202,7 +202,7 @@ static void bng__motionhook(t_scalehandle *sh, if (properties) { int new_w = x->x_gui.x_w + sh->h_dragx; - properties_set_field_int(properties,"dim.w_ent",new_w); + properties_set_field_int(properties,"size",new_w); } } scalehandle_dragon_label(sh,mouse_x, mouse_y); diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index b33381dbb..a9221b32e 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -369,9 +369,9 @@ static void my_numbox__motionhook(t_scalehandle *sh, int properties = gfxstub_haveproperties((void *)x); if (properties) { - properties_set_field_int(properties,"dim.w_ent",x->x_scalewidth); - properties_set_field_int(properties,"dim.h_ent",x->x_scaleheight); - properties_set_field_int(properties,"label.fontsize_entry",x->x_tmpfontsize); + properties_set_field_int(properties,"width",x->x_scalewidth); + properties_set_field_int(properties,"height",x->x_scaleheight); + properties_set_field_int(properties,"font-size",x->x_tmpfontsize); } } scalehandle_dragon_label(sh,mouse_x, mouse_y); diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c index 899324683..8a73cc971 100644 --- a/pd/src/g_radio.c +++ b/pd/src/g_radio.c @@ -190,7 +190,7 @@ static void radio__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg int properties = gfxstub_haveproperties((void *)x); if (properties) { - properties_set_field_int(properties,"dim.w_ent", x->x_orient ? + properties_set_field_int(properties,"size", x->x_orient ? x->x_gui.x_h + sh->h_dragy : x->x_gui.x_w + sh->h_dragx); } diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c index 143bedbc2..5fab44579 100644 --- a/pd/src/g_slider.c +++ b/pd/src/g_slider.c @@ -183,8 +183,8 @@ static void slider__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg { int new_w = x->x_gui.x_w + sh->h_dragx; int new_h = x->x_gui.x_h + sh->h_dragy; - properties_set_field_int(properties,"dim.w_ent",new_w); - properties_set_field_int(properties,"dim.h_ent",new_h); + properties_set_field_int(properties,"width",new_w); + properties_set_field_int(properties,"height",new_h); } } scalehandle_dragon_label(sh,mouse_x, mouse_y); diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 089115e53..9316e1135 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -159,13 +159,12 @@ static void toggle__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg if (properties) { int new_w = x->x_gui.x_w + sh->h_dragx; - properties_set_field_int(properties,"dim.w_ent",new_w); + properties_set_field_int(properties,"size",new_w); } } scalehandle_dragon_label(sh,mouse_x, mouse_y); } - void toggle_draw(t_toggle *x, t_glist *glist, int mode) { if(mode == IEM_GUI_DRAW_MODE_UPDATE) sys_queuegui(x, x->x_gui.x_glist, toggle_draw_update); diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index 7e09183f1..65ef77d26 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -354,8 +354,8 @@ static void vu__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg mou { int new_w = x->x_gui.x_w + sh->h_dragx; int new_h = x->x_gui.x_h + sh->h_dragy; - properties_set_field_int(properties,"dim.w_ent",new_w); - properties_set_field_int(properties,"dim.h_ent",new_h); + properties_set_field_int(properties,"width",new_w); + properties_set_field_int(properties,"height",new_h); } } scalehandle_dragon_label(sh,mouse_x, mouse_y); -- GitLab