Commit 144a0443 authored by Ivica Bukvic's avatar Ivica Bukvic Committed by Hans-Christoph Steiner
Browse files

Pd-0.42.5-extended-l2ork-dev-20110301.tar.bz2

parent f71af8d2
......@@ -52,6 +52,8 @@ static void sigdelwrite_checkvecsize(t_sigdelwrite *x, int vecsize)
#endif
}
#include <stdio.h>
static void *sigdelwrite_new(t_symbol *s, t_floatarg msec)
{
int nsamps;
......@@ -59,6 +61,7 @@ static void *sigdelwrite_new(t_symbol *s, t_floatarg msec)
if (!*s->s_name) s = gensym("delwrite~");
pd_bind(&x->x_obj.ob_pd, s);
x->x_sym = s;
if (msec == 0) msec = 1000;
nsamps = msec * sys_getsr() * (t_float)(0.001f);
if (nsamps < 1) nsamps = 1;
nsamps += ((- nsamps) & (SAMPBLK - 1));
......
......@@ -754,6 +754,8 @@ static void *canvas_undo_set_move(t_canvas *x, int selected)
static void canvas_undo_move(t_canvas *x, void *z, int action)
{
t_undo_move *buf = z;
t_class *cl;
int resortin = 0, resortout = 0;
if (action == UNDO_UNDO || action == UNDO_REDO)
{
int i;
......@@ -770,8 +772,13 @@ static void canvas_undo_move(t_canvas *x, void *z, int action)
gobj_displace(y, x, newx-x1, newy - y1);
buf->u_vec[i].e_xpix = x1;
buf->u_vec[i].e_ypix = y1;
cl = pd_class(&y->g_pd);
if (cl == vinlet_class) resortin = 1;
else if (cl == voutlet_class) resortout = 1;
}
}
if (resortin) canvas_resortinlets(x);
if (resortout) canvas_resortoutlets(x);
}
else if (action == UNDO_FREE)
{
......@@ -1631,8 +1638,12 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
t_gobj *y=NULL, *oldy=NULL, *oldy_prev=NULL, *oldy_next=NULL, *y_begin, *y_end=NULL;
int x1, y1, x2, y2;
// first deselect any objects that may be already selected
glist_noselect(x);
// first deselect any objects that may be already selected if doing action 3 or 4
if (which == 3 || which == 4) {
if (x->gl_editor->e_selection && x->gl_editor->e_selection->sel_next)
glist_noselect(x);
}
else glist_noselect(x);
// mark the beginning of the glist for front/back
y_begin = x->gl_list;
......@@ -1640,6 +1651,7 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
if (which == 3 || which == 4) {
// if no object has been selected for to-front/back action
if (!x->gl_editor->e_selection) {
//fprintf(stderr,"doing hitbox\n");
for (y = x->gl_list; y; y = y->g_next) {
if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)) {
if (!x->gl_edit)
......@@ -1648,8 +1660,11 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
glist_select(x, y);
}
}
// this was a bogus call--get me out of here!
if (!x->gl_editor->e_selection) return;
// this was a bogus/unsupported call--get me out of here!
if (!x->gl_editor->e_selection) {
post("To front/back action could not be performed because multiple items were selected...");
return;
}
}
}
......@@ -1764,6 +1779,8 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
t_gobj *y;
int shiftmod, runmode, altmod, doublemod = 0, rightclick;
int x1=0, y1=0, x2=0, y2=0, clickreturned = 0;
//fprintf(stderr,"canvas_doclick\n");
if (!x->gl_editor)
{
......@@ -1801,8 +1818,10 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
}
/* post("click %d %d %d %d", xpos, ypos, which, mod); */
if (x->gl_editor->e_onmotion != MA_NONE)
if (x->gl_editor->e_onmotion != MA_NONE) {
//fprintf(stderr,"onmotion != MA_NONE\n");
return;
}
x->gl_editor->e_xwas = xpos;
x->gl_editor->e_ywas = ypos;
......@@ -2018,7 +2037,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
for (parseOutlet = parseOb->ob_outlet;
parseOutlet && parseOutno;
parseOutlet = parseOutlet->o_next, parseOutno--);
if (parseOutlet)
if (parseOutlet && magicGlass_isOn(x->gl_magic_glass))
{
magicGlass_bind(x->gl_magic_glass,
t.tr_ob,
......@@ -2398,6 +2417,22 @@ void canvas_mouseup(t_canvas *x,
}
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
}
if (canvas_cnct_outlet_tag[0] != 0)
{
sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n",
x, canvas_cnct_outlet_tag,
(last_outlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")),
(outlet_issignal ? "$signal_nlet" : "$msg_nlet"));
}
if (canvas_cnct_inlet_tag[0] != 0)
{
sys_vgui(".x%x.c itemconfigure %s -outline %s -fill %s -width 1\n",
x, canvas_cnct_inlet_tag,
(last_inlet_filter ? "black" : (outlet_issignal ? "$signal_cord" : "$msg_cord")),
(inlet_issignal ? "$signal_nlet" : "$msg_nlet"));
canvas_cnct_inlet_tag[0] = 0;
}
x->gl_editor->e_onmotion = MA_NONE;
}
......@@ -2598,7 +2633,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg fmod)
{
/* post("motion %d %d", (int)xpos, (int)ypos); */
//fprintf(stderr,"motion %d %d\n", (int)xpos, (int)ypos);
int mod = fmod;
if (!x->gl_editor)
{
......@@ -2615,8 +2650,10 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
}
else if (x->gl_editor->e_onmotion == MA_REGION)
canvas_doregion(x, xpos, ypos, 0);
else if (x->gl_editor->e_onmotion == MA_CONNECT)
else if (x->gl_editor->e_onmotion == MA_CONNECT) {
//fprintf(stderr,"MA_CONNECT\n");
canvas_doconnect(x, xpos, ypos, 0, 0);
}
else if (x->gl_editor->e_onmotion == MA_PASSOUT)
{
if (!x->gl_editor->e_motionfn)
......@@ -2643,6 +2680,7 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
void canvas_startmotion(t_canvas *x)
{
//fprintf(stderr,"canvas_startmotion\n");
int xval, yval;
if (!x->gl_editor) return;
glist_getnextxy(x, &xval, &yval);
......@@ -3180,10 +3218,12 @@ static void glist_donewloadbangs(t_glist *x)
static void canvas_paste_xyoffset(t_canvas *x)
{
t_selection *sel;
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
gobj_displace(sel->sel_what, x, paste_xyoffset*10, paste_xyoffset*10);
paste_xyoffset++;
//t_selection *sel;
//for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
//gobj_displace(sel->sel_what, x, paste_xyoffset*10, paste_xyoffset*10);
canvas_displaceselection(x, 10, 10);
//paste_xyoffset++;
//fprintf(stderr,"xyoffset %d\n",paste_xyoffset);
}
static void canvas_paste_atmouse(t_canvas *x)
......@@ -3656,6 +3696,7 @@ static void canvas_dofont(t_canvas *x, t_floatarg font, t_floatarg xresize,
if (pd_class(&y->g_pd) == canvas_class
&& !canvas_isabstraction((t_canvas *)y))
canvas_dofont((t_canvas *)y, font, xresize, yresize);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
}
/* canvas_menufont calls up a TK dialog which calls this back */
......
......@@ -372,8 +372,13 @@ void canvas_resortinlets(t_canvas *x)
obj_moveinletfirst(&x->gl_obj, ip);
}
freebytes(vec, ninlets * sizeof(*vec));
if (x->gl_owner && glist_isvisible(x->gl_owner))
if (x->gl_owner && glist_isvisible(x->gl_owner)) {
canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
//fprintf(stderr,"good place to fix redrawing of inlets\n");
//fprintf(stderr,"found it\n");
graph_vis(&x->gl_gobj, x->gl_owner, 0);
graph_vis(&x->gl_gobj, x->gl_owner, 1);
}
}
t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s)
......@@ -445,8 +450,13 @@ void canvas_resortoutlets(t_canvas *x)
obj_moveoutletfirst(&x->gl_obj, ip);
}
freebytes(vec, noutlets * sizeof(*vec));
if (x->gl_owner && glist_isvisible(x->gl_owner))
if (x->gl_owner && glist_isvisible(x->gl_owner)) {
canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
//fprintf(stderr,"good place to fix redrawing of outlets\n");
//fprintf(stderr,"found it\n");
graph_vis(&x->gl_gobj, x->gl_owner, 0);
graph_vis(&x->gl_gobj, x->gl_owner, 1);
}
}
/* ----------calculating coordinates and controlling appearance --------- */
......
......@@ -233,7 +233,7 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
x->x_gui.x_lcol, x, x);
my_numbox_ftoa(x);
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} %d %s} -fill #%6.6x -tags {%lxNUMBER %lxNUM}\n",
-font {{%s} %d %s} -fill #%6.6x -tags {%lxNUMBER %lxNUM noscroll}\n",
canvas, xpos+half+2, ypos+half+d,
x->x_buf, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fcol, x, x);
......
......@@ -1113,7 +1113,34 @@ static void text_displace_withtag(t_gobj *z, t_glist *glist,
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 gatom_displace_withtag(t_gobj *z, t_glist *glist,
......@@ -1356,6 +1383,7 @@ static t_widgetbehavior gatom_widgetbehavior =
void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
char *tag, int x1, int y1, int x2, int y2)
{
//fprintf(stderr,"glist_drawiofor\n");
int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i;
int width = x2 - x1;
int issignal;
......@@ -1364,6 +1392,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
int onset = x1 + (width - IOWIDTH) * i / nplus;
if (firsttime)
{
//fprintf(stderr,"glist_drawiofor o firsttime\n");
issignal = obj_issignaloutlet(ob,i);
sys_vgui(".x%lx.c create rectangle %d %d %d %d \
-fill %s -outline %s -tags %so%d\n",
......@@ -1372,7 +1401,8 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
(issignal ? "$signal_cord" : "$msg_cord"),
tag, i);
}
else
else {
//fprintf(stderr,"glist_drawiofor o redraw\n");
sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n",
glist_getcanvas(glist), tag, i,
onset, y2 - 2,
......@@ -1383,6 +1413,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
tag,
i);*/
// end jsarlo
}
}
n = obj_ninlets(ob);
nplus = (n == 1 ? 1 : n-1);
......@@ -1391,6 +1422,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
int onset = x1 + (width - IOWIDTH) * i / nplus;
if (firsttime)
{
//fprintf(stderr,"glist_drawiofor i firsttime\n");
issignal = obj_issignalinlet(ob,i);
sys_vgui(".x%lx.c create rectangle %d %d %d %d \
-fill %s -outline %s -tags %si%d\n",
......@@ -1399,7 +1431,8 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
(issignal ? "$signal_cord" : "$msg_cord"),
tag, i);
}
else
else {
//fprintf(stderr,"glist_drawiofor i firsttime\n");
sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n",
glist_getcanvas(glist), tag, i,
onset, y1,
......@@ -1410,6 +1443,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
tag,
i);*/
// end jsarlo
}
}
}
......@@ -1417,6 +1451,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime,
char *tag, int x1, int y1, int x2, int y2)
{
//fprintf(stderr,"drawiofor_withtag\n");
int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i;
int width = x2 - x1;
int issignal;
......@@ -1425,6 +1460,7 @@ void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime,
int onset = x1 + (width - IOWIDTH) * i / nplus;
if (firsttime)
{
//fprintf(stderr,"drawiofor_withtag o firsttime\n");
issignal = obj_issignaloutlet(ob,i);
sys_vgui(".x%lx.c create rectangle %d %d %d %d \
-fill %s -outline %s -tags %so%d\n",
......@@ -1442,12 +1478,14 @@ void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime,
*/
}
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);
sys_vgui(".x%lx.c create rectangle %d %d %d %d \
-fill %s -outline %s -tags %si%d\n",
......@@ -1456,11 +1494,17 @@ void glist_drawiofor_withtag(t_glist *glist, t_object *ob, int firsttime,
(issignal ? "$signal_cord" : "$msg_cord"),
tag, i);
}
/*
else
/* else
{
sys_vgui(".x%lx.c addtag selected withtag %si%d \n",
glist_getcanvas(glist), tag, i);
//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 ? "$signal_nlet" : "$msg_nlet"),
(issignal ? "$signal_cord" : "$msg_cord"));
}
*/
}
......@@ -1656,6 +1700,7 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag)
{
//fprintf(stderr,"glist_eraseiofor\n");
int i, n;
n = obj_noutlets(ob);
for (i = 0; i < n; i++)
......
......@@ -11,7 +11,7 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 42
#define PD_BUGFIX_VERSION 5
#define PD_TEST_VERSION "extended-l2ork-20110221"
#define PD_TEST_VERSION "extended-l2ork-20110301"
/* old name for "MSW" flag -- we have to take it for the sake of many old
"nmakefiles" for externs, which will define NT and not MSW */
......
......@@ -19,7 +19,14 @@ d_array.o: d_array.c m_pd.h \
/usr/include/bits/sigset.h /usr/include/bits/time.h \
/usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
d_delay.o: d_delay.c m_pd.h \
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h /usr/include/stdio.h \
/usr/include/features.h /usr/include/bits/predefs.h \
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
d_filter.o: d_filter.c m_pd.h \
/usr/lib/gcc/i486-linux-gnu/4.4.1/include/stddef.h /usr/include/math.h \
/usr/include/features.h /usr/include/bits/predefs.h \
......
......@@ -2794,11 +2794,8 @@ proc pdtk_canvas_getscroll {name} {
return
}
# set safe defaults for font scaling in case
# non-standard fonts are being used
set font 0
set mult 1.553
set div 59.76
#debug
#catch { $name delete debug }
#ico@bukvic.net 5/18/10
#bbox all is not accurate when using text
......@@ -2810,7 +2807,8 @@ proc pdtk_canvas_getscroll {name} {
#borrowed from http://wiki.tcl.tk/4844
set x1 1.0e30; set x2 -1.0e30 ;
set y1 1.0e30; set y2 -1.0e30 ;
foreach item [$name find all] {
foreach item [$name find withtag {(!noscroll)}] {
switch -exact [$name type $item] {
"arc" -
"line" -
......@@ -2827,102 +2825,15 @@ proc pdtk_canvas_getscroll {name} {
}
"text" {
set size [$name bbox $item]
if { $pd_nt == 0 } {
#find out what font we're using
set fnt [$name itemcget $item -font]
#puts stderr $fnt
if { [$name itemcget $item -text] != ""} {
if {![string match "*8*" $fnt]} {
#puts stderr adjusting
#following fixes DejaVu Sans Mono ONLY on Linux w/ Tcl/Tk 8.5
#other fonts require different kinds of adjustments (most likely limited
#to changing 59.76 to a different ratio.
set tempya [lindex $size 1]
set tempyb [lindex $size 3]
set height [expr ($tempyb -$tempya)]
set yctr [expr $tempya + ($tempyb - $tempya)/2]
#$name create rectangle $x1 $yctr $x2 $yctr -outline #ff0000
#YOU MAY HAVE TO CHANGE THESE WHEN PORTING TO OSX AND WINDOWS
if {[string match "*DejaVu*" $fnt]} {
set font 0
set mult 1.553
set div 59.76
} elseif {[string match "*helvetica*" $fnt]} {
set font 1
set mult 1.652
set div 63.53
} elseif {[string match "*times*" $fnt]} {
#puts stderr times
set font 2
set mult 1.7
set div 65.38
}
#END CHANGES
set yoffset [expr int($height / ($mult * 2))]
set tempya [expr $yctr - $yoffset]
set tempyb [expr $yctr + $yoffset]
#puts stderr [concat h: $height]
#YOU MAY HAVE TO CHANGE THESE WHEN PORTING TO OSX AND WINDOWS
if { $height > $div } {
if { $font == 0 } {
set topfix [expr int($height / $div + 0.5)]
} elseif { $font == 1 } {
set topfix 0
} elseif { $font == 2 } {
set topfix 0
}
if { $topfix < 3 } {
if { $font == 0 } {
set bottomfix $topfix
} elseif { $font == 1 } {
set bottomfix [expr - int($height / $div + 0.5) + 1]
} elseif { $font == 2 } {
set bottomfix [expr - int($height / $div + 0.5) + 1]
}
} else {
set bottomfix 3
}
} else {
set topfix 0
set bottomfix 0
}
#END CHANGES
#puts stderr [concat topfix: $topfix bottomfix: $bottomfix]
foreach {xa ya xb yb} $size {
if { $xa < $x1 } {set x1 $xa}
if { $xb > $x2 } {set x2 $xb}
if { [expr $tempya - $topfix] < $y1 } {set y1 [expr $tempya - $topfix]}
if { [expr $tempyb - $topfix + $bottomfix] > $y2 } {set y2 [expr $tempyb - $topfix + $bottomfix]}
}
} else {
#if there is no text or it is less than 10 pixels which speeds up things
#for common objects while ensuring the text is not truncated
foreach {xa ya xb yb} $size {
if { $xa < $x1 } {set x1 $xa}
if { $xb > $x2 } {set x2 $xb}
if { $ya < $y1 } {set y1 $ya}
if { $yb > $y2 } {set y2 $yb}
}
}
}
} else {
#Non-Linux OSs use the old-school style
#Tested on both Windows and OSX and this does not work
#right. Given that this stuff is also font-specific,
#it will have to be visited some other time. Chances are
#similar approach should work but will also restrict
#its applicability to that specific font.
if { [$name itemcget $item -text] != ""} {
foreach {xa ya xb yb} $size {
if { $xa < $x1 } {set x1 $xa}
if { $xb > $x2 } {set x2 $xb}
if { $ya < $y1 } {set y1 $ya}
if { $yb > $y2 } {set y2 $yb}
}
#for debugging purposes
#$name create rectangle $x1 $y1 $x2 $y2 -outline #ff0000 -tag debug
}
}
}
}
......@@ -3609,7 +3520,7 @@ proc popup_action {name action} {
if {[string compare $name .c]} {
set name [string trimright $name .c]
}
set cmd [concat $name done-popup $action $popup_xpix $popup_ypix \;]
set cmd [concat $name done-popup $action $popup_xpix $popup_ypix\;]
#puts stderr $cmd
pd $cmd
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment