void movecolright(void) /* Moves right one column */ { int col, oldleftcol, oldrightcol; unsigned char oldcolstart[SCREENCOLS]; movmem(colstart, oldcolstart, sizeof(colstart)); oldleftcol = leftcol; oldrightcol = rightcol; displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (curcol < rightcol) curcol++; else if (rightcol < (MAXCOLS - 1)) { curcol++; rightcol++; setleftcol(); setrightcol(); if (oldrightcol >= leftcol) scroll(LEFT, oldcolstart[leftcol - oldleftcol] - LEFTMARGIN, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); clearlastcol(); for (col = oldrightcol + 1; col <= rightcol; col++) displaycol(col, NOUPDATE); } } /* movecolright */
void movecolleft(void) /* Moves left one column */ { int col, oldleftcol; unsigned char oldcolstart[SCREENCOLS]; oldleftcol = leftcol; movmem(colstart, oldcolstart, sizeof(colstart)); displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (curcol > leftcol) curcol--; else if (leftcol != 0) { curcol--; leftcol--; setrightcol(); setleftcol(); if (oldleftcol <= rightcol) scroll(RIGHT, colstart[oldleftcol - leftcol] - LEFTMARGIN, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); clearlastcol(); for (col = leftcol; col <= oldleftcol - 1; col++) displaycol(col, NOUPDATE); } } /* movecolleft */
void displayscreen(int updating) /* Displays the current screen of the spreadsheet */ { int row; for (row = toprow; row <= bottomrow; row++) displayrow(row, updating); clearlastcol(); } /* displayscreen */
void deletecol(int col) /* Deletes a column */ { int counter, row; for (counter = 0; counter <= lastrow; counter++) deletecell(col, counter, NOUPDATE); printfreemem(); if (col != MAXCOLS - 1) { movmem(&cell[col + 1][0], &cell[col][0], MAXROWS * sizeof(CELLPTR) * (MAXCOLS - col - 1)); movmem(&format[col + 1][0], &format[col][0], MAXROWS * (MAXCOLS - col - 1)); movmem(&colwidth[col + 1], &colwidth[col], MAXCOLS - col - 1); } setmem(&cell[MAXCOLS - 1][0], MAXROWS * sizeof(CELLPTR), 0); setmem(&format[MAXCOLS - 1][0], MAXROWS, DEFAULTFORMAT); colwidth[MAXCOLS - 1] = DEFAULTWIDTH; if ((lastcol >= col) && (lastcol > 0)) lastcol--; setrightcol(); if (curcol > rightcol) { rightcol++; setleftcol(); } clearlastcol(); for (counter = 0; counter <= lastcol; counter++) { for (row = 0; row <= lastrow; row++) { if ((cell[counter][row] != NULL) && (cell[counter][row]->attrib == FORMULA)) fixformula(counter, row, COLDEL, col); updateoflags(col, row, NOUPDATE); } } while (col <= rightcol) displaycol(col++, NOUPDATE); changed = TRUE; recalc(); } /* deletecol */