diff options
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 59 |
1 files changed, 56 insertions, 3 deletions
@@ -141,7 +141,48 @@ void draw_box(int x1, int y1, int fix){ show_cursor(); } -void get_box(FILE *fc){ +void draw_parallelogram(int x1, int y1, char st, char fix){ + int xmin, ymin, xmax, ymax; + int dy; + int i; + void (*f)(int, int, char); + + + xmin = MIN(x, x1); + xmax = MAX(x, x1); + ymin = MIN(y, y1); + ymax = MAX(y, y1); + dy = ymax - ymin; + + if (fix == FIX){ + f = set_xy; + copy_lines_to_ring(ymin, ymax, PRV_STATE); + } + else + f = draw_xy; + /*FIXME: INCOMPLETE -- CONTINUE HERE */ + for(i=xmin+1; i<=xmax; i++){ + f(i, ymin, line_h); + f(i, ymax, line_h); + } + for(i=ymin+1; i<=ymax; i++){ + f(xmin, i, line_v); + f(xmax, i, line_v); + } + f(xmin, ymin, corner); + f(xmin, ymax, corner); + f(xmax, ymin, corner); + f(xmax, ymax, corner); + if (fix == FIX) + copy_lines_to_ring(ymin, ymax, NEW_STATE); + show_cursor(); + + + +} + + +void get_box(FILE *fc, char st){ char c; int orig_x=x, orig_y=y; redraw(); @@ -156,14 +197,21 @@ void get_box(FILE *fc){ redraw(); step = 1; update_box: - draw_box(orig_x, orig_y, NOFIX); + if (st == BOX_RECT) + draw_box(orig_x, orig_y, NOFIX); + else + draw_parallelogram(orig_x, orig_y, st, NOFIX); status_bar(); show_cursor(); } - if (c == 'b' || c == '\n'){ + if (st == BOX_RECT && (c == 'b' || c == '\n')){ draw_box(orig_x, orig_y, FIX); modified = 1; } + else if ((st & (BOX_PAR1 | BOX_PAR2)) && (c == 'z' || c == 'Z' || c == '\n')){ + draw_parallelogram(orig_x, orig_y, FIX); + modified = 1; + } redraw(); mode = MOVE; } @@ -331,6 +379,9 @@ void erase(FILE *fc){ } + + + /*** Visual ***/ @@ -385,6 +436,8 @@ vis_exit: mode = MOVE; } +/*** yank/paste/undo ***/ + void paste(){ int y2; |