From 85815260a2c651d52f53798e7ffd959b52d05857 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Fri, 9 Feb 2018 16:40:14 -0500 Subject: [PATCH] clean up unused variables and old code Also fix a type mismatch in dropdown widget (g_text.c) and add an error check in ALSA audio (s_audio_alsamm.c). --- pd/src/g_all_guis.c | 56 +++--- pd/src/g_array.c | 343 ++++++++++++++++-------------------- pd/src/g_canvas.c | 3 - pd/src/g_canvas.h | 2 - pd/src/g_editor.c | 41 ++--- pd/src/g_graph.c | 45 +---- pd/src/g_magicglass.c | 6 +- pd/src/g_mycanvas.c | 2 - pd/src/g_numbox.c | 7 +- pd/src/g_rtext.c | 3 - pd/src/g_slider.c | 23 +-- pd/src/g_template.c | 70 ++------ pd/src/g_text.c | 372 ++-------------------------------------- pd/src/g_toggle.c | 1 - pd/src/g_traversal.c | 3 +- pd/src/s_audio_alsamm.c | 14 +- pd/src/x_scalar.c | 1 - 17 files changed, 244 insertions(+), 748 deletions(-) diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index fb7613160..faaf731a4 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -428,7 +428,7 @@ void iemgui_shouldvis(t_iemgui *x, int mode) properties changed we'll adjust our layer position to ensure that ordering is honored */ t_canvas *canvas = glist_getcanvas(x->x_glist); - t_gobj *y = (t_gobj *)x->x_glist; + //t_gobj *y = (t_gobj *)x->x_glist; // this crashes when the label goes invisible and then // needs to be made visible again, so for the time being // we use the brute force redraw below for both the @@ -437,7 +437,6 @@ void iemgui_shouldvis(t_iemgui *x, int mode) //gobj_vis(y, canvas, 1); // reorder it visually glist_redraw(canvas); - } } //fprintf(stderr,"draw move x->x_w=%d\n", x->x_w); @@ -692,7 +691,8 @@ extern t_class *my_canvas_class; // in 18 cases only, because canvas does not fit the pattern below. // canvas has no label handle and has a motion handle // but in the case of canvas, the "iemgui" tag is added (it wasn't the case originally) -void scalehandle_draw_select(t_scalehandle *h, int px, int py) { +void scalehandle_draw_select(t_scalehandle *h, int px, int py) +{ char tagbuf[MAXPDSTRING]; t_object *x = h->h_master; t_canvas *canvas=glist_getcanvas(h->h_glist); @@ -710,7 +710,8 @@ void scalehandle_draw_select(t_scalehandle *h, int px, int py) { } } -void scalehandle_draw_select2(t_iemgui *x) { +void scalehandle_draw_select2(t_iemgui *x) +{ t_canvas *canvas=glist_getcanvas(x->x_glist); t_class *c = pd_class((t_pd *)x); int sx,sy; @@ -735,29 +736,35 @@ void scalehandle_draw_select2(t_iemgui *x) { scalehandle_draw_select(x->x_lhandle,x->x_ldx,x->x_ldy); } -void scalehandle_draw_erase(t_scalehandle *h) { - t_canvas *canvas = glist_getcanvas(h->h_glist); +void scalehandle_draw_erase(t_scalehandle *h) +{ + //t_canvas *canvas = glist_getcanvas(h->h_glist); if (!h->h_vis) return; gui_vmess("gui_iemgui_label_show_drag_handle", "xxiiii", h->h_glist, h->h_master, 0, 0, 0, h->h_scale); h->h_vis = 0; } -void scalehandle_draw_erase2(t_iemgui *x) { +void scalehandle_draw_erase2(t_iemgui *x) +{ t_scalehandle *sh = (t_scalehandle *)(x->x_handle); t_scalehandle *lh = (t_scalehandle *)(x->x_lhandle); if (sh->h_vis) scalehandle_draw_erase(sh); if (lh->h_vis) scalehandle_draw_erase(lh); } -void scalehandle_draw(t_iemgui *x) { - if (x->x_glist == glist_getcanvas(x->x_glist)) { +void scalehandle_draw(t_iemgui *x) +{ + if (x->x_glist == glist_getcanvas(x->x_glist)) + { if (x->x_selected == x->x_glist) scalehandle_draw_select2(x); else scalehandle_draw_erase2(x); } } -t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, t_clickhandlefn chf, t_motionhandlefn mhf) { +t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, + t_clickhandlefn chf, t_motionhandlefn mhf) +{ t_scalehandle *h = (t_scalehandle *)pd_new(scalehandle_class); char buf[19]; // 3 + max size of %lx h->h_master = x; @@ -784,7 +791,8 @@ t_scalehandle *scalehandle_new(t_object *x, t_glist *glist, int scale, t_clickha return h; } -void scalehandle_free(t_scalehandle *h) { +void scalehandle_free(t_scalehandle *h) +{ if (!h->h_scale || pd_class((t_pd *)(h->h_master)) == my_canvas_class) { /* only binding label handles and my_canvas resize handle */ pd_unbind((t_pd *)h, h->h_bindsym); @@ -792,16 +800,18 @@ void scalehandle_free(t_scalehandle *h) { pd_free((t_pd *)h); } -void properties_set_field_int(long props, const char *gui_field, int value) { +void properties_set_field_int(long props, const char *gui_field, int 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) { +void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) +{ if (h->h_dragon && !h->h_scale) { t_iemgui *x = (t_iemgui *)(h->h_master); @@ -823,8 +833,8 @@ void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) { if (glist_isvisible(x->x_glist)) { - int xpos=text_xpix(&x->x_obj, x->x_glist); - int ypos=text_ypix(&x->x_obj, x->x_glist); + //int xpos=text_xpix(&x->x_obj, x->x_glist); + //int ypos=text_ypix(&x->x_obj, x->x_glist); //iemgui_getrect_legacy_label(x, &xpos, &ypos); t_canvas *canvas=glist_getcanvas(x->x_glist); gui_vmess("gui_iemgui_label_coords", "xxii", @@ -836,12 +846,13 @@ void scalehandle_dragon_label(t_scalehandle *h, float mouse_x, float mouse_y) { } } -void scalehandle_click_label(t_scalehandle *h) { +void scalehandle_click_label(t_scalehandle *h) +{ t_iemgui *x = (t_iemgui *)h->h_master; if (glist_isvisible(x->x_glist)) { //sys_vgui("lower %s\n", h->h_pathname); - t_scalehandle *othersh = x->x_handle; + //t_scalehandle *othersh = x->x_handle; //sys_vgui("lower .x%lx.h%lx\n", // (t_int)glist_getcanvas(x->x_glist), (t_int)othersh); } @@ -965,10 +976,11 @@ void iemgui_label_draw_new(t_iemgui *x) { x->x_fontsize); } -void iemgui_label_draw_move(t_iemgui *x) { +void iemgui_label_draw_move(t_iemgui *x) +{ t_canvas *canvas=glist_getcanvas(x->x_glist); - int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x; - int y1=text_ypix(&x->x_obj, x->x_glist)+x->legacy_y; + //int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x; + //int y1=text_ypix(&x->x_obj, x->x_glist)+x->legacy_y; //iemgui_getrect_legacy_label(x, &x1, &y1); //sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", // canvas, x, x1+x->x_ldx, y1+x->x_ldy); @@ -977,7 +989,7 @@ void iemgui_label_draw_move(t_iemgui *x) { Ivica's legacy logic isn't affecting us. Quick fix below by just adding the legacy offsets... */ gui_vmess("gui_iemgui_label_coords", "xxii", - glist_getcanvas(x->x_glist), + canvas, x, x->x_ldx + x->legacy_x, x->x_ldy + x->legacy_y); diff --git a/pd/src/g_array.c b/pd/src/g_array.c index ab50218e6..51c5ade95 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -286,7 +286,6 @@ static int garray_get_largest_array(t_garray *x) t_gobj *g; t_array *a; t_garray *tmp; - int an = 0; // checks if there is a PLOTSTYLE_POLY vs others // longest array uses has_*, total_* gives total number @@ -442,7 +441,6 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, int argc, t_atom *argv) int n = fsize, zonset, ztype, saveit; t_symbol *zarraytype; t_garray *x; - t_pd *x2; t_template *template, *ztemplate; t_symbol *templatesym; int flags = fflags; @@ -1081,14 +1079,14 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, /* if it has more than 2000 points, just check 1000 of them. */ int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); t_float pxpix1 = 0.0, pxpix2 = 0.0, pypix = 0.0, pwpix = 0.0, - dx, dy, dy2, dy3; + dy, dy2, dy3; for (i = 0; i < array->a_n; i += incr) { array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix1, &pxpix2, &pypix, &pwpix, 1); - //fprintf(stderr," array_getcoordinate %d: pxpix1:%f pxpix2:%f pypix:%f pwpix:%f dx:%f dy:%f elemsize:%d yonset:%d wonset:%d xonset:%d xloc:%f yloc:%f xinc:%f\n", i, pxpix1, pxpix2, pypix, pwpix, dx, dy, elemsize, yonset, wonset, xonset, xloc, yloc, xinc); - // increased following on 20140830 to 8 and updated array_getcoordinate + // increased following on 20140830 to 8 and updated + // array_getcoordinate // so that the smallest hitbox is always at least 8x8--check with // all_about_arrays.pd inside custom scalars in an array if (pwpix < 8) @@ -1101,34 +1099,13 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, best = i; break; } -/* - if (pwpix < 4) - pwpix = 4; - dx = pxpix1 - xpix; - if (dx < 0) dx = -dx; - if (dx > pxpix2-pxpix1) //this is the arbitrary radius away from the actual object's center, originally 8 - continue; - dy = pypix - ypix; - if (dy < 0) dy = -dy; - if (dx + dy < best) - best = dx + dy; - if (wonset >= 0) - { - dy = (pypix + pwpix) - ypix; - if (dy < 0) dy = -dy; - if (dx + dy < best) - best = dx + dy; - dy = (pypix - pwpix) - ypix; - if (dy < 0) dy = -dy; - if (dx + dy < best) - best = dx + dy; - } - //fprintf(stderr," 1st %f %f %f %f %f %d %d %d %d %d\n", pxpix, pypix, pwpix, dx, dy, elemsize, yonset, wonset, xonset, i);*/ } //fprintf(stderr," best = %f\n", best); - if (best == -1 && (array_joc == 0)) //this is the arbitrary radius away from the actual object's center, originally 8 + /* this is the arbitrary radius away from the actual object's + center, originally 8 */ + if (best == -1 && (array_joc == 0)) { - //fprintf(stderr," best > 8\n"); + //fprintf(stderr,"best > 8\n"); if (scalarvis != 0) { //fprintf(stderr," array_doclick_element\n"); @@ -1143,176 +1120,156 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, return (0); } } - //best += 0.001; /* add truncation error margin */ - //for (i = 0; i < array->a_n; i += incr) - //{ - //array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, - // xonset, yonset, wonset, i, xloc, yloc, xinc, - // xfield, yfield, wfield, &pxpix1, &pxpix2, &pypix, &pwpix, 1); - //dx = pxpix1 - xpix; - //if (dx < 0) dx = -dx; - dy = pypix - ypix; - if (dy < 0) dy = -dy; - if (wonset >= 0) + dy = pypix - ypix; + if (dy < 0) dy = -dy; + if (wonset >= 0) + { + dy2 = (pypix + pwpix) - ypix; + if (dy2 < 0) dy2 = -dy2; + dy3 = (pypix - pwpix) - ypix; + if (dy3 < 0) dy3 = -dy3; + if (yonset < 0) + dy = 100; + } + else dy2 = dy3 = 100; +#if 0 // this doesn't seem to be used anywhere -ag + int dx; + int hit = 0; + if(array_joc) + { + hit = (xpix >= pxpix1) && (xpix < pxpix2); + } + else + hit = dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best; +#endif + if (dy < dy2 && dy < dy3) + { + array_motion_fatten = 0; + //fprintf(stderr,"A\n"); + } + else if (dy2 < dy3) + { + array_motion_fatten = -1; + //fprintf(stderr,"B\n"); + } + else if (!array_joc) + { + array_motion_fatten = 1; + //fprintf(stderr,"C\n"); + } + if (doit || (glob_lmclick && array_joc)) + { + char *elem = (char *)array->a_vec; + array_motion_elemsize = elemsize; + array_motion_glist = glist; + array_motion_scalar = sc; + array_motion_array = ap; + array_motion_template = elemtemplate; + array_motion_xperpix = glist_dpixtodx(glist, 1); + array_motion_yperpix = glist_dpixtody(glist, 1); + if (alt) /* delete a point */ { - dy2 = (pypix + pwpix) - ypix; - if (dy2 < 0) dy2 = -dy2; - dy3 = (pypix - pwpix) - ypix; - if (dy3 < 0) dy3 = -dy3; - if (yonset < 0) - dy = 100; + if (array->a_n <= 1) + return (0); + memmove((char *)(array->a_vec) + elemsize * i, + (char *)(array->a_vec) + elemsize * (i+1), + (array->a_n - 1 - i) * elemsize); + //array_resize_and_redraw(array, glist, array->a_n - 1); + garray_resize(array_garray, array->a_n - 1); + canvas_setcursor(glist_getcanvas(glist), 0); + return (0); } - else dy2 = dy3 = 100; - //fprintf(stderr," 2nd %f %f %f %f %f %f %f %d %d %d %d %d\n", pxpix, pypix, pwpix, dx, dy, dy2, dy3, elemsize, yonset, wonset, xonset, i); - //if (dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best) - //{ - //fprintf(stderr, "dy=%f dy2=%f dy3=%f\n", dy, dy2, dy3); - -/* from array-rev */ - -#if 0 // this doesn't seem to be used anywhere -ag - int hit = 0; - if(array_joc) + else if (shift) { - hit = (xpix >= pxpix1) && (xpix < pxpix2); + /* add a point (after the clicked-on one) */ + //fprintf(stderr,"add a point\n"); + //array_resize_and_redraw(array, glist, array->a_n + 1); + elem = (char *)array->a_vec; + memmove(elem + elemsize * (i+1), + elem + elemsize * i, + (array->a_n - i - 1) * elemsize); + i++; + garray_resize(array_garray, array->a_n + 1); + canvas_setcursor(glist_getcanvas(glist), 0); + } + if (xonset >= 0) + { + //fprintf(stderr, " xonset >=0\n"); + array_motion_xfield = xfield; + array_motion_xcumulative = + fielddesc_getcoord(xfield, array_motion_template, + (t_word *)(elem + i * elemsize), 1); + array_motion_wp = (t_word *)(elem + i * elemsize); + if (shift) + array_motion_npoints = array->a_n - i; + else array_motion_npoints = 1; } else - hit = dx + dy <= best || dx + dy2 <= best || dx + dy3 <= best; -#endif -/* end array-rev */ - - if (dy < dy2 && dy < dy3) - { - array_motion_fatten = 0; - //fprintf(stderr,"A\n"); - } - else if (dy2 < dy3) - { - array_motion_fatten = -1; - //fprintf(stderr,"B\n"); - } - else if (!array_joc) - { - array_motion_fatten = 1; - //fprintf(stderr,"C\n"); - } - if (doit || (glob_lmclick && array_joc)) - { - char *elem = (char *)array->a_vec; - array_motion_elemsize = elemsize; - array_motion_glist = glist; - array_motion_scalar = sc; - array_motion_array = ap; - array_motion_template = elemtemplate; - array_motion_xperpix = glist_dpixtodx(glist, 1); - array_motion_yperpix = glist_dpixtody(glist, 1); - if (alt) /* delete a point */ - { - if (array->a_n <= 1) - return (0); - memmove((char *)(array->a_vec) + elemsize * i, - (char *)(array->a_vec) + elemsize * (i+1), - (array->a_n - 1 - i) * elemsize); - //array_resize_and_redraw(array, glist, array->a_n - 1); - garray_resize(array_garray, array->a_n - 1); - canvas_setcursor(glist_getcanvas(glist), 0); - return (0); - } - else if (shift) - { - /* add a point (after the clicked-on one) */ - //fprintf(stderr,"add a point\n"); - //array_resize_and_redraw(array, glist, array->a_n + 1); - elem = (char *)array->a_vec; - memmove(elem + elemsize * (i+1), - elem + elemsize * i, - (array->a_n - i - 1) * elemsize); - i++; - garray_resize(array_garray, array->a_n + 1); - canvas_setcursor(glist_getcanvas(glist), 0); - } - if (xonset >= 0) - { - //fprintf(stderr, " xonset >=0\n"); - array_motion_xfield = xfield; - array_motion_xcumulative = - fielddesc_getcoord(xfield, array_motion_template, - (t_word *)(elem + i * elemsize), 1); - array_motion_wp = (t_word *)(elem + i * elemsize); - if (shift) - array_motion_npoints = array->a_n - i; - else array_motion_npoints = 1; - } - else - { - //fprintf(stderr, " !(xonset >=0)\n"); - array_motion_xfield = 0; - array_motion_xcumulative = 0; - array_motion_wp = (t_word *)elem; - array_motion_npoints = array->a_n; - - array_motion_initx = i; - array_motion_lastx = i; - array_motion_xperpix *= (xinc == 0 ? 1 : 1./xinc); - } - if (array_motion_fatten) - { - //fprintf(stderr, " motion_fatten\n"); - array_motion_yfield = wfield; - array_motion_ycumulative = - fielddesc_getcoord(wfield, array_motion_template, - (t_word *)(elem + i * elemsize), 1); - array_motion_yperpix *= -array_motion_fatten; - } - else if (yonset >= 0) - { - //fprintf(stderr, " yonset >=0\n"); - array_motion_yfield = yfield; - array_motion_ycumulative = - fielddesc_getcoord(yfield, array_motion_template, - (t_word *)(elem + i * elemsize), 1); - /* *(t_float *)((elem + elemsize * i) + yonset); */ - //if (array_joc) { - // we do cursor detection based on the kind of a graph. - // (e.g. 3-point PLOYSTYLE_POINTS creates a graph that has 4 delimiting points, - // while a 3-point PLOTSTYLE_POLY creates a graph that has only 3 delimiting points) - // This, therefore takes into account whether we should count the center point - // of a bar or the starting point (poly) as our reference - // TODO: see if we can reimplement Bezier curves - if (array_garray != NULL && (array_garray->x_style == PLOTSTYLE_POLY || array_garray->x_style == PLOTSTYLE_BEZ)) - array_motion(0, xpix - pxpix1, ypix - pypix); - else - array_motion(0, (xpix - (pxpix1 + (pxpix2 - pxpix1)/2)), ypix - pypix); - //} - //else { - // array_motion(0, (xpix - (pxpix1 + (pxpix2 - pxpix1)/2)), ypix - pypix); - //} - //fprintf(stderr, "xpix:%d pxpix1:%f half:%f result:%f\n", xpix, pxpix1, (pxpix2-pxpix1)/2, xpix - (pxpix1 + (pxpix2 - pxpix1)/2)); - } - else - { - //fprintf(stderr, " else 0\n"); - array_motion_yfield = 0; - array_motion_ycumulative = 0; - } - //fprintf(stderr," glist_grab %d %d\n", xpix, ypix); - glist_grab(glist, 0, array_motion, 0, xpix, ypix); - //fprintf(stderr," VALUES: array_motion_initx:%f array_motion_lastx:%d array_motion_xperpix:%f array_motion_xcumulative:%f\n", array_motion_initx, array_motion_lastx, array_motion_xperpix, array_motion_xcumulative); - //fprintf(stderr," array_getcoordinate %d: pxpix1:%f pxpix2:%f pypix:%f pwpix:%f dx:%f dy:%f elemsize:%d yonset:%d wonset:%d xonset:%d xloc:%f yloc:%f xinc:%f\n", i, pxpix1, pxpix2, pypix, pwpix, dx, dy, elemsize, yonset, wonset, xonset, xloc, yloc, xinc); - - } - if (alt) - { - return (CURSOR_EDITMODE_DISCONNECT); - } - else if (shift) + { + //fprintf(stderr, " !(xonset >=0)\n"); + array_motion_xfield = 0; + array_motion_xcumulative = 0; + array_motion_wp = (t_word *)elem; + array_motion_npoints = array->a_n; + + array_motion_initx = i; + array_motion_lastx = i; + array_motion_xperpix *= (xinc == 0 ? 1 : 1./xinc); + } + if (array_motion_fatten) + { + //fprintf(stderr, " motion_fatten\n"); + array_motion_yfield = wfield; + array_motion_ycumulative = + fielddesc_getcoord(wfield, array_motion_template, + (t_word *)(elem + i * elemsize), 1); + array_motion_yperpix *= -array_motion_fatten; + } + else if (yonset >= 0) + { + //fprintf(stderr, " yonset >=0\n"); + array_motion_yfield = yfield; + array_motion_ycumulative = + fielddesc_getcoord(yfield, array_motion_template, + (t_word *)(elem + i * elemsize), 1); + /* *(t_float *)((elem + elemsize * i) + yonset); */ + // we do cursor detection based on the kind of a graph. + // (e.g. 3-point PLOYSTYLE_POINTS creates a graph that has 4 + // delimiting points, while a 3-point PLOTSTYLE_POLY creates + // a graph that has only 3 delimiting points) + // This, therefore takes into account whether we should count + // the center point of a bar or the starting point (poly) as + // our reference. + // TODO: see if we can reimplement Bezier curves + if (array_garray != NULL && + (array_garray->x_style == PLOTSTYLE_POLY || + array_garray->x_style == PLOTSTYLE_BEZ)) { - return (CURSOR_RUNMODE_ADDPOINT); + array_motion(0, xpix - pxpix1, ypix - pypix); } - else return (array_motion_fatten ? - CURSOR_RUNMODE_THICKEN : CURSOR_RUNMODE_CLICKME); - //} - //} + else + array_motion(0, (xpix - (pxpix1 + (pxpix2 - pxpix1)/2)), + ypix - pypix); + } + else + { + //fprintf(stderr, " else 0\n"); + array_motion_yfield = 0; + array_motion_ycumulative = 0; + } + //fprintf(stderr," glist_grab %d %d\n", xpix, ypix); + glist_grab(glist, 0, array_motion, 0, xpix, ypix); + } + if (alt) + { + return (CURSOR_EDITMODE_DISCONNECT); + } + else if (shift) + { + return (CURSOR_RUNMODE_ADDPOINT); + } + else return (array_motion_fatten ? + CURSOR_RUNMODE_THICKEN : CURSOR_RUNMODE_CLICKME); } return (0); } diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c index 1e5d057b6..b30d7d5ba 100644 --- a/pd/src/g_canvas.c +++ b/pd/src/g_canvas.c @@ -2036,11 +2036,8 @@ static int canvas_open_iter(const char *path, t_canvasopen *co) int canvas_open(t_canvas *x, const char *name, const char *ext, char *dirresult, char **nameresult, unsigned int size, int bin) { - t_namelist *nl, thislist; int fd = -1; - char listbuf[MAXPDSTRING]; char final_name[FILENAME_MAX]; - t_canvas *y; t_canvasopen co; sys_expandpathelems(name, final_name); diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h index ccb802a4b..a08ef13d6 100644 --- a/pd/src/g_canvas.h +++ b/pd/src/g_canvas.h @@ -488,8 +488,6 @@ EXTERN int canvas_restore_original_position(t_glist *x, t_gobj *y, const char *o EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos); EXTERN void text_drawborder(t_text *x, t_glist *glist, char *tag, int width, int height, int firsttime); -EXTERN void text_drawborder_withtag(t_text *x, t_glist *glist, char *tag, - int width, int height, int firsttime); EXTERN void text_erase_gobj(t_text *x, t_glist *glist, char *tag); EXTERN void text_eraseborder(t_text *x, t_glist *glist, char *tag); EXTERN int text_xcoord(t_text *x, t_glist *glist); diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 2817d1774..1dbcad0b6 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -322,7 +322,7 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag, if (pd_class(&y->g_pd) != canvas_class || ((t_glist *)y)->gl_owner == x) { t_object *ob = NULL; - t_rtext *yrnxt = NULL, *yr = NULL; + t_rtext *yrnxt = NULL; if (y->g_next) { @@ -340,10 +340,6 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag, { ret = 1; } - if (ob) - { - yr = glist_findrtext(x, (t_text *)&ob->ob_g); - } if (ret != 1) { if (dir == -1) @@ -455,13 +451,9 @@ void glist_deselectline(t_glist *x) do { oc = linetraverser_next(&t); } while (oc && oc != x->gl_editor->e_selectline_tag); - int issignal; - if(outlet_getsymbol(t.tr_outlet) == &s_signal) - issignal = 1; - else - issignal = 0; canvas_draw_gop_resize_hooks(x); - sprintf(tagbuf, "l%lx", (long unsigned int)x->gl_editor->e_selectline_tag); + sprintf(tagbuf, "l%lx", + (long unsigned int)x->gl_editor->e_selectline_tag); gui_vmess("gui_canvas_deselect_line", "xs", x, tagbuf); } } @@ -2661,7 +2653,8 @@ int garray_properties(t_garray *x, t_symbol **gfxstubp, t_symbol **namep, void canvas_properties(t_glist *x) { t_gobj *y; - char graphbuf[200], *gfx_tag; + //char graphbuf[200]; + char *gfx_tag; gfx_tag = gfxstub_new2(&x->gl_pd, x); @@ -2736,7 +2729,6 @@ void canvas_properties(t_glist *x) { if (pd_class(&y->g_pd) == garray_class) { - t_garray *garray = (t_garray *)y; t_symbol *gfxstub, *name, *fill, *outline; int size, flags; /* garray_properties can fail to find an array, so we won't @@ -5629,7 +5621,6 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce) /* put up a dialog which may call canvas_font back to do the work */ static void canvas_menufont(t_canvas *x) { - char buf[80]; t_canvas *x2 = canvas_getrootfor(x); gfxstub_deleteforkey(x2); char *gfxstub = gfxstub_new2(&x2->gl_pd, &x2->gl_pd); @@ -7503,7 +7494,7 @@ static void canvas_enterobj(t_canvas *x, t_symbol *item, t_floatarg xpos, t_floatarg ypos, t_floatarg xletno) { if (x->gl_editor->e_onmotion == MA_MOVE) { return; } - t_symbol *name = 0, *helpname, *dir; + //t_symbol *name = 0, *helpname, *dir; int yoffset = 0, xoffset = 0; if (item == gensym("inlet")) { @@ -7523,19 +7514,19 @@ static void canvas_enterobj(t_canvas *x, t_symbol *item, t_floatarg xpos, if (pd_class((t_pd *)g)==canvas_class ? canvas_isabstraction((t_canvas *)g) : 0) { - t_canvas *z = (t_canvas *)g; - name = z->gl_name; - helpname = z->gl_name; - dir = canvas_getdir(z); + //t_canvas *z = (t_canvas *)g; + //name = z->gl_name; + //helpname = z->gl_name; + //dir = canvas_getdir(z); } else { - name = g->g_pd->c_name; - helpname = g->g_pd->c_helpname; - dir = g->g_pd->c_externdir; + //name = g->g_pd->c_name; + //helpname = g->g_pd->c_helpname; + //dir = g->g_pd->c_externdir; } - //sys_vgui("pdtk_gettip .x%lx.c %s %d \ - //[list %s] [list %s] [list %s]\n", + //sys_vgui("pdtk_gettip .x%lx.c %s %d " + //"[list %s] [list %s] [list %s]\n", //x, item->s_name, (int)xletno, //name->s_name, helpname->s_name, dir->s_name); } @@ -7551,7 +7542,7 @@ static void canvas_tip(t_canvas *x, t_symbol *s, int argc, t_atom *argv) else { //sys_vgui("pdtk_tip .x%lx.c 1", x); - t_atom *at = argv; + //t_atom *at = argv; int i; for (i=0; i<argc; i++) { diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index c75140bd1..94b129609 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -1291,6 +1291,7 @@ static void graph_getrect(t_gobj *z, t_glist *glist, graph_checkgop_rect(z, glist, &x1, &y1, &x2, &y2); /* fix visibility of edge items for garrays */ + /* int has_garray = 0; for (g = x->gl_list; g; g = g->g_next) { @@ -1299,7 +1300,7 @@ static void graph_getrect(t_gobj *z, t_glist *glist, has_garray = 1; } } - /*if (has_garray) { + if (has_garray) { x1 -= 1; y1 -= 2; //x2 += 1; @@ -1507,48 +1508,6 @@ static void graph_delete(t_gobj *z, t_glist *glist) canvas_getscroll(glist); } -static t_float graph_lastxpix, graph_lastypix; - -static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) -{ - t_glist *x = (t_glist *)z; - t_float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy; - t_garray *a = (t_garray *)(x->gl_list); - int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix); - int newx = 0.5 + glist_pixelstox(x, newxpix); - t_word *vec; - int nelem, i; - t_float oldy = glist_pixelstoy(x, graph_lastypix); - t_float newy = glist_pixelstoy(x, newypix); - graph_lastxpix = newxpix; - graph_lastypix = newypix; - /* verify that the array is OK */ - if (!a || pd_class((t_pd *)a) != garray_class) - return; - if (!garray_getfloatwords(a, &nelem, &vec)) - return; - if (oldx < 0) oldx = 0; - if (oldx >= nelem) - oldx = nelem - 1; - if (newx < 0) newx = 0; - if (newx >= nelem) - newx = nelem - 1; - if (oldx < newx - 1) - { - for (i = oldx + 1; i <= newx; i++) - vec[i].w_float = newy + (oldy - newy) * - ((t_float)(newx - i))/(t_float)(newx - oldx); - } - else if (oldx > newx + 1) - { - for (i = oldx - 1; i >= newx; i--) - vec[i].w_float = newy + (oldy - newy) * - ((t_float)(newx - i))/(t_float)(newx - oldx); - } - else vec[newx].w_float = newy; - garray_redraw(a); -} - extern t_class *my_canvas_class; // for ignoring runtime clicks static int graph_click(t_gobj *z, struct _glist *glist, diff --git a/pd/src/g_magicglass.c b/pd/src/g_magicglass.c index f999aef51..999bc55e9 100644 --- a/pd/src/g_magicglass.c +++ b/pd/src/g_magicglass.c @@ -65,14 +65,14 @@ void magicGlass_updateText(t_magicGlass *x, int moved) { if (!moved) { - char *color; + //char *color; if (x->x_issignal || strcmp(x->x_old_string, x->x_string)) { - color = "$pd_colors(magic_glass_text)"; + //color = "$pd_colors(magic_glass_text)"; } else { - color = "$pd_colors(magic_glass_flash)"; + //color = "$pd_colors(magic_glass_flash)"; gui_vmess("gui_cord_inspector_flash", "xi", x->x_c, 1); clock_delay(x->x_flashClock, MG_CLOCK_FLASH_DELAY); } diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index a5977ada5..d33cb46ed 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -38,8 +38,6 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); if (!glist_isvisible(canvas)) return; - int x1=text_xpix(&x->x_gui.x_obj, glist); - int y1=text_ypix(&x->x_gui.x_obj, glist); iemgui_base_draw_move(&x->x_gui); gui_vmess("gui_mycanvas_coords", "xxiiii", canvas, x, diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c index 9de4cf189..e3bfa944f 100644 --- a/pd/src/g_numbox.c +++ b/pd/src/g_numbox.c @@ -231,7 +231,6 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) char fg[8], bg[8]; sprintf(fg, "#%6.6x", x->x_gui.x_fcol); sprintf(bg, "#%6.6x", x->x_gui.x_bcol); - int issel = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas; gui_vmess("gui_numbox_update", "xxsssii", canvas, x, @@ -283,13 +282,13 @@ static void my_numbox__clickhook(t_scalehandle *sh, int newstate) } static void my_numbox__motionhook(t_scalehandle *sh, - t_floatarg mouse_x, t_floatarg mouse_y) + t_floatarg mouse_x, t_floatarg mouse_y) { if (sh->h_scale) { t_my_numbox *x = (t_my_numbox *)(sh->h_master); - int dx = (int)mouse_x - sh->h_offset_x, - dy = (int)mouse_y - sh->h_offset_y; + //int dx = (int)mouse_x - sh->h_offset_x; + int dy = (int)mouse_y - sh->h_offset_y; /* first calculate y */ int newy = maxi(x->x_gui.x_obj.te_ypix + x->x_gui.x_h + diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index 04a8f6761..9dec3ed30 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -212,7 +212,6 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, //fprintf(stderr,"rtext_senditup <%s>\n", x->x_buf); if (x) { - t_float dispx, dispy; char smallbuf[200] = { '\0' }, *tempbuf; int outchars_b = 0, nlines = 0, ncolumns = 0, pixwide, pixhigh, font, fontwidth, fontheight, findx, findy; @@ -323,8 +322,6 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, } if (!reportedindex) *indexp = outchars_b; - dispx = text_xpix(x->x_text, x->x_glist); - dispy = text_ypix(x->x_text, x->x_glist); if (nlines < 1) nlines = 1; if (!widthspec_c) { diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c index e4849f5ac..5421df81f 100644 --- a/pd/src/g_slider.c +++ b/pd/src/g_slider.c @@ -110,26 +110,6 @@ static void slider_draw_config(t_slider *x, t_glist *glist) canvas, x, cbuf); } -void slider_check_minmax(t_slider *x, double min, double max); -void slider_check_length(t_slider *x, int w); - -static void hslider__clickhook2(t_scalehandle *sh, t_slider *x) { - double w_change_ratio = (double)(x->x_gui.x_w + sh->h_dragx) - /(double)x->x_gui.x_w; - x->x_val = x->x_val * w_change_ratio; - slider_check_length(x, x->x_gui.x_w + sh->h_dragx); - x->x_gui.x_h += sh->h_dragy; - slider_check_minmax(x, x->x_min, x->x_max); -} -static void vslider__clickhook2(t_scalehandle *sh, t_slider *x) { - double h_change_ratio = (double)(x->x_gui.x_h + sh->h_dragy) - /(double)x->x_gui.x_h; - x->x_val = x->x_val * h_change_ratio; - x->x_gui.x_w += sh->h_dragx; - slider_check_length(x, x->x_gui.x_h + sh->h_dragy); - slider_check_minmax(x, x->x_min, x->x_max); -} - static void slider__clickhook(t_scalehandle *sh, int newstate) { t_slider *x = (t_slider *)(sh->h_master); @@ -142,6 +122,8 @@ static void slider__clickhook(t_scalehandle *sh, int newstate) sh->h_dragon = newstate; } +void slider_check_length(t_slider *x, int w); + static void slider__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg mouse_y) { if (sh->h_scale) @@ -418,7 +400,6 @@ static int slider_newclick(t_gobj *z, struct _glist *glist, static void slider_set(t_slider *x, t_floatarg f) { double g; - t_floatarg of=f; if(x->x_gui.x_reverse) f = maxf(minf(f,x->x_min),x->x_max); else diff --git a/pd/src/g_template.c b/pd/src/g_template.c index 854404b3c..9e4997457 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -3627,8 +3627,7 @@ static void svg_getrectrect(t_svg *x, t_glist *glist, t_float mtx1[3][3] = { {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }; t_float mtx2[3][3] = { {1, 0, 0}, {0, 1, 0}, {1, 0, 1} }; - t_float m1, m2, m3, m4, m5, m6, - tx1, ty1, tx2, ty2, t5, t6; + t_float tx1, ty1, tx2, ty2, t5, t6; if (!fielddesc_getfloat(&x->x_bbox, template, data, 0) || (x->x_vis.a_flag && !fielddesc_getfloat(&x->x_vis.a_attr, template, data, 0))) @@ -4258,12 +4257,12 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, } } -static int draw_motion_field; +//static int draw_motion_field; static t_float draw_motion_xcumulative; -static t_float draw_motion_xbase; +//static t_float draw_motion_xbase; static t_float draw_motion_xper; static t_float draw_motion_ycumulative; -static t_float draw_motion_ybase; +//static t_float draw_motion_ybase; static t_float draw_motion_yper; static t_glist *draw_motion_glist; static t_scalar *draw_motion_scalar; @@ -4426,7 +4425,7 @@ static int draw_click(t_gobj *z, t_glist *glist, SETFLOAT(at+2, ypix - glist_ytopixels(glist, basey)); t_float mtx1[3][3]; t_float mtx2[3][3]; - t_float m1, m2, m3, m4, m5, m6, tdx, tdy; + t_float m1, m2, m3, m4, m5, m6; t_svg *sa = (t_svg *)x->x_attr; /* might use this to output the ctm */ @@ -4518,8 +4517,7 @@ static void scalar_spelunkforword(void* word_candidate, t_template* template, if (t) { int i, elemsize = wp->w_array->a_elemsize; - char *vec; - for(i = 0, vec = wp->w_array->a_vec; i < wp->w_array->a_n; i++) + for(i = 0; i < wp->w_array->a_n; i++) scalar_spelunkforword(word_candidate, t, (t_word *)(wp->w_array->a_vec + i * elemsize), word_index, arrayp, datap); @@ -6146,7 +6144,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, } } int mex1 = fielddesc_cvttocoord(xfielddesc, usexloc); - t_float mey1 = fielddesc_cvttocoord(yfielddesc, minyval) - 1; + //t_float mey1 = fielddesc_cvttocoord(yfielddesc, minyval) - 1; int mex2 = fielddesc_cvttocoord(xfielddesc, xsum + x_inverse); t_float mey2 = style == PLOTSTYLE_POINTS ? @@ -6609,8 +6607,8 @@ static void *drawarray_new(t_symbol *s, int argc, t_atom *argv) t_svg *sa = (t_svg *)x->x_attr; x->x_canvas = canvas_getcurrent(); - t_template *t = template_findbyname( - canvas_makebindsym(x->x_canvas->gl_name)); + //t_template *t = template_findbyname( + // canvas_makebindsym(x->x_canvas->gl_name)); if (argc) fielddesc_setarrayarg(&x->x_data, argc--, argv++); else fielddesc_setfloat_const(&x->x_data, 1); @@ -6680,51 +6678,6 @@ static int drawarray_readownertemplate(t_drawarray *x, return (0); } -static void drawarray_getgrouprect(t_glist *glist, t_template *elemtemplate, - t_canvas *groupcanvas, int elemsize, - t_array *array, int i, t_float usexloc, t_float useyloc, - int *x1, int *y1, int *x2, int *y2) -{ - t_gobj *y; - for (y = groupcanvas->gl_list; y; y = y->g_next) - { - if (pd_class(&y->g_pd) == canvas_class && - ((t_canvas *)y)->gl_svg) - { - drawarray_getgrouprect(glist, elemtemplate, (t_canvas *)y, - elemsize, array, i, usexloc, useyloc, x1, y1, x2, y2); - } - //fprintf(stderr,".-.-. usexloc %f useyloc %f " - // "(alt %f %f)\n", - // usexloc, useyloc, - // basex + xloc + - // fielddesc_cvttocoord(xfielddesc, - // *(t_float *)(((char *)(array->a_vec) + elemsize * i) - // + xonset)), - // *(t_float *)(((char *)(array->a_vec) + elemsize * i) + - // yonset)); - int xx1, xx2, yy1, yy2; - t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); - if (!wb) continue; - (*wb->w_parentgetrectfn)(y, glist, - (t_word *)((char *)(array->a_vec) + elemsize * i), - elemtemplate, usexloc, useyloc, - &xx1, &yy1, &xx2, &yy2); - //fprintf(stderr," .....drawarray_getrect %d %d %d %d\n", - // xx1, yy1, xx2, yy2); - if (xx1 < *x1) - *x1 = xx1; - if (yy1 < *y1) - *y1 = yy1; - if (xx2 > *x2) - *x2 = xx2; - if (yy2 > *y2) - *y2 = yy2; - //fprintf(stderr," ....drawarray_getrect %d %d %d %d\n", - // x1, y1, x2, y2); - } -} - static void drawarray_getrect(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) @@ -6821,10 +6774,10 @@ static void drawarray_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, t_canvas *elemtemplatecanvas; t_template *elemtemplate; t_symbol *elemtemplatesym; - t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc; /* Let's just set constant increment values and see how they play out before adding xinc and yinc to the public interface... */ - t_float xinc = 40, yinc = 40, xsum, yval; + t_float xinc = 40, xsum, yval; + //t_float yinc = 40; t_array *array; int nelem; char *elem; @@ -8536,7 +8489,6 @@ static void drawimage_setup(void) t_template *canvas_findtemplate(t_canvas *c) { t_gobj *g; - t_symbol *s1 = gensym("struct"); for (g = c->gl_list; g; g = g->g_next) { if (pd_class(&g->g_pd) == gtemplate_class) diff --git a/pd/src/g_text.c b/pd/src/g_text.c index f5a42a6d1..b3f54ed31 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -34,8 +34,6 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, void canvas_startmotion(t_canvas *x); t_widgetbehavior text_widgetbehavior; -static char *invalid_fill = "$::pd_colors(dash_fill)"; - extern void canvas_displaceselection(t_canvas *x, int dx, int dy); extern void canvas_apply_setundo(t_canvas *x, t_gobj *y); extern void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, @@ -283,14 +281,12 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, { t_gobj *g, *selected = x->gl_editor->e_selection->sel_what; t_text *t = (t_text *)selected; - int recreate = 0; // if selected object has not yet been activated we need to recreate it first if (pd_class(&t->te_pd) == text_class && t->te_type != T_TEXT) { glist_noselect(x); // we do this to explicitly activate object glist_select(x, glist_nth(x, glist_getindex(x, 0)-1)); // then reselect it selected = x->gl_editor->e_selection->sel_what; - recreate = 1; } for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++) if (g == selected) @@ -582,10 +578,11 @@ static void messresponder_symbol(t_messresponder *x, t_symbol *s) outlet_symbol(x->mr_outlet, s); } -static void messresponder_blob(t_messresponder *x, t_blob *st) -{ /* MP 20070107 blob type */ - outlet_blob(x->mr_outlet, st); -} +/* MP 20070107 blob type */ +//static void messresponder_blob(t_messresponder *x, t_blob *st) +//{ +// outlet_blob(x->mr_outlet, st); +//} static void messresponder_list(t_messresponder *x, t_symbol *s, int argc, t_atom *argv) @@ -1215,14 +1212,7 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) static void gatom_displace(t_gobj *z, t_glist *glist, int dx, int dy) { - //fprintf(stderr,"gatom_displace\n"); - t_gatom *x = (t_gatom*)z; text_displace(z, glist, dx, dy); - if (glist_isvisible(glist)) - { - //sys_vgui(".x%lx.c move %lx.l %d %d\n", glist_getcanvas(glist), - // x, dx, dy); - } } /* for gatom's label */ @@ -1424,11 +1414,11 @@ static void dropdown_redraw(t_gobj *client, t_glist *glist) 1 recolor */ static void dropdown_retext(t_dropdown *x, int senditup, int recolor) { - t_canvas *canvas = glist_getcanvas(x->a_glist); - t_rtext *y = glist_findrtext(x->a_glist, &x->a_text); if (recolor) { /* not sure if we need to activate dropdown */ + //t_rtext *y = glist_findrtext(x->a_glist, &x->a_text); + //t_canvas *canvas = glist_getcanvas(x->a_glist); //gui_vmess("gui_gatom_activate", "xsi", // canvas, rtext_gettag(y), 0); post("note: dropdown is being activated!"); @@ -1459,7 +1449,7 @@ static void dropdown_set(t_dropdown *x, t_symbol *s, int argc, t_atom *argv) } static int dropdown_names_getmaxwidth(t_dropdown *x) { - char buf[MAXPDSTRING]; + char *buf; t_binbuf *names = x->a_names, *b = binbuf_new(); int len = binbuf_getnatom(x->a_names), maxwidth = 0; while (len--) @@ -1899,7 +1889,7 @@ static void text_getrect(t_gobj *z, t_glist *glist, { int font = glist_getfont(glist); int fontwidth = sys_fontwidth(font); -// width += fontwidth * 2; + //width += fontwidth * 2; width = fontwidth * (((t_dropdown *)x)->a_maxnamewidth + 2); } height = rtext_height(y) - (iscomment << 1); @@ -1965,7 +1955,6 @@ static void text_getrect(t_gobj *z, t_glist *glist, static void text_displace(t_gobj *z, t_glist *glist, int dx, int dy) { - //fprintf(stderr,"text_displace\n"); t_text *x = (t_text *)z; x->te_xpix += dx; x->te_ypix += dy; @@ -1977,13 +1966,6 @@ static void text_displace(t_gobj *z, t_glist *glist, rtext_gettag(y), dx, dy); - /* Since the gui organizes all the text and shapes that - make an object into a container, we just displace - the container here */ - //t_rtext *y = glist_findrtext(glist, x); - //rtext_displace(y, dx, dy); - //text_drawborder(x, glist, rtext_gettag(y), - // rtext_width(y), rtext_height(y), 0); canvas_fixlinesfor(glist_getcanvas(glist), x); } } @@ -1991,162 +1973,35 @@ static void text_displace(t_gobj *z, t_glist *glist, static void text_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy) { - //fprintf(stderr,"text_displace_withtag\n"); t_text *x = (t_text *)z; x->te_xpix += dx; x->te_ypix += dy; if (glist_isvisible(glist)) - { - //t_rtext *y = glist_findrtext(glist, x); - //text_drawborder_withtag(x, glist, rtext_gettag(y), - // rtext_width(y), rtext_height(y), 0); canvas_fixlinesfor(glist_getcanvas(glist), x); - /* if this is a subpatcher in which case we may be - possibly moving nlets around - which in turn requires that we redraw parent's nlets */ - -/* if (glist->gl_owner && glist_isvisible(glist->gl_owner)) - { - int resortin = 0, resortout = 0; - t_class *cl = pd_class(&z->g_pd); - if (cl == vinlet_class) resortin = 1; - else if (cl == voutlet_class) resortout = 1; - fprintf(stderr,"vinlet=%d voutlet=%d\n", resortin, resortout); - if (resortin) canvas_resortinlets(glist->gl_owner); - if (resortout) canvas_resortoutlets(glist->gl_owner); - - char *buf; - char name[6]; - int bufsize, i; - rtext_gettext(y, &buf, &bufsize); - for (i = 0; i < 5; i++) - { - name[i] = buf[i]; - } - name[5] = '\0'; - //fprintf(stderr,"yes, this is a subpatch with visible parent %s\n", - // name); - if (!strcmp(name, "inlet") || - !strcmp(name, "outle")) - { - - //fprintf(stderr,"yes, we're moving nlets around\n"); - glist_redraw(glist->gl_owner); - } - }*/ - } } static void text_select(t_gobj *z, t_glist *glist, int state) { t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); - char *outline; rtext_select(y, state); - //fprintf(stderr,"text_select %s %d\n", rtext_gettag(y), state); // text_class is either a comment or an object that failed to create // so we distinguish between it and comment using T_TEXT type check - if (pd_class(&x->te_pd) == text_class && x->te_type != T_TEXT) - outline = "$pd_colors(dash_outline)"; - else if (z->g_pd == gatom_class) - outline = "$pd_colors(atom_box_border)"; - else - outline = "$pd_colors(box_border)"; - //fprintf(stderr,"text_select isvisible=%d shouldvis=%d istoplevel=%d\n", - // glist_isvisible(glist), gobj_shouldvis(&x->te_g, glist), - // glist_istoplevel(glist)); if (gobj_shouldvis(&x->te_g, glist)) { - if (glist_istoplevel(glist)) - { - if (z->g_pd == gatom_class) - { - //sys_vgui(".x%lx.c itemconfigure %lx.l -fill %s\n", - // glist_getcanvas(glist), x, - // (state? "$pd_colors(selection)" : "$pd_colors(text)")); - } - } if (z->g_pd->c_wb && z->g_pd->c_wb->w_displacefnwtag) { - int i; if (state) { - if (z->g_pd == gatom_class) - { - /* Since the label is a child of the parent gobj, we - only need to select the gobj to displace it */ - //sys_vgui(".x%lx.c addtag selected withtag %lx.l\n", - // glist_getcanvas(glist), x); - } gui_vmess("gui_gobj_select", "xs", glist_getcanvas(glist), rtext_gettag(y)); - - if (pd_class(&x->te_pd) == text_class && - x->te_type != T_TEXT && - glist_istoplevel(glist)) - { - /* Not sure yet what this was doing... */ - //sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 1 " - // "-strokedasharray {} " - // "-fill $pd_colors(box)\n", - // glist_getcanvas(glist), rtext_gettag(y)); - } - - t_object *ob = pd_checkobject(&x->te_pd); - int no = obj_noutlets(ob); - int ni = obj_ninlets(ob); - - for (i = 0; i < no; i++) - { - /* Not necessary since xlet rect is child of gobj */ - //sys_vgui(".x%lx.c addtag selected withtag %so%d \n", - // glist_getcanvas(glist), rtext_gettag(y), i); - } - for (i = 0; i < ni; i++) - { - /* Not necessary since xlet rect is child of gobj */ - //sys_vgui(".x%lx.c addtag selected withtag %si%d \n", - // glist_getcanvas(glist), rtext_gettag(y), i); - } } else { - if (z->g_pd == gatom_class) - { - //sys_vgui(".x%lx.c dtag %lx.l selected\n", - // glist_getcanvas(glist), x); - } gui_vmess("gui_gobj_deselect", "xs", glist_getcanvas(glist), rtext_gettag(y)); - - if (pd_class(&x->te_pd) == text_class && - x->te_type != T_TEXT) - { - /* This is for broken objects, but we're doing - it in CSS now... */ - //sys_vgui(".x%lx.c itemconfigure %sR -strokewidth 2 " - // "-strokelinecap projecting -strokedasharray {2 3} " - // "-fill %s\n", - // glist_getcanvas(glist), - // rtext_gettag(y), invalid_fill); - } - - t_object *ob = pd_checkobject(&x->te_pd); - int no = obj_noutlets(ob); - int ni = obj_ninlets(ob); - - for (i = 0; i < no; i++) - { - //sys_vgui(".x%lx.c dtag %so%d selected\n", - // glist_getcanvas(glist), rtext_gettag(y), i); - } - for (i = 0; i < ni; i++) - { - //sys_vgui(".x%lx.c dtag %si%d selected\n", - // glist_getcanvas(glist), rtext_gettag(y), i); - } } } } @@ -2446,7 +2301,6 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i; int width = x2 - x1; int issignal; - int selected = glist_isselected(glist, (t_gobj*)ob); for (i = 0; i < n; i++) { int onset = x1 + (width - IOWIDTH) * i / nplus; @@ -2526,96 +2380,13 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, } } - /* draw inlets and outlets for a text object or for a graph. */ - /* this should never get called... */ -void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime, - char *tag, int x1, int y1, int x2, int y2) -{ - post("glist_drawiofor_withtag: should never get called!"); - return; - if (pd_class(&ob->te_pd) == text_class) - return; - //fprintf(stderr,"drawiofor_withtag\n"); - int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i; - int width = x2 - x1; - int issignal; - for (i = 0; i < n; i++) - { - int onset = x1 + (width - IOWIDTH) * i / nplus; - if (firsttime) - { - //fprintf(stderr,"drawiofor_withtag o firsttime\n"); - issignal = obj_issignaloutlet(ob,i); - /* Hm, I can't seem to find a case where this is needed - yet. All the xlets in nw.js port load and get created - correctly without it... */ - //sys_vgui(".x%lx.c create prect %d %d %d %d \ - // -fill %s -stroke %s -tags {%so%d %lx outlet}\n", - // glist_getcanvas(glist), onset, y2 - 2, onset + IOWIDTH, y2, - // (issignal ? "$pd_colors(signal_nlet)" : - // "$pd_colors(control_nlet)"), - // (issignal ? "$pd_colors(signal_cord)" : - // "$pd_colors(control_cord)"), - // tag, i, tag); - } - /* - else - { - sys_vgui(".x%lx.c addtag selected withtag %so%d \n", - glist_getcanvas(glist), tag, i); - } - */ - } - n = obj_ninlets(ob); - //fprintf(stderr,"drawiofor_withtag n=%d\n", n); - nplus = (n == 1 ? 1 : n-1); - for (i = 0; i < n; i++) - { - int onset = x1 + (width - IOWIDTH) * i / nplus; - if (firsttime) - { - //fprintf(stderr,"drawiofor_withtag i firsttime\n"); - issignal = obj_issignalinlet(ob,i); - /* Looks like this doesn't get called... */ - //sys_vgui(".x%lx.c create prect %d %d %d %d \ - // -fill %s -stroke %s -tags {%si%d %lx inlet}\n", - // glist_getcanvas(glist), onset, y1, - // onset + IOWIDTH, y1 + EXTRAPIX, - // (issignal ? "$pd_colors(signal_nlet)" : - // "$pd_colors(control_nlet)"), - // (issignal ? "$pd_colors(signal_cord)" : - // "$pd_colors(control_cord)"), - // tag, i, tag); - } -/* else - { - //sys_vgui(".x%lx.c addtag selected withtag %si%d \n", - // glist_getcanvas(glist), tag, i); - fprintf(stderr,"drawiofor_withtag i redraw\n"); - issignal = obj_issignalinlet(ob,i); - sys_vgui(".x%lx.c itemconfigure %si%d \ - -fill %s -outline %s\n", - glist_getcanvas(glist), tag, i, - (issignal ? "$pd_colors(signal_nlet)" : - "$pd_colors(control_nlet)"), - (issignal ? "$pd_colors(signal_cord)" : - "$pd_colors(control_cord)")); - } -*/ - } -} - void text_drawborder(t_text *x, t_glist *glist, char *tag, int width2, int height2, int firsttime) { - //fprintf(stderr,"text_drawborder\n"); - t_object *ob; int x1, y1, x2, y2; int broken; - int selected = glist_isselected(glist, (t_gobj*)x); - /* if this is gop patcher, the getrect should be equal to gop-ed window rather than just the size of text */ if (pd_class(&x->te_pd) == canvas_class && @@ -2743,118 +2514,6 @@ void text_drawborder(t_text *x, t_glist *glist, /* raise cords over everything else */ if (firsttime && glist==glist_getcanvas(glist)) canvas_raise_all_cords(glist); - - //ico@bukvic.net 100518 update scrollbars when GOP - //potentially exceeds window size - //canvas_getscroll( - // (long unsigned int)glist_getcanvas(glist)); -} - -/* Should be able to remove this since it never gets called... */ -void text_drawborder_withtag(t_text *x, t_glist *glist, - char *tag, int width2, int height2, int firsttime) -{ - post("text_drawborder_withtag: should never get called!"); - return; - t_object *ob; - int x1, y1, x2, y2, msg_draw_const, atom_draw_const; - text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2); - - if (x->te_type == T_OBJECT) - { - char *pattern; char *outline; char *fill; - if (pd_class(&x->te_pd) == text_class) - { - pattern = "-"; - outline = "$pd_colors(dash_outline) -strokewidth 2 -strokelinecap projecting -strokedasharray {2 3}"; - fill = invalid_fill; - } - else - { - pattern = "\"\""; - outline = "$pd_colors(box_border)"; - fill = "$pd_colors(box)"; - } - if (firsttime) - { - /* Looks like this isn't needed... */ - //sys_vgui(".x%lx.c create ppolygon %d %d %d %d %d %d %d %d %d %d" - // "-stroke %s -fill %s -tags {%sR %lx text}\n", - // glist_getcanvas(glist), - // x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, - // outline, fill, tag, tag); - // //-dash %s -> pattern disabled for tkpath - } - } - else if (x->te_type == T_MESSAGE) - { - msg_draw_const = ((y2-y1)/4); - if (msg_draw_const > 10) msg_draw_const = 10; /* looks bad if too big */ - if (firsttime) - { - /* Doesn't look like this is necessary... */ - sys_vgui(".x%lx.c create ppolygon " - "%d %d %d %d %d %d %d %d %d %d %d %d %d %d " - "-stroke $pd_colors(msg_border) -fill $pd_colors(msg) " - "-tags {%sR %lx text msg box}\n", - glist_getcanvas(glist), - x1, y1, x2+msg_draw_const, y1, x2, y1+msg_draw_const, - x2, y2-msg_draw_const, x2+msg_draw_const, y2, - x1, y2, x1, y1, - tag, tag); - } - } - else if (x->te_type == T_ATOM) - { - atom_draw_const = ((y2-y1)/3); - if (firsttime) - { - /* Looks like this isn't needed... */ - //sys_vgui(".x%lx.c create ppolygon " - // "%d %d %d %d %d %d %d %d %d %d %d %d " - // "-stroke $pd_colors(atom_box_border) " - // "-fill $pd_colors(atom_box) " - // "-tags {%sR %lx text atom box}\n", - // glist_getcanvas(glist), - // x1, y1, x2-atom_draw_const, y1, x2, y1+atom_draw_const, - // x2, y2, x1, y2, x1, y1, - // tag, tag); - } - } - /* for comments, draw a dotted box; when a visible - canvas is unlocked we have to call this anew on all comments, and when - locked we erase them all via the annoying "commentbar" tag. */ - else if (x->te_type == T_TEXT && glist->gl_edit) - { - if (firsttime) - { - /* Looks like this isn't needed... */ - //sys_vgui(".x%lx.c create pline %d %d %d %d " - // "-tags [list %sR commentbar] -stroke $box_outline\n", - // glist_getcanvas(glist), - // x2, y1, x2, y2, tag); - } - else - { - /* Looks like this isn't needed... */ - //sys_vgui(".x%lx.c coords %sR %d %d %d %d\n", - // glist_getcanvas(glist), tag, x2, y1, x2, y2); - } - } - /* draw inlets/outlets */ - - if (ob = pd_checkobject(&x->te_pd)) - { - glist_drawiofor_withtag(glist, ob, firsttime, tag, x1, y1, x2, y2); - } - /* raise cords over everything else */ - if (firsttime && glist==glist_getcanvas(glist)) - canvas_raise_all_cords(glist); - - //ico@bukvic.net 100518 update scrollbars when GOP - //potentially exceeds window size - //canvas_getscroll( - // (long unsigned int)glist_getcanvas(glist)); } void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag) @@ -2889,8 +2548,6 @@ void text_eraseborder(t_text *x, t_glist *glist, char *tag) { if (x->te_type == T_TEXT && !glist->gl_edit) return; //if (!glist_isvisible(glist)) return; - //sys_vgui(".x%lx.c delete %sR\n", - // glist_getcanvas(glist), tag); glist_eraseiofor(glist, x, tag); } @@ -2928,10 +2585,13 @@ void text_checkvalidwidth(t_glist *glist) contains a scalar. */ if (pd_class((t_pd *)yg) == scalar_class) return; t_text *newest_t = (t_text *)yg; - //fprintf(stderr, "newest object text class is %lx\n", newest_t); t_rtext *yn = glist_findrtext(glist, newest_t); - if (yn && pd_class(&newest_t->te_pd) == text_class && newest_t->te_type != T_TEXT) - text_drawborder(newest_t, glist, rtext_gettag(yn), rtext_width(yn), rtext_height(yn), 0); + if (yn && pd_class(&newest_t->te_pd) == text_class && + newest_t->te_type != T_TEXT) + { + text_drawborder(newest_t, glist, rtext_gettag(yn), + rtext_width(yn), rtext_height(yn), 0); + } } } @@ -3115,7 +2775,7 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos) } } - /* this gets called when amessage gets sent to an object whose creation + /* this gets called when a message gets sent to an object whose creation failed, presumably because of loading a patch with a missing extern or abstraction */ static void text_anything(t_text *x, t_symbol *s, int argc, t_atom *argv) diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index d89c73852..6286b9c6e 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -43,7 +43,6 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) int x1=text_xpix(&x->x_gui.x_obj, glist); int y1=text_ypix(&x->x_gui.x_obj, glist); int x2=x1+x->x_gui.x_w, y2=y1+x->x_gui.x_h; - int col = (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol; iemgui_base_draw_new(&x->x_gui); gui_vmess("gui_toggle_new", "xxsiiiiiiiiiiii", canvas, diff --git a/pd/src/g_traversal.c b/pd/src/g_traversal.c index dc02eb675..fdb88748b 100644 --- a/pd/src/g_traversal.c +++ b/pd/src/g_traversal.c @@ -187,7 +187,6 @@ t_binbuf *pointertobinbuf(t_pd *x, t_gpointer *gp, t_symbol *s, t_symbol *templatesym = gpointer_gettemplatesym(gp), *arraytype; t_template *template; int onset, type; - t_binbuf *b; t_gstub *gs = gp->gp_stub; t_word *vec; if (!templatesym) @@ -661,6 +660,8 @@ static void set_set(t_set *x, t_symbol *templatesym, t_symbol *field) } extern void scalar_configure(t_scalar *x, t_glist *owner); +extern void array_configure(t_scalar *x, t_glist *owner, t_array *a, + t_word *data); static void set_bang(t_set *x) { diff --git a/pd/src/s_audio_alsamm.c b/pd/src/s_audio_alsamm.c index fe5d48650..604d0fe76 100644 --- a/pd/src/s_audio_alsamm.c +++ b/pd/src/s_audio_alsamm.c @@ -178,8 +178,6 @@ static void check_error(int err, const char *why) int alsamm_open_audio(int rate, int blocksize) { int err; - char devname[80]; - char *cardname; snd_pcm_hw_params_t* hw_params; snd_pcm_sw_params_t* sw_params; @@ -190,8 +188,6 @@ int alsamm_open_audio(int rate, int blocksize) ...we use periodsize and buffersize in frames */ int i; - short* tmp_buf; - unsigned int tmp_uint; snd_pcm_hw_params_alloca(&hw_params); snd_pcm_sw_params_alloca(&sw_params); @@ -315,8 +311,6 @@ int alsamm_open_audio(int rate, int blocksize) /* check for linked handles of input for each output*/ for(i=0; i<(alsa_noutdev < alsa_nindev ? alsa_noutdev:alsa_nindev); i++){ - t_alsa_dev *ad = &alsa_outdev[i]; - if (alsa_outdev[i].a_devno == alsa_indev[i].a_devno){ if ((err = snd_pcm_link (alsa_indev[i].a_handle, alsa_outdev[i].a_handle)) == 0){ @@ -838,7 +832,7 @@ static int alsamm_start() { int err = 0; int devno; - int chn,nchns; + int chn; #ifdef ALSAMM_DEBUG if(sys_verbose) @@ -872,7 +866,7 @@ static int alsamm_start() avail,offset,alsamm_buffer_size); #endif - if(avail > 0){ + if (avail > 0){ int comitted = 0; @@ -886,6 +880,9 @@ static int alsamm_start() memset(dev->a_addr[chn],0,avail*ALSAMM_SAMPLEWIDTH_32); comitted = snd_pcm_mmap_commit (dev->a_handle, offset, avail); + if (comitted < 0) { + check_error(comitted, "couldn't commit frames"); + } avail = snd_pcm_avail_update(dev->a_handle); @@ -1044,7 +1041,6 @@ int alsamm_send_dacs(void) t_sample *fpo, *fpi, *fp1, *fp2; int i, err, devno; - const snd_pcm_channel_area_t *my_areas; snd_pcm_sframes_t size; snd_pcm_sframes_t commitres; snd_pcm_state_t state; diff --git a/pd/src/x_scalar.c b/pd/src/x_scalar.c index 48210e091..61a6cf1f4 100644 --- a/pd/src/x_scalar.c +++ b/pd/src/x_scalar.c @@ -21,7 +21,6 @@ t_class *scalar_define_class; static void *scalar_define_new(t_symbol *s, int argc, t_atom *argv) { t_atom a[9]; - t_glist *gl; t_canvas *x, *z = canvas_getcurrent(); t_symbol *templatesym = &s_float, *asym = gensym("#A"); t_template *template; -- GitLab