Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14573
Modified Files:
Tag: impd_0_37
g_canvas.c g_editor.c u_object.tk u_main.tk
Log Message:
updated patchcords again
Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.1.1.4.2.7.2.10
retrieving revision 1.1.1.4.2.7.2.11
diff -C2 -d -r1.1.1.4.2.7.2.10 -r1.1.1.4.2.7.2.11
*** g_canvas.c 2 Apr 2004 00:16:42 -0000 1.1.1.4.2.7.2.10
--- g_canvas.c 17 Apr 2004 04:04:23 -0000 1.1.1.4.2.7.2.11
***************
*** 831,841 ****
linetraverser_start(&t, x);
while (oc = linetraverser_next(&t)) {
! int x1=t.tr_lx1, y1=t.tr_ly1;
! int x2=t.tr_lx2, y2=t.tr_ly2;
! sys_vgui("wire_draw l%x .x%x.c %d %d %d %d %d\n",
! oc, glist_getcanvas(x), (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1), x1, y1, x2, y2);
}
}
void canvas_fixlinesfor(t_canvas *x, t_text *text)
{
--- 831,841 ----
linetraverser_start(&t, x);
while (oc = linetraverser_next(&t)) {
! sys_vgui("wire_update l%x {%x %d %x %d %d}\n", oc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno,
! outlet_getsymbol(t.tr_outlet) == &s_signal);
! sys_vgui("wire_draw2 l%x .x%x.c\n", oc, glist_getcanvas(x));
}
}
+
void canvas_fixlinesfor(t_canvas *x, t_text *text)
{
***************
*** 844,853 ****
linetraverser_start(&t, x);
while (oc = linetraverser_next(&t)) {
! if (t.tr_ob == text || t.tr_ob2 == text) {
! int x1=t.tr_lx1, y1=t.tr_ly1;
! int x2=t.tr_lx2, y2=t.tr_ly2;
! sys_vgui("wire_draw l%x .x%x.c %d %d %d %d %d\n",
! oc, glist_getcanvas(x), (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1), x1, y1, x2, y2);
! }
}
}
--- 844,851 ----
linetraverser_start(&t, x);
while (oc = linetraverser_next(&t)) {
! if (t.tr_ob != text && t.tr_ob2 != text) continue;
! sys_vgui("wire_update l%x {%x %d %x %d %d}\n", oc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno,
! outlet_getsymbol(t.tr_outlet) == &s_signal);
! sys_vgui("wire_draw2 l%x .x%x.c\n", oc, glist_getcanvas(x));
}
}
Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.1.1.4.2.3.2.12
retrieving revision 1.1.1.4.2.3.2.13
diff -C2 -d -r1.1.1.4.2.3.2.12 -r1.1.1.4.2.3.2.13
*** g_editor.c 8 Apr 2004 10:48:11 -0000 1.1.1.4.2.3.2.12
--- g_editor.c 17 Apr 2004 04:04:23 -0000 1.1.1.4.2.3.2.13
***************
*** 62,79 ****
/* ------------------------ managing the selection ----------------- */
- void glist_selectline(t_glist *x, t_outconnect *oc, int index1,
- int outno, int index2, int inno)
- {
- if (x->gl_editor)
- {
- glist_noselect(x);
- x->gl_editor->e_selectedline = 1;
- x->gl_editor->e_selectline_index1 = index1; x->gl_editor->e_selectline_outno = outno;
- x->gl_editor->e_selectline_index2 = index2; x->gl_editor->e_selectline_inno = inno;
- x->gl_editor->e_selectline_tag = oc;
- sys_vgui("wire_select l%x .x%x.c 1\n", x->gl_editor->e_selectline_tag, x);
- }
- }
-
void glist_deselectline(t_glist *x)
{
--- 62,65 ----
***************
*** 338,342 ****
sinkno == index2 && t.tr_inno == inno)
{
! sys_vgui(".x%x.c delete l%x\n", x, oc);
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
break;
--- 324,328 ----
sinkno == index2 && t.tr_inno == inno)
{
! sys_vgui("wire_erase l%x .x%x.c\n", oc, x);
obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
break;
***************
*** 897,930 ****
}
void canvas_click_on_wire(t_canvas *self, t_symbol *linesym,
t_float x, t_float y, t_float b, t_float f) {
! int mod = (int)f;
! int shiftmod = mod & SHIFTMOD;
! int runmode = (mod & CTRLMOD) || !self->gl_edit;
! int altmod = mod & ALTMOD;
! int rightclick = mod & RIGHTCLICK;
post("canvas_click_on_wire: 0x%08x %s %f %f %f %f",
(unsigned)self, linesym->s_name, x, y, b, f);
/*post("shiftmod=%d runmode=%d altmod=%d rightclick=%d b=%f f=%f",shiftmod,runmode,altmod,rightclick,b,f);*/
! if (!runmode && !altmod && !shiftmod && !rightclick) {
t_outconnect *oc;
int obj1,port1,obj2,port2;
post("canvas_click_on_wire: selecting this one...");
canvas_find_wire(self,linesym,&oc,&obj1,&port1,&obj2,&port2);
! glist_selectline(glist_getcanvas(self),oc,obj1,port1,obj2,port2);
! }
}
void canvas_click_on_object(t_canvas *self, t_symbol *linesym,
t_float x, t_float y, t_float b, t_float f) {
! int mod = (int)f;
! int shiftmod = mod & SHIFTMOD;
! int runmode = (mod & CTRLMOD) || !self->gl_edit;
! int altmod = mod & ALTMOD;
! int rightclick = mod & RIGHTCLICK;
post("canvas_click_on_object: 0x%08x %s %f %f %f %f",
(unsigned)self, linesym->s_name, x, y, b, f);
! /*post("shiftmod=%d runmode=%d altmod=%d rightclick=%d b=%f f=%f",shiftmod,runmode,altmod,rightclick,b,f);*/
! if (!runmode && !altmod && !shiftmod && !rightclick) {
}
}
--- 883,932 ----
}
+ 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 &&
+ sys_getrealtime() - canvas_upclicktime < DCLICKINTERVAL)
+ *rightclick = 1;
+ #endif
+ }
+
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;
! canvas_modifiers(self,f,0,&run,&shift,&alt,&rightclick);
post("canvas_click_on_wire: 0x%08x %s %f %f %f %f",
(unsigned)self, linesym->s_name, x, y, b, f);
/*post("shiftmod=%d runmode=%d altmod=%d rightclick=%d b=%f f=%f",shiftmod,runmode,altmod,rightclick,b,f);*/
! if (!run && !alt && !shift && !rightclick) {
! /* change selection to single wire */
t_outconnect *oc;
+ t_canvas *c = glist_getcanvas(self);
+ t_editor *e = c->gl_editor;
int obj1,port1,obj2,port2;
post("canvas_click_on_wire: selecting this one...");
canvas_find_wire(self,linesym,&oc,&obj1,&port1,&obj2,&port2);
! if (!e) {bug("canvas_click_on_wire: no editor?"); return;}
! glist_noselect(c);
! e->e_selectedline = 1;
! e->e_selectline_index1 = obj1; e->e_selectline_outno = port1;
! e->e_selectline_index2 = obj2; e->e_selectline_inno = port2;
! e->e_selectline_tag = oc;
! sys_vgui("wire_select l%x .x%x.c 1\n", e->e_selectline_tag, self);
! }
}
void canvas_click_on_object(t_canvas *self, t_symbol *linesym,
t_float x, t_float y, t_float b, t_float f) {
! int run, shift, alt, rightclick;
! canvas_modifiers(self,f,0,&run,&shift,&alt,&rightclick);
post("canvas_click_on_object: 0x%08x %s %f %f %f %f",
(unsigned)self, linesym->s_name, x, y, b, f);
! /*post("shift=%d run=%d alt=%d rightclick=%d b=%f f=%f",shift,run,alt,rightclick,b,f);*/
! if (!run && !alt && !shift && !rightclick) {
}
}
***************
*** 934,975 ****
int mod, int doit)
{
! int shiftmod = mod & SHIFTMOD;
! int runmode = (mod & CTRLMOD) || !x->gl_edit;
! int altmod = mod & ALTMOD;
! int rightclick = mod & RIGHTCLICK;
int x1, y1, x2, y2, clickreturned = 0;
t_gobj *y;
! if (!x->gl_editor) {bug("editor"); return;}
canvas_undo_already_set_move = 0;
/* if keyboard was grabbed, notify grabber and cancel the grab */
! if (doit && x->gl_editor->e_grab && x->gl_editor->e_keyfn)
{
! (* x->gl_editor->e_keyfn) (x->gl_editor->e_grab, 0);
glist_grab(x, 0, 0, 0, 0, 0);
}
! #ifdef SIMULATERIGHTCLICK
! if (doit && !runmode && xpos == canvas_upx && ypos == canvas_upy &&
! sys_getrealtime() - canvas_upclicktime < DCLICKINTERVAL)
! rightclick = 1;
! #endif
!
! x->gl_editor->e_lastmoved = 0;
if (doit)
{
! x->gl_editor->e_grab = 0;
! x->gl_editor->e_onmotion = MA_NONE;
}
/* post("click %d %d %d %d", xpos, ypos, which, mod); */
! if (x->gl_editor->e_onmotion != MA_NONE)
return;
! x->gl_editor->e_xwas = xpos;
! x->gl_editor->e_ywas = ypos;
! if (runmode && !rightclick)
{
for (y = x->gl_list; y; y = y->g_next)
--- 936,970 ----
int mod, int doit)
{
! int run, shift, alt, rightclick;
! canvas_modifiers(x,mod,doit,&run,&shift,&alt,&rightclick);
int x1, y1, x2, y2, clickreturned = 0;
t_gobj *y;
! t_editor *e = x->gl_editor;
! if (!e) {bug("editor"); return;}
canvas_undo_already_set_move = 0;
/* if keyboard was grabbed, notify grabber and cancel the grab */
! if (doit && e->e_grab && e->e_keyfn)
{
! e->e_keyfn(e->e_grab, 0);
glist_grab(x, 0, 0, 0, 0, 0);
}
! e->e_lastmoved = 0;
if (doit)
{
! e->e_grab = 0;
! e->e_onmotion = MA_NONE;
}
/* post("click %d %d %d %d", xpos, ypos, which, mod); */
! if (e->e_onmotion != MA_NONE)
return;
! e->e_xwas = xpos;
! e->e_ywas = ypos;
! if (run && !rightclick)
{
for (y = x->gl_list; y; y = y->g_next)
***************
*** 977,982 ****
/* 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,
! shiftmod, altmod, 0, doit)))
break;
}
--- 972,976 ----
/* 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;
}
***************
*** 984,1009 ****
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))
{
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 (shiftmod)
{
if (doit)
{
t_rtext *rt;
! if (ob && (rt = x->gl_editor->e_textedfor) &&
rt == glist_findrtext(x, ob))
{
rtext_mouse(rt, xpos - x1, ypos - y1, RTEXT_SHIFT);
! x->gl_editor->e_onmotion = MA_DRAGTEXT;
! x->gl_editor->e_xwas = x1;
! x->gl_editor->e_ywas = y1;
}
else
--- 978,1003 ----
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))
{
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
***************
*** 1029,1036 ****
if (doit)
{
! int issignal = obj_issignaloutlet(ob, closest);
! x->gl_editor->e_onmotion = MA_CONNECT;
! x->gl_editor->e_xwas = xpos;
! x->gl_editor->e_ywas = ypos;
}
else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT);
--- 1023,1029 ----
if (doit)
{
! e->e_onmotion = MA_CONNECT;
! e->e_xwas = xpos;
! e->e_ywas = ypos;
}
else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT);
***************
*** 1055,1065 ****
/* check if the box is being text edited */
nooutletafterall:
! if (ob && (rt = x->gl_editor->e_textedfor) &&
rt == glist_findrtext(x, ob))
{
rtext_mouse(rt, xpos - x1, ypos - y1, RTEXT_DOWN);
! x->gl_editor->e_onmotion = MA_DRAGTEXT;
! x->gl_editor->e_xwas = x1;
! x->gl_editor->e_ywas = y1;
}
else
--- 1048,1058 ----
/* check if the box is being text edited */
nooutletafterall:
! 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
***************
*** 1071,1075 ****
glist_select(x, y);
}
! x->gl_editor->e_onmotion = MA_MOVE;
}
}
--- 1064,1068 ----
glist_select(x, y);
}
! e->e_onmotion = MA_MOVE;
}
}
***************
*** 1083,1096 ****
/* if not an editing action, and if we didn't hit a
box, set cursor and return */
! if (runmode || rightclick) {canvas_setcursor(x, CURSOR_RUNMODE_NOTHING); return;}
canvas_setcursor(x, CURSOR_EDITMODE_NOTHING);
if (doit)
{
! if (!shiftmod) glist_noselect(x);
sys_vgui(".x%x.c create rectangle %d %d %d %d -tags x\n",
x, xpos, ypos, xpos, ypos);
! x->gl_editor->e_xwas = xpos;
! x->gl_editor->e_ywas = ypos;
! x->gl_editor->e_onmotion = MA_REGION;
}
}
--- 1076,1089 ----
/* if not an editing action, and if we didn't hit a
box, set cursor and return */
! if (run || rightclick) {canvas_setcursor(x, CURSOR_RUNMODE_NOTHING); return;}
canvas_setcursor(x, CURSOR_EDITMODE_NOTHING);
if (doit)
{
! 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;
! e->e_onmotion = MA_REGION;
}
}
***************
*** 1121,1128 ****
int xwas = x->gl_editor->e_xwas,
ywas = x->gl_editor->e_ywas;
- /* if (doit) sys_vgui(".x%x.c delete x\n", x);
- else sys_vgui("wire_draw x .x%x.c 1 %d %d %d %d\n",
- x, x->gl_editor->e_xwas, x->gl_editor->e_ywas, xpos, ypos);
- */
y1 = canvas_findhitbox(x, xwas, ywas, &x11, &y11, &x12, &y12);
y2 = canvas_findhitbox(x, xpos, ypos, &x21, &y21, &x22, &y22);
--- 1114,1117 ----
***************
*** 1170,1182 ****
if (doit)
{
- int lx1 = x11 + (noutlet1>1 ?
- ((x12-x11-IOWIDTH)*closest1)/(noutlet1-1) : 0) + IOMIDDLE;
- int lx2 = x21 + ( ninlet2>1 ?
- ((x22-x21-IOWIDTH)*closest2)/ (ninlet2-1) : 0) + IOMIDDLE;
oc = obj_connect(ob1, closest1, ob2, closest2);
! sys_vgui("wire_draw l%x .x%x.c %d %d %d %d %d\n",
! oc, glist_getcanvas(x), (obj_issignaloutlet(ob1, closest1) ? 2 : 1),
! lx1, y12,
! lx2, y21);
canvas_setundo(x, canvas_undo_connect,
canvas_undo_set_connect(x,
--- 1159,1166 ----
if (doit)
{
oc = obj_connect(ob1, closest1, ob2, closest2);
! sys_vgui("wire_update l%x {%x %d %x %d %d}\n", oc, y1, closest1, y2, closest2,
! obj_issignaloutlet(ob1, closest1));
! sys_vgui("wire_draw2 l%x .x%x.c\n", oc, glist_getcanvas(x));
canvas_setundo(x, canvas_undo_connect,
canvas_undo_set_connect(x,
***************
*** 1210,1229 ****
static void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit)
{
if (doit)
{
int lox, loy, hix, hiy;
! if (x->gl_editor->e_xwas < xpos)
! lox = x->gl_editor->e_xwas, hix = xpos;
! else hix = x->gl_editor->e_xwas, lox = xpos;
! if (x->gl_editor->e_ywas < ypos)
! loy = x->gl_editor->e_ywas, hiy = ypos;
! else hiy = x->gl_editor->e_ywas, loy = ypos;
canvas_selectinrect(x, lox, loy, hix, hiy);
sys_vgui(".x%x.c delete x\n", x);
! x->gl_editor->e_onmotion = 0;
}
else sys_vgui(".x%x.c coords x %d %d %d %d\n",
! x, x->gl_editor->e_xwas,
! x->gl_editor->e_ywas, xpos, ypos);
}
--- 1194,1213 ----
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);
}
***************
*** 1828,1838 ****
goto bad;
if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
! if (glist_isvisible(x))
! {
! sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n",
! glist_getcanvas(x), 0, 0, 0, 0,
! (obj_issignaloutlet(objsrc, outno) ? 2 : 1),oc);
! canvas_fixlinesfor(x, objsrc);
! }
return;
--- 1812,1816 ----
goto bad;
if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
! if (glist_isvisible(x)) canvas_fixlinesfor(x, objsrc);
return;
Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.40
retrieving revision 1.1.1.4.2.7.4.41
diff -C2 -d -r1.1.1.4.2.7.4.40 -r1.1.1.4.2.7.4.41
*** u_main.tk 11 Apr 2004 05:16:40 -0000 1.1.1.4.2.7.4.40
--- u_main.tk 17 Apr 2004 04:04:23 -0000 1.1.1.4.2.7.4.41
***************
*** 28,32 ****
#option add *activeForeground #ffffff
! proc l+ {al bl} {set r {}; foreach a $al b $bl {lappend r [expr $a+$b]}; return $r}
proc lreverse {list} {
--- 28,35 ----
#option add *activeForeground #ffffff
! proc l+ {al bl} {set r {}; foreach a $al b $bl {lappend r [expr $a+$b]}; return $r}
! proc l- {al bl} {set r {}; foreach a $al b $bl {lappend r [expr $a-$b]}; return $r}
! proc l/2 {al } {set r {}; foreach a $al {lappend r [expr $a/2 ]}; return $r}
! #proc lmap ...
proc lreverse {list} {
Index: u_object.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -C2 -d -r1.1.2.17 -r1.1.2.18
*** u_object.tk 8 Apr 2004 10:48:12 -0000 1.1.2.17
--- u_object.tk 17 Apr 2004 04:04:23 -0000 1.1.2.18
***************
*** 70,73 ****
--- 70,79 ----
}
+ proc wire_update {self d} {
+ global _
+ foreach [list _($self:obj1) _($self:port1) _($self:obj2) _($self:port2)] \
+ [lrange $d 0 3] {}
+ }
+
proc object_xy {self canvas} {
global _
***************
*** 109,112 ****
--- 115,129 ----
}
+ proc wire_draw2 {self canvas} {
+ global _
+ set bbox1 [$canvas bbox $_($self:obj1)o$_($self:port1)]
+ set bbox2 [$canvas bbox $_($self:obj2)i$_($self:port2)]
+ if {[llength $bbox1] < 4} {puts stderr "wire_draw2: crap ($_($self:obj1) outlet)"; return}
+ if {[llength $bbox2] < 4} {puts stderr "wire_draw2: crap ($_($self:obj2) inlet)"; return}
+ foreach {x1 y1} [l/2 [l+ [lrange $bbox1 0 1] [lrange $bbox1 2 3]]] {}
+ foreach {x2 y2} [l/2 [l+ [lrange $bbox2 0 1] [lrange $bbox2 2 3]]] {}
+ wire_draw $self $canvas 1 $x1 $y1 $x2 $y2
+ }
+
proc wire_select {self canvas flag} {
if {$flag} {set colour #0000ff} {set colour #8888cc}