diff options
author | mongo <mongo@iomega> | 2016-05-17 16:02:56 -0300 |
---|---|---|
committer | mongo <mongo@iomega> | 2016-05-17 16:02:56 -0300 |
commit | 4558bd9fa7a01f3c99ec9c70885d7a48392a3af3 (patch) | |
tree | 5392565b2a480f8e33759a708343ad230396abff /src/shift.c | |
parent | d44df1b0f0882d5433464e6984aec1f90983ceee (diff) |
shift: sk
Diffstat (limited to 'src/shift.c')
-rw-r--r-- | src/shift.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/shift.c b/src/shift.c index e8c1efe..732865d 100644 --- a/src/shift.c +++ b/src/shift.c @@ -4,6 +4,9 @@ #include "sc.h" #include "vmtbl.h" // for growtbl #include "cmds.h" +#include "dep_graph.h" + +extern graphADT graph; // shift a range of 'ENTS' void shift_range(int delta_rows, int delta_cols, int tlrow, int tlcol, int brrow, int brcol) { @@ -24,10 +27,8 @@ void shift_range(int delta_rows, int delta_cols, int tlrow, int tlcol, int brrow void shift_cells_down(int deltarows, int deltacols) { int r, c; struct ent ** pp; - int lim = maxrow - currow + deltarows; if (currow > maxrow) maxrow = currow; maxrow += deltarows; - lim = maxrow - lim + deltarows - 1; if ((maxrow >= maxrows) && !growtbl(GROWROW, maxrow, 0)) return; @@ -75,12 +76,10 @@ void shift_cells_right(int deltarows, int deltacols) { } - - - // shift cells up // TODO rewrite without using copyent void shift_cells_up(int deltarows, int deltacols) { + /* register struct ent ** pp; register struct ent * n; register struct ent * p; @@ -108,6 +107,30 @@ void shift_cells_up(int deltarows, int deltacols) { clearent(*pp); } return; + */ + int r, c; + struct ent ** pp; + for (r = currow; r <= maxrow; r++) { + for (c = curcol; c < curcol + deltacols; c++) { + if (r <= maxrow - deltarows) { + pp = ATBL(tbl, r, c); + + /* delete vertex in graph */ + if (*pp && getVertex(graph, *pp, 0) != NULL) destroy_vertex(*pp); + + if (*pp) mark_ent_as_deleted(*pp); //FIXME + *pp = NULL; //FIXME + pp[0] = *ATBL(tbl, r+deltarows, c); + if ( pp[0] ) pp[0]->row -= deltarows; + } + //blank bottom ents + if (r > maxrow - deltarows) { + pp = ATBL(tbl, r, c); + *pp = (struct ent *) 0; + } + } + } + return; } // shift cells left |