fix svg export if colorscheme changed via menu; allow monochrome svg export via menu Options -> Color Postscript/SVG
This commit is contained in:
parent
60791062ac
commit
61df74b50b
|
|
@ -50,9 +50,15 @@ static void set_svg_colors(unsigned int pixel)
|
|||
svg_stroke.green = svg_colors[pixel].green;
|
||||
svg_stroke.blue = svg_colors[pixel].blue;
|
||||
} else {
|
||||
svg_stroke.red = 0;
|
||||
svg_stroke.green = 0;
|
||||
svg_stroke.blue = 0;
|
||||
if(dark_colorscheme == 0 ) {
|
||||
svg_stroke.red = 0;
|
||||
svg_stroke.green = 0;
|
||||
svg_stroke.blue = 0;
|
||||
} else {
|
||||
svg_stroke.red = 255;
|
||||
svg_stroke.green = 255;
|
||||
svg_stroke.blue = 255;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -400,12 +406,22 @@ static void fill_svg_colors()
|
|||
tcleval( "puts $svg_colors");
|
||||
}
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_snprintf(s, S(s), "lindex $svg_colors %d", i);
|
||||
tcleval( s);
|
||||
sscanf(tclresult(),"%x", &c);
|
||||
svg_colors[i].red = (c & 0xff0000) >> 16;
|
||||
svg_colors[i].green = (c & 0x00ff00) >> 8;
|
||||
svg_colors[i].blue = (c & 0x0000ff);
|
||||
if(color_ps) {
|
||||
my_snprintf(s, S(s), "lindex $svg_colors %d", i);
|
||||
tcleval( s);
|
||||
sscanf(tclresult(),"%x", &c);
|
||||
svg_colors[i].red = (c & 0xff0000) >> 16;
|
||||
svg_colors[i].green = (c & 0x00ff00) >> 8;
|
||||
svg_colors[i].blue = (c & 0x0000ff);
|
||||
} else if(dark_colorscheme) {
|
||||
svg_colors[i].red = 255;
|
||||
svg_colors[i].green = 255;
|
||||
svg_colors[i].blue = 255;
|
||||
} else {
|
||||
svg_colors[i].red = 0;
|
||||
svg_colors[i].green = 0;
|
||||
svg_colors[i].blue = 0;
|
||||
}
|
||||
if(debug_var>=1) {
|
||||
fprintf(errfp, "svg_colors: %d %d %d\n", svg_colors[i].red, svg_colors[i].green, svg_colors[i].blue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -685,6 +685,9 @@ int build_colors(double dim) /* 20171113 */
|
|||
if(atoi(tclresult())<cadlayers){
|
||||
fprintf(errfp,"Tcl var colors not set correctly\n");
|
||||
return -1; /* fail */
|
||||
} else {
|
||||
tcleval("regsub -all {\"} $colors {} svg_colors");
|
||||
tcleval("regsub -all {#} $svg_colors {0x} svg_colors");
|
||||
}
|
||||
init_color_array(dim);
|
||||
for(i=0;i<cadlayers;i++)
|
||||
|
|
|
|||
|
|
@ -1963,10 +1963,10 @@ proc change_color {} {
|
|||
set dark_colors $cc
|
||||
} else {
|
||||
set light_colors $cc
|
||||
regsub -all {\"} $cc {} ps_colors
|
||||
regsub -all {"} $cc {} ps_colors
|
||||
regsub -all {#} $ps_colors {0x} ps_colors
|
||||
}
|
||||
regsub -all {\"} $colors {} svg_colors
|
||||
regsub -all {"} $colors {} svg_colors
|
||||
regsub -all {#} $svg_colors {0x} svg_colors
|
||||
|
||||
xschem change_colors
|
||||
|
|
@ -3118,9 +3118,9 @@ if {!$rainbow_colors} {
|
|||
}
|
||||
|
||||
# for svg and pdf draw 20121108
|
||||
regsub -all {\"} $dark_colors {} svg_colors
|
||||
regsub -all {"} $dark_colors {} svg_colors
|
||||
regsub -all {#} $svg_colors {0x} svg_colors
|
||||
regsub -all {\"} $light_colors {} ps_colors
|
||||
regsub -all {"} $light_colors {} ps_colors
|
||||
regsub -all {#} $ps_colors {0x} ps_colors
|
||||
|
||||
## pad missing colors with black
|
||||
|
|
@ -3311,7 +3311,7 @@ font configure Underline-Font -underline true -size 24
|
|||
if { $show_infowindow != 0 } {wm deiconify .infotext
|
||||
} else {wm withdraw .infotext}
|
||||
}
|
||||
.menubar.option.menu add checkbutton -label "Color postscript" -variable color_ps \
|
||||
.menubar.option.menu add checkbutton -label "Color Postscript/SVG" -variable color_ps \
|
||||
-command {
|
||||
if { $color_ps==1 } {xschem set color_ps 1} else { xschem set color_ps 0}
|
||||
}
|
||||
|
|
@ -3727,9 +3727,9 @@ if { $dark_colorscheme == 1} {
|
|||
} else {
|
||||
set colors $light_colors
|
||||
}
|
||||
regsub -all {\"} $light_colors {} ps_colors
|
||||
regsub -all {"} $light_colors {} ps_colors
|
||||
regsub -all {#} $ps_colors {0x} ps_colors
|
||||
regsub -all {\"} $colors {} svg_colors
|
||||
regsub -all {"} $colors {} svg_colors
|
||||
regsub -all {#} $svg_colors {0x} svg_colors
|
||||
|
||||
if { $show_infowindow } { wm deiconify .infotext }
|
||||
|
|
|
|||
Loading…
Reference in New Issue