From c05257ed8e12ddaa348967d0a07a38b181acab2c Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@monsoon-hp.(none)> Date: Fri, 2 Mar 2012 08:43:07 -0500 Subject: [PATCH] removed selection from the undo queue as it precludes selecting older stuff and pasting it into new stuff (undo -> select old would purge the queue ahead of that undo, so -> redo -> paste would be impossible) --- src/g_editor.c | 42 +++++++++++++++++++++--------------------- src/g_undo.c | 8 ++++---- src/g_undo.h | 4 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/g_editor.c b/src/g_editor.c index 3ca75e963..c39bbad45 100644 --- a/src/g_editor.c +++ b/src/g_editor.c @@ -69,7 +69,7 @@ struct _outlet }; /* ----------- 11. selection -------------- */ -typedef struct _undo_sel +/*typedef struct _undo_sel { int u_index; struct _undo_sel *sel_next; @@ -79,7 +79,7 @@ typedef struct _undo_redo_sel { t_undo_sel *u_undo; t_undo_sel *u_redo; -} t_undo_redo_sel; +} t_undo_redo_sel;*/ /* ---------------------------------------- */ /* used for new duplicate behavior where we can "duplicate" into new window */ @@ -1728,7 +1728,7 @@ void canvas_undo_recreate(t_canvas *x, void *z, int action) //structs are defined at the top of the file due to unusual undo/redo design of the selection -void *canvas_undo_set_selection(t_canvas *x) +/*void *canvas_undo_set_selection(t_canvas *x) { t_undo_sel *u_sel = (t_undo_sel *)getbytes(sizeof(*u_sel)); u_sel->u_index = -1; @@ -1789,7 +1789,7 @@ void canvas_undo_selection(t_canvas *x, void *z, int action) freebytes(u_main, sizeof(*u_main)); } } - +*/ /* ------------------------ event handling ------------------------ */ static char *cursorlist[] = { @@ -2576,15 +2576,15 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, } else { - t_undo_redo_sel *buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); - buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); + //t_undo_redo_sel *buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); + //buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); if (glist_isselected(x, y)) glist_deselect(x, y); else glist_select(x, y); - buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); - canvas_undo_add(x, 11, "selection", buf); + //buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); + //canvas_undo_add(x, 11, "selection", buf); } } } @@ -2716,14 +2716,14 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, /* otherwise select and drag to displace */ if (!glist_isselected(x, y)) { - t_undo_redo_sel *buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); - buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); + //t_undo_redo_sel *buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); + //buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); glist_noselect(x); glist_select(x, y); - buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); - canvas_undo_add(x, 11, "selection", buf); + //buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); + //canvas_undo_add(x, 11, "selection", buf); } //toggle_moving = 1; //sys_vgui("pdtk_update_xy_tooltip .x%lx %d %d\n", x, (int)xpos, (int)ypos); @@ -2867,13 +2867,13 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if (doit) { if (!shiftmod && x->gl_editor->e_selection) { - t_undo_redo_sel *buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); - buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); + //t_undo_redo_sel *buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); + //buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); glist_noselect(x); - buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); - canvas_undo_add(x, 11, "selection", buf); + //buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); + //canvas_undo_add(x, 11, "selection", buf); } sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags x -outline $select_color\n", x, xpos, ypos, xpos, ypos); @@ -3076,7 +3076,7 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy) { //fprintf(stderr,"canvas_selectinrect\n"); t_gobj *y; - t_undo_redo_sel *buf=NULL; + //t_undo_redo_sel *buf=NULL; int selection_changed = 0; for (y = x->gl_list; y; y = y->g_next) { @@ -3084,8 +3084,8 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy) gobj_getrect(y, x, &x1, &y1, &x2, &y2); if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2) { if (!selection_changed) { - buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); - buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); + //buf = (t_undo_redo_sel *)getbytes(sizeof(*buf)); + //buf->u_undo = (t_undo_sel *)canvas_undo_set_selection(x); selection_changed = 1; } if (!glist_isselected(x, y)) @@ -3093,10 +3093,10 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy) else glist_deselect(x, y); } } - if (buf) { + /*if (buf) { buf->u_redo = (t_undo_sel *)canvas_undo_set_selection(x); canvas_undo_add(x, 11, "selection", buf); - } + }*/ } static void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit) diff --git a/src/g_undo.c b/src/g_undo.c index e30a0c87b..390241a20 100644 --- a/src/g_undo.c +++ b/src/g_undo.c @@ -67,7 +67,7 @@ void canvas_undo_undo(t_canvas *x) case 8: canvas_undo_canvas_apply(x, x->u_last->data, UNDO_UNDO); break; //canvas apply case 9: canvas_undo_create(x, x->u_last->data, UNDO_UNDO); break; //create case 10:canvas_undo_recreate(x, x->u_last->data, UNDO_UNDO); break; //recreate - case 11:canvas_undo_selection(x, x->u_last->data, UNDO_UNDO); break; //selection + //case 11:canvas_undo_selection(x, x->u_last->data, UNDO_UNDO); break; //selection default: error("canvas_undo_undo: unsupported undo command %d", x->u_last->type); } @@ -101,7 +101,7 @@ void canvas_undo_redo(t_canvas *x) case 8: canvas_undo_canvas_apply(x, x->u_last->data, UNDO_REDO); break; //canvas apply case 9: canvas_undo_create(x, x->u_last->data, UNDO_REDO); break; //create case 10:canvas_undo_recreate(x, x->u_last->data, UNDO_REDO); break; //recreate - case 11:canvas_undo_selection(x, x->u_last->data, UNDO_REDO); break; //selection + //case 11:canvas_undo_selection(x, x->u_last->data, UNDO_REDO); break; //selection default: error("canvas_undo_redo: unsupported redo command %d", x->u_last->type); } @@ -134,7 +134,7 @@ void canvas_undo_rebranch(t_canvas *x) case 8: canvas_undo_canvas_apply(x, a->data, UNDO_FREE); break; //canvas apply case 9: canvas_undo_create(x, a->data, UNDO_FREE); break; //create case 10:canvas_undo_recreate(x, a->data, UNDO_FREE); break; //recreate - case 11:canvas_undo_selection(x, a->data, UNDO_FREE); break; //selection + //case 11:canvas_undo_selection(x, a->data, UNDO_FREE); break; //selection default: error("canvas_undo_rebranch: unsupported undo command %d", a->type); } @@ -174,7 +174,7 @@ void canvas_undo_free(t_canvas *x) case 8: canvas_undo_canvas_apply(x, a->data, UNDO_FREE); break; //canvas apply case 9: canvas_undo_create(x, a->data, UNDO_FREE); break; //create case 10:canvas_undo_recreate(x, a->data, UNDO_FREE); break; //recreate - case 11:canvas_undo_selection(x, a->data, UNDO_FREE); break; //selection + //case 11:canvas_undo_selection(x, a->data, UNDO_FREE); break; //selection default: error("canvas_undo_free: unsupported undo command %d", a->type); } diff --git a/src/g_undo.h b/src/g_undo.h index 9fb1fb193..68c744ae8 100644 --- a/src/g_undo.h +++ b/src/g_undo.h @@ -117,8 +117,8 @@ EXTERN void *canvas_undo_set_recreate(t_canvas *x, t_gobj *y, int old_pos); /* --------- 11. selection ------- */ -EXTERN void canvas_undo_selection(t_canvas *x, void *z, int action); -EXTERN void *canvas_undo_set_selection(t_canvas *x); +//EXTERN void canvas_undo_selection(t_canvas *x, void *z, int action); +//EXTERN void *canvas_undo_set_selection(t_canvas *x); /* ------------------------------- */ -- GitLab