Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1:/tmp/cvs-serv1309
Modified Files: Tag: devel_0_37 d_osc.c g_canvas.h g_editor.c g_graph.c g_io.c m_class.c m_glob.c m_imp.h m_obj.c m_pd.h s_stuff.h Log Message: tooltips
Index: d_osc.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_osc.c,v retrieving revision 1.1.1.2.2.1 retrieving revision 1.1.1.2.2.2 diff -C2 -d -r1.1.1.2.2.1 -r1.1.1.2.2.2 *** d_osc.c 18 Nov 2003 10:34:10 -0000 1.1.1.2.2.1 --- d_osc.c 25 Nov 2003 19:19:57 -0000 1.1.1.2.2.2 *************** *** 270,273 **** --- 270,274 ---- outlet_new(&x->x_obj, gensym("signal")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); + inlet_settip(x->x_obj.te_inlet,gensym("phase")); x->x_phase = 0; x->x_conv = 0; *************** *** 350,353 **** --- 351,355 ---- class_addmethod(osc_class, (t_method)osc_dsp, gensym("dsp"), 0); class_addmethod(osc_class, (t_method)osc_ft1, gensym("ft1"), A_FLOAT, 0); + class_settip(osc_class,gensym("frequency"));
cos_maketable();
Index: g_canvas.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_canvas.h,v retrieving revision 1.1.1.4.2.3 retrieving revision 1.1.1.4.2.4 diff -C2 -d -r1.1.1.4.2.3 -r1.1.1.4.2.4 *** g_canvas.h 12 Sep 2003 20:55:31 -0000 1.1.1.4.2.3 --- g_canvas.h 25 Nov 2003 19:19:57 -0000 1.1.1.4.2.4 *************** *** 445,449 **** EXTERN void canvas_redraw(t_canvas *x);
! EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym); EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip); EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym); --- 445,449 ---- EXTERN void canvas_redraw(t_canvas *x);
! EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym,t_symbol* s); EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip); EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym);
Index: g_editor.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v retrieving revision 1.1.1.4.2.2 retrieving revision 1.1.1.4.2.3 diff -C2 -d -r1.1.1.4.2.2 -r1.1.1.4.2.3 *** g_editor.c 12 Sep 2003 20:55:31 -0000 1.1.1.4.2.2 --- g_editor.c 25 Nov 2003 19:19:57 -0000 1.1.1.4.2.3 *************** *** 16,19 **** --- 16,20 ---- void open_via_helppath(const char *name, const char *dir); char *class_gethelpdir(t_class *c); + char* inlet_tip(t_inlet* i,int num);
/* ------------------ forward declarations --------------- */ *************** *** 745,748 **** --- 746,764 ---- }
+ + void canvas_inlettip(t_canvas* x,t_object* ob,int closest,int xpos,int ypos) + { + if (!sys_tooltips) return; + if (ob->ob_pd->c_firstin) closest--; + if (closest < 0) + sys_vgui(".x%x.c create text %d %d -anchor sw -text "%s" -tags y\n", + x, xpos, ypos,ob->ob_pd->c_firsttip->s_name); + else + sys_vgui(".x%x.c create text %d %d -anchor sw -text "%s" -tags y\n", + x, xpos, ypos-4,inlet_tip(ob->te_inlet,closest)); + } + + + /* check if a point lies in a gobj. */ int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos, *************** *** 1027,1030 **** --- 1043,1048 ---- return; } + sys_vgui(".x%x.c delete x\n",x); + /* if not a runmode left click, fall here. */ if (y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2)) *************** *** 1059,1063 **** { /* look for an outlet */ ! int noutlet; if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4) { --- 1077,1081 ---- { /* look for an outlet */ ! int noutlet,ninlet; if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4) { *************** *** 1086,1089 **** --- 1104,1123 ---- goto nooutletafterall; } + /* look for an inlet */ + else if (ob && (ninlet = obj_ninlets(ob)) && ypos <= y1+4) + { + int width = x2 - x1; + int nin1 = (ninlet > 1 ? ninlet - 1 : 1); + int closest = ((xpos-x1) * (nin1) + width/2)/width; + int hotspot = x1 + + (width - IOWIDTH) * closest / (nin1); + if (closest < ninlet && + xpos >= (hotspot-1) && xpos <= hotspot + (IOWIDTH+1)) + { + + canvas_inlettip(x,ob,closest,xpos,ypos); + } + } + /* not in an outlet; select and move */ else if (doit) *************** *** 1269,1273 **** "connect"); } ! else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT); return; } --- 1303,1310 ---- "connect"); } ! else { ! canvas_setcursor(x, CURSOR_EDITMODE_CONNECT); ! canvas_inlettip(x,ob2,closest2,xpos,ypos); ! } return; } *************** *** 1489,1492 **** --- 1526,1531 ---- return; } + sys_vgui(".x%x.c delete y\n",x); + glist_setlastxy(x, xpos, ypos); if (x->gl_editor->e_onmotion == MA_MOVE)
Index: g_graph.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_graph.c,v retrieving revision 1.1.1.3.2.2 retrieving revision 1.1.1.3.2.3 diff -C2 -d -r1.1.1.3.2.2 -r1.1.1.3.2.3 *** g_graph.c 29 Oct 2003 12:57:42 -0000 1.1.1.3.2.2 --- g_graph.c 25 Nov 2003 19:19:57 -0000 1.1.1.3.2.3 *************** *** 259,265 ****
! t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *s) { t_inlet *ip = inlet_new(&x->gl_obj, who, s, 0); if (!x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner)) { --- 259,266 ----
! t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *s,t_symbol* h) { t_inlet *ip = inlet_new(&x->gl_obj, who, s, 0); + inlet_settip(ip,h); if (!x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner)) {
Index: g_io.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_io.c,v retrieving revision 1.1.1.1.16.1 retrieving revision 1.1.1.1.16.2 diff -C2 -d -r1.1.1.1.16.1 -r1.1.1.1.16.2 *** g_io.c 2 Aug 2003 15:37:49 -0000 1.1.1.1.16.1 --- g_io.c 25 Nov 2003 19:19:57 -0000 1.1.1.1.16.2 *************** *** 28,31 **** --- 28,32 ---- void signal_setborrowed(t_signal *sig, t_signal *sig2); void signal_makereusable(t_signal *sig); + void inlet_sethelp(t_inlet* i,t_symbol* s);
/* ------------------------- vinlet -------------------------- */ *************** *** 46,51 **** signal from the prolog to the DSP routine: */ t_signal *x_directsignal; ! ! t_resample x_updown; /* IOhannes */ } t_vinlet;
--- 47,51 ---- signal from the prolog to the DSP routine: */ t_signal *x_directsignal; ! t_resample x_updown; /* IOhannes */ } t_vinlet;
*************** *** 54,58 **** t_vinlet *x = (t_vinlet *)pd_new(vinlet_class); x->x_canvas = canvas_getcurrent(); ! x->x_inlet = canvas_addinlet(x->x_canvas, &x->x_obj.ob_pd, 0); x->x_bufsize = 0; x->x_buf = 0; --- 54,58 ---- t_vinlet *x = (t_vinlet *)pd_new(vinlet_class); x->x_canvas = canvas_getcurrent(); ! x->x_inlet = canvas_addinlet(x->x_canvas, &x->x_obj.ob_pd, 0,s); x->x_bufsize = 0; x->x_buf = 0; *************** *** 256,260 **** t_vinlet *x = (t_vinlet *)pd_new(vinlet_class); x->x_canvas = canvas_getcurrent(); ! x->x_inlet = canvas_addinlet(x->x_canvas, &x->x_obj.ob_pd, &s_signal); x->x_endbuf = x->x_buf = (t_float *)getbytes(0); x->x_bufsize = 0; --- 256,260 ---- t_vinlet *x = (t_vinlet *)pd_new(vinlet_class); x->x_canvas = canvas_getcurrent(); ! x->x_inlet = canvas_addinlet(x->x_canvas, &x->x_obj.ob_pd, &s_signal,s); x->x_endbuf = x->x_buf = (t_float *)getbytes(0); x->x_bufsize = 0;
Index: m_class.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_class.c,v retrieving revision 1.1.1.2.2.1 retrieving revision 1.1.1.2.2.2 diff -C2 -d -r1.1.1.2.2.1 -r1.1.1.2.2.2 *** m_class.c 12 Sep 2003 20:54:57 -0000 1.1.1.2.2.1 --- m_class.c 25 Nov 2003 19:19:57 -0000 1.1.1.2.2.2 *************** *** 203,206 **** --- 203,207 ---- c->c_pwb = 0; c->c_firstin = ((flags & CLASS_NOINLET) == 0); + c->c_firsttip = gensym("?"); c->c_patchable = (typeflag == CLASS_PATCHABLE); c->c_gobj = (typeflag >= CLASS_GOBJ); *************** *** 820,822 **** --- 821,829 ---- if (m->me_name == s) return(m->me_fun); return(0); + } + + + void class_settip(t_class *x,t_symbol* s) + { + x->c_firsttip = s; }
Index: m_glob.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_glob.c,v retrieving revision 1.1.1.2.2.2 retrieving revision 1.1.1.2.2.3 diff -C2 -d -r1.1.1.2.2.2 -r1.1.1.2.2.3 *** m_glob.c 2 Aug 2003 15:37:49 -0000 1.1.1.2.2.2 --- m_glob.c 25 Nov 2003 19:19:57 -0000 1.1.1.2.2.3 *************** *** 27,30 **** --- 27,31 ---- void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv); void glob_ping(t_pd *dummy); + void glob_tooltips(t_pd *dummy, t_float f);
void alsa_resync( void); *************** *** 98,101 **** --- 99,104 ---- class_addmethod(glob_pdobject, (t_method)glob_path_dialog, gensym("path-dialog"), A_GIMME, 0); + class_addmethod(glob_pdobject, (t_method)glob_tooltips, + gensym("tooltips"), A_DEFFLOAT, 0); #ifdef UNIX class_addmethod(glob_pdobject, (t_method)glob_ping, gensym("ping"), 0);
Index: m_imp.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_imp.h,v retrieving revision 1.1.1.2.2.1 retrieving revision 1.1.1.2.2.2 diff -C2 -d -r1.1.1.2.2.1 -r1.1.1.2.2.2 *** m_imp.h 12 Sep 2003 20:58:08 -0000 1.1.1.2.2.1 --- m_imp.h 25 Nov 2003 19:19:57 -0000 1.1.1.2.2.2 *************** *** 52,55 **** --- 52,56 ---- char c_firstin; /* if patchable, true if draw first inlet */ char c_drawcommand; /* a drawing command for a template */ + t_symbol* c_firsttip; };
Index: m_obj.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_obj.c,v retrieving revision 1.1.1.3.2.2 retrieving revision 1.1.1.3.2.3 diff -C2 -d -r1.1.1.3.2.2 -r1.1.1.3.2.3 *** m_obj.c 16 Oct 2003 16:50:20 -0000 1.1.1.3.2.2 --- m_obj.c 25 Nov 2003 19:19:57 -0000 1.1.1.3.2.3 *************** *** 23,26 **** --- 23,28 ---- };
+ int sys_tooltips = 1; + struct _inlet { *************** *** 31,34 **** --- 33,37 ---- t_symbol *i_symfrom; union inletunion i_un; + t_symbol* i_tip; };
*************** *** 58,61 **** --- 61,65 ---- x->i_symfrom = s1; x->i_next = 0; + x->i_tip = gensym("?"); if (y = owner->ob_inlet) { *************** *** 72,75 **** --- 76,103 ---- x->i_symfrom->s_name, s->s_name); } + + void inlet_settip(t_inlet* i,t_symbol* s) + { + i->i_tip = s; + } + + void glob_tooltips(t_pd *dummy, t_float f) + { + sys_tooltips = f; + } + + char* inlet_tip(t_inlet* i,int num) + { + if (num < 0) return "???"; + while (num-- && i) + i = i->i_next; + + if (i) + if (i->i_tip) { + return i->i_tip->s_name; + } + return "?"; + } +
/* LATER figure out how to make these efficient: */
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.1.1.4.2.9 retrieving revision 1.1.1.4.2.10 diff -C2 -d -r1.1.1.4.2.9 -r1.1.1.4.2.10 *** m_pd.h 18 Nov 2003 10:34:10 -0000 1.1.1.4.2.9 --- m_pd.h 25 Nov 2003 19:19:57 -0000 1.1.1.4.2.10 *************** *** 441,444 **** --- 441,447 ---- #endif
+ void class_settip(t_class *x,t_symbol* s); + void inlet_settip(t_inlet* i,t_symbol* s); + /* ------------ printing --------------------------------- */ EXTERN void post(char *fmt, ...);
Index: s_stuff.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v retrieving revision 1.1.1.1.2.4 retrieving revision 1.1.1.1.2.5 diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.5 *** s_stuff.h 7 Oct 2003 14:31:45 -0000 1.1.1.1.2.4 --- s_stuff.h 25 Nov 2003 19:19:57 -0000 1.1.1.1.2.5 *************** *** 24,27 **** --- 24,28 ---- extern int sys_nogui; extern char *sys_guicmd; + extern int sys_tooltips;
EXTERN int sys_nearestfontsize(int fontsize);