From b0f5f2fe004337eb79e5a3d5723c2755c867cce9 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Mon, 23 Feb 2015 19:25:00 -0500 Subject: [PATCH] First draft for iemgui properties dialog covering all iemguis --- pd/nw/pdcanvas.html | 8 +- pd/nw/pdgui.js | 188 +++++++++++++++++++++++++++--- pd/nw/pdproperties.html | 133 ++++++++++++++++++--- pd/nw/todo.txt | 14 +++ pd/src/g_all_guis.c | 106 ++++++++++------- pd/src/g_bang.c | 88 +++++++------- pd/src/g_mycanvas.c | 56 +++++++-- pd/src/g_numbox.c | 98 +++++++++++----- pd/src/g_radio.c | 84 +++++++++++--- pd/src/g_slider.c | 90 +++++++++++---- pd/src/g_template.c | 102 ++++++++-------- pd/src/g_toggle.c | 79 ++++++------- pd/src/g_vumeter.c | 249 +++++++++++++++++++++++++++++----------- pd/src/m_pd.h | 6 +- pd/src/s_inter.c | 6 +- 15 files changed, 948 insertions(+), 359 deletions(-) diff --git a/pd/nw/pdcanvas.html b/pd/nw/pdcanvas.html index f295f3ab3..6642ac467 100644 --- a/pd/nw/pdcanvas.html +++ b/pd/nw/pdcanvas.html @@ -494,7 +494,9 @@ function nw_create_patch_window_menus (name) { editMenu.append(new nw.MenuItem({ label: 'Zoom In', click: function () { - nw.Window.get().zoomLevel += 1; + var z = nw.Window.get().zoomLevel; + if (z < 8) { z++; } + nw.Window.get().zoomLevel = z; pdgui.gui_post("zoom level is " + nw.Window.get().zoomLevel); }, key: '=', @@ -504,7 +506,9 @@ function nw_create_patch_window_menus (name) { editMenu.append(new nw.MenuItem({ label: 'Zoom Out', click: function () { - nw.Window.get().zoomLevel -= 1; + var z = nw.Window.get().zoomLevel; + if (z > -7) { z--; } + nw.Window.get().zoomLevel = z; pdgui.gui_post("zoom level is " + nw.Window.get().zoomLevel); }, key: '-', diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index 73d2b0324..3129b5c23 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -1870,6 +1870,13 @@ function gui_canvas_drawio(cid, parenttag, tag, x1, y1, x2, y2, basex, basey) { class: 'xlet' }); g.appendChild(rect); + gui_post("the tag for this XLET is " + tag); +} + +function gui_eraseio(cid, tag) { + gui_post("the tag for this bout-to-ba-leted XLET is " + tag); + var xlet = get_item(cid, tag); + xlet.parentNode.removeChild(xlet); } function gui_message_drawborder(cid,tag,width,height) { @@ -2143,7 +2150,7 @@ function gui_bng_flash(cid, tag, color) { configure_item(button, { fill: color }); } -function gui_create_toggle(cid, tag, color, width, p1,p2,p3,p4,p5,p6,p7,p8,basex,basey) { +function gui_create_toggle(cid, tag, color, state, width, p1,p2,p3,p4,p5,p6,p7,p8,basex,basey) { var g = get_gobj(cid, tag); var points_array = [p1 - basex, p2 - basey, p3 - basex, p4 - basey @@ -2153,7 +2160,7 @@ function gui_create_toggle(cid, tag, color, width, p1,p2,p3,p4,p5,p6,p7,p8,basex stroke: color, fill: 'none', id: tag + 'cross1', - display: 'none', + display: state ? 'inline' : 'none', 'stroke-width': width }); @@ -2165,7 +2172,7 @@ function gui_create_toggle(cid, tag, color, width, p1,p2,p3,p4,p5,p6,p7,p8,basex stroke: color, fill: 'none', id: tag + 'cross2', - display: 'none', + display: state ? 'inline' : 'none', 'stroke-width': width }); g.appendChild(cross1); @@ -2206,7 +2213,8 @@ function gui_toggle_update(cid, tag, state, color) { } // Todo: send fewer parameters from c -function gui_create_numbox(cid,tag,bgcolor,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,basex,basey,half) { +function gui_create_numbox(width,cid,tag,bgcolor,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,basex,basey,half) { +gui_post("numbox width is " + width); // numbox doesn't have a standard iemgui border, so we must create its gobj manually var g = gui_text_create_gobj(cid, tag, basex, basey) var data_array = ['M', p1 - basex, p2 - basey, @@ -2228,12 +2236,13 @@ function gui_create_numbox(cid,tag,bgcolor,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,basex, g.appendChild(border); } -function gui_numbox_drawtext(cid,tag,text,color,xpos,ypos,basex,basey) { +function gui_numbox_drawtext(cid,tag,text,font_size,color,xpos,ypos,basex,basey) { var g = get_gobj(cid, tag); var svg_text = create_item(cid, 'text', { x: xpos - basex, y: ypos - basey + 5, - 'font-size': font, + 'font-size': font_size, + fill: color, id: tag + 'text' }); @@ -2242,6 +2251,14 @@ function gui_numbox_drawtext(cid,tag,text,color,xpos,ypos,basex,basey) { g.appendChild(svg_text); } +function gui_update_numbox(cid, tag, fcolor, bgcolor, font_name, font_size, font_weight) { +gui_post("inside update_numbox fcolor is " + fcolor); + var b = get_item(cid, tag + 'border'); + var text = get_item(cid, tag + 'text'); + configure_item(b, { fill: bgcolor }); + configure_item(text, { fill: fcolor, 'font-size': font_size }); +} + function gui_create_slider(cid,tag,color,p1,p2,p3,p4,basex, basey) { var g = get_gobj(cid, tag); var indicator = create_item(cid, 'line', { @@ -2268,6 +2285,13 @@ function gui_slider_update(cid,tag,p1,p2,p3,p4,basex,basey) { }); } +function gui_slider_indicator_color(cid, tag, color) { + var i = get_item(cid, tag + 'indicator'); + configure_item(i, { + stroke: color + }); +} + function gui_create_radio(cid,tag,p1,p2,p3,p4,i,basex,basey) { var g = get_gobj(cid, tag); var cell = create_item(cid, 'line', { @@ -2288,7 +2312,7 @@ function gui_create_radio_buttons(cid,tag,color,p1,p2,p3,p4,basex,basey,i,state) var g = get_gobj(cid, tag); var b = create_item(cid, 'rect', { x: p1 - basex, - y: p2 -basey, + y: p2 - basey, width: p3 - p1, height: p4 - p2, stroke: color, @@ -2299,11 +2323,32 @@ function gui_create_radio_buttons(cid,tag,color,p1,p2,p3,p4,basex,basey,i,state) g.appendChild(b); } -function gui_radio_update(cid,tag,prev,next) { +function gui_radio_button_coords(cid, tag, x1, y1, xi, yi, i, s, d, orient) { + var button = get_item(cid, tag + 'button_' + i); + var cell = get_item(cid, tag + 'cell_' + i); + // the line to draw the cell for i=0 doesn't exist. Probably was not worth + // the effort, but it's easier just to check for that here atm. + if (i > 0) { + configure_item(cell, { + x1: orient ? 0 : xi, + y1: orient ? yi : 0, + x2: orient ? d : xi, + y2: orient ? yi : d + }); + } + configure_item(button, { + x: orient ? s : xi+s, + y: orient ? yi+s : s, + width: d-(s*2), + height: d-(s*2) + }); +} + +function gui_radio_update(cid,tag,bgcolor,prev,next) { var prev = get_item(cid, tag + 'button_' + prev); var next = get_item(cid, tag + 'button_' + next); - configure_item(prev, { display: 'none' }); - configure_item(next, { display: 'inline' }); + configure_item(prev, { display: 'none', fill: bgcolor, stroke: bgcolor }); + configure_item(next, { display: 'inline', fill: bgcolor, stroke: bgcolor }); } function gui_create_vumeter_text(cid,tag,color,xpos,ypos,text,index,basex,basey) { @@ -2320,7 +2365,36 @@ function gui_create_vumeter_text(cid,tag,color,xpos,ypos,text,index,basex,basey) g.appendChild(svg_text); } -function gui_create_vumeter_steps(cid,tag,color,p1,p2,p3,p4,width,index,basex,basey) { +// Oh, what a terrible interface this is! +// the c API for vumeter was just spewing all kinds of state changes +// at tcl/tk, depending on it to just ignore non-existent objects. +// On changes in the Properties dialog, it would +// a) remove all the labels +// b) configure a bunch of _non-existent_ labels +// c) recreate all the missing labels +// To get on to other work we just parrot the insanity here, +// and silently ignore calls to update non-existent text. +function gui_update_vumeter_text(cid, tag, text, font, selected, color, i) { + var svg_text = get_item(cid, tag + 'text_' + i); + if (!selected) { + // Hack... + if (svg_text !== null) { + configure_item(svg_text, { fill: color }); + } + } +} + +function gui_vumeter_text_coords(cid, tag, i, xpos, ypos, basex, basey) { + var t = get_item(cid, tag + 'text_' + i); + configure_item(t, { x: xpos - basex, y: ypos - basey }); +} + +function gui_erase_vumeter_text(cid, tag, i) { + var t = get_item(cid, tag + 'text_' + i); + t.parentNode.removeChild(t); +} + +function gui_create_vumeter_steps(cid,tag,color,p1,p2,p3,p4,width,index,basex,basey,i) { var g = get_gobj(cid, tag); var l = create_item(cid, 'line', { x1: p1 - basex, @@ -2334,6 +2408,22 @@ function gui_create_vumeter_steps(cid,tag,color,p1,p2,p3,p4,width,index,basex,ba g.appendChild(l); } +function gui_update_vumeter_steps(cid, tag, i, width) { + var step = get_item(cid, tag + 'led_' + i); + configure_item(step, { 'stroke-width': width }); +} + +function gui_update_vumeter_step_coords(cid,tag,i,x1,y1,x2,y2,basex,basey) { +gui_post("updating step coords..."); + var l = get_item(cid, tag + 'led_' + i); + configure_item(l, { + x1: x1 - basex, + y1: y1 - basey, + x2: x2 - basex, + y2: y2 - basey + }); +} + function gui_create_vumeter_rect(cid,tag,color,p1,p2,p3,p4,basex,basey) { var g = get_gobj(cid, tag); var rect = create_item(cid, 'rect', { @@ -2348,6 +2438,22 @@ function gui_create_vumeter_rect(cid,tag,color,p1,p2,p3,p4,basex,basey) { g.appendChild(rect); } +function gui_update_vumeter_rect(cid, tag, color) { + var r = get_item(cid, tag + 'rect'); + configure_item(r, { fill: color, stroke: color }); +} + +/* Oh hack upon hack... why doesn't the iemgui base_config just take care of this? */ +function gui_vumeter_border_coords(cid, tag, width, height) { + var r = get_item(cid, tag + 'border'); + configure_item(r, { width: width, height: height }); +} + +function gui_update_vumeter_peak(cid, tag, width) { + var r = get_item(cid, tag + 'rect'); + configure_item(r, { 'stroke-width': width }); +} + function gui_create_vumeter_peak(cid,tag,color,p1,p2,p3,p4,width,basex,basey) { var g = get_gobj(cid, tag); var line = create_item(cid, 'line', { @@ -2362,9 +2468,9 @@ function gui_create_vumeter_peak(cid,tag,color,p1,p2,p3,p4,width,basex,basey) { g.appendChild(line); } -// change tag from "rect" to "rms" +// probably should change tag from "rect" to "cover" function gui_vumeter_update_rms(cid,tag,p1,p2,p3,p4,basex,basey) { - rect = get_item(cid, tag + 'rect'); + var rect = get_item(cid, tag + 'rect'); configure_item(rect, { x: p1 - basex, y: p2 - basey, @@ -2374,7 +2480,7 @@ function gui_vumeter_update_rms(cid,tag,p1,p2,p3,p4,basex,basey) { } function gui_vumeter_update_peak(cid,tag,color,p1,p2,p3,p4,basex,basey) { - line = get_item(cid, tag + 'peak'); + var line = get_item(cid, tag + 'peak'); configure_item(line, { x1: p1 - basex, y1: p2 - basey, @@ -2412,7 +2518,8 @@ function gui_create_mycanvas(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) { width: x2_vis - x1, height: y2_vis - y1, fill: color, - stroke: color + stroke: color, + id: tag + 'rect' } ); @@ -2421,7 +2528,7 @@ function gui_create_mycanvas(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) { var rect = create_item(cid,'rect', { width: x2 - x1, height: y2 - y1, - fill: color, + fill: 'none', stroke: color, id: tag + 'drag_handle' } @@ -2431,8 +2538,24 @@ function gui_create_mycanvas(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) { g.appendChild(rect); } +function gui_update_mycanvas(cid, tag, color, selected) { + var r = get_item(cid, tag + 'rect'); + var h = get_item(cid, tag + 'drag_handle'); + configure_item(r, { fill: color, stroke: color }); + if (!selected) { + configure_item(h, { stroke: color }); + } +} + +function gui_mycanvas_coords(cid, tag, vis_width, vis_height, select_width, select_height) { + var r = get_item(cid, tag + 'rect'); + var h = get_item(cid, tag + 'drag_handle'); + configure_item(r, { width: vis_width, height: vis_height }); + configure_item(h, { width: select_width, height: select_height }); +} + function gui_mycanvas_select_color(cid,tag,color) { - item = get_item(cid,tag + 'drag_handle'); + var item = get_item(cid,tag + 'drag_handle'); configure_item(item, {stroke: color}); } @@ -2604,7 +2727,7 @@ function gui_draw_configure_all(cid, tag, attr_array) { } function add_popup(cid, popup) { - popup_menu[cid] = popup; + popup_menu[cid] = popup; } exports.add_popup = add_popup; @@ -2612,6 +2735,32 @@ exports.add_popup = add_popup; function gui_canvas_popup(cid, xpos, ypos, canprop, canopen, isobject) { gui_post("canvas_popup called... " + JSON.stringify(arguments)); // Set the global popup x/y so they can be retrieved by the relevant doc's event handler + var zoom_level = patchwin[cid].zoomLevel; + gui_post("zoom level is " + zoom_level); + var zoom_factor = 1 + (zoom_level * (zoom_level * 0.02 + 0.18)); + var zfactor; + switch(zoom_level) { + case -7: zfactor = 0.279; break; + case -6: zfactor = 0.335; break; + case -5: zfactor = 0.402; break; + case -4: zfactor = 0.483; break; + case -3: zfactor = 0.58; break; + case -2: zfactor = 0.695; break; + case -1: zfactor = 0.834; break; + case 1: zfactor = 1.2; break; + case 2: zfactor = 1.44; break; + case 3: zfactor = 1.73; break; + case 4: zfactor = 2.073; break; + case 5: zfactor = 2.485; break; + case 6: zfactor = 2.98; break; + case 7: zfactor = 3.6; break; + case 8: zfactor = 4.32; break; + default: zfactor = 1; + } + + xpos = Math.floor(xpos * zfactor); + ypos = Math.floor(ypos * zfactor); + gui_post("xpos is " + xpos + " and ypos is " + ypos); popup_coords[0] = xpos; popup_coords[1] = ypos; popup_menu[cid].items[0].enabled = canprop; @@ -2624,7 +2773,8 @@ function gui_canvas_popup(cid, xpos, ypos, canprop, canopen, isobject) { var left = patchwin[cid].window.document.body.scrollLeft; var top = patchwin[cid].window.document.body.scrollTop; - popup_menu[cid].popup(xpos - left, ypos - top); + popup_menu[cid].popup(xpos - Math.floor(left * zfactor), + ypos - Math.floor(top * zfactor)); } function popup_action(cid, index) { diff --git a/pd/nw/pdproperties.html b/pd/nw/pdproperties.html index f38ece9c4..0b78458e0 100644 --- a/pd/nw/pdproperties.html +++ b/pd/nw/pdproperties.html @@ -28,11 +28,35 @@ input[type="text"]{width:3em;} size <input type="text" name="size"></label><br> </span> + <span class="selection-size prop"> + <label title="size of the selection rectangle used to select and drag the object"> + selection size <input type="text" name="selection-size"></label><br> + </span> + + <span class="width prop"> + <label title="width of the iemgui"> + width <input type="text" name="width"></label> + <label title="height of the iemgui"> + height <input type="text" name="height"></label><br> + </span> + + <span class="visible-width prop"> + <label title="width of the rectangle"> + width <input type="text" name="visible-width"></label> + <label title="height of the rectangle"> + height <input type="text" name="visible-height"></label><br> + </span> + <span class="nonzero-value prop"> <label title="value to output when the toggle shows an 'x'"> nonzero value <input type="text" name="nonzero-value"></label><br> </span> + <span class="number prop"> + <label title="number of buttons"> + number <input type="text" name="number"></label><br> + </span> + <span class="flash-interrupt prop"> <label title="the amount of time (in milliseconds) that Pd will wait before interrupting the flashing of the button"> interrupt <input type="text" name="flash-interrupt"></label> @@ -43,16 +67,37 @@ input[type="text"]{width:3em;} hold <input type="text" name="flash-hold"></label> <br> </span> - <span class="min-range prop"> + <span class="minimum-range prop"> <label title="the lowest number to output. Anything lower will be replaced by this number"> - minimum <input type="text" name="min-range"></label> + minimum <input type="text" name="minimum-range"></label> <label title="the largest number to output. Anything higher will be replaced by this number"> - maximum <input type="text" name="max-range"></label> <br> + maximum <input type="text" name="maximum-range"></label> <br> </span> <span class="init prop"> <label title="when checked, this will save the state of the iemgui with the patch, and output a value when the patch is loaded (as if you had an invisible [loadbang] connected to the input)."> - init <input type="checkbox" name="init" value="on" ></label> <br> + init <input type="checkbox" name="init" value="on"></label><br> + </span> + + <span class="vu-scale prop"> + <label title="display scale (numbers) next to the meter"> + scale <input type="checkbox" name="vu-scale" value="on"></label><br> + </span> + + + <span class="log-scaling prop"> + <label title="logarithmic scale for values along the slider"> + logarithmic scaling <input type="checkbox" name="log-scaling" value="on"></label><br> + </span> + + <span class="log-height prop"> + <label title="logarithmic scale for values along the slider"> + log height<input type="text" name="log-height"></label><br> + </span> + + <span class="steady-on-click prop"> + <label title="don't move the slider on click, only on dragging."> + steady on click <input type="checkbox" name="steady-on-click" value="on"></label><br> </span> </fieldset> @@ -114,6 +159,7 @@ input[type="text"]{width:3em;} <span class="prop"> <input type="hidden" name="minimum-size"> <input type="hidden" name="range-schedule"> + <input type="hidden" name="hide-frame"> </span> <div style="text-align: center"> @@ -139,6 +185,10 @@ input[type="text"]{width:3em;} cancel(); } +// function toggler(evt) { +// evt.value = evt.checked ? 1 : 0; +// } + function substitute_space(arg) { var fake_space = String.fromCharCode(11); return arg.split(' ').join(fake_space); @@ -201,53 +251,94 @@ input[type="text"]{width:3em;} var height, width; var size = document.getElementsByName('size')[0].value; - if (size !== null) { - height = size; - width = size; + if (size === '') { + var size = document.getElementsByName('selection-size')[0].value; } - var slot3 = document.getElementsByName('min-range')[0].value; - var slot4 = document.getElementsByName('max-range')[0].value; + if (size !== '') { + width = size; + height = size; + } else { + width = document.getElementsByName('width')[0].value; + height = document.getElementsByName('height')[0].value; + } - pdgui.gui_post("min-range is " + slot3); + var slot3 = document.getElementsByName('minimum-range')[0].value; + var slot4 = document.getElementsByName('maximum-range')[0].value; if (slot3 === '') { slot3 = document.getElementsByName('flash-interrupt')[0].value; slot4 = document.getElementsByName('flash-hold')[0].value; - pdgui.gui_post("slot3 is now " + slot3); + } + + if (slot3 === '') { + slot3 = document.getElementsByName('visible-width')[0].value; + slot4 = document.getElementsByName('visible-height')[0].value; } if (slot3 === '') { // toggle slot3 = document.getElementsByName('nonzero-value')[0].value; + if (slot3 === '') { + slot3 = 0; + } slot4 = 0; } - var init = document.getElementsByName('init')[0].value; - if (init !== null) { init = 0; } + var slot5 = +document.getElementsByName('log-scaling')[0].checked; + // Hack to accomodate the vu-scale property, which exists in the same + // slot as this one + var log_scaling_spanner = document.getElementsByClassName('log-scaling')[0]; + var log_display = log_scaling_spanner.style.getPropertyValue('display'); + + if (log_display === null) { + slot5 = +document.getElementsByName('vu-scale')[0].checked; + pdgui.gui_post('slot five is ' + slot5); + } + pdgui.gui_post('slot five is ' + slot5); + + var init = +document.getElementsByName('init')[0].checked; + if (init === '') { init = 0; } + + var slot7 = document.getElementsByName('log-height')[0].value; + if (slot7 === '') { + slot7 = document.getElementsByName('number')[0].value; + } + if (slot7 === '') { + slot7 = 0; + } var font_style = document.getElementsByName('font-style')[0].value; if (font_style !== null) { font_style = 0; } var font_size = document.getElementsByName('font-size')[0].value; - if (font_size !== null) { font_size = 0; } + if (font_size === '') { font_size = 0; } var foreground_color = parseInt(document.getElementsByName('foreground-color')[0].value.slice(1), 16); var background_color = parseInt(document.getElementsByName('background-color')[0].value.slice(1), 16); var label_color = parseInt(document.getElementsByName('label-color')[0].value.slice(1), 16); + var slot18 = +document.getElementsByName('steady-on-click')[0].checked; + pdgui.pdsend([pd_object_callback, 'dialog', width, height, - slot3, // flash-interrupt, min-range, or nonzero-value - slot4, // flash-hold or max-range - 0, // this should be the lin/log thingy + slot3, // bng: flash-interrupt + // slider: min-range + // toggle: nonzero-value + // my_canvas: visible_width + slot4, // bng: flash-hold + // slider: max-range + // my_canvas: visible_height + slot5, // slider: lin/log thingy + // nbx: lin/log + // vu: vu-scale init, - 0, // this should be the number for toggle + slot7, // log-height or vradio/hradio number send_symbol, receive_symbol, label, label_x_offset, label_y_offset, font_style, font_size, background_color, foreground_color, label_color, - 0, // steady on click + slot18, // steady on click 0].join(' ')); /* pd [concat $id dialog \ @@ -309,6 +400,10 @@ function populate_form(attr_array) { var color_string = "#" + (hex_string === '0' ? '000000' : hex_string); pdgui.gui_post("color is " + color_string); elem[0].value = color_string; + } else if (elem[0].type === 'checkbox') { + // The attr here is a string, so we need to + // force it to number, hence the "+" below + elem[0].checked = +attr_array[i+1]; } else { elem[0].value = attr_array[i+1]; } diff --git a/pd/nw/todo.txt b/pd/nw/todo.txt index 99327ecda..2889f2202 100644 --- a/pd/nw/todo.txt +++ b/pd/nw/todo.txt @@ -88,3 +88,17 @@ Everything else: * implement the crappy iemgui color dialog presets * find a simple translation API * use underscores for iemgui dialog element names +* revisit the x_thick logic in g_slider.c. It thickens the indicator when it's + in the middle of the slider, but it's pretty obscure in the current impl. +* for as many items as possible, hide them instead of removing from DOM (stuff + like xlets, etc.) +* fix iemgui_font so it doesn't use tcl list syntax +* change all the gui color char[MAXPDSTRING] junk to simple int, and do the conversion to + hex html string in the gui +* implement iemgui labels and its ascetic font chooser +* think about scaling the svg instead of the page, and making the selection + rectangle a div above that +* change 'visible-width' to 'cnv-width' +* in pdproperties.html, use an object to store all the prop/value pairs that + got sent. That way we don't have to use all those awful tricks to + conditionally fill the slots diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 5d3ecbe35..c7b739462 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -504,8 +504,8 @@ void iemgui_select(t_gobj *z, t_glist *glist, int selected) x->x_selected = canvas; else x->x_selected = NULL; - sys_vgui(".x%lx.c itemconfigure {x%lx&&border} -stroke %s\n", canvas, x, - x->x_selected && x->x_glist == canvas ? selection_color : border_color); + //sys_vgui(".x%lx.c itemconfigure {x%lx&&border} -stroke %s\n", canvas, x, + // x->x_selected && x->x_glist == canvas ? selection_color : border_color); gui_vmess("gui_text_select_color", "ss", canvas_string(canvas), tagbuf); x->x_draw((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT); if (selected < 2) @@ -949,12 +949,12 @@ void iemgui_tag_selected(t_iemgui *x) { t_canvas *canvas=glist_getcanvas(x->x_glist); if(x->x_selected) { - sys_vgui(".x%lx.c addtag selected withtag x%lx\n", canvas, x); + //sys_vgui(".x%lx.c addtag selected withtag x%lx\n", canvas, x); gui_vmess("gui_text_select", "ss", canvas_string(canvas), tagbuf); } else { - sys_vgui(".x%lx.c dtag x%lx selected\n", canvas, x); + //sys_vgui(".x%lx.c dtag x%lx selected\n", canvas, x); gui_vmess("gui_text_deselect", "ss", canvas_string(canvas), tagbuf); } } @@ -1012,6 +1012,7 @@ void iemgui_label_draw_select(t_iemgui *x) { extern t_class *my_numbox_class; extern t_class *vu_class; +extern t_class *my_canvas_class; void iemgui_draw_io(t_iemgui *x, int old_sr_flags) { t_canvas *canvas=glist_getcanvas(x->x_glist); @@ -1028,49 +1029,71 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags) c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2); int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH; - + /* cnv has no inlets */ + if (c == my_canvas_class) + n = 0; int a=old_sr_flags&IEM_GUI_OLD_SND_FLAG; int b=x->x_snd!=s_empty; //fprintf(stderr,"%lx SND: old_sr_flags=%d SND_FLAG=%d || OUTCOME: OLD_SND_FLAG=%d not_empty=%d\n", (t_int)x, old_sr_flags, IEM_GUI_OLD_SND_FLAG, a, b); if(a && !b) for (i=0; i<n; i++) { - sys_vgui(".x%lx.c create prect %d %d %d %d " - "-stroke $pd_colors(iemgui_nlet) " - "-tags {%so%d x%lx outlet %s}\n", - canvas, x1+i*k, y2-1, x1+i*k + IOWIDTH, y2, - iem_get_tag(canvas, x), i, x, - x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); + //sys_vgui(".x%lx.c create prect %d %d %d %d " + // "-stroke $pd_colors(iemgui_nlet) " + // "-tags {%so%d x%lx outlet %s}\n", + // canvas, x1+i*k, y2-1, x1+i*k + IOWIDTH, y2, + // iem_get_tag(canvas, x), i, x, + // x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); char parenttagbuf[MAXPDSTRING]; char tagbuf[MAXPDSTRING]; sprintf(parenttagbuf, "x%lx", (long unsigned int)x); sprintf(tagbuf, "%so%d", iem_get_tag(canvas, x), i); - gui_vmess("gui_canvas_drawio", "sssiiiiii", canvas_string(canvas), parenttagbuf, - tagbuf, x1+i*k, y2-1, x1+i*k + IOWIDTH, y2, x1, y1); + gui_vmess("gui_canvas_drawio", "sssiiiiii", canvas_string(canvas), + parenttagbuf, tagbuf, + x1+i*k, y2-1, x1+i*k + IOWIDTH, y2, x1, y1); } - if(!a && b) for (i=0; i<n; i++) - sys_vgui(".x%lx.c delete %so%d\n", canvas, iem_get_tag(canvas, x), i); + if(!a && b) + for (i=0; i<n; i++) + { + //sys_vgui(".x%lx.c delete %so%d\n", + // canvas, iem_get_tag(canvas, x), i); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "%so%d", iem_get_tag(canvas, x), i); + gui_vmess("gui_eraseio", "ss", + canvas_string(canvas), tagbuf); + } - a=old_sr_flags&IEM_GUI_OLD_RCV_FLAG; - b=x->x_rcv!=s_empty; - //fprintf(stderr,"%lx RCV: old_sr_flags=%d RCV_FLAG=%d || OUTCOME: OLD_RCV_FLAG=%d not_empty=%d\n", (t_int)x, old_sr_flags, IEM_GUI_OLD_RCV_FLAG, a, b); + a = old_sr_flags & IEM_GUI_OLD_RCV_FLAG; + b = x->x_rcv != s_empty; + //fprintf(stderr, "%lx RCV: old_sr_flags=%d RCV_FLAG=%d || " + // "OUTCOME: OLD_RCV_FLAG=%d not_empty=%d\n", + // (t_int)x, old_sr_flags, IEM_GUI_OLD_RCV_FLAG, a, b); if(a && !b) for (i=0; i<n; i++) { - sys_vgui(".x%lx.c create prect %d %d %d %d " - "-stroke $pd_colors(iemgui_nlet) " - "-tags {%si%d x%lx inlet %s}\n", - canvas, x1+i*k, y1, x1+i*k + IOWIDTH, y1+1, - iem_get_tag(canvas, x), i, x, - x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); + //sys_vgui(".x%lx.c create prect %d %d %d %d " + // "-stroke $pd_colors(iemgui_nlet) " + // "-tags {%si%d x%lx inlet %s}\n", + // canvas, x1+i*k, y1, x1+i*k + IOWIDTH, y1+1, + // iem_get_tag(canvas, x), i, x, + // x->x_selected == x->x_glist ? "iemgui selected" : "iemgui"); char parenttagbuf[MAXPDSTRING]; char tagbuf[MAXPDSTRING]; sprintf(parenttagbuf, "x%lx", (long unsigned int)x); sprintf(tagbuf, "%si%d", iem_get_tag(canvas, x), i); - gui_vmess("gui_canvas_drawio", "sssiiiiii", canvas_string(canvas), parenttagbuf, - tagbuf, x1+i*k, y1, x1+i*k + IOWIDTH, y1+1, x1, y1); + gui_vmess("gui_canvas_drawio", "sssiiiiii", canvas_string(canvas), + parenttagbuf, tagbuf, + x1+i*k, y1, x1+i*k + IOWIDTH, y1+1, x1, y1); } - if(!a && b) for (i=0; i<n; i++) - sys_vgui(".x%lx.c delete %si%d\n", canvas, iem_get_tag(canvas, x), i); + if(!a && b) + for (i=0; i<n; i++) + { + //sys_vgui(".x%lx.c delete %si%d\n", + // canvas, iem_get_tag(canvas, x), i); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "%si%d", iem_get_tag(canvas, x), i); + gui_vmess("gui_eraseio", "ss", + canvas_string(canvas), tagbuf); + } } void iemgui_io_draw_move(t_iemgui *x) { @@ -1079,6 +1102,9 @@ void iemgui_io_draw_move(t_iemgui *x) { int x1,y1,x2,y2; c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2); int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH; + /* cnv has no xlets */ + if (c == my_canvas_class) + n = 0; if(!iemgui_has_snd(x) && canvas == x->x_glist) for (i=0; i<n; i++) { //sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n", @@ -1088,10 +1114,10 @@ void iemgui_io_draw_move(t_iemgui *x) { gui_start_vmess("gui_configure_item", "ss", canvas_string(canvas), tagbuf); gui_start_array(); - gui_string_elem("x"); - gui_int_elem(i*k); - gui_string_elem("y"); - gui_int_elem(y2 - y1 - 1); + gui_s("x"); + gui_i(i*k); + gui_s("y"); + gui_i(y2 - y1 - 1); gui_end_array(); gui_end_vmess(); } @@ -1104,8 +1130,8 @@ void iemgui_io_draw_move(t_iemgui *x) { gui_start_vmess("gui_configure_item", "ss", canvas_string(canvas), tagbuf); gui_start_array(); - gui_string_elem("x"); - gui_int_elem(i*k); + gui_s("x"); + gui_i(i*k); gui_end_array(); gui_end_vmess(); @@ -1120,10 +1146,10 @@ void iemgui_base_draw_new(t_iemgui *x) { int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0; c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2); gop_redraw=gr; - sys_vgui(".x%lx.c create prect %d %d %d %d " - "-stroke $pd_colors(iemgui_border) -fill #%6.6x " - "-tags {%lxBASE x%lx text iemgui border}\n", - canvas, x1,y1,x2,y2, x->x_bcol, x, x); + //sys_vgui(".x%lx.c create prect %d %d %d %d " + // "-stroke $pd_colors(iemgui_border) -fill #%6.6x " + // "-tags {%lxBASE x%lx text iemgui border}\n", + // canvas, x1,y1,x2,y2, x->x_bcol, x, x); gui_vmess("gui_text_create_gobj", "ssii", canvas_string(canvas), tagbuf, x1, y1); char colorbuf[MAXPDSTRING]; @@ -1155,8 +1181,8 @@ void iemgui_base_draw_config(t_iemgui *x) { gui_start_vmess("gui_configure_item", "ss", canvas_string(canvas), tagbuf); gui_start_array(); - gui_string_elem("fill"); - gui_string_elem(bcol); + gui_s("fill"); + gui_s(bcol); gui_end_array(); gui_end_vmess(); } diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index 5dce22083..1c636b3ce 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -83,14 +83,14 @@ void bng_draw_move(t_bng *x, t_glist *glist) gui_start_vmess("gui_configure_item", "ss", canvas_string(canvas), tagbuf); gui_start_array(); - gui_string_elem("cx"); - gui_float_elem(cx - x1 - 0.5); // 0.5 is fudge factor... might be better - gui_string_elem("cy"); - gui_float_elem(cy - y1 - 0.5); // handled by shape-rendering css attr - gui_string_elem("r"); - gui_float_elem(cr); - gui_string_elem("fill"); - gui_string_elem(col); + gui_s("cx"); + gui_f(cx - x1 - 0.5); // 0.5 is fudge factor... might be better + gui_s("cy"); + gui_f(cy - y1 - 0.5); // handled by shape-rendering css attr + gui_s("r"); + gui_f(cr); + gui_s("fill"); + gui_s(col); gui_end_array(); gui_end_vmess(); } @@ -108,8 +108,8 @@ void bng_draw_config(t_bng* x, t_glist* glist) gui_start_vmess("gui_configure_item", "ss", canvas_string(canvas), tagbuf); gui_start_array(); - gui_string_elem("fill"); - gui_string_elem(fcol); + gui_s("fill"); + gui_s(fcol); gui_end_array(); gui_end_vmess(); } @@ -244,56 +244,56 @@ static void bng_properties(t_gobj *z, t_glist *owner) gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); gui_start_array(); - gui_string_elem("type"); - gui_string_elem("bng"); + gui_s("type"); + gui_s("bng"); - gui_string_elem("size"); - gui_int_elem(x->x_gui.x_w); + gui_s("size"); + gui_i(x->x_gui.x_w); - gui_string_elem("minimum-size"); - gui_int_elem(IEM_GUI_MINSIZE); + gui_s("minimum-size"); + gui_i(IEM_GUI_MINSIZE); - gui_string_elem("range-schedule"); // no idea what this is... - gui_int_elem(2); + gui_s("range-schedule"); // no idea what this is... + gui_i(2); - gui_string_elem("flash-interrupt"); - gui_int_elem(x->x_flashtime_break); + gui_s("flash-interrupt"); + gui_i(x->x_flashtime_break); - gui_string_elem("flash-hold"); - gui_int_elem(x->x_flashtime_hold); + gui_s("flash-hold"); + gui_i(x->x_flashtime_hold); - gui_string_elem("init"); - gui_int_elem(x->x_gui.x_loadinit); + gui_s("init"); + gui_i(x->x_gui.x_loadinit); - gui_string_elem("send-symbol"); - gui_string_elem(srl[0]->s_name); + gui_s("send-symbol"); + gui_s(srl[0]->s_name); - gui_string_elem("receive-symbol"); - gui_string_elem(srl[1]->s_name); + gui_s("receive-symbol"); + gui_s(srl[1]->s_name); - gui_string_elem("label"); - gui_string_elem(srl[2]->s_name); + gui_s("label"); + gui_s(srl[2]->s_name); - gui_string_elem("x-offset"); - gui_int_elem(x->x_gui.x_ldx); + gui_s("x-offset"); + gui_i(x->x_gui.x_ldx); - gui_string_elem("y-offset"); - gui_int_elem(x->x_gui.x_ldy); + gui_s("y-offset"); + gui_i(x->x_gui.x_ldy); - gui_string_elem("font-style"); - gui_int_elem(x->x_gui.x_font_style); + gui_s("font-style"); + gui_i(x->x_gui.x_font_style); - gui_string_elem("font-size"); - gui_int_elem(x->x_gui.x_fontsize); + gui_s("font-size"); + gui_i(x->x_gui.x_fontsize); - gui_string_elem("background-color"); - gui_int_elem(0xffffff & x->x_gui.x_bcol); + gui_s("background-color"); + gui_i(0xffffff & x->x_gui.x_bcol); - gui_string_elem("foreground-color"); - gui_int_elem(0xffffff & x->x_gui.x_fcol); + gui_s("foreground-color"); + gui_i(0xffffff & x->x_gui.x_fcol); - gui_string_elem("label-color"); - gui_int_elem(0xffffff & x->x_gui.x_lcol); + gui_s("label-color"); + gui_i(0xffffff & x->x_gui.x_lcol); gui_end_array(); gui_end_vmess(); diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index bb1389865..801add84c 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -55,17 +55,28 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) canvas, x, x1, y1, x1+x->x_vis_w, y1+x->x_vis_h); sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, x1, y1, x1+x->x_gui.x_w, y1+x->x_gui.x_h); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_mycanvas_coords", "ssiiii", + canvas_string(canvas), tagbuf, + x->x_vis_w, x->x_vis_h, x->x_gui.x_w, x->x_gui.x_h); } void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxRECT -fill #%6.6x -stroke #%6.6x\n", - canvas, x, x->x_gui.x_bcol, x->x_gui.x_bcol); + int isselected; + //sys_vgui(".x%lx.c itemconfigure %lxRECT -fill #%6.6x -stroke #%6.6x\n", + // canvas, x, x->x_gui.x_bcol, x->x_gui.x_bcol); char bcol[8]; sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke %s\n", canvas, x, - x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas ? - "$pd_colors(selection)" : bcol); + //sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke %s\n", canvas, x, + // x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas ? + // "$pd_colors(selection)" : bcol); + isselected = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas; + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_update_mycanvas", "sssi", + canvas_string(canvas), tagbuf, bcol, isselected); } void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) @@ -195,7 +206,7 @@ static void my_canvas_save(t_gobj *z, t_binbuf *b) static void my_canvas_properties(t_gobj *z, t_glist *owner) { t_my_canvas *x = (t_my_canvas *)z; - char buf[800]; + char buf[800], *gfx_tag; t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); @@ -214,7 +225,37 @@ static void my_canvas_properties(t_gobj *z, t_glist *owner) srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + //gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + + gfx_tag = gfxstub_new2(&x->x_gui.x_obj.ob_pd, x); + /* todo: send along the x/y of the object here so we can + create the window in the right place */ + + gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); + gui_start_array(); + + gui_s("type"); gui_s("cnv"); + gui_s("selection-size"); gui_i(x->x_gui.x_w); + gui_s("visible-width"); gui_i(x->x_vis_w); + gui_s("visible-height"); gui_i(x->x_vis_h); + gui_s("minimum-size"); gui_i(IEM_GUI_MINSIZE); + + gui_s("range-schedule"); // no idea what this is... + gui_i(0); + + gui_s("send-symbol"); gui_s(srl[0]->s_name); + gui_s("receive-symbol"); gui_s(srl[1]->s_name); + gui_s("label"); gui_s(srl[2]->s_name); + gui_s("x-offset"); gui_i(x->x_gui.x_ldx); + gui_s("y-offset"); gui_i(x->x_gui.x_ldy); + gui_s("font-style"); gui_i(x->x_gui.x_font_style); + gui_s("font-size"); gui_i(x->x_gui.x_fontsize); + gui_s("background-color"); gui_i(0xffffff & x->x_gui.x_bcol); + gui_s("foreground-color"); gui_i(0xffffff & x->x_gui.x_fcol); + gui_s("label-color"); gui_i(0xffffff & x->x_gui.x_lcol); + + gui_end_array(); + gui_end_vmess(); } static void my_canvas_get_pos(t_my_canvas *x) @@ -236,6 +277,7 @@ static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv x->x_gui.x_w = maxi(atom_getintarg(0, argc, argv),1); x->x_vis_w = maxi(atom_getintarg(2, argc, argv),1); x->x_vis_h = maxi(atom_getintarg(3, argc, argv),1); + post("FUCK OFF ASSHOLE!"); iemgui_dialog(&x->x_gui, argc, argv); x->x_gui.x_loadinit = 0; iemgui_draw_config(&x->x_gui); diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index 6459ba4d1..e421cf85a 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -137,9 +137,9 @@ static void my_numbox_draw_update(t_gobj *client, t_glist *glist) x->x_buf[sl+1] = 0; if(sl >= x->x_gui.x_w) cp += sl - x->x_gui.x_w + 1; - sys_vgui( - ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s}\n", - glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, cp); + //sys_vgui( + // ".x%lx.c itemconfigure %lxNUMBER -fill #%6.6x -text {%s}\n", + // glist_getcanvas(glist), x, IEM_GUI_COLOR_EDITED, cp); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); gui_vmess("gui_text_set", "sss", canvas_string(glist_getcanvas(glist)), @@ -153,11 +153,11 @@ static void my_numbox_draw_update(t_gobj *client, t_glist *glist) char fcol[8]; sprintf(fcol, "#%6.6x", x->x_gui.x_change ? IEM_GUI_COLOR_EDITED : x->x_gui.x_fcol); my_numbox_ftoa(x); - sys_vgui( - ".x%lx.c itemconfigure %lxNUMBER -fill %s -text {%s} \n", - glist_getcanvas(glist), x, - x->x_gui.x_selected == glist_getcanvas(glist) && - !x->x_gui.x_change ? selection_color : fcol, x->x_buf); + //sys_vgui( + // ".x%lx.c itemconfigure %lxNUMBER -fill %s -text {%s} \n", + // glist_getcanvas(glist), x, + // x->x_gui.x_selected == glist_getcanvas(glist) && + // !x->x_gui.x_change ? selection_color : fcol, x->x_buf); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); gui_vmess("gui_text_set", "sss", canvas_string(glist_getcanvas(glist)), @@ -174,15 +174,15 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h; char bcol[8]; sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); - sys_vgui( - ".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d -stroke %s" - " -fill %s -tags {%lxBASE1 x%lx text iemgui}\n", - canvas, x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, - x->x_hide_frame <= 1 ? "$pd_colors(iemgui_border)" : bcol, - bcol, x, x); + //sys_vgui( + // ".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d -stroke %s" + // " -fill %s -tags {%lxBASE1 x%lx text iemgui}\n", + // canvas, x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, + // x->x_hide_frame <= 1 ? "$pd_colors(iemgui_border)" : bcol, + // bcol, x, x); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); - gui_vmess("gui_create_numbox", "sssiiiiiiiiiiiii", canvas_string(canvas), + gui_vmess("gui_create_numbox", "isssiiiiiiiiiiiii", x->x_numwidth, canvas_string(canvas), tagbuf, bcol, x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1, half); if (!x->x_hide_frame || x->x_hide_frame == 2) sys_vgui(".x%lx.c create polyline %d %d %d %d %d %d -stroke #%6.6x " @@ -190,14 +190,14 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) canvas, x1, y1, x1 + half, y1 + half, x1, y2, x->x_gui.x_fcol, x, x); my_numbox_ftoa(x); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " - "-font %s -fill #%6.6x -tags {%lxNUMBER x%lx noscroll text iemgui}\n", - canvas, x1+half+2, y1+half+d, x->x_buf, iemgui_font(&x->x_gui), - x->x_gui.x_fcol, x, x); + //sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " + // "-font %s -fill #%6.6x -tags {%lxNUMBER x%lx noscroll text iemgui}\n", + // canvas, x1+half+2, y1+half+d, x->x_buf, iemgui_font(&x->x_gui), + // x->x_gui.x_fcol, x, x); char colorbuf[MAXPDSTRING]; sprintf(colorbuf, "#%6.6x", x->x_gui.x_fcol); - gui_vmess("gui_numbox_drawtext", "ssssiiii", canvas_string(canvas), tagbuf, - x->x_buf, colorbuf, x1+half+2, y1+half+d, x1, y1); + gui_vmess("gui_numbox_drawtext", "sssisiiii", canvas_string(canvas), tagbuf, + x->x_buf, x->x_gui.x_fontsize, colorbuf, x1+half+2, y1+half+d, x1, y1); } static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) @@ -224,12 +224,20 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) t_canvas *canvas=glist_getcanvas(glist); char fcol[8]; sprintf(fcol, "#%6.6x", x->x_gui.x_fcol); int issel = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas; - sys_vgui(".x%lx.c itemconfigure %lxNUMBER -font %s -fill %s\n", - canvas, x, iemgui_font(&x->x_gui), issel ? selection_color : fcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE2 -stroke %s\n", - canvas, x, issel ? selection_color : fcol); - sys_vgui(".x%lx.c itemconfigure %lxBASE1 -fill #%6.6x\n", canvas, - x, x->x_gui.x_bcol); + //sys_vgui(".x%lx.c itemconfigure %lxNUMBER -font %s -fill %s\n", + // canvas, x, iemgui_font(&x->x_gui), issel ? selection_color : fcol); + //sys_vgui(".x%lx.c itemconfigure %lxBASE2 -stroke %s\n", + // canvas, x, issel ? selection_color : fcol); + //sys_vgui(".x%lx.c itemconfigure %lxBASE1 -fill #%6.6x\n", canvas, + // x, x->x_gui.x_bcol); + char tagbuf[MAXPDSTRING]; + char bgcol[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + sprintf(bgcol, "#%6.6x", x->x_gui.x_bcol); + + gui_vmess("gui_update_numbox", "sssssii", + canvas_string(canvas), tagbuf, + fcol, bgcol, iemgui_typeface, x->x_gui.x_fontsize, sys_fontweight); } static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) @@ -441,7 +449,7 @@ int my_numbox_check_minmax(t_my_numbox *x, double min, double max) static void my_numbox_properties(t_gobj *z, t_glist *owner) { t_my_numbox *x = (t_my_numbox *)z; - char buf[800]; + char buf[800], *gfx_tag; t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); @@ -466,7 +474,32 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner) x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + //gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + gfx_tag = gfxstub_new2(&x->x_gui.x_obj.ob_pd, x); + + gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); + gui_start_array(); + gui_s("type"); gui_s("nbx"); + gui_s("width"); gui_i(x->x_gui.x_w); + gui_s("height"); gui_i(x->x_gui.x_h); + gui_s("minimum-range"); gui_f(x->x_min); + gui_s("maximum-range"); gui_f(x->x_max); + gui_s("log-scaling"); gui_i(x->x_lin0_log1); + gui_s("log-height"); gui_i(x->x_log_height); + gui_s("init"); gui_i(x->x_gui.x_loadinit); + gui_s("send-symbol"); gui_s(srl[0]->s_name); + gui_s("receive-symbol"); gui_s(srl[1]->s_name); + gui_s("label"); gui_s(srl[2]->s_name); + gui_s("x-offset"); gui_i(x->x_gui.x_ldx); + gui_s("y-offset"); gui_i(x->x_gui.x_ldy); + gui_s("font-style"); gui_i(x->x_gui.x_font_style); + gui_s("font-size"); gui_i(x->x_gui.x_fontsize); + gui_s("background-color"); gui_i(0xffffff & x->x_gui.x_bcol); + gui_s("foreground-color"); gui_i(0xffffff & x->x_gui.x_fcol); + gui_s("label-color"); gui_i(0xffffff & x->x_gui.x_lcol); + gui_s("hide-frame"); gui_i(x->x_hide_frame); + gui_end_array(); + gui_end_vmess(); } static void my_numbox_bang(t_my_numbox *x) @@ -488,6 +521,13 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, x->x_hide_frame = (int)atom_getintarg(18, argc, argv); iemgui_dialog(&x->x_gui, argc, argv); x->x_numwidth = my_numbox_calc_fontwidth(x); + +post("numwidth after dialog is %d", x->x_numwidth); +post("w is %d", x->x_gui.x_w); +post("h is %d", x->x_gui.x_h); +post("font style is %d", x->x_gui.x_font_style); +post("font size is %d", x->x_gui.x_fontsize); + my_numbox_check_minmax(x, min, max); // normally, you'd do move+config, but here you have to do erase+new // because iemgui_draw_io does not support changes to x_hide_frame. diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c index aa9fb81f2..2b08249f1 100644 --- a/pd/src/g_radio.c +++ b/pd/src/g_radio.c @@ -33,9 +33,12 @@ void radio_draw_update(t_gobj *client, t_glist *glist) sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", canvas, x, x->x_on, x->x_gui.x_fcol, x->x_gui.x_fcol); char tagbuf[MAXPDSTRING]; + char fcol[8], bcol[8]; + sprintf(fcol, "#%6.6x", x->x_gui.x_fcol); + sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); sprintf(tagbuf, "x%lx", (long unsigned int)x); - gui_vmess("gui_radio_update", "ssii", canvas_string(canvas), - tagbuf, x->x_drawn, x->x_on); + gui_vmess("gui_radio_update", "sssii", canvas_string(canvas), + tagbuf, fcol, x->x_drawn, x->x_on); x->x_drawn = x->x_on; } @@ -107,20 +110,28 @@ void radio_draw_move(t_radio *x, t_glist *glist) t_canvas *canvas=glist_getcanvas(glist); if (!glist_isvisible(canvas)) return; int n=x->x_number, i, d=x->x_gui.x_w, s=d/4; - int x1=text_xpix(&x->x_gui.x_obj, glist), xi=x1; - int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1; + int x1=text_xpix(&x->x_gui.x_obj, glist), xi=0; + int y1=text_ypix(&x->x_gui.x_obj, glist), yi=0; + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); iemgui_base_draw_move(&x->x_gui); for(i=0; i<n; i++) if (x->x_orient) { - sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n", - canvas, x, i, x1, yi, x1+d, yi); - sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n", - canvas, x, i, x1+s, yi+s, x1+d-s, yi+d-s); + //sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n", + // canvas, x, i, x1, yi, x1+d, yi); + //sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n", + // canvas, x, i, x1+s, yi+s, x1+d-s, yi+d-s); + gui_vmess("gui_radio_button_coords", "ssiiiiiiii", + canvas_string(canvas), tagbuf, + x1, y1, xi, yi, i, s, d, x->x_orient); yi += d; } else { - sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n", - canvas, x, i, xi, y1, xi, y1+d); - sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n", - canvas, x, i, xi+s, y1+s, xi+d-s, y1+d-s); + //sys_vgui(".x%lx.c coords %lxBASE%d %d %d %d %d\n", + // canvas, x, i, xi, y1, xi, y1+d); + //sys_vgui(".x%lx.c coords %lxBUT%d %d %d %d %d\n", + // canvas, x, i, xi+s, y1+s, xi+d-s, y1+d-s); + gui_vmess("gui_radio_button_coords", "ssiiiiiiii", + canvas_string(canvas), tagbuf, + x1, y1, xi, yi, i, s, d, x->x_orient); xi += d; } } @@ -132,11 +143,18 @@ void radio_draw_config(t_radio *x, t_glist *glist) iemgui_base_draw_config(&x->x_gui); for(i=0; i<n; i++) { - sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", - canvas, x, i, - (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol, - (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol); + //sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", + // canvas, x, i, + // (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol, + // (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol); } + char tagbuf[MAXPDSTRING]; + char col[8]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + sprintf(col, "#%6.6x", x->x_gui.x_fcol); + gui_vmess("gui_radio_update", "sssii", + canvas_string(canvas), tagbuf, col, 0, x->x_on); + } static void radio__clickhook(t_scalehandle *sh, int newstate) @@ -242,7 +260,7 @@ static void radio_save(t_gobj *z, t_binbuf *b) static void radio_properties(t_gobj *z, t_glist *owner) { t_radio *x = (t_radio *)z; - char buf[800]; + char buf[800], *gfx_tag; t_symbol *srl[3]; int hchange=-1; @@ -261,7 +279,37 @@ static void radio_properties(t_gobj *z, t_glist *owner) x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + //gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + gfx_tag = gfxstub_new2(&x->x_gui.x_obj.ob_pd, x); + + gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); + gui_start_array(); + + gui_s("type"); gui_s(x->x_orient ? "vradio" : "hradio"); + gui_s("size"); gui_i(x->x_gui.x_w); + gui_s("minimum-size"); gui_i(IEM_GUI_MINSIZE); + + gui_s("range-schedule"); // no idea what this is... + gui_i(0); + + gui_s("hchange"); // no idea... + gui_i(hchange); + + gui_s("init"); gui_i(x->x_gui.x_loadinit); + gui_s("number"); gui_i(x->x_number); + gui_s("send-symbol"); gui_s(srl[0]->s_name); + gui_s("receive-symbol"); gui_s(srl[1]->s_name); + gui_s("label"); gui_s(srl[2]->s_name); + gui_s("x-offset"); gui_i(x->x_gui.x_ldx); + gui_s("y-offset"); gui_i(x->x_gui.x_ldy); + gui_s("font-style"); gui_i(x->x_gui.x_font_style); + gui_s("font-size"); gui_i(x->x_gui.x_fontsize); + gui_s("background-color"); gui_i(0xffffff & x->x_gui.x_bcol); + gui_s("foreground-color"); gui_i(0xffffff & x->x_gui.x_fcol); + gui_s("label-color"); gui_i(0xffffff & x->x_gui.x_lcol); + + gui_end_array(); + gui_end_vmess(); } static void radio_dialog(t_radio *x, t_symbol *s, int argc, t_atom *argv) diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c index 1be19a1e2..0a615569f 100644 --- a/pd/src/g_slider.c +++ b/pd/src/g_slider.c @@ -31,8 +31,8 @@ static void slider_draw_update(t_gobj *client, t_glist *glist) int r; if (x->x_orient) { r=y2-3 - (x->x_val+50)/100; - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, x1+2, r, x2-2, r); + //sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", + // canvas, x, x1+2, r, x2-2, r); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); gui_vmess("gui_slider_update", "ssiiiiii", @@ -40,8 +40,8 @@ static void slider_draw_update(t_gobj *client, t_glist *glist) x1, y1); } else { r=x1+3 + (x->x_val+50)/100; - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, r, y1+2, r, y2-2); + //sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", + // canvas, x, r, y1+2, r, y2-2); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); gui_vmess("gui_slider_update", "ssiiiiii", @@ -51,8 +51,13 @@ static void slider_draw_update(t_gobj *client, t_glist *glist) int t = x->x_thick; x->x_thick = x->x_val == x->x_center; if (t!=x->x_thick) - sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth %d\n", - canvas, x, 4*x->x_thick+3); + { + /* the indicator thickens when it's right in the middle... but + it's pretty obscure, undocumented, and looks a bit like a bug + if you're not expecting it */ + //sys_vgui(".x%lx.c itemconfigure %lxKNOB -strokewidth %d\n", + // canvas, x, 4*x->x_thick+3); + } } static void slider_draw_new(t_slider *x, t_glist *glist) @@ -66,9 +71,9 @@ static void slider_draw_new(t_slider *x, t_glist *glist) else r = x1+3 + (x->x_val + 50)/100; iemgui_base_draw_new(&x->x_gui); if (x->x_orient) { - sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 " - "-stroke #%6.6x -tags {%lxKNOB x%lx text iemgui}\n", - canvas, x1+2, r, x2-2, r, x->x_gui.x_fcol, x, x); + //sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 " + // "-stroke #%6.6x -tags {%lxKNOB x%lx text iemgui}\n", + // canvas, x1+2, r, x2-2, r, x->x_gui.x_fcol, x, x); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); char colorbuf[MAXPDSTRING]; @@ -76,9 +81,9 @@ static void slider_draw_new(t_slider *x, t_glist *glist) gui_vmess("gui_create_slider", "sssiiiiii", canvas_string(canvas), tagbuf, colorbuf, x1+2, r, x2-2, r, x1, y1); } else { - sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 " - "-stroke #%6.6x -tags {%lxKNOB x%lx text iemgui}\n", - canvas, r, y1+2, r, y2-2, x->x_gui.x_fcol, x, x); + //sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 " + // "-stroke #%6.6x -tags {%lxKNOB x%lx text iemgui}\n", + // canvas, r, y1+2, r, y2-2, x->x_gui.x_fcol, x, x); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); char colorbuf[MAXPDSTRING]; @@ -100,19 +105,39 @@ static void slider_draw_move(t_slider *x, t_glist *glist) else r = x1+3 + (x->x_val + 50)/100; iemgui_base_draw_move(&x->x_gui); if (x->x_orient) - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, x1+2, r, x2-2, r); + { + //sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", + // canvas, x, x1+2, r, x2-2, r); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_slider_update", "ssiiiiii", + canvas_string(canvas), tagbuf, + x1+2, r, x2-2, r, x1, y1); + } else - sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", - canvas, x, r, y1+2, r, y2-2); + { + //sys_vgui(".x%lx.c coords %lxKNOB %d %d %d %d\n", + // canvas, x, r, y1+2, r, y2-2); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_slider_update", "ssiiiiii", + canvas_string(canvas), tagbuf, + r, y1+2, r, y2-2, x1, y1); + } } static void slider_draw_config(t_slider *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); iemgui_base_draw_config(&x->x_gui); - sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n", - canvas, x, x->x_gui.x_fcol); + //sys_vgui(".x%lx.c itemconfigure %lxKNOB -stroke #%6.6x\n", + // canvas, x, x->x_gui.x_fcol); + char tagbuf[MAXPDSTRING]; + char colorbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + sprintf(colorbuf, "#%6.6x", x->x_gui.x_fcol); + gui_vmess("gui_slider_indicator_color", "sss", + canvas_string(canvas), tagbuf, colorbuf); } void slider_check_minmax(t_slider *x, double min, double max); @@ -268,7 +293,7 @@ void slider_check_minmax(t_slider *x, double min, double max) static void slider_properties(t_gobj *z, t_glist *owner) { t_slider *x = (t_slider *)z; - char buf[800]; + char buf[800], *gfx_tag; t_symbol *srl[3]; int minx = x->x_orient ? IEM_GUI_MINSIZE : IEM_SL_MINSIZE; int miny = x->x_orient ? IEM_SL_MINSIZE : IEM_GUI_MINSIZE; @@ -286,7 +311,32 @@ static void slider_properties(t_gobj *z, t_glist *owner) x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + //gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + gfx_tag = gfxstub_new2(&x->x_gui.x_obj.ob_pd, x); + gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); + gui_start_array(); + + gui_s("type"); gui_s(x->x_orient ? "vsl" : "hsl"); + gui_s("width"); gui_i(x->x_gui.x_w); + gui_s("height"); gui_i(x->x_gui.x_h); + gui_s("minimum-range"); gui_f(x->x_min); + gui_s("maximum-range"); gui_f(x->x_max); + gui_s("log-scaling"); gui_i(x->x_lin0_log1); + gui_s("init"); gui_i(x->x_gui.x_loadinit); + gui_s("steady-on-click"); gui_i(x->x_steady); + gui_s("send-symbol"); gui_s(srl[0]->s_name); + gui_s("receive-symbol"); gui_s(srl[1]->s_name); + gui_s("label"); gui_s(srl[2]->s_name); + gui_s("x-offset"); gui_i(x->x_gui.x_ldx); + gui_s("y-offset"); gui_i(x->x_gui.x_ldy); + gui_s("font-style"); gui_i(x->x_gui.x_font_style); + gui_s("font-size"); gui_i(x->x_gui.x_fontsize); + gui_s("background-color"); gui_i(0xffffff & x->x_gui.x_bcol); + gui_s("foreground-color"); gui_i(0xffffff & x->x_gui.x_fcol); + gui_s("label-color"); gui_i(0xffffff & x->x_gui.x_lcol); + + gui_end_array(); + gui_end_vmess(); } static void slider_bang(t_slider *x) diff --git a/pd/src/g_template.c b/pd/src/g_template.c index 32c415f50..bb7a21526 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -1686,7 +1686,7 @@ void svg_sendupdate(t_svg *x, t_canvas *c, t_symbol *s, for (i = 0; i < x->x_ndash; i++) { //sys_vgui(" %g ", fielddesc_getcoord(fd+i, template, data, 1)); - gui_float_elem(fielddesc_getcoord(fd+i, template, data, 1)); + gui_f(fielddesc_getcoord(fd+i, template, data, 1)); } //sys_gui("}\n"); gui_end_array(); @@ -1720,11 +1720,11 @@ void svg_sendupdate(t_svg *x, t_canvas *c, t_symbol *s, f = (x->x_vec)+totalpoints; //sys_vgui("%c\\\n", *(cmd)); sprintf(cmdbuf, "%c", *(cmd)); - gui_string_elem(cmdbuf); + gui_s(cmdbuf); for (j = 0; j < x->x_nargs_per_cmd[i]; j++) //sys_vgui("%g\\\n", fielddesc_getcoord( // f+j, template, data, 1)); - gui_float_elem(fielddesc_getcoord( + gui_f(fielddesc_getcoord( f+j, template, data, 0)); totalpoints += x->x_nargs_per_cmd[i]; } @@ -3513,8 +3513,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) t_symbol *f = fielddesc_getsymbol(fd, template, data, 1); //sys_vgui("-fill %s ", f->s_name); //sys_vgui("fill: '%s',", f->s_name); - gui_string_elem("fill"); - gui_string_elem(f->s_name); + gui_s("fill"); + gui_s(f->s_name); } else if (x->x_filltype == 2) { @@ -3533,8 +3533,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // template, data, 1), // (int)fielddesc_getfloat(fd+2, // template, data, 1))); - gui_string_elem("fill"); - gui_string_elem(rgb_to_hex( + gui_s("fill"); + gui_s(rgb_to_hex( (int)fielddesc_getfloat(fd, template, data, 1), (int)fielddesc_getfloat(fd+1, @@ -3549,8 +3549,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // fielddesc_getfloat(&x->x_fillopacity.a_attr, template, data, 1)); //sys_vgui("fill-opacity: %g,", // fielddesc_getfloat(&x->x_fillopacity.a_attr, template, data, 1)); - gui_string_elem("fill-opacity"); - gui_float_elem(fielddesc_getfloat(&x->x_fillopacity.a_attr, template, data, 1)); + gui_s("fill-opacity"); + gui_f(fielddesc_getfloat(&x->x_fillopacity.a_attr, template, data, 1)); } if (x->x_fillrule.a_flag) { @@ -3560,8 +3560,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) //sys_vgui("'fill-rule': '%s',", (int)fielddesc_getfloat( // &x->x_fillrule.a_attr, template, data, 1) ? // "evenodd" : "nonzero"); - gui_string_elem("fill-rule"); - gui_string_elem((int)fielddesc_getfloat( + gui_s("fill-rule"); + gui_s((int)fielddesc_getfloat( &x->x_fillrule.a_attr, template, data, 1) ? "evenodd" : "nonzero"); } @@ -3574,8 +3574,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) t_symbol *s = fielddesc_getsymbol(fd, template, data, 1); //sys_vgui("-stroke %s ", s->s_name); //sys_vgui("stroke: '%s',", s->s_name); - gui_string_elem("stroke"); - gui_string_elem(s->s_name); + gui_s("stroke"); + gui_s(s->s_name); } else if (x->x_stroketype == 2) { @@ -3594,8 +3594,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // (int)fielddesc_getfloat(fd+2, // template, data, 1))); - gui_string_elem("stroke"); - gui_string_elem(rgb_to_hex( + gui_s("stroke"); + gui_s(rgb_to_hex( (int)fielddesc_getfloat(fd, template, data, 1), (int)fielddesc_getfloat(fd+1, @@ -3610,15 +3610,15 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // fielddesc_getfloat(&x->x_strokewidth.a_attr, template, data, 1)); //sys_vgui("stroke-width: %g,", // fielddesc_getfloat(&x->x_strokewidth.a_attr, template, data, 1)); - gui_string_elem("stroke-width"); - gui_float_elem(fielddesc_getfloat(&x->x_strokewidth.a_attr, template, data, 1)); + gui_s("stroke-width"); + gui_f(fielddesc_getfloat(&x->x_strokewidth.a_attr, template, data, 1)); } if (x->x_type == gensym("circle")) { if (x->x_nargs > 0) { - gui_string_elem("cx"); - gui_float_elem(fielddesc_getfloat(&x->x_vec[0], template, data, 1)); + gui_s("cx"); + gui_f(fielddesc_getfloat(&x->x_vec[0], template, data, 1)); } } if (x->x_strokeopacity.a_flag) @@ -3628,8 +3628,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) //sys_vgui("'stroke-opacity': %g,", // fielddesc_getfloat(&x->x_strokeopacity.a_attr, template, data, 1)); - gui_string_elem("stroke-opacity"); - gui_float_elem(fielddesc_getfloat(&x->x_strokeopacity.a_attr, template, data, 1)); + gui_s("stroke-opacity"); + gui_f(fielddesc_getfloat(&x->x_strokeopacity.a_attr, template, data, 1)); } if (x->x_strokelinecap.a_flag) { @@ -3640,8 +3640,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // (int)fielddesc_getcoord(&x->x_strokelinecap.a_attr, // template, data, 1))); - gui_string_elem("stroke-linecap"); - gui_string_elem(get_strokelinecap( + gui_s("stroke-linecap"); + gui_s(get_strokelinecap( (int)fielddesc_getcoord(&x->x_strokelinecap.a_attr, template, data, 1))); } @@ -3654,8 +3654,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // (int)fielddesc_getfloat(&x->x_strokelinejoin.a_attr, //template, data, 1))); - gui_string_elem("stroke-linejoin"); - gui_string_elem(get_strokelinejoin( + gui_s("stroke-linejoin"); + gui_s(get_strokelinejoin( (int)fielddesc_getfloat(&x->x_strokelinejoin.a_attr, template, data, 1))); } @@ -3667,8 +3667,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) //sys_vgui("'stroke-miterlimit': %g,", // fielddesc_getfloat(&x->x_strokemiterlimit.a_attr, // template, data, 1)); - gui_string_elem("stroke-miterlimit"); - gui_float_elem(fielddesc_getfloat(&x->x_strokemiterlimit.a_attr, + gui_s("stroke-miterlimit"); + gui_f(fielddesc_getfloat(&x->x_strokemiterlimit.a_attr, template, data, 1)); } if (x->x_ndash) @@ -3678,14 +3678,14 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // inner array... //sys_gui(" -strokedasharray {\\\n"); //sys_gui("'stroke-dasharray': \""); - gui_string_elem("stroke-dasharray"); + gui_s("stroke-dasharray"); gui_start_array(); for (i = 0, fd = x->x_strokedasharray; i < x->x_ndash; i++) { // Should this be a float? //sys_vgui("%d ", (int)fielddesc_getfloat(fd+i, //template, data, 1)); - gui_int_elem((int)fielddesc_getfloat(fd+i, + gui_i((int)fielddesc_getfloat(fd+i, template, data, 1)); } //sys_gui("\","); @@ -3699,11 +3699,11 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) &m4, &m5, &m6); //sys_vgui("-matrix { {%g %g} {%g %g} {%g %g} }\\\n", // m1, m2, m3, m4, m5, m6); - gui_string_elem("transform"); + gui_s("transform"); char transbuf[MAXPDSTRING]; sprintf(transbuf, "matrix(%g,%g,%g,%g,%g,%g)", m1, m2, m3, m4, m5, m6); - gui_string_elem(transbuf); + gui_s(transbuf); } if (x->x_vis.a_flag) { @@ -3711,8 +3711,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // template, data, 1) ? "normal" : "hidden"); //sys_vgui("visibility: '%s',", fielddesc_getfloat(&x->x_vis.a_attr, // template, data, 1) ? "visible" : "hidden"); - gui_string_elem("visibility"); - gui_string_elem(fielddesc_getfloat(&x->x_vis.a_attr, + gui_s("visibility"); + gui_s(fielddesc_getfloat(&x->x_vis.a_attr, template, data, 1) ? "visible" : "hidden"); } if (x->x_rx.a_flag) @@ -3721,8 +3721,8 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // template, data, 1)); //sys_vgui("rx: %d,", (int)fielddesc_getfloat(&x->x_rx.a_attr, // template, data, 1)); - gui_string_elem("rx"); - gui_int_elem((int)fielddesc_getfloat(&x->x_rx.a_attr, + gui_s("rx"); + gui_i((int)fielddesc_getfloat(&x->x_rx.a_attr, template, data, 1)); } if (x->x_ry.a_flag) @@ -3731,12 +3731,12 @@ static void svg_togui(t_svg *x, t_template *template, t_word *data) // template, data, 1)); //sys_vgui("ry: %d,", (int)fielddesc_getfloat(&x->x_ry.a_attr, // template, data, 1)); - gui_string_elem("ry"); - gui_float_elem((int)fielddesc_getfloat(&x->x_ry.a_attr, + gui_s("ry"); + gui_f((int)fielddesc_getfloat(&x->x_ry.a_attr, template, data, 1)); } - gui_string_elem("display"); - gui_string_elem("inline"); + gui_s("display"); + gui_s("inline"); //sys_gui("display: 'inline'},"); gui_end_array(); } @@ -3866,12 +3866,12 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, //sys_vgui("%c\\\n", *(cmd)); //sys_vgui("%c ", *(cmd)); sprintf(cmdbuf, "%c", *(cmd)); - gui_string_elem(cmdbuf); + gui_s(cmdbuf); for (j = 0; j < sa->x_nargs_per_cmd[i]; j++) //sys_vgui("%g\\\n", fielddesc_getcoord( // f+j, template, data, 1)); //sys_vgui("%g ", fielddesc_getcoord(f+j, template, data, 1)); - gui_float_elem(fielddesc_getcoord(f+j, template, data, 0)); + gui_f(fielddesc_getcoord(f+j, template, data, 0)); totalpoints += sa->x_nargs_per_cmd[i]; } //sys_gui("}\\\n"); @@ -3886,8 +3886,8 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, { //sys_vgui("%g %g\\\n", pix[2*i], pix[2*i+1]); //sys_vgui("%g %g ", pix[2*i], pix[2*i+1]); - gui_float_elem(pix[2*i]); - gui_float_elem(pix[2*i+1]); + gui_f(pix[2*i]); + gui_f(pix[2*i+1]); if ((sa->x_type == gensym("ellipse") || sa->x_type == gensym("circle")) && n > 1) { @@ -3907,9 +3907,9 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, // 3 : 2), // template, data, 1))); - gui_float_elem(fielddesc_getcoord(sa->x_vec+2, + gui_f(fielddesc_getcoord(sa->x_vec+2, template, data, 0)); - gui_float_elem(fielddesc_getcoord(sa->x_vec + + gui_f(fielddesc_getcoord(sa->x_vec + (sa->x_type == gensym("ellipse")? 3 : 2), template, data, 1)); @@ -3933,9 +3933,9 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, // fielddesc_getcoord(sa->x_vec+3, // template, data, 1)); - gui_float_elem(fielddesc_getcoord(sa->x_vec+2, + gui_f(fielddesc_getcoord(sa->x_vec+2, template, data, 0)); - gui_float_elem(fielddesc_getcoord(sa->x_vec+3, + gui_f(fielddesc_getcoord(sa->x_vec+3, template, data, 0)); break; } @@ -3947,7 +3947,7 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, //sys_vgui("%d ", // (t_int)fielddesc_getcoord(sa->x_vec+2, // template, data, 1)); - gui_int_elem((t_int)fielddesc_getcoord(sa->x_vec+2, + gui_i((t_int)fielddesc_getcoord(sa->x_vec+2, template, data, 1)); break; } @@ -3967,7 +3967,7 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, //sys_vgui("\"scelem%lx.%lx\",", parentglist, data); sprintf(parent_tagbuf, "scelem%lx.%lx", (long unsigned int)parentglist, (long unsigned int)data); - gui_string_elem(parent_tagbuf); + gui_s(parent_tagbuf); } else { @@ -3976,7 +3976,7 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, // x->x_canvas, data); sprintf(parent_tagbuf, "dgroup%lx.%lx", (long unsigned int)x->x_canvas, (long unsigned int)data); - gui_string_elem(parent_tagbuf); + gui_s(parent_tagbuf); } /* tags - one for this scalar (not sure why the double glist thingy) one for this specific draw item @@ -3989,7 +3989,7 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "draw%lx.%lx", (long unsigned int)x, (long unsigned int)data); - gui_string_elem(tagbuf); + gui_s(tagbuf); if (!glist_istoplevel(glist)) { t_canvas *gl = glist_getcanvas(glist); diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index 2d51e3f0b..4cd25d449 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -26,10 +26,10 @@ void toggle_draw_update(t_gobj *xgobj, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); - sys_vgui(".x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n", canvas, x, - (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x, - (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); + //sys_vgui(".x%lx.c itemconfigure %lxX1 -stroke #%6.6x\n", canvas, x, + // (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); + //sys_vgui(".x%lx.c itemconfigure %lxX2 -stroke #%6.6x\n", canvas, x, + // (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); char tagbuf[MAXPDSTRING]; char colorbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); @@ -60,8 +60,9 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) //sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth %d " // "-stroke #%6.6x -tags {%lxX2 x%lx text iemgui}\n", // canvas, x1+w+1, y2-w-1, x2-w-1, y1+w+1, w, col, x, x); - gui_vmess("gui_create_toggle", "sssiiiiiiiiiii", canvas_string(canvas), tagbuf, - colorbuf, w, + gui_vmess("gui_create_toggle", "sssiiiiiiiiiiii", canvas_string(canvas), + tagbuf, colorbuf, w, + (x->x_on != 0.0), x1+w+1, y1+w+1, x2-w-1, y2-w-1, x1+w+1, y2-w-1, x2-w-1, y1+w+1, x1, y1); } @@ -75,7 +76,7 @@ void toggle_draw_move(t_toggle *x, t_glist *glist) int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h; iemgui_base_draw_move(&x->x_gui); - sys_vgui(".x%lx.c itemconfigure {%lxX1||%lxX2} -strokewidth %d\n", canvas, x, x, w); + //sys_vgui(".x%lx.c itemconfigure {%lxX1||%lxX2} -strokewidth %d\n", canvas, x, x, w); //sys_vgui(".x%lx.c coords %lxX1 %d %d %d %d\n", // canvas, x, x1+s, y1+s, x2-s, y2-s); //sys_vgui(".x%lx.c coords %lxX2 %d %d %d %d\n", @@ -207,53 +208,53 @@ static void toggle_properties(t_gobj *z, t_glist *owner) gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); gui_start_array(); - gui_string_elem("type"); - gui_string_elem("tgl"); + gui_s("type"); + gui_s("tgl"); - gui_string_elem("size"); - gui_int_elem(x->x_gui.x_w); + gui_s("size"); + gui_i(x->x_gui.x_w); - gui_string_elem("minimum-size"); - gui_int_elem(IEM_GUI_MINSIZE); + gui_s("minimum-size"); + gui_i(IEM_GUI_MINSIZE); - gui_string_elem("nonzero-value"); - gui_float_elem(x->x_nonzero); + gui_s("nonzero-value"); + gui_f(x->x_nonzero); - gui_string_elem("nonzero_schedule"); // no idea what this is... - gui_float_elem(1.0); + gui_s("nonzero_schedule"); // no idea what this is... + gui_f(1.0); - gui_string_elem("init"); - gui_int_elem(x->x_gui.x_loadinit); + gui_s("init"); + gui_i(x->x_gui.x_loadinit); - gui_string_elem("send-symbol"); - gui_string_elem(srl[0]->s_name); + gui_s("send-symbol"); + gui_s(srl[0]->s_name); - gui_string_elem("receive-symbol"); - gui_string_elem(srl[1]->s_name); + gui_s("receive-symbol"); + gui_s(srl[1]->s_name); - gui_string_elem("label"); - gui_string_elem(srl[2]->s_name); + gui_s("label"); + gui_s(srl[2]->s_name); - gui_string_elem("x-offset"); - gui_int_elem(x->x_gui.x_ldx); + gui_s("x-offset"); + gui_i(x->x_gui.x_ldx); - gui_string_elem("y-offset"); - gui_int_elem(x->x_gui.x_ldy); + gui_s("y-offset"); + gui_i(x->x_gui.x_ldy); - gui_string_elem("font-style"); - gui_int_elem(x->x_gui.x_font_style); + gui_s("font-style"); + gui_i(x->x_gui.x_font_style); - gui_string_elem("font-size"); - gui_int_elem(x->x_gui.x_fontsize); + gui_s("font-size"); + gui_i(x->x_gui.x_fontsize); - gui_string_elem("background-color"); - gui_int_elem(0xffffff & x->x_gui.x_bcol); + gui_s("background-color"); + gui_i(0xffffff & x->x_gui.x_bcol); - gui_string_elem("foreground-color"); - gui_int_elem(0xffffff & x->x_gui.x_fcol); + gui_s("foreground-color"); + gui_i(0xffffff & x->x_gui.x_fcol); - gui_string_elem("label-color"); - gui_int_elem(0xffffff & x->x_gui.x_lcol); + gui_s("label-color"); + gui_i(0xffffff & x->x_gui.x_lcol); gui_end_array(); gui_end_vmess(); diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index d86fbc31f..adc304f4b 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -74,9 +74,9 @@ static void vu_update_rms(t_vu *x, t_glist *glist) y1 = text_ypix(&x->x_gui.x_obj, glist), quad1 = x1 + w4 + 1, quad3 = x1 + x->x_gui.x_w-w4 - 1; - sys_vgui(".x%lx.c coords %lxRCOVER %d %d %d %d\n", - glist_getcanvas(glist), x, quad1 + 1, off + 2, quad3 + 1, - off + (x->x_led_size + 1) * (IEM_VU_STEPS - x->x_rms) + 2); + //sys_vgui(".x%lx.c coords %lxRCOVER %d %d %d %d\n", + // glist_getcanvas(glist), x, quad1 + 1, off + 2, quad3 + 1, + // off + (x->x_led_size + 1) * (IEM_VU_STEPS - x->x_rms) + 2); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); gui_vmess("gui_vumeter_update_rms", "ssiiiiii", @@ -101,25 +101,36 @@ static void vu_update_peak(t_vu *x, t_glist *glist) int j = y1 + (x->x_led_size + 1) * (IEM_VU_STEPS + 1 - x->x_peak) - (x->x_led_size + 1) / 2; - sys_vgui(".x%lx.c coords %lxPLED %d %d %d %d\n", - canvas, x, x1 + 1, j + 2, x1 + x->x_gui.x_w + 2, j + 2); + //sys_vgui(".x%lx.c coords %lxPLED %d %d %d %d\n", + // canvas, x, x1 + 1, j + 2, x1 + x->x_gui.x_w + 2, j + 2); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); char colorbuf[MAXPDSTRING]; sprintf(colorbuf, "#%6.6x", iemgui_color_hex[i]); - gui_vmess("gui_vumeter_update_peak", "sssiiiiii", canvas_string(canvas), - tagbuf, colorbuf, x1 + 1, j + 2, x1 + x->x_gui.x_w + 2, j + 2, x1, y1); - sys_vgui(".x%lx.c itemconfigure %lxPLED -stroke #%6.6x\n", - canvas, x, iemgui_color_hex[i]); + gui_vmess("gui_vumeter_update_peak", "sssiiiiii", + canvas_string(canvas), tagbuf, colorbuf, + x1 + 1, j + 2, x1 + x->x_gui.x_w + 2, j + 2, x1, y1); + + //sys_vgui(".x%lx.c itemconfigure %lxPLED -stroke #%6.6x\n", + // canvas, x, iemgui_color_hex[i]); } else { int mid = x1 + x->x_gui.x_w / 2; - sys_vgui(".x%lx.c itemconfigure %lxPLED -stroke #%6.6x\n", - canvas, x, x->x_gui.x_bcol); - sys_vgui(".x%lx.c coords %lxPLED %d %d %d %d\n", - canvas, x, mid+1, y1+22, mid+1, y1+22); + //sys_vgui(".x%lx.c itemconfigure %lxPLED -stroke #%6.6x\n", + // canvas, x, x->x_gui.x_bcol); + //sys_vgui(".x%lx.c coords %lxPLED %d %d %d %d\n", + // canvas, x, mid+1, y1+22, mid+1, y1+22); + + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + char colorbuf[MAXPDSTRING]; + sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol); + + gui_vmess("gui_vumeter_update_peak", "sssiiiiii", + canvas_string(canvas), tagbuf, colorbuf, + mid+1, y1+22, mid+1, y1+22, x1, y1); } } } @@ -155,11 +166,11 @@ static void vu_draw_new(t_vu *x, t_glist *glist) yyy = k4 + k1 * (k2-i); if((i&3)==1 && (x->x_scale)) { - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " - "-font %s -fill #%6.6x " - "-tags {%lxSCALEN %lxSCALE%d x%lx text iemgui}\n", - canvas, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], - iemgui_font(&x->x_gui), x->x_gui.x_lcol, x, x, i, x); + //sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " + // "-font %s -fill #%6.6x " + // "-tags {%lxSCALEN %lxSCALE%d x%lx text iemgui}\n", + // canvas, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], + // iemgui_font(&x->x_gui), x->x_gui.x_lcol, x, x, i, x); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); char colorbuf[MAXPDSTRING]; @@ -172,35 +183,35 @@ static void vu_draw_new(t_vu *x, t_glist *glist) led_col = iemgui_vu_col[i]; if (i<=IEM_VU_STEPS) { - sys_vgui(".x%lx.c create polyline %d %d %d %d " - "-strokewidth %d -stroke #%6.6x " - "-tags {%lxRLED%d x%lx text iemgui}\n", - canvas, quad1+1, yyy+2, quad3, yyy+2, - x->x_led_size, iemgui_color_hex[led_col], x, i, x); + //sys_vgui(".x%lx.c create polyline %d %d %d %d " + //"-strokewidth %d -stroke #%6.6x " + //"-tags {%lxRLED%d x%lx text iemgui}\n", + //canvas, quad1+1, yyy+2, quad3, yyy+2, + //x->x_led_size, iemgui_color_hex[led_col], x, i, x); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); char colorbuf[MAXPDSTRING]; sprintf(colorbuf, "#%6.6x", iemgui_color_hex[led_col]); - gui_vmess("gui_create_vumeter_steps", "sssiiiiiiii", + gui_vmess("gui_create_vumeter_steps", "sssiiiiiiiii", canvas_string(canvas), tagbuf, colorbuf, quad1+1, - yyy+2, quad3, yyy+2, x->x_led_size, index, x1, y1); + yyy+2, quad3, yyy+2, x->x_led_size, index, x1, y1, i); } } - sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x " - "-stroke #%6.6x -tags {%lxRCOVER x%lx text iemgui}\n", - canvas, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, - x->x_gui.x_bcol, x->x_gui.x_bcol, x, x); + //sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x " + // "-stroke #%6.6x -tags {%lxRCOVER x%lx text iemgui}\n", + // canvas, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, + // x->x_gui.x_bcol, x->x_gui.x_bcol, x, x); char tagbuf[MAXPDSTRING]; sprintf(tagbuf, "x%lx", (long unsigned int)x); char colorbuf[MAXPDSTRING]; sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol); gui_vmess("gui_create_vumeter_rect", "sssiiiiii", canvas_string(canvas), tagbuf, colorbuf, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, x1, y1); - sys_vgui(".x%lx.c create polyline %d %d %d %d " - "-strokewidth %d -fill #%6.6x " - "-tags {%lxPLED x%lx text iemgui}\n", - canvas, mid+1, y1+12, - mid+1, y1+12, x->x_led_size, x->x_gui.x_bcol, x, x); + //sys_vgui(".x%lx.c create polyline %d %d %d %d " + // "-strokewidth %d -fill #%6.6x " + // "-tags {%lxPLED x%lx text iemgui}\n", + // canvas, mid+1, y1+12, + // mid+1, y1+12, x->x_led_size, x->x_gui.x_bcol, x, x); sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol); gui_vmess("gui_create_vumeter_peak", "sssiiiiiii", canvas_string(canvas), tagbuf, colorbuf, mid+1, y1+12, mid+1, y1+12, x->x_led_size, x1, y1); @@ -220,23 +231,46 @@ static void vu_draw_move(t_vu *x, t_glist *glist) end=x1+x->x_gui.x_w+4; int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; int yyy, i, k4=y1-k3; - sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", - canvas, x, x1, y1, x1+x->x_gui.x_w+2,y1+x->x_gui.x_h+4); + + //sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", + // canvas, x, x1, y1, x1+x->x_gui.x_w+2,y1+x->x_gui.x_h+4); + char tagbuffer[MAXPDSTRING]; + sprintf(tagbuffer, "x%lx", (long unsigned int)x); + gui_vmess("gui_vumeter_border_coords", "ssii", + canvas_string(canvas), tagbuffer, x->x_gui.x_w+2, x->x_gui.x_h+4); for(i=1; i<=IEM_VU_STEPS; i++) { yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c coords %lxRLED%d %d %d %d %d\n", - canvas, x, i, quad1+1, yyy+2, quad3, yyy+2); - if(((i+2)&3) && (x->x_scale)) - sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", - canvas, x, i, end+1, yyy+k3+2); + //sys_vgui(".x%lx.c coords %lxRLED%d %d %d %d %d\n", + // canvas, x, i, quad1+1, yyy+2, quad3, yyy+2); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_update_vumeter_step_coords", "ssiiiiiii", + canvas_string(canvas), tagbuf, i, quad1+1, yyy+2, quad3, yyy+2, + x1, y1); +// if(((i+2)&3) && (x->x_scale)) + if((i&3)==1 && (x->x_scale)) + { + //sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", + // canvas, x, i, end+1, yyy+k3+2); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_vumeter_text_coords", "ssiiiii", + canvas_string(canvas), tagbuf, i, + end+1, yyy+k3+2, x1, y1); + } } if(x->x_scale) { i=IEM_VU_STEPS+1; yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", - canvas, x, i, end+1, yyy+k3+2); + //sys_vgui(".x%lx.c coords %lxSCALE%d %d %d\n", + // canvas, x, i, end+1, yyy+k3+2); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_vumeter_text_coords", "ssiiiii", + canvas_string(canvas), tagbuf, i, + end+1, yyy+k3+2, x1, y1); } x->x_updaterms = x->x_updatepeak = 1; sys_queuegui(x, glist, vu_draw_update); @@ -250,17 +284,43 @@ static void vu_draw_config(t_vu* x, t_glist* glist) for(i = 1; i <= IEM_VU_STEPS+1; i++) { if (i <= IEM_VU_STEPS) - sys_vgui(".x%lx.c itemconfigure %lxRLED%d -strokewidth %d\n", - canvas, x, i, x->x_led_size); - if((i&3)==1) sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} " - "-font %s -fill %s\n", canvas, x, i, iemgui_vu_scale_str[i/4], - iemgui_font(&x->x_gui), x->x_gui.x_selected == canvas && - x->x_gui.x_glist == canvas && x->x_scale ? selection_color : lcol); + { + //sys_vgui(".x%lx.c itemconfigure %lxRLED%d -strokewidth %d\n", + // canvas, x, i, x->x_led_size); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_update_vumeter_steps", "ssii", + canvas_string(canvas), tagbuf, i, x->x_led_size); + } + //if((i&3)==1) + if((i&3)==1) + { + //sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} " + //"-font %s -fill %s\n", canvas, x, i, iemgui_vu_scale_str[i/4], + //iemgui_font(&x->x_gui), x->x_gui.x_selected == canvas && + //x->x_gui.x_glist == canvas && x->x_scale ? selection_color : lcol); + + int isselected = x->x_gui.x_selected == canvas && + x->x_gui.x_glist == canvas && x->x_scale; + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_update_vumeter_text", "ssssisi", + canvas_string(canvas), tagbuf, iemgui_vu_scale_str[i/4], + iemgui_font(&x->x_gui), isselected, lcol, i); + } } - sys_vgui(".x%lx.c itemconfigure %lxRCOVER -fill #%6.6x -stroke #%6.6x\n", - canvas, x, x->x_gui.x_bcol, x->x_gui.x_bcol); - sys_vgui(".x%lx.c itemconfigure %lxPLED -strokewidth %d\n", - canvas, x, x->x_led_size); + //sys_vgui(".x%lx.c itemconfigure %lxRCOVER -fill #%6.6x -stroke #%6.6x\n", + // canvas, x, x->x_gui.x_bcol, x->x_gui.x_bcol); + //sys_vgui(".x%lx.c itemconfigure %lxPLED -strokewidth %d\n", + // canvas, x, x->x_led_size); + char tagbuf[MAXPDSTRING]; + char bcol[8]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); + gui_vmess("gui_update_vumeter_rect", "sss", + canvas_string(canvas), tagbuf, bcol); + gui_vmess("gui_update_vumeter_peak", "ssi", + canvas_string(canvas), tagbuf, x->x_led_size); iemgui_base_draw_config(&x->x_gui); } @@ -459,11 +519,22 @@ static void vu_scale(t_vu *x, t_floatarg fscale) { for(i=1; i<=IEM_VU_STEPS; i++) { - if((i+2)&3) - sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); + /* if((i+2)&3) */ + if((i&3)==1) + { + //sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + gui_vmess("gui_erase_vumeter_text", "ssi", + canvas_string(canvas), tagbuf, i); + } } i=IEM_VU_STEPS+1; + char tagbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); sys_vgui(".x%lx.c delete %lxSCALE%d\n", canvas, x, i); + gui_vmess("gui_erase_vumeter_text", "ssi", + canvas_string(canvas), tagbuf, i); } } if(!x->x_scale && scale) @@ -481,17 +552,35 @@ static void vu_scale(t_vu *x, t_floatarg fscale) { yyy = k4 + k1*(k2-i); if((i&3)==1) - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " - "-font %s -fill #%6.6x -tags {%lxSCALE%d x%lx}\n", - canvas, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], - iemgui_font(&x->x_gui), x->x_gui.x_lcol, x, i, x); + { + //sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " + // "-font %s -fill #%6.6x -tags {%lxSCALE%d x%lx}\n", + // canvas, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], + // iemgui_font(&x->x_gui), x->x_gui.x_lcol, x, i, x); + char tagbuf[MAXPDSTRING]; + char colorbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + sprintf(colorbuf, "#%6.6x", x->x_gui.x_lcol); + gui_vmess("gui_create_vumeter_text", "sssiisiii", + canvas_string(canvas), tagbuf, colorbuf, + end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], + i, end, yyy); + } } i = IEM_VU_STEPS + 1; yyy = k4 + k1*(k2-i); - sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " - "-font %s -fill #%6.6x -tags {%lxSCALE%d x%lx}\n", - canvas, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], - iemgui_font(&x->x_gui), x->x_gui.x_lcol, x, i, x); + //sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w " + // "-font %s -fill #%6.6x -tags {%lxSCALE%d x%lx}\n", + // canvas, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], + // iemgui_font(&x->x_gui), x->x_gui.x_lcol, x, i, x); + char tagbuf[MAXPDSTRING]; + char colorbuf[MAXPDSTRING]; + sprintf(tagbuf, "x%lx", (long unsigned int)x); + sprintf(colorbuf, "#%6.6x", x->x_gui.x_lcol); + gui_vmess("gui_create_vumeter_text", "sssiisiii", + canvas_string(canvas), tagbuf, colorbuf, + end+1, yyy+k3+2, iemgui_vu_scale_str[i/4], + i, end, yyy); } } } @@ -499,7 +588,7 @@ static void vu_scale(t_vu *x, t_floatarg fscale) static void vu_properties(t_gobj *z, t_glist *owner) { t_vu *x = (t_vu *)z; - char buf[800]; + char buf[800], *gfx_tag; t_symbol *srl[3]; iemgui_properties(&x->x_gui, srl); @@ -516,7 +605,37 @@ static void vu_properties(t_gobj *z, t_glist *owner) x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); - gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + //gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); + gfx_tag = gfxstub_new2(&x->x_gui.x_obj.ob_pd, x); + + gui_start_vmess("gui_iemgui_dialog", "s", gfx_tag); + + gui_start_array(); + + gui_s("type"); + gui_s("vu"); + + gui_s("width"); gui_i(x->x_gui.x_w); + gui_s("height"); gui_i(x->x_gui.x_h); + + gui_s("vu-scale"); gui_i(x->x_scale); + + gui_s("minimum-size"); gui_i(IEM_GUI_MINSIZE); + + gui_s("range-schedule"); // no idea what this is... + gui_i(2); + + gui_s("receive-symbol"); gui_s(srl[1]->s_name); + gui_s("label"); gui_s(srl[2]->s_name); + gui_s("x-offset"); gui_i(x->x_gui.x_ldx); + gui_s("y-offset"); gui_i(x->x_gui.x_ldy); + gui_s("font-style"); gui_i(x->x_gui.x_font_style); + gui_s("font-size"); gui_i(x->x_gui.x_fontsize); + gui_s("background-color"); gui_i(0xffffff & x->x_gui.x_bcol); + gui_s("label-color"); gui_i(0xffffff & x->x_gui.x_lcol); + + gui_end_array(); + gui_end_vmess(); } static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h index 4df43257f..7fb61be59 100644 --- a/pd/src/m_pd.h +++ b/pd/src/m_pd.h @@ -671,9 +671,9 @@ EXTERN void gui_vmess(const char *sel, char *fmt, ...); /* some more gui interfaces for building incremental messages */ EXTERN void gui_start_vmess(const char *sel, char *fmt, ...); EXTERN void gui_start_array(void); -EXTERN void gui_float_elem(t_float f); -EXTERN void gui_int_elem(int i); -EXTERN void gui_string_elem(const char *s); +EXTERN void gui_f(t_float f); /* send a float element in an array */ +EXTERN void gui_i(int i); /* send an int element in an array */ +EXTERN void gui_s(const char *s); /* send a string element in an array */ EXTERN void gui_end_array(void); EXTERN void gui_end_vmess(void); diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c index 2ae0a9912..11c9ba329 100644 --- a/pd/src/s_inter.c +++ b/pd/src/s_inter.c @@ -827,7 +827,7 @@ void gui_start_array(void) sys_gui(",["); } -void gui_float_elem(t_float f) +void gui_f(t_float f) { if (gui_array_head) { @@ -838,7 +838,7 @@ void gui_float_elem(t_float f) sys_vgui(",%g", f); } -void gui_int_elem(int i) +void gui_i(int i) { if (gui_array_head) { @@ -849,7 +849,7 @@ void gui_int_elem(int i) sys_vgui(",%d", i); } -void gui_string_elem(const char *s) +void gui_s(const char *s) { if (gui_array_head) { -- GitLab