xschem/src/psprint.c

604 lines
16 KiB
C
Raw Normal View History

2020-08-08 15:47:34 +02:00
/* File: psprint.c
*
2020-08-08 15:47:34 +02:00
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
2020-08-08 15:47:34 +02:00
* simulation.
* Copyright (C) 1998-2020 Stefan Frederik Schippers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "xschem.h"
#define X_TO_PS(x) ( (x+xctx->xorigin)* xctx->mooz )
#define Y_TO_PS(y) ( (y+xctx->yorigin)* xctx->mooz )
2020-08-08 15:47:34 +02:00
static FILE *fd;
2020-08-08 15:47:34 +02:00
typedef struct {
int red;
int green;
int blue;
} Ps_color;
static Ps_color *ps_colors;
static void restore_lw(void)
2020-08-08 15:47:34 +02:00
{
if(xctx->lw==0.0)
2020-08-08 15:47:34 +02:00
fprintf(fd, "%.16g setlinewidth\n",0.5);
else
if(a3page) fprintf(fd, "%.16g setlinewidth\n",xctx->lw/1.2/sqrt(2));
else fprintf(fd, "%.16g setlinewidth\n",xctx->lw/1.2);
2020-08-08 15:47:34 +02:00
}
static void set_ps_colors(unsigned int pixel)
{
if(color_ps) fprintf(fd, "%.16g %.16g %.16g setrgbcolor\n",
(double)ps_colors[pixel].red/256.0, (double)ps_colors[pixel].green/256.0,
2020-08-08 15:47:34 +02:00
(double)ps_colors[pixel].blue/256.0);
2020-08-08 15:47:34 +02:00
}
static void ps_xdrawarc(int layer, int fillarc, double x, double y, double r, double a, double b)
{
if(fill && fillarc)
2020-08-08 15:47:34 +02:00
fprintf(fd, "%.16g %.16g %.16g %.16g %.16g AF\n", x, y, r, -a, -a-b);
else
fprintf(fd, "%.16g %.16g %.16g %.16g %.16g A\n", x, y, r, -a, -a-b);
2020-08-08 15:47:34 +02:00
}
static void ps_xdrawline(int layer, double x1, double y1, double x2,
2020-08-08 15:47:34 +02:00
double y2)
{
fprintf(fd, "%.16g %.16g %.16g %.16g L\n", x2, y2, x1, y1);
}
static void ps_xdrawpoint(int layer, double x1, double y1)
{
fprintf(fd, "%.16g %.16g %.16g %.16g L\n", x1, y1,x1,y1);
}
static void ps_xfillrectange(int layer, double x1, double y1, double x2,
double y2)
{
/*fprintf(fd, "%.16g %.16g moveto %.16g %.16g lineto %.16g %.16g lineto %.16g %.16g lineto closepath\n", */
/* x1,y1,x2,y1,x2,y2,x1,y2); */
fprintf(fd, "%.16g %.16g %.16g %.16g R\n", x1,y1,x2-x1,y2-y1);
if( (layer==4 || layer==PINLAYER || layer==WIRELAYER) && fill) {
fprintf(fd, "%.16g %.16g %.16g %.16g RF\n", x1,y1,x2-x1,y2-y1);
/* fprintf(fd,"fill\n"); */
}
/*fprintf(fd,"stroke\n"); */
}
/* Convex Nonconvex Complex */
#define Polygontype Nonconvex
2020-09-03 10:05:48 +02:00
static void ps_drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash)
2020-08-08 15:47:34 +02:00
{
double x1,y1,x2,y2;
double xx, yy;
2020-09-03 10:05:48 +02:00
double psdash;
2020-08-08 15:47:34 +02:00
int i;
polygon_bbox(x, y, points, &x1,&y1,&x2,&y2);
x1=X_TO_PS(x1);
y1=Y_TO_PS(y1);
x2=X_TO_PS(x2);
y2=Y_TO_PS(y2);
if( !rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) ) {
return;
}
psdash = dash / xctx->zoom;
2020-09-03 10:05:48 +02:00
if(dash) {
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
}
2020-08-08 15:47:34 +02:00
for(i=0;i<points; i++) {
xx = X_TO_PS(x[i]);
yy = Y_TO_PS(y[i]);
2020-09-03 10:05:48 +02:00
if(i==0) fprintf(fd, "newpath\n%.16g %.16g MT\n", xx, yy);
2020-08-08 15:47:34 +02:00
else fprintf(fd, "%.16g %.16g LT\n", xx, yy);
}
if(fill && fill_type[c] && poly_fill) {
2020-09-03 10:05:48 +02:00
fprintf(fd, "closepath gsave stroke\n");
fprintf(fd, "grestore\n");
2020-08-08 15:47:34 +02:00
fprintf(fd, " fill\n");
2020-09-03 10:05:48 +02:00
} else {
fprintf(fd, "closepath stroke\n");
}
2020-09-03 10:05:48 +02:00
if(dash) {
fprintf(fd, "[] 0 setdash\n");
2020-08-08 15:47:34 +02:00
}
}
2020-09-03 10:05:48 +02:00
static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,double recty2, int dash)
2020-08-08 15:47:34 +02:00
{
double x1,y1,x2,y2;
2020-09-03 10:05:48 +02:00
double psdash;
2020-08-08 15:47:34 +02:00
x1=X_TO_PS(rectx1);
y1=Y_TO_PS(recty1);
x2=X_TO_PS(rectx2);
y2=Y_TO_PS(recty2);
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
{
psdash = dash / xctx->zoom;
2020-09-03 10:05:48 +02:00
if(dash) {
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
}
ps_xfillrectange(gc, x1,y1,x2,y2);
if(dash) {
fprintf(fd, "[] 0 setdash\n");
}
2020-08-08 15:47:34 +02:00
}
}
2020-09-03 10:05:48 +02:00
static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a, double b, int dash)
2020-08-08 15:47:34 +02:00
{
double xx,yy,rr;
double x1, y1, x2, y2;
2020-09-03 10:05:48 +02:00
double psdash;
2020-08-08 15:47:34 +02:00
xx=X_TO_PS(x);
yy=Y_TO_PS(y);
rr=r*xctx->mooz;
2020-08-08 15:47:34 +02:00
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
x1=X_TO_PS(x1);
y1=Y_TO_PS(y1);
x2=X_TO_PS(x2);
y2=Y_TO_PS(y2);
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
{
psdash = dash / xctx->zoom;
2020-09-03 10:05:48 +02:00
if(dash) {
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
}
ps_xdrawarc(gc, fillarc, xx, yy, rr, a, b);
if(dash) {
fprintf(fd, "[] 0 setdash\n");
}
2020-08-08 15:47:34 +02:00
}
}
2020-09-03 10:05:48 +02:00
static void ps_drawline(int gc, double linex1,double liney1,double linex2,double liney2, int dash)
2020-08-08 15:47:34 +02:00
{
double x1,y1,x2,y2;
2020-09-03 10:05:48 +02:00
double psdash;
2020-08-08 15:47:34 +02:00
x1=X_TO_PS(linex1);
y1=Y_TO_PS(liney1);
x2=X_TO_PS(linex2);
y2=Y_TO_PS(liney2);
if( clip(&x1,&y1,&x2,&y2) )
{
psdash = dash / xctx->zoom;
2020-09-03 10:05:48 +02:00
if(dash) {
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
}
ps_xdrawline(gc, x1, y1, x2, y2);
if(dash) {
fprintf(fd, "[] 0 setdash\n");
}
2020-08-08 15:47:34 +02:00
}
}
static void ps_draw_string(int gctext, const char *str,
int rot, int flip, int hcenter, int vcenter,
2020-08-08 15:47:34 +02:00
double x1,double y1,
double xscale, double yscale)
2020-08-08 15:47:34 +02:00
{
double a,yy,curr_x1,curr_y1,curr_x2,curr_y2,rx1,rx2,ry1,ry2;
int pos=0,cc,pos2=0;
int i;
2020-08-08 15:47:34 +02:00
if(str==NULL) return;
#ifdef HAS_CAIRO
text_bbox_nocairo(str, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1, &rx1,&ry1,&rx2,&ry2);
2020-08-08 15:47:34 +02:00
#else
text_bbox(str, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1, &rx1,&ry1,&rx2,&ry2);
2020-08-08 15:47:34 +02:00
#endif
xscale*=nocairo_font_xscale;
yscale*=nocairo_font_yscale;
if(!textclip(areax1,areay1,areax2,areay2,rx1,ry1,rx2,ry2)) return;
set_ps_colors(gctext);
2020-08-08 15:47:34 +02:00
x1=rx1;y1=ry1;
if(rot&1) {y1=ry2;rot=3;}
else rot=0;
flip = 0; yy=y1;
while(str[pos2])
{
cc = (int)str[pos2++];
if(cc=='\n')
2020-08-08 15:47:34 +02:00
{
yy+=(FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*
yscale;
pos=0;
continue;
}
2020-08-08 15:47:34 +02:00
a = pos*(FONTWIDTH+FONTWHITESPACE);
for(i=0;i<character[cc][0]*4;i+=4)
{
curr_x1 = ( character[cc][i+1]+ a ) * xscale + x1;
curr_y1 = ( character[cc][i+2] ) * yscale+yy;
curr_x2 = ( character[cc][i+3]+ a ) * xscale + x1;
curr_y2 = ( character[cc][i+4] ) * yscale+yy;
ROTATION(x1,y1,curr_x1,curr_y1,rx1,ry1);
ROTATION(x1,y1,curr_x2,curr_y2,rx2,ry2);
ORDER(rx1,ry1,rx2,ry2);
2020-09-03 10:05:48 +02:00
ps_drawline(gctext, rx1, ry1, rx2, ry2, 0);
2020-08-08 15:47:34 +02:00
}
pos++;
}
}
static void ps_drawgrid()
{
double x,y;
double delta,tmp;
if(!draw_grid) return;
delta=cadgrid* xctx->mooz;
2020-08-08 15:47:34 +02:00
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
2020-08-08 15:47:34 +02:00
set_ps_colors(GRIDLAYER);
if(y>areay1 && y<areay2)
{
ps_xdrawline(GRIDLAYER,areax1+1,(int)y, areax2-1, (int)y);
}
if(x>areax1 && x<areax2)
{
ps_xdrawline(GRIDLAYER,(int)x,areay1+1, (int)x, areay2-1);
}
set_ps_colors(GRIDLAYER);
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<areax2;x+=delta)
2020-08-08 15:47:34 +02:00
{
for(y=tmp;y<areay2;y+=delta)
{
ps_xdrawpoint(GRIDLAYER,(int)(x), (int)(y));
}
}
}
static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
double xoffset, double yoffset)
2020-08-08 15:47:34 +02:00
/* draws current layer only, should be called within */
{ /* a "for(i=0;i<cadlayers;i++)" loop */
int j;
double x0,y0,x1,y1,x2,y2;
int flip, textlayer;
xLine line;
xRect box;
xText text;
2020-08-08 15:47:34 +02:00
xArc arc;
xPoly polygon;
2020-08-08 15:47:34 +02:00
if(xctx->inst[n].ptr == -1) return;
if( (layer != PINLAYER && !enable_layer[layer]) ) return;
2020-08-08 15:47:34 +02:00
if(layer==0)
{
x1=X_TO_PS(xctx->inst[n].x1);
x2=X_TO_PS(xctx->inst[n].x2);
y1=Y_TO_PS(xctx->inst[n].y1);
y2=Y_TO_PS(xctx->inst[n].y2);
2020-08-08 15:47:34 +02:00
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
{
xctx->inst[n].flags|=1;
2020-08-08 15:47:34 +02:00
return;
}
else xctx->inst[n].flags&=~1;
2020-08-08 15:47:34 +02:00
/* following code handles different text color for labels/pins 06112002 */
}
else if(xctx->inst[n].flags&1)
2020-08-08 15:47:34 +02:00
{
dbg(1, "draw_symbol(): skippinginst %d\n", n);
return;
}
flip = xctx->inst[n].flip;
2020-08-08 15:47:34 +02:00
if(tmp_flip) flip = !flip;
rot = (xctx->inst[n].rot + rot ) & 0x3;
x0=xctx->inst[n].x0 + xoffset;
y0=xctx->inst[n].y0 + yoffset;
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer];j++)
2020-08-08 15:47:34 +02:00
{
line = ((xctx->inst[n].ptr+ xctx->sym)->line[layer])[j];
2020-08-08 15:47:34 +02:00
ROTATION(0.0,0.0,line.x1,line.y1,x1,y1);
ROTATION(0.0,0.0,line.x2,line.y2,x2,y2);
ORDER(x1,y1,x2,y2);
2020-09-03 10:05:48 +02:00
ps_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
2020-08-08 15:47:34 +02:00
}
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->polygons[layer];j++)
2020-08-08 15:47:34 +02:00
{
polygon = ((xctx->inst[n].ptr+ xctx->sym)->poly[layer])[j];
2020-08-08 15:47:34 +02:00
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
int k;
double *x = my_malloc(309, sizeof(double) * polygon.points);
double *y = my_malloc(310, sizeof(double) * polygon.points);
for(k=0;k<polygon.points;k++) {
ROTATION(0.0,0.0,polygon.x[k],polygon.y[k],x[k],y[k]);
x[k]+= x0;
y[k] += y0;
}
2020-09-03 10:05:48 +02:00
ps_drawpolygon(layer, NOW, x, y, polygon.points, polygon.fill, polygon.dash);
2020-08-08 15:47:34 +02:00
my_free(876, &x);
my_free(877, &y);
}
2020-08-08 15:47:34 +02:00
}
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->arcs[layer];j++)
2020-08-08 15:47:34 +02:00
{
double angle;
arc = ((xctx->inst[n].ptr+ xctx->sym)->arc[layer])[j];
2020-08-08 15:47:34 +02:00
if(flip) {
angle = 270.*rot+180.-arc.b-arc.a;
} else {
angle = arc.a+rot*270.;
}
angle = fmod(angle, 360.);
if(angle<0.) angle+=360.;
ROTATION(0.0,0.0,arc.x,arc.y,x1,y1);
2020-09-03 10:05:48 +02:00
ps_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
2020-08-08 15:47:34 +02:00
}
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->rects[layer];j++)
2020-08-08 15:47:34 +02:00
{
box = ((xctx->inst[n].ptr+ xctx->sym)->rect[layer])[j];
2020-08-08 15:47:34 +02:00
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
RECTORDER(x1,y1,x2,y2);
2020-09-03 10:05:48 +02:00
ps_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
2020-08-08 15:47:34 +02:00
}
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
(sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) )
2020-08-08 15:47:34 +02:00
{
const char *txtptr;
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->texts;j++)
2020-08-08 15:47:34 +02:00
{
text = (xctx->inst[n].ptr+ xctx->sym)->text[j];
/* if(text.xscale*FONTWIDTH* xctx->mooz<1) continue; */
txtptr= translate(n, text.txt_ptr);
2020-08-08 15:47:34 +02:00
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
textlayer = layer;
if( !(layer == PINLAYER && (xctx->inst[n].flags & 4))) {
textlayer = (xctx->inst[n].ptr+ xctx->sym)->text[j].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer;
}
if((layer == PINLAYER && xctx->inst[n].flags & 4) || enable_layer[textlayer]) {
ps_draw_string(textlayer, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter,
x0+x1, y0+y1, text.xscale, text.yscale);
}
2020-08-08 15:47:34 +02:00
}
restore_lw();
}
Tcl_SetResult(interp,"",TCL_STATIC);
2020-08-08 15:47:34 +02:00
}
static void fill_ps_colors()
{
char s[200]; /* overflow safe 20161122 */
unsigned int i,c;
if(debug_var>=1) {
tcleval( "puts $ps_colors");
2020-08-08 15:47:34 +02:00
}
for(i=0;i<cadlayers;i++) {
my_snprintf(s, S(s), "lindex $ps_colors %d", i);
tcleval( s);
sscanf(tclresult(),"%x", &c);
2020-08-08 15:47:34 +02:00
ps_colors[i].red = (c & 0xff0000) >> 16;
ps_colors[i].green = (c & 0x00ff00) >> 8;
ps_colors[i].blue = (c & 0x0000ff);
}
2020-08-08 15:47:34 +02:00
}
void ps_draw(void)
{
double dx, dy, delta,scale;
int c,i, textlayer;
char *tmp=NULL;
2020-08-08 15:47:34 +02:00
int old_grid;
int modified_save;
const char *r;
if(!plotfile[0]) {
my_strdup(59, &tmp, "tk_getSaveFile -title {Select destination file} -initialdir [pwd]");
2020-08-08 15:47:34 +02:00
tcleval(tmp);
my_free(878, &tmp);
r = tclresult();
2020-08-08 15:47:34 +02:00
if(r[0]) my_strncpy(plotfile, r, S(plotfile));
else {
return;
}
}
modified_save=modified;
push_undo();
2020-08-08 15:47:34 +02:00
trim_wires(); /* 20161121 add connection boxes on wires but undo at end */
ps_colors=my_calloc(311, cadlayers, sizeof(Ps_color));
if(ps_colors==NULL){
fprintf(errfp, "ps_draw(): calloc error\n");tcleval( "exit");
}
2020-08-08 15:47:34 +02:00
fill_ps_colors();
old_grid=draw_grid;
draw_grid=0;
dx=areax2-areax1;
dy=areay2-areay1;
dbg(1, "ps_draw(): dx=%.16g dy=%.16g\n", dx, dy);
2020-08-08 15:47:34 +02:00
fd=fopen("plot.ps", "w");
fprintf(fd, "%%!\n");
fprintf(fd, "%%%%BoundingBox: (atend)\n");
fprintf(fd, "%%%%Title: xschem plot\n");
fprintf(fd, "%%%%Creator: xschem\n");
fprintf(fd, "%%%%Pages: 1\n");
fprintf(fd, "%%%%DocumentFonts: (atend)\n");
fprintf(fd, "%%%%EndComments\n");
fprintf(fd, "%%%%BeginProlog\n\n");
fprintf(fd, "%%%%EndProlog\n");
fprintf(fd, "%%%%BeginSetup\n");
if(a3page) {
fprintf(fd, "%%%%BeginFeature: *PageSize A3\n");
fprintf(fd, "<< /PageSize [842 1191] /ImagingBBox null >> setpagedevice\n");
}
fprintf(fd, "%%%%EndSetup\n");
fprintf(fd, "%%%%Page: 1 1\n\n");
fprintf(fd,"/cm {28.346457 mul} bind def\n");
fprintf(fd,"/LT {lineto} bind def\n");
fprintf(fd,"/MT {moveto} bind def\n");
fprintf(fd,"/L {moveto lineto stroke} bind def\n");
fprintf(fd,"/A {arcn stroke} bind def\n");
fprintf(fd,"/AF {arcn fill stroke} bind def\n");
fprintf(fd,"/R {rectstroke} bind def\n");
fprintf(fd,"/RF {rectfill} bind def\n");
if(dx/dy>27.7/19 || dy/dx>27.7/19)
{
delta=dx>dy? dx:dy;
if(a3page) scale=28.7*28.346457/delta*sqrt(2);
else scale=27.7*28.346457/delta;
}
else
{
delta=dx>dy? dy:dx;
if(a3page) scale=20*28.346457/delta*sqrt(2);
else scale=19*28.346457/delta;
}
if(dx>dy)
{
if(a3page) fprintf(fd,"28.99137803 cm 41.29503602 cm translate\n");
else fprintf(fd,"20 cm 28.7 cm translate\n");
fprintf(fd,"-90 rotate\n");
fprintf(fd,"%.16g %.16g scale\n",scale,-scale);
}
else
{
fprintf(fd,"1 cm 28.7 cm translate\n");
fprintf(fd,"%.16g %.16g scale\n",scale,-scale);
}
fprintf(fd, "1 setlinejoin 1 setlinecap\n");
restore_lw();
ps_drawgrid();
for(i=0;i<xctx->texts;i++)
2020-08-08 15:47:34 +02:00
{
textlayer = xctx->text[i].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
ps_draw_string(textlayer, xctx->text[i].txt_ptr,
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0,xctx->text[i].y0,
xctx->text[i].xscale, xctx->text[i].yscale);
2020-08-08 15:47:34 +02:00
}
restore_lw();
for(c=0;c<cadlayers;c++)
{
set_ps_colors(c);
for(i=0;i<xctx->lines[c];i++)
ps_drawline(c, xctx->line[c][i].x1, xctx->line[c][i].y1,
xctx->line[c][i].x2, xctx->line[c][i].y2, xctx->line[c][i].dash);
for(i=0;i<xctx->rects[c];i++)
2020-08-08 15:47:34 +02:00
{
ps_filledrect(c, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash);
2020-08-08 15:47:34 +02:00
}
for(i=0;i<xctx->arcs[c];i++)
2020-08-08 15:47:34 +02:00
{
ps_drawarc(c, xctx->arc[c][i].fill, xctx->arc[c][i].x, xctx->arc[c][i].y,
xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b, xctx->arc[c][i].dash);
2020-08-08 15:47:34 +02:00
}
for(i=0;i<xctx->polygons[c];i++) {
ps_drawpolygon(c, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points,
xctx->poly[c][i].fill, xctx->poly[c][i].dash);
2020-08-08 15:47:34 +02:00
}
for(i=0;i<xctx->instances;i++)
2020-08-08 15:47:34 +02:00
ps_draw_symbol(i,c,0,0,0.0,0.0);
}
set_ps_colors(WIRELAYER);
for(i=0;i<xctx->wires;i++)
2020-08-08 15:47:34 +02:00
{
ps_drawline(WIRELAYER, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
2020-08-08 15:47:34 +02:00
}
{
double x1, y1, x2, y2;
struct wireentry *wireptr;
int i;
update_conn_cues(0, 0);
/* draw connecting dots */
x1 = X_TO_XSCHEM(areax1);
y1 = Y_TO_XSCHEM(areay1);
x2 = X_TO_XSCHEM(areax2);
y2 = Y_TO_XSCHEM(areay2);
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
i = wireptr->n;
if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */
ps_drawarc(WIRELAYER, 1, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360, 0);
2020-08-08 15:47:34 +02:00
}
if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */
ps_drawarc(WIRELAYER, 1, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360, 0);
2020-08-08 15:47:34 +02:00
}
}
}
2020-08-08 15:47:34 +02:00
dbg(1, "ps_draw(): INT_WIDTH(xctx->lw)=%d plotfile=%s\n",INT_WIDTH(xctx->lw), plotfile);
2020-08-08 15:47:34 +02:00
fprintf(fd, "showpage\n\n");
fprintf(fd, "%%%%EOF\n");
fclose(fd);
draw_grid=old_grid;
my_free(879, &ps_colors);
if(plotfile[0]) {
my_strdup(53, &tmp, "convert_to_pdf plot.ps ");
2020-08-08 15:47:34 +02:00
my_strcat(54, &tmp, plotfile);
} else {
my_strdup(312, &tmp, "convert_to_pdf plot.ps plot.pdf");
2020-08-08 15:47:34 +02:00
}
my_strncpy(plotfile,"", S(plotfile));
tcleval( tmp);
my_free(880, &tmp);
pop_undo(0);
modified=modified_save;
2020-08-08 15:47:34 +02:00
}