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


parent 9887d05d
......@@ -3275,18 +3275,38 @@ static void canvas_paste_atmouse(t_canvas *x)
extern void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv);
extern void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
int *indexp, int *totalp);
static void canvas_dopaste(t_canvas *x, t_binbuf *b)
//fprintf(stderr,"start dopaste\n");
t_gobj *newgobj, *last, *g2;
int dspstate = canvas_suspend_dsp(), nbox, count;
//autopatching variables
int connectme, xpix, ypix, indx, nobj;
connectme = 0;
canvas_editmode(x, 1.);
/* abolish potential displacing of object that may have been
created with the first new object on canvas, but now we are
pasting and therefore MA_MOVE should not apply to new objects
x->gl_editor->e_onmotion = MA_NONE;
//if we have something selected in another canvas
if (c_selection && c_selection != x)
//else is we are not duplicating but pasting see if we can autopatch
else if (canvas_undo_name[0] != 'd') {
canvas_howputnew(x, &connectme, &xpix, &ypix, &indx, &nobj);
//else we are duplicating
else glist_noselect(x);
for (g2 = x->gl_list, nbox = 0; g2; g2 = g2->g_next) nbox++;
/* found the end of the queue */
......@@ -3310,6 +3330,23 @@ static void canvas_dopaste(t_canvas *x, t_binbuf *b)
paste_canvas = 0;
//if we are pasting only one object autoposition it below our selection
if (count == nbox+1 && connectme) {
canvas_connect(x, indx, 0, nobj, 0);
//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);
else if (canvas_undo_name[0] != 'd') {
canvas_dirty(x, 1);
if (!canvas_undo_name || canvas_undo_name[0] != 'd') {
......@@ -3344,7 +3381,6 @@ static void canvas_paste(t_canvas *x)
canvas_dopaste(x, copy_binbuf);
......@@ -142,7 +142,7 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected,
extern int sys_noautopatch;
/* utility routine to figure out where to put a new text box from menu
and whether to connect to it automatically */
static void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp,
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;
......@@ -11,7 +11,7 @@ extern "C" {
#define PD_TEST_VERSION "extended-l2ork-20110413"
#define PD_TEST_VERSION "extended-l2ork-20110416"
/* 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 */
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