diff options
author | epoch <epoch@enzo.thebackupbox.net> | 2021-01-05 09:40:08 -0600 |
---|---|---|
committer | epoch <epoch@enzo.thebackupbox.net> | 2021-01-05 09:40:08 -0600 |
commit | 028f2d5d467582afc666c761718940fb6b722916 (patch) | |
tree | c10fa65c10898d8f0bf9c8ebfe85c9baef8e904c | |
parent | 515132d67b7839ef769ceb66489a65dd6b2d689f (diff) | |
download | hackvr-028f2d5d467582afc666c761718940fb6b722916.tar.gz hackvr-028f2d5d467582afc666c761718940fb6b722916.zip |
put version into a global and use it to not do mouseover effect for svg output
-rw-r--r-- | src/common.h | 1 | ||||
-rw-r--r-- | src/graphics_c2.c | 3 | ||||
-rw-r--r-- | src/graphics_cs_svg.c | 13 | ||||
-rw-r--r-- | src/hackvr.c | 3 |
4 files changed, 18 insertions, 2 deletions
diff --git a/src/common.h b/src/common.h index 99ac1fa..77ad619 100644 --- a/src/common.h +++ b/src/common.h @@ -120,6 +120,7 @@ struct hvr_global { real split; char localecho; int selfpipe[2]; + char *version; }; int selfcommand(char *); diff --git a/src/graphics_c2.c b/src/graphics_c2.c index 65d139f..c4c9193 100644 --- a/src/graphics_c2.c +++ b/src/graphics_c2.c @@ -33,6 +33,9 @@ void draw_c2_shape(c2_s_t s) { ss.p[i]=c2_to_cs(s.p[i]); } draw_cs_shape(ss); + if(!strcmp(global.version,"svg")) { + return;//disable mouseover for svg + } // if(cn_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline. if(epoch_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline. set_ansi_color(7); diff --git a/src/graphics_cs_svg.c b/src/graphics_cs_svg.c index 1e3672e..9321dc1 100644 --- a/src/graphics_cs_svg.c +++ b/src/graphics_cs_svg.c @@ -47,7 +47,7 @@ void set_luminosity_color(int lum) { void draw_cs_line(cs_t p1,cs_t p2) { char tmp[1024]; snprintf(tmp,sizeof(tmp)-1,"<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" stroke=\"%s\" />\n" - ,p1.x ,p1.y ,p2.x ,p2.y ,svg_global.foreground_color); + ,p1.x ,p1.y ,p2.x ,p2.y ,svg_global.foreground_color?svg_global.foreground_color:"green"); strcat(svg_global.backbuffer,tmp); } @@ -80,6 +80,9 @@ void draw_cs_shape(cs_s_t s) {//this is implemented as draw_cs_line... hrm. it c switch(s.len) { case 1: break; + case 2: + draw_cs_line(s.p[0],s.p[1]); + break; default: strcat(svg_global.backbuffer,"<polygon points=\""); for(i=0;i<s.len+(s.len==1);i++) {//this shape is closed! @@ -114,6 +117,9 @@ void draw_cs_filled_shape(cs_s_t s) { switch(s.len) { case 1: break; + case 2: + draw_cs_line(s.p[0],s.p[1]); + break; default: strcat(svg_global.backbuffer,"<polygon points=\""); for(i=0;i<s.len+(s.len==1);i++) {//this shape is closed! @@ -121,6 +127,9 @@ void draw_cs_filled_shape(cs_s_t s) { strcat(svg_global.backbuffer,tmp); if(i != s.len-1) strcat(svg_global.backbuffer," ");//only print space after points that have a point after them. } + if(svg_global.foreground_color == 0) { + svg_global.foreground_color="green"; + } snprintf(tmp,sizeof(tmp)-1,"\" fill=\"%s\" stroke=\"%s\" />\n",svg_global.foreground_color,svg_global.foreground_color); strcat(svg_global.backbuffer,tmp); break; @@ -186,6 +195,7 @@ void set_color_snow() { } void set_ansi_color(int i) { + if(i < 0 || i > 7) i=0; svg_global.foreground_color=svg_global.ansi_color[i]; } @@ -248,6 +258,7 @@ int graphics_sub_init() {//this returns an fd we need to keep an eye one? :/ svg_global.ansi_color[6]="yellow"; svg_global.ansi_color[7]="white"; svg_global.ansi_color[8]=0; + set_ansi_color(0); /* x11_global.fd=ConnectionNumber(x11_global.dpy);//we need to to pass to libidc x11_global.color_map=DefaultColormap(x11_global.dpy, DefaultScreen(x11_global.dpy)); fprintf(stderr,"# generating colors...\n"); diff --git a/src/hackvr.c b/src/hackvr.c index 1a72896..4668e90 100644 --- a/src/hackvr.c +++ b/src/hackvr.c @@ -128,7 +128,7 @@ int glob_match(char *a,char *b) { } void hvr_version() { - fprintf(stderr,"# hackvr version: %s\n",HVR_VERSION); + fprintf(stderr,"# hackvr version: %s\n",global.version); } int hackvr_handler(char *line); @@ -763,6 +763,7 @@ void alarm_handler(int sig) { } int main(int argc,char *argv[]) { + global.version=HVR_VERSION; int i; int fd=0;//stdin if(argc == 2) { |