[PD-cvs] pd/src g_editor.c,1.1.1.4.2.3.2.18,1.1.1.4.2.3.2.19 u_main.tk,1.1.1.4.2.7.4.53,1.1.1.4.2.7.4.54
Mathieu Bouchard
matju at users.sourceforge.net
Sat May 1 19:41:32 CEST 2004
- Previous message: [PD-cvs] pd/src g_all_guis.c,1.1.1.4.2.4.2.20,1.1.1.4.2.4.2.21 g_all_guis.h,1.1.1.4.2.2.2.17,1.1.1.4.2.2.2.18 g_bang.c,1.1.1.3.2.2.2.16,1.1.1.3.2.2.2.17 g_dropper.c,1.1.2.7,1.1.2.8 g_hdial.c,1.1.1.4.2.2.2.13,1.1.1.4.2.2.2.14 g_hslider.c,1.1.1.3.2.2.2.16,1.1.1.3.2.2.2.17 g_mycanvas.c,1.1.1.3.2.2.2.7,1.1.1.3.2.2.2.8 g_numbox.c,1.1.1.4.2.2.2.11,1.1.1.4.2.2.2.12 g_toggle.c,1.1.1.3.2.2.2.12,1.1.1.3.2.2.2.13 g_vumeter.c,1.1.1.3.2.2.2.10,1.1.1.3.2.2.2.11
- Next message: [PD-cvs] pd/src g_editor.c,1.1.1.4.2.3.2.19,1.1.1.4.2.3.2.20 g_canvas.c,1.1.1.4.2.7.2.14,1.1.1.4.2.7.2.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23781
Modified Files:
Tag: impd_0_37
g_editor.c u_main.tk
Log Message:
fixed bugs
Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.1.1.4.2.3.2.18
retrieving revision 1.1.1.4.2.3.2.19
diff -C2 -d -r1.1.1.4.2.3.2.18 -r1.1.1.4.2.3.2.19
*** g_editor.c 1 May 2004 01:46:18 -0000 1.1.1.4.2.3.2.18
--- g_editor.c 1 May 2004 17:41:29 -0000 1.1.1.4.2.3.2.19
***************
*** 3,6 ****
--- 3,8 ----
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+ /* Copyright 2004 by Mathieu Bouchard */
+
#include <stdlib.h>
#include <stdio.h>
***************
*** 737,742 ****
int canprop = !y || (y && class_getpropertiesfn(pd_class(&y->g_pd)));
int canopen = y && zgetfn(&y->g_pd, gensym("menu-open"));
! sys_vgui("pdtk_canvas_popup .x%x %d %d %d %d\n",
! x, xpos, ypos, canprop, canopen);
}
--- 739,743 ----
int canprop = !y || (y && class_getpropertiesfn(pd_class(&y->g_pd)));
int canopen = y && zgetfn(&y->g_pd, gensym("menu-open"));
! sys_vgui("pdtk_canvas_popup .x%x %d %d %d %d\n",x,xpos,ypos,canprop,canopen);
}
***************
*** 987,991 ****
{
int run, shift, alt, rightclick;
! int x1, y1, x2, y2, clickreturned = 0;
t_gobj *y;
t_editor *e = x->gl_editor;
--- 988,992 ----
{
int run, shift, alt, rightclick;
! int x1, y1, x2, y2;
t_gobj *y;
t_editor *e = x->gl_editor;
***************
*** 1011,1020 ****
if (run && !rightclick)
{
for (y = x->gl_list; y; y = y->g_next)
{
/* check if the object wants to be clicked */
! if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)
! && (clickreturned = gobj_click(y,x,xpos,ypos,shift,alt,0,doit)))
! break;
}
if (!doit) canvas_setcursor(x, y?clickreturned:CURSOR_RUNMODE_NOTHING);
--- 1012,1023 ----
if (run && !rightclick)
{
+ int clickreturned=0;
for (y = x->gl_list; y; y = y->g_next)
{
/* check if the object wants to be clicked */
! if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) {
! clickreturned = gobj_click(y,x,xpos,ypos,shift,alt,0,doit);
! if (clickreturned) break;
! }
}
if (!doit) canvas_setcursor(x, y?clickreturned:CURSOR_RUNMODE_NOTHING);
***************
*** 1023,1080 ****
/* if not a runmode left click, fall here. */
! if (y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2))
! {
t_object *ob = pd_checkobject(&y->g_pd);
/* check you're in the rectangle */
ob = pd_checkobject(&y->g_pd);
if (rightclick) canvas_rightclick(x, xpos, ypos, y);
! else if (shift)
! {
! if (doit)
! {
! t_rtext *rt;
! if (ob && (rt = e->e_textedfor) &&
! rt == glist_findrtext(x, ob))
! {
! rtext_mouse(rt, xpos - x1, ypos - y1, RTEXT_SHIFT);
! e->e_onmotion = MA_DRAGTEXT;
! e->e_xwas = x1;
! e->e_ywas = y1;
! }
! else
! {
! if (glist_isselected(x, y))
! glist_deselect(x, y);
! else glist_select(x, y);
! }
! }
! }
! else
! {
! int noutlet,ninlet;
! if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4) {}
! /* look for an inlet */
! else if (ob && (ninlet = obj_ninlets(ob)) && ypos <= y1+4) {}
! /* not in an outlet; select and move */
! /*
! else if (doit)
! {
! t_rtext *rt;
! // check if the box is being text edited
! if (ob && (rt = e->e_textedfor) && rt == glist_findrtext(x, ob))
! {
! rtext_mouse(rt, xpos - x1, ypos - y1, RTEXT_DOWN);
e->e_onmotion = MA_DRAGTEXT;
e->e_xwas = x1;
e->e_ywas = y1;
}
! else
! {
! // otherwise select and drag to displace
! }
! }
! else canvas_setcursor(x, CURSOR_EDITMODE_NOTHING);
! */
! }
return;
}
--- 1026,1045 ----
/* if not a runmode left click, fall here. */
! y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2);
! if (y) {
t_object *ob = pd_checkobject(&y->g_pd);
/* check you're in the rectangle */
ob = pd_checkobject(&y->g_pd);
if (rightclick) canvas_rightclick(x, xpos, ypos, y);
! if (doit) {
! t_rtext *rt = e->e_textedfor;
! if (ob && rt==glist_findrtext(x, ob)) {
! rtext_mouse(rt, xpos - x1, ypos - y1, shift ? RTEXT_SHIFT : RTEXT_DOWN);
e->e_onmotion = MA_DRAGTEXT;
e->e_xwas = x1;
e->e_ywas = y1;
}
! }
! if (!doit && !shift) canvas_setcursor(x, CURSOR_EDITMODE_NOTHING);
return;
}
***************
*** 1089,1094 ****
{
if (!shift) glist_noselect(x);
- sys_vgui(".x%x.c create rectangle %d %d %d %d -tags x\n",
- x, xpos, ypos, xpos, ypos);
e->e_xwas = xpos;
e->e_ywas = ypos;
--- 1054,1057 ----
***************
*** 1142,1153 ****
}
! void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy)
{
t_gobj *y;
for (y = x->gl_list; y; y = y->g_next)
{
int x1, y1, x2, y2;
gobj_getrect(y, x, &x1, &y1, &x2, &y2);
! if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2
&& !glist_isselected(x, y))
glist_select(x, y);
--- 1105,1118 ----
}
! static void canvas_selectinrect(t_canvas *x, float bx1, float by1, float bx2, float by2)
{
t_gobj *y;
+ if (bx1>bx2) {float t=bx1; bx1=bx2; bx2=t;}
+ if (by1>by2) {float t=by1; by1=by2; by2=t;}
for (y = x->gl_list; y; y = y->g_next)
{
int x1, y1, x2, y2;
gobj_getrect(y, x, &x1, &y1, &x2, &y2);
! if (bx2 >= x1 && bx1 <= x2 && by2 >= y1 && by1 <= y2
&& !glist_isselected(x, y))
glist_select(x, y);
***************
*** 1155,1176 ****
}
! static void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit)
! {
! t_editor *e = x->gl_editor;
! if (doit)
! {
! int lox, loy, hix, hiy;
! if (e->e_xwas < xpos)
! lox = e->e_xwas, hix = xpos;
! else hix = e->e_xwas, lox = xpos;
! if (e->e_ywas < ypos)
! loy = e->e_ywas, hiy = ypos;
! else hiy = e->e_ywas, loy = ypos;
! canvas_selectinrect(x, lox, loy, hix, hiy);
! /* sys_vgui(".x%x.c delete x\n", x);*/
! e->e_onmotion = 0;
! }
! else sys_vgui(".x%x.c coords x %d %d %d %d\n",
! x, e->e_xwas, e->e_ywas, xpos, ypos);
}
--- 1120,1127 ----
}
! static void canvas_gobj_activate(t_canvas *x, t_symbol *objsym) {
! t_gobj *id = 0;
! if (!sscanf(objsym->s_name,"x%x",&id)) {post("BORK!!! %s:%d",__FILE__,__LINE__); return;}
! gobj_activate(id, x, 1);
}
***************
*** 1178,1201 ****
t_floatarg fxpos, t_floatarg fypos, t_floatarg fwhich)
{
! int xpos = fxpos, ypos = fypos;
! /* post("mouseup %d %d %d", xpos, ypos); */
! if (!x->gl_editor) {bug("editor"); return;}
#ifdef SIMULATERIGHTCLICK
canvas_upclicktime = sys_getrealtime();
! canvas_upx = xpos;
! canvas_upy = ypos;
#endif
! if (x->gl_editor->e_onmotion == MA_REGION)
! canvas_doregion(x, xpos, ypos, 1);
! else if (x->gl_editor->e_onmotion == MA_MOVE)
{
/* after motion, if there's only one item selected, activate it */
! if (x->gl_editor->e_selection &&
! !(x->gl_editor->e_selection->sel_next))
! gobj_activate(x->gl_editor->e_selection->sel_what, x, 1);
}
! else if (x->gl_editor->e_onmotion == MA_PASSOUT)
! x->gl_editor->e_onmotion = 0;
! x->gl_editor->e_onmotion = MA_NONE;
}
--- 1129,1149 ----
t_floatarg fxpos, t_floatarg fypos, t_floatarg fwhich)
{
! t_editor *e = x->gl_editor;
! fprintf(stderr,"MOUSEUP!\n");
! if (!e) {bug("editor"); return;}
#ifdef SIMULATERIGHTCLICK
canvas_upclicktime = sys_getrealtime();
! canvas_upx = fxpos;
! canvas_upy = fypos;
#endif
! if (e->e_onmotion == MA_MOVE)
{
/* after motion, if there's only one item selected, activate it */
! if (e->e_selection && !e->e_selection->sel_next) {
! fprintf(stderr,"ACTIVATE!\n");
! gobj_activate(e->e_selection->sel_what, x, 1);
! }
}
! e->e_onmotion = MA_NONE;
}
***************
*** 1311,1347 ****
}
}
- /* check for arrow keys */
else if (!strcmp(gotkeysym->s_name, "Up")) canvas_displaceselection(x, 0, shift ? -10 : -1);
! else if (!strcmp(gotkeysym->s_name, "Down")) canvas_displaceselection(x, 0, shift ? 10 : 1);
else if (!strcmp(gotkeysym->s_name, "Left")) canvas_displaceselection(x, shift ? -10 : -1, 0);
! else if (!strcmp(gotkeysym->s_name, "Right")) canvas_displaceselection(x, shift ? 10 : 1, 0);
}
}
! void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
! t_floatarg fmod)
{
! /* post("motion %d %d", xpos, ypos); */
int mod = fmod;
! if (!x->gl_editor) {bug("editor"); return;}
glist_setlastxy(x, xpos, ypos);
! if (x->gl_editor->e_onmotion == MA_REGION)
! canvas_doregion(x, xpos, ypos, 0);
! else if (x->gl_editor->e_onmotion == MA_PASSOUT)
{
! if (!x->gl_editor->e_motionfn)
! bug("e_motionfn");
! (*x->gl_editor->e_motionfn)(&x->gl_editor->e_grab->g_pd,
! xpos - x->gl_editor->e_xwas,
! ypos - x->gl_editor->e_ywas);
! x->gl_editor->e_xwas = xpos;
! x->gl_editor->e_ywas = ypos;
}
! else if (x->gl_editor->e_onmotion == MA_DRAGTEXT)
{
! t_rtext *rt = x->gl_editor->e_textedfor;
! if (rt)
! rtext_mouse(rt, xpos - x->gl_editor->e_xwas,
! ypos - x->gl_editor->e_ywas, RTEXT_DRAG);
}
else canvas_doclick(x, xpos, ypos, 0, mod, 0);
--- 1259,1286 ----
}
}
else if (!strcmp(gotkeysym->s_name, "Up")) canvas_displaceselection(x, 0, shift ? -10 : -1);
! else if (!strcmp(gotkeysym->s_name, "Down")) canvas_displaceselection(x, 0, shift ? +10 : +1);
else if (!strcmp(gotkeysym->s_name, "Left")) canvas_displaceselection(x, shift ? -10 : -1, 0);
! else if (!strcmp(gotkeysym->s_name, "Right")) canvas_displaceselection(x, shift ? +10 : +1, 0);
}
}
! void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg fmod)
{
! t_editor *e = x->gl_editor;
int mod = fmod;
! if (!e) {bug("editor"); return;}
glist_setlastxy(x, xpos, ypos);
! if (e->e_onmotion == MA_PASSOUT)
{
! if (!e->e_motionfn) {bug("e_motionfn"); return;}
! e->e_motionfn(&e->e_grab->g_pd, xpos-e->e_xwas, ypos-e->e_ywas);
! e->e_xwas = xpos;
! e->e_ywas = ypos;
}
! else if (e->e_onmotion == MA_DRAGTEXT)
{
! t_rtext *rt = e->e_textedfor;
! if (rt) rtext_mouse(rt, xpos-e->e_xwas, ypos-e->e_ywas, RTEXT_DRAG);
}
else canvas_doclick(x, xpos, ypos, 0, mod, 0);
***************
*** 1363,1367 ****
/* ----------------------------- window stuff ----------------------- */
! void canvas_print(t_canvas *x, t_symbol *s)
{
if (*s->s_name) sys_vgui(".x%x.c postscript -file %s\n", x, s->s_name);
--- 1302,1306 ----
/* ----------------------------- window stuff ----------------------- */
! static void canvas_print(t_canvas *x, t_symbol *s)
{
if (*s->s_name) sys_vgui(".x%x.c postscript -file %s\n", x, s->s_name);
***************
*** 1369,1383 ****
}
! void canvas_menuclose(t_canvas *x, t_floatarg force)
{
! if (x->gl_owner)
! canvas_vis(x, 0);
! else if ((force != 0) || (!x->gl_dirty))
! pd_free(&x->gl_pd);
! else sys_vgui("pdtk_check {This window has been modified. Close anyway?}\
! {.x%x menuclose 1;\n}\n", x);
}
! /* put up a dialog which may call canvas_font back to do the work */
static void canvas_menufont(t_canvas *x)
{
--- 1308,1319 ----
}
! static void canvas_menuclose(t_canvas *x, t_floatarg force)
{
! if (x->gl_owner) canvas_vis(x, 0);
! else if (force || !x->gl_dirty) pd_free(&x->gl_pd);
! else sys_vgui("pdtk_check {This window has been modified. Close anyway?} {.x%x menuclose 1}\n", x);
}
! /* put up a dialog which may call canvas_font back to do the work */
static void canvas_menufont(t_canvas *x)
{
***************
*** 1393,1405 ****
int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf);
! /* find an atom or string of atoms */
! static int canvas_dofind(t_canvas *x, int *myindex1p)
{
t_gobj *y;
! int myindex1 = *myindex1p, myindex2;
! if (myindex1 >= canvas_find_index1)
{
! for (y = x->gl_list, myindex2 = 0; y;
! y = y->g_next, myindex2++)
{
t_object *ob = pd_checkobject(&y->g_pd);
--- 1329,1342 ----
int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf);
! /* find an atom or string of atoms, starting at index *ip (not?? see later) */
! /* if found, returns 1 and *ip = index */
! /* if not found, return 0 */
! static int canvas_dofind(t_canvas *x, int *ip)
{
t_gobj *y;
! int i=*ip, j;
! if (i >= canvas_find_index1)
{
! for (y=x->gl_list, j=0; y; y=y->g_next, j++)
{
t_object *ob = pd_checkobject(&y->g_pd);
***************
*** 1408,1422 ****
if (binbuf_match(ob->ob_binbuf, canvas_findbuf))
{
! if (myindex1 > canvas_find_index1 ||
! myindex1 == canvas_find_index1 &&
! myindex2 > canvas_find_index2)
{
! canvas_find_index1 = myindex1;
! canvas_find_index2 = myindex2;
glist_noselect(x);
canvas_vis(x, 1);
canvas_editmode(x, 1.);
glist_select(x, y);
! return (1);
}
}
--- 1345,1358 ----
if (binbuf_match(ob->ob_binbuf, canvas_findbuf))
{
! if (i >canvas_find_index1 ||
! i==canvas_find_index1 && j>canvas_find_index2)
{
! canvas_find_index1 = i;
! canvas_find_index2 = j;
glist_noselect(x);
canvas_vis(x, 1);
canvas_editmode(x, 1.);
glist_select(x, y);
! return 1;
}
}
***************
*** 1424,1434 ****
}
}
! for (y = x->gl_list, myindex2 = 0; y; y = y->g_next, myindex2++)
{
if (pd_class(&y->g_pd) == canvas_class)
{
! (*myindex1p)++;
! if (canvas_dofind((t_canvas *)y, myindex1p))
! return (1);
}
}
--- 1360,1369 ----
}
}
! for (y=x->gl_list, j=0; y; y=y->g_next, j++)
{
if (pd_class(&y->g_pd) == canvas_class)
{
! (*ip)++;
! if (canvas_dofind((t_canvas *)y, ip)) return 1;
}
}
***************
*** 1438,1452 ****
static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av)
{
! int myindex1 = 0, i;
! for (i = 0; i < ac; i++)
{
! if (av[i].a_type == A_SYMBOL)
{
! if (!strcmp(av[i].a_w.w_symbol->s_name, "_semi_")) SETSEMI(&av[i]);
! else if (!strcmp(av[i].a_w.w_symbol->s_name, "_comma_")) SETCOMMA(&av[i]);
}
}
! if (!canvas_findbuf)
! canvas_findbuf = binbuf_new();
binbuf_clear(canvas_findbuf);
binbuf_add(canvas_findbuf, ac, av);
--- 1373,1386 ----
static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av)
{
! int i=0, k;
! for (k=0; k<ac; k++)
{
! if (av[k].a_type == A_SYMBOL)
{
! if (!strcmp(av[k].a_w.w_symbol->s_name, "_semi_")) SETSEMI(&av[k]);
! else if (!strcmp(av[k].a_w.w_symbol->s_name, "_comma_")) SETCOMMA(&av[k]);
}
}
! if (!canvas_findbuf) canvas_findbuf=binbuf_new();
binbuf_clear(canvas_findbuf);
binbuf_add(canvas_findbuf, ac, av);
***************
*** 1454,1458 ****
canvas_find_index2 = -1;
canvas_whichfind = x;
! if (!canvas_dofind(x, &myindex1))
{
binbuf_print(canvas_findbuf);
--- 1388,1392 ----
canvas_find_index2 = -1;
canvas_whichfind = x;
! if (!canvas_dofind(x,&i))
{
binbuf_print(canvas_findbuf);
***************
*** 1463,1469 ****
static void canvas_find_again(t_canvas *x)
{
! int myindex1 = 0;
if (!canvas_findbuf || !canvas_whichfind) return;
! if (!canvas_dofind(canvas_whichfind, &myindex1))
{
binbuf_print(canvas_findbuf);
--- 1397,1403 ----
static void canvas_find_again(t_canvas *x)
{
! int i=0;
if (!canvas_findbuf || !canvas_whichfind) return;
! if (!canvas_dofind(canvas_whichfind,&i))
{
binbuf_print(canvas_findbuf);
***************
*** 1473,1480 ****
static void canvas_find_parent(t_canvas *x)
! {
! if (x->gl_owner)
! canvas_vis(glist_getcanvas(x->gl_owner), 1);
! }
static int glist_dofinderror(t_glist *gl, void *error_object)
--- 1407,1411 ----
static void canvas_find_parent(t_canvas *x)
! {if (x->gl_owner) canvas_vis(glist_getcanvas(x->gl_owner), 1);}
static int glist_dofinderror(t_glist *gl, void *error_object)
***************
*** 1591,1598 ****
static void canvas_copy(t_canvas *x)
{
! if (!x->gl_editor || !x->gl_editor->e_selection)
! return;
binbuf_free(copy_binbuf);
! copy_binbuf = canvas_docopy(x);
}
--- 1522,1528 ----
static void canvas_copy(t_canvas *x)
{
! if (!x->gl_editor || !x->gl_editor->e_selection) return;
binbuf_free(copy_binbuf);
! copy_binbuf=canvas_docopy(x);
}
***************
*** 1618,1632 ****
t_gobj *y, *y2;
int dspstate;
!
dspstate = canvas_suspend_dsp();
! if (x->gl_editor->e_selectedline)
{
canvas_disconnect(x,
! x->gl_editor->e_selectline_index1, x->gl_editor->e_selectline_outno,
! x->gl_editor->e_selectline_index2, x->gl_editor->e_selectline_inno);
canvas_setundo(x, canvas_undo_disconnect,
canvas_undo_set_disconnect(x,
! x->gl_editor->e_selectline_index1, x->gl_editor->e_selectline_outno,
! x->gl_editor->e_selectline_index2, x->gl_editor->e_selectline_inno),
"disconnect");
}
--- 1548,1562 ----
t_gobj *y, *y2;
int dspstate;
! t_editor *e = x->gl_editor;
dspstate = canvas_suspend_dsp();
! if (e->e_selectedline)
{
canvas_disconnect(x,
! e->e_selectline_index1, e->e_selectline_outno,
! e->e_selectline_index2, e->e_selectline_inno);
canvas_setundo(x, canvas_undo_disconnect,
canvas_undo_set_disconnect(x,
! e->e_selectline_index1, e->e_selectline_outno,
! e->e_selectline_index2, e->e_selectline_inno),
"disconnect");
}
***************
*** 1634,1638 ****
object. So we deselect it and hunt for a "new" object on
the glist to reselect. */
! if (x->gl_editor->e_textedfor)
{
newest = 0;
--- 1564,1568 ----
object. So we deselect it and hunt for a "new" object on
the glist to reselect. */
! if (e->e_textedfor)
{
newest = 0;
***************
*** 1661,1667 ****
static void canvas_cut(t_canvas *x)
{
! if (x->gl_editor && x->gl_editor->e_selectedline)
! canvas_clearline(x);
! else if (x->gl_editor && x->gl_editor->e_selection)
{
canvas_setundo(x, canvas_undo_cut,
--- 1591,1597 ----
static void canvas_cut(t_canvas *x)
{
! t_editor *e = x->gl_editor;
! if (e && e->e_selectedline) canvas_clearline(x);
! else if (e && e->e_selection)
{
canvas_setundo(x, canvas_undo_cut,
***************
*** 1677,1687 ****
static void glist_donewloadbangs(t_glist *x)
{
! if (x->gl_editor)
! {
! t_selection *sel;
! for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
! if (pd_class(&sel->sel_what->g_pd) == canvas_class)
! canvas_loadbang((t_canvas *)(&sel->sel_what->g_pd));
! }
}
--- 1607,1615 ----
static void glist_donewloadbangs(t_glist *x)
{
! t_selection *sel;
! if (!x->gl_editor) return;
! for (sel=x->gl_editor->e_selection; sel; sel=sel->sel_next)
! if (pd_class(&sel->sel_what->g_pd) == canvas_class)
! canvas_loadbang((t_canvas *)(&sel->sel_what->g_pd));
}
***************
*** 1718,1733 ****
static void canvas_duplicate(t_canvas *x)
{
! if (x->gl_editor->e_onmotion == MA_NONE)
! {
! t_selection *y;
! canvas_copy(x);
! canvas_setundo(x, canvas_undo_paste, canvas_undo_set_paste(x),
! "duplicate");
! canvas_dopaste(x, copy_binbuf);
! for (y = x->gl_editor->e_selection; y; y = y->sel_next)
! gobj_displace(y->sel_what, x,
! 10, 10);
! canvas_dirty(x, 1);
! }
}
--- 1646,1657 ----
static void canvas_duplicate(t_canvas *x)
{
! t_selection *y;
! if (x->gl_editor->e_onmotion != MA_NONE) return;
! canvas_copy(x);
! canvas_setundo(x, canvas_undo_paste, canvas_undo_set_paste(x), "duplicate");
! canvas_dopaste(x, copy_binbuf);
! for (y=x->gl_editor->e_selection; y; y=y->sel_next)
! gobj_displace(y->sel_what, x, 10, 10);
! canvas_dirty(x, 1);
}
***************
*** 1735,1745 ****
{
t_gobj *y;
! if (!x->gl_edit)
! canvas_editmode(x, 1);
! for (y = x->gl_list; y; y = y->g_next)
! {
if (!glist_isselected(x, y))
glist_select(x, y);
- }
}
--- 1659,1666 ----
{
t_gobj *y;
! if (!x->gl_edit) canvas_editmode(x, 1);
! for (y=x->gl_list; y; y=y->g_next)
if (!glist_isselected(x, y))
glist_select(x, y);
}
***************
*** 1881,1897 ****
static void canvas_texteditor(t_canvas *x)
{
! t_rtext *foo;
! char *buf;
! int bufsize;
! if (foo = x->gl_editor->e_textedfor)
! rtext_gettext(foo, &buf, &bufsize);
! else buf = "", bufsize = 0;
sys_vgui("pdtk_pd_texteditor {%.*s}\n", bufsize, buf);
-
}
void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av)
{
! /* canvas_editing can be zero; canvas_key checks for that */
canvas_key(canvas_editing, s, ac, av);
}
--- 1802,1815 ----
static void canvas_texteditor(t_canvas *x)
{
! t_rtext *foo = x->gl_editor->e_textedfor;
! char *buf="";
! int bufsize=0;
! if (foo) rtext_gettext(foo, &buf, &bufsize);
sys_vgui("pdtk_pd_texteditor {%.*s}\n", bufsize, buf);
}
void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av)
{
! /* canvas_editing can be zero; canvas_key checks for that */
canvas_key(canvas_editing, s, ac, av);
}
***************
*** 1900,1905 ****
{
int yesplease = fyesplease;
! if (yesplease && x->gl_edit)
! return;
x->gl_edit = !x->gl_edit;
if (x->gl_edit && glist_isvisible(x) && glist_istoplevel(x))
--- 1818,1822 ----
{
int yesplease = fyesplease;
! if (yesplease && x->gl_edit) return;
x->gl_edit = !x->gl_edit;
if (x->gl_edit && glist_isvisible(x) && glist_istoplevel(x))
***************
*** 1994,1997 ****
--- 1911,1917 ----
class_addmethod(c, (t_method)glist_noselect, gensym("deselect-all"), A_NULL);
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_gobj_activate, gensym("gobj-activate"), A_SYMBOL, A_NULL);
/* ------------------------ menu actions ---------------------------- */
Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.53
retrieving revision 1.1.1.4.2.7.4.54
diff -C2 -d -r1.1.1.4.2.7.4.53 -r1.1.1.4.2.7.4.54
*** u_main.tk 1 May 2004 15:03:07 -0000 1.1.1.4.2.7.4.53
--- u_main.tk 1 May 2004 17:41:29 -0000 1.1.1.4.2.7.4.54
***************
*** 876,881 ****
puts "RIGHTCLICK OBJECT"
} elseif {$run && [info exists _($id:clickevent)]} {
! eval [linsert [list $id $self $cx $cy $b $f] 0 $_($id:clickevent)]
! } elseif {$edit && [llength [$canvas bbox ${id}BASE]]} {
foreach {x1 y1 x2 y2} [$canvas bbox ${id}BASE] {}
if {abs($y2-3-$cy)<=3} {
--- 876,885 ----
puts "RIGHTCLICK OBJECT"
} elseif {$run && [info exists _($id:clickevent)]} {
! eval [linsert [list $id $canvas $cx $cy $b $f] 0 $_($id:clickevent)]
! } elseif {!$run && [info exists _($id:clickeditevent)]} {
! eval [linsert [list $id $canvas $cx $cy $b $f] 0 $_($id:clickeditevent)]
! }
! #!@#$ "elseif" should go here ?
! if {$edit && [llength [$canvas bbox ${id}BASE]]} {
foreach {x1 y1 x2 y2} [$canvas bbox ${id}BASE] {}
if {abs($y2-3-$cy)<=3} {
***************
*** 912,915 ****
--- 916,927 ----
return
}
+ default {
+ if {$edit} {
+ set _($self:action) rect
+ $canvas create line $cx $cy $cx $cy $cx $cy $cx $cy $cx $cy -tags selrect
+ global pd_nt
+ switch $pd_nt { 2 {} default { $canvas itemconfigure selrect -dash {3 3 3 3}}}
+ }
+ }
}
pd "[canvastosym $canvas] mouse $cx $cy $b $f ;"
***************
*** 962,965 ****
--- 974,985 ----
return
}
+ rect {
+ set coords [$canvas coords selrect]
+ set x1 [lindex $coords 0]
+ set y1 [lindex $coords 1]
+ set x2 $cx
+ set y2 $cy
+ $canvas coords selrect $x1 $y1 $x2 $y1 $x2 $y2 $x1 $y2 $x1 $y1
+ }
}
foreach {type id} [identify_target $canvas $cx $cy -1 -1 "move "] {}
***************
*** 969,973 ****
set run [expr !$edit]
if {$run && [info exists _($id:motionevent)]} {
! eval [linsert [list $id $self $cx $cy $mods] 0 $_($id:motionevent)]
}
if {$edit && [llength [$canvas bbox ${id}BASE]]} {
--- 989,995 ----
set run [expr !$edit]
if {$run && [info exists _($id:motionevent)]} {
! eval [linsert [list $id $canvas $cx $cy $mods] 0 $_($id:motionevent)]
! } elseif {!$run && [info exists _($id:motioneditevent)]} {
! eval [linsert [list $id $canvas $cx $cy $mods] 0 $_($id:motioneditevent)]
}
if {$edit && [llength [$canvas bbox ${id}BASE]]} {
***************
*** 1030,1033 ****
--- 1052,1056 ----
proc pdtk_canvas_mouseup2 {name x y b} {
global pdtk_canvas_mouseup wire_from wire_to _
+ set canvas $name
set cx [$name canvasx $x]
set cy [$name canvasy $y]
***************
*** 1043,1046 ****
--- 1066,1081 ----
#return
}
+ if {[llength [$canvas gettags selrect]] > 0} {
+ set coords [$canvas coords selrect]
+ set x1 [lindex $coords 0]
+ set y1 [lindex $coords 1]
+ set x2 $cx
+ set y2 $cy
+ pd "$self select-in-rectangle $x1 $y1 $x2 $y2 ;"
+ $canvas delete selrect
+ }
+ if {[llength $_($self:selection)]==1} {
+ pd "$self gobj-activate x$_($self:selection);"
+ }
pd "$self mouseup $cx $cy $b ;"
- Previous message: [PD-cvs] pd/src g_all_guis.c,1.1.1.4.2.4.2.20,1.1.1.4.2.4.2.21 g_all_guis.h,1.1.1.4.2.2.2.17,1.1.1.4.2.2.2.18 g_bang.c,1.1.1.3.2.2.2.16,1.1.1.3.2.2.2.17 g_dropper.c,1.1.2.7,1.1.2.8 g_hdial.c,1.1.1.4.2.2.2.13,1.1.1.4.2.2.2.14 g_hslider.c,1.1.1.3.2.2.2.16,1.1.1.3.2.2.2.17 g_mycanvas.c,1.1.1.3.2.2.2.7,1.1.1.3.2.2.2.8 g_numbox.c,1.1.1.4.2.2.2.11,1.1.1.4.2.2.2.12 g_toggle.c,1.1.1.3.2.2.2.12,1.1.1.3.2.2.2.13 g_vumeter.c,1.1.1.3.2.2.2.10,1.1.1.3.2.2.2.11
- Next message: [PD-cvs] pd/src g_editor.c,1.1.1.4.2.3.2.19,1.1.1.4.2.3.2.20 g_canvas.c,1.1.1.4.2.7.2.14,1.1.1.4.2.7.2.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list