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

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

parent f82f3092
......@@ -458,6 +458,7 @@ void canvas_noundo(t_canvas *x)
static void canvas_undo(t_canvas *x)
{
//fprintf(stderr,"canvas_undo\n");
if (x != canvas_undo_canvas)
bug("canvas_undo 1");
else if (canvas_undo_whatnext != UNDO_UNDO)
......@@ -635,10 +636,12 @@ static void *canvas_undo_set_cut(t_canvas *x, int mode)
static void canvas_undo_cut(t_canvas *x, void *z, int action)
{
//fprintf(stderr, "canvas_undo_cut canvas=%d buf=%d action=%d\n", (int)x, (int)z, action);
t_undo_cut *buf = z;
int mode = buf->u_mode;
if (action == UNDO_UNDO)
{
//fprintf(stderr,"UNDO_UNDO\n");
if (mode == UCUT_CUT) {
//fprintf(stderr, "UCUT_CUT\n");
canvas_dopaste(x, copy_binbuf);
......@@ -673,6 +676,7 @@ static void canvas_undo_cut(t_canvas *x, void *z, int action)
}
else if (action == UNDO_REDO)
{
//fprintf(stderr,"UNDO_REDO\n");
if (mode == UCUT_CUT || mode == UCUT_CLEAR)
canvas_doclear(x);
else if (mode == UCUT_TEXT)
......@@ -690,6 +694,7 @@ static void canvas_undo_cut(t_canvas *x, void *z, int action)
}
else if (action == UNDO_FREE)
{
//fprintf(stderr,"UNDO_FREE\n");
if (buf->u_objectbuf)
binbuf_free(buf->u_objectbuf);
if (buf->u_reconnectbuf)
......@@ -3247,12 +3252,14 @@ 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);
canvas_displaceselection(x, 10, 10);
//paste_xyoffset++;
//fprintf(stderr,"xyoffset %d\n",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);
// alternative one-line implementation that
// replaces the entire function
//canvas_displaceselection(x, 10, 10);
//paste_xyoffset++; //a part of original way
}
static void canvas_paste_atmouse(t_canvas *x)
......@@ -3305,8 +3312,8 @@ static void canvas_dopaste(t_canvas *x, t_binbuf *b)
//if we have something selected in another canvas
if (c_selection && c_selection != x)
glist_noselect(c_selection);
//else is we are not duplicating but pasting see if we can autopatch
else if (canvas_undo_name[0] != 'd') {
//else is we are pasting see if we can autopatch
else if (canvas_undo_name && !strcmp(canvas_undo_name, "paste")) {
canvas_howputnew(x, &connectme, &xpix, &ypix, &indx, &nobj);
//glist_noselect(x);
}
......@@ -3325,14 +3332,8 @@ static void canvas_dopaste(t_canvas *x, t_binbuf *b)
/* select newly created objects */
for (g2 = x->gl_list, count = 0; g2; g2 = g2->g_next, count++)
/*if (count == nbox) {
// delete bogus object we created in canvas_docopy in order to circumvent tcl/tk's failure
// to provide "unique" id to every new instance of an object
glist_delete(x, g2);
} else*/ if (count >= nbox) {
if (count >= nbox)
glist_select(x, g2);
//fprintf(stderr,"object=.x%lx glist_getcanvas(x)=.x%lx\n", (t_int)g2, (t_int)glist_getcanvas((t_glist*)g2) );
}
paste_canvas = 0;
canvas_resume_dsp(dspstate);
......@@ -3343,20 +3344,28 @@ static void canvas_dopaste(t_canvas *x, t_binbuf *b)
//is this universally safe? I think so
t_text *z = (t_text *)x->gl_editor->e_selection->sel_what;
z->te_xpix = xpix;
z->te_ypix = ypix;
//this would be an alternative way but how would we then figure out delta?
//canvas_displaceselection(x, xpix, ypix);
//fprintf(stderr,"%d %d %d %d\n", z->te_xpix, z->te_ypix, xpix, ypix);
//calculate delta (since displace is always relative)
int delta_x = xpix - z->te_xpix;
int delta_y = ypix - z->te_ypix;
//now displace it but without undo
//(by spoofing canvas_undo_already_set_move)
canvas_undo_already_set_move = 1;
canvas_displaceselection(x, delta_x, delta_y);
//reset canvas_undo_already_set_move
canvas_undo_already_set_move = 0;
}
else if (canvas_undo_name[0] != 'd') {
else if (canvas_undo_name && !strcmp(canvas_undo_name, "paste") ) {
canvas_paste_atmouse(x);
//fprintf(stderr,"doing a paste\n");
}
canvas_dirty(x, 1);
if (!canvas_undo_name || canvas_undo_name[0] != 'd') {
/*if (!canvas_undo_name || canvas_undo_name[0] != 'd') {
canvas_redraw(x);
}
}*/
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
glist_donewloadbangs(x);
}
......
......@@ -987,6 +987,12 @@ static void graph_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
x->gl_obj.te_xpix += dx;
x->gl_obj.te_ypix += dy;
/*char tag[80];
sprintf(tag, "%s", rtext_gettag(glist_findrtext((x->gl_owner ? x->gl_owner: x), &x->gl_obj)));
sys_vgui(".x%lx.c move %s %d %d\n",
glist_getcanvas(x->gl_owner), tag, dx, dy);
sys_vgui(".x%lx.c move %sR %d %d\n",
glist_getcanvas(x->gl_owner), tag, dx, dy);*/
glist_redraw(x);
gobj_select(z, glist, 1);
canvas_fixlinesfor(glist_getcanvas(glist), &x->gl_obj);
......
......@@ -146,8 +146,16 @@ void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
int *indexp, int *totalp)
{
int xpix, ypix, indx = 0, nobj = 0, n2, x1, x2, y1, y2;
int connectme = (x->gl_editor->e_selection &&
!x->gl_editor->e_selection->sel_next && !sys_noautopatch);
int connectme = 0;
t_gobj *selected;
if (x->gl_editor->e_selection &&
!x->gl_editor->e_selection->sel_next &&
!sys_noautopatch) {
selected = x->gl_editor->e_selection->sel_what;
t_object *ob = pd_checkobject(&selected->g_pd);
connectme = (obj_noutlets(ob) ? 1 : 0);
}
if (connectme)
{
t_gobj *g, *selected = x->gl_editor->e_selection->sel_what;
......
......@@ -610,7 +610,7 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv)
int nargs, maxnargs = 0;
//first we need to check if the list of arguments has $@
//fprintf(stderr,"ac=%d\n", ac);
//fprintf(stderr,"binbuf=%d target=%d argc=%d argv=%d ac=%d\n", (int)x, (int)target, (int)ac, argc, (int)argv);
int count;
for (count = 0; count < ac; count++) {
//fprintf(stderr, "count %d\n", count);
......
......@@ -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-20110418"
#define PD_TEST_VERSION "extended-l2ork-20110419"
/* 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 */
......
......@@ -3046,8 +3046,8 @@ proc pdtk_canvas_sendkey {name state key iso shift} {
pd [canvastosym $name] key $state $key $shift \;
}
# only do actions if this is a canvas. if so
# if so, invoke edit menu option (whcih will work
# only do actions if this is a canvas.
# if so, invoke edit menu option (which will work
# only if the actual option is currently enabled)
proc pdtk_canvas_edit_menu_actions {name action} {
# pdtk_post "edit_menu_actions $name $action\n"
......
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