Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31015
Modified Files: Tag: impd_0_37 g_editor.c g_canvas.c Log Message: cleanup
Index: g_editor.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v retrieving revision 1.1.1.4.2.3.2.19 retrieving revision 1.1.1.4.2.3.2.20 diff -C2 -d -r1.1.1.4.2.3.2.19 -r1.1.1.4.2.3.2.20 *** g_editor.c 1 May 2004 17:41:29 -0000 1.1.1.4.2.3.2.19 --- g_editor.c 1 May 2004 18:19:03 -0000 1.1.1.4.2.3.2.20 *************** *** 46,75 **** void gobj_getrect(t_gobj *x, t_glist *glist, int *x1, int *y1, int *x2, int *y2) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_getrectfn) (*b->w_getrectfn)(x, glist, x1, y1, x2, y2);}
void gobj_displace(t_gobj *x, t_glist *glist, int dx, int dy) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_displacefn) (*b->w_displacefn)(x, glist, dx, dy);}
void gobj_select(t_gobj *x, t_glist *glist, int state) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_selectfn) (*b->w_selectfn)(x, glist, state);}
void gobj_activate(t_gobj *x, t_glist *glist, int state) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_activatefn) (*b->w_activatefn)(x, glist, state);}
void gobj_delete(t_gobj *x, t_glist *glist) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_deletefn) (*b->w_deletefn)(x, glist);}
void gobj_vis(t_gobj *x, struct _glist *glist, int flag) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_visfn) (*b->w_visfn)(x, glist, flag);}
int gobj_click(t_gobj *x, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_clickfn) return (*b->w_clickfn)(x, glist, xpix, ypix, shift, alt, dbl, doit); return 0;}
--- 46,75 ---- void gobj_getrect(t_gobj *x, t_glist *glist, int *x1, int *y1, int *x2, int *y2) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_getrectfn) b->w_getrectfn(x, glist, x1, y1, x2, y2);}
void gobj_displace(t_gobj *x, t_glist *glist, int dx, int dy) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_displacefn) b->w_displacefn(x, glist, dx, dy);}
void gobj_select(t_gobj *x, t_glist *glist, int state) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_selectfn) b->w_selectfn(x, glist, state);}
void gobj_activate(t_gobj *x, t_glist *glist, int state) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_activatefn) b->w_activatefn(x, glist, state);}
void gobj_delete(t_gobj *x, t_glist *glist) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_deletefn) b->w_deletefn(x, glist);}
void gobj_vis(t_gobj *x, struct _glist *glist, int flag) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_visfn) b->w_visfn(x, glist, flag);}
int gobj_click(t_gobj *x, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { struct _widgetbehavior *b = x->g_pd->c_wb; ! if (b && b->w_clickfn) return b->w_clickfn(x, glist, xpix, ypix, shift, alt, dbl, doit); return 0;}
*************** *** 273,277 **** if (canvas_undo_fn && canvas_undo_buf && (buf != canvas_undo_buf)) { ! (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_FREE); hadone = 1; } --- 273,277 ---- if (canvas_undo_fn && canvas_undo_buf && (buf != canvas_undo_buf)) { ! canvas_undo_fn(canvas_undo_canvas, canvas_undo_buf, UNDO_FREE); hadone = 1; } *************** *** 299,303 **** if (x != canvas_undo_canvas) {bug("canvas_undo 1"); return;} if (canvas_undo_whatnext != UNDO_UNDO) {bug("canvas_undo 2"); return;} ! (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_UNDO); /* enable redo in menu */ if (glist_isvisible(x) && glist_istoplevel(x)) --- 299,303 ---- if (x != canvas_undo_canvas) {bug("canvas_undo 1"); return;} if (canvas_undo_whatnext != UNDO_UNDO) {bug("canvas_undo 2"); return;} ! canvas_undo_fn(canvas_undo_canvas, canvas_undo_buf, UNDO_UNDO); /* enable redo in menu */ if (glist_isvisible(x) && glist_istoplevel(x)) *************** *** 310,314 **** if (x != canvas_undo_canvas) {bug("canvas_redo 1"); return;} if (canvas_undo_whatnext != UNDO_REDO) {bug("canvas_redo 2"); return;} ! (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_REDO); /* enable undo in menu */ if (glist_isvisible(x) && glist_istoplevel(x)) --- 310,314 ---- if (x != canvas_undo_canvas) {bug("canvas_redo 1"); return;} if (canvas_undo_whatnext != UNDO_REDO) {bug("canvas_redo 2"); return;} ! canvas_undo_fn(canvas_undo_canvas, canvas_undo_buf, UNDO_REDO); /* enable undo in menu */ if (glist_isvisible(x) && glist_istoplevel(x)) *************** *** 820,847 **** static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) { - char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING]; t_gobj *y; ! for (y = x->gl_list; y; y = y->g_next) ! { ! int x1, y1, x2, y2; ! if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) ! { ! if (which == 0) /* properties */ ! { ! if (!class_getpropertiesfn(pd_class(&y->g_pd))) continue; ! (*class_getpropertiesfn(pd_class(&y->g_pd)))(y, x); return; ! } ! else if (which == 1) /* open */ ! { ! if (!zgetfn(&y->g_pd, gensym("menu-open"))) continue; vmess(&y->g_pd, gensym("menu-open"), ""); ! return; ! } ! else /* help */ ! { char *dir; ! if (pd_class(&y->g_pd) == canvas_class && ! canvas_isabstraction((t_canvas *)y)) ! { t_object *ob = (t_object *)y; int ac = binbuf_getnatom(ob->te_binbuf); --- 820,839 ---- static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) { t_gobj *y; ! int x1, y1, x2, y2; ! for (y=x->gl_list; y; y=y->g_next) ! if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) goto found; ! if (which == 0) canvas_properties(x); ! else if (which == 2) sys_vgui("menu_opentext %s/doc/5.reference/0.INTRO.txt\n", sys_libdir->s_name); ! return; ! found: ! if (which==0 && class_getpropertiesfn(pd_class(&y->g_pd))) { ! class_getpropertiesfn(pd_class(&y->g_pd))(y, x); ! } else if (which == 1 && zgetfn(&y->g_pd, gensym("menu-open"))) { vmess(&y->g_pd, gensym("menu-open"), ""); ! } else if (which == 2) { char *dir; ! char namebuf[MAXPDSTRING]; ! if (pd_class(&y->g_pd)==canvas_class && canvas_isabstraction((t_canvas *)y)) { t_object *ob = (t_object *)y; int ac = binbuf_getnatom(ob->te_binbuf); *************** *** 850,882 **** atom_string(av, namebuf, MAXPDSTRING); dir = canvas_getdir((t_canvas *)y)->s_name; ! } ! else ! { strcpy(namebuf, class_gethelpname(pd_class(&y->g_pd))); dir = class_gethelpdir(pd_class(&y->g_pd)); } ! if (strcmp(namebuf + strlen(namebuf) - 3, ".pd")) ! strcat(namebuf, ".pd"); open_via_helppath(namebuf, dir); ! return; ! } ! } ! } ! if (which == 0) ! canvas_properties(x); ! else if (which == 2) ! { ! strcpy(pathbuf, sys_libdir->s_name); ! strcat(pathbuf, "/doc/5.reference/0.INTRO.txt"); ! sys_vgui("menu_opentext %s\n", pathbuf); ! } }
- #define NOMOD 0 - #define SHIFTMOD 1 - #define CTRLMOD 2 - #define ALTMOD 4 - #define RIGHTCLICK 8 - /* on one-button-mouse machines, you can use double click to mean right click (which gets the popup menu.) Do this for Mac. */ --- 842,854 ---- atom_string(av, namebuf, MAXPDSTRING); dir = canvas_getdir((t_canvas *)y)->s_name; ! } else { strcpy(namebuf, class_gethelpname(pd_class(&y->g_pd))); dir = class_gethelpdir(pd_class(&y->g_pd)); } ! if (strcmp(namebuf+strlen(namebuf)-3,".pd")) strcat(namebuf,".pd"); open_via_helppath(namebuf, dir); ! } }
/* on one-button-mouse machines, you can use double click to mean right click (which gets the popup menu.) Do this for Mac. */ *************** *** 891,895 **** #endif
! void canvas_find_wire(t_canvas *self, t_symbol *linesym, t_outconnect **oc, int *obj1, int *port1, int *obj2, int *port2) { t_outconnect *w; --- 863,867 ---- #endif
! static void canvas_find_wire(t_canvas *self, t_symbol *linesym, t_outconnect **oc, int *obj1, int *port1, int *obj2, int *port2) { t_outconnect *w; *************** *** 908,917 **** }
! void canvas_modifiers(t_canvas *self, int f, int doit, int *run, int *shift, int *alt, int *rightclick) { int mod = (int)f; ! *run = (mod & CTRLMOD) || !self->gl_edit; ! *shift = mod & SHIFTMOD; ! *alt = mod & ALTMOD; ! *rightclick = mod & RIGHTCLICK; #ifdef SIMULATERIGHTCLICK if (doit && !runmode && xpos == canvas_upx && ypos == canvas_upy && --- 880,889 ---- }
! static void canvas_modifiers(t_canvas *self, int f, int doit, int *run, int *shift, int *alt, int *rightclick) { int mod = (int)f; ! *run = (mod & 2) || !self->gl_edit; ! *shift = mod & 1; ! *alt = mod & 4; ! *rightclick = mod & 8; #ifdef SIMULATERIGHTCLICK if (doit && !runmode && xpos == canvas_upx && ypos == canvas_upy && *************** *** 921,925 **** }
! void canvas_click_on_wire(t_canvas *self, t_symbol *linesym, t_float x, t_float y, t_float b, t_float f) { int run, shift, alt, rightclick; --- 893,897 ---- }
! static void canvas_click_on_wire(t_canvas *self, t_symbol *linesym, t_float x, t_float y, t_float b, t_float f) { int run, shift, alt, rightclick; *************** *** 946,950 **** }
! void canvas_click_on_object(t_canvas *self, t_symbol *objsym, t_float x, t_float y, t_float b, t_float f) { int run, shift, alt, rightclick; --- 918,922 ---- }
! static void canvas_click_on_object(t_canvas *self, t_symbol *objsym, t_float x, t_float y, t_float b, t_float f) { int run, shift, alt, rightclick; *************** *** 1060,1068 **** }
! void canvas_mousedown(t_canvas *x, t_floatarg xpos, t_floatarg ypos, ! t_floatarg which, t_floatarg mod) ! { ! canvas_doclick(x, xpos, ypos, which, mod, 1); ! }
int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, --- 1032,1037 ---- }
! void canvas_mousedown(t_canvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg which, t_floatarg mod) ! {canvas_doclick(x, xpos, ypos, which, mod, 1);}
int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, *************** *** 1232,1237 **** if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) ! (* x->gl_editor->e_keyfn) ! (x->gl_editor->e_grab, (float)keynum); /* if a text editor is open send it on */ else if (x->gl_editor->e_textedfor) --- 1201,1205 ---- if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) ! x->gl_editor->e_keyfn(x->gl_editor->e_grab, (float)keynum); /* if a text editor is open send it on */ else if (x->gl_editor->e_textedfor) *************** *** 1912,1915 **** --- 1880,1887 ---- class_addmethod(c, (t_method)canvas_displaceselection, gensym("displace-selection"), A_FLOAT, A_FLOAT, A_NULL); class_addmethod(c, (t_method)canvas_selectinrect, gensym("select-in-rectangle"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); + class_addmethod(c, (t_method)canvas_click_on_object, gensym("click-on-object"), + A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); + class_addmethod(c, (t_method)canvas_click_on_wire, gensym("click-on-wire"), + A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(c, (t_method)canvas_gobj_activate, gensym("gobj-activate"), A_SYMBOL, A_NULL);
Index: g_canvas.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v retrieving revision 1.1.1.4.2.7.2.14 retrieving revision 1.1.1.4.2.7.2.15 diff -C2 -d -r1.1.1.4.2.7.2.14 -r1.1.1.4.2.7.2.15 *** g_canvas.c 1 May 2004 01:46:18 -0000 1.1.1.4.2.7.2.14 --- g_canvas.c 1 May 2004 18:19:03 -0000 1.1.1.4.2.7.2.15 *************** *** 7,12 ****
/* changes by Thomas Musil IEM KUG Graz Austria 2001 */ - - /* bug-fix: canvas_menuclose(): by Krzysztof Czaja */ /* bug-fix: table_new(): I reversed the y-bounds */
--- 7,10 ---- *************** *** 19,22 **** --- 17,22 ---- */
+ /* Copyright 2004 by Mathieu Bouchard */ + #include <stdlib.h> #include <stdio.h> *************** *** 1294,1302 **** /*DECL(canvas_guiext)*/
- void canvas_click_on_object(t_canvas *self, t_symbol linesym, - t_float x, t_float y, t_float b, t_float f); - void canvas_click_on_wire (t_canvas *self, t_symbol linesym, - t_float x, t_float y, t_float b, t_float f); - void g_graph_setup(void); void g_editor_setup(void); --- 1294,1297 ---- *************** *** 1341,1348 ****
/* ------------------------ gui stuff --------------------------- */ - class_addmethod(c, (t_method)canvas_click_on_object, gensym("click-on-object"), - A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); - class_addmethod(c, (t_method)canvas_click_on_wire, gensym("click-on-wire"), - A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL); class_addmethod(c, (t_method)canvas_pop, gensym("pop"), A_DEFFLOAT, A_NULL); class_addmethod(c, (t_method)canvas_loadbang, gensym("loadbang"), A_NULL); --- 1336,1339 ----