Introduction
Introduction Statistics Contact Development Disclaimer Help
towards parallelograms - gramscii - A simple editor for ASCII box-and-arrow cha…
Log
Files
Refs
Tags
README
LICENSE
---
commit 257ec5d56fbe0ac65b04ae10bf36dd14e86c95a5
parent 39ec615b54c0cc2734ac29ba4caac574c21503a4
Author: KatolaZ <[email protected]>
Date: Tue, 13 Aug 2019 16:20:49 +0100
towards parallelograms
Diffstat:
M draw.c | 59 +++++++++++++++++++++++++++++…
1 file changed, 56 insertions(+), 3 deletions(-)
---
diff --git a/draw.c b/draw.c
@@ -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 =…
+ 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;
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.