code formatting

This commit is contained in:
Stefan Frederik 2020-12-22 22:37:39 +01:00
parent 1cfea4d1d3
commit 26b5b67262
2 changed files with 9 additions and 25 deletions

View File

@ -471,7 +471,6 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue; if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue;
txtptr= translate(n, text.txt_ptr); txtptr= translate(n, text.txt_ptr);
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1); ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
textlayer = c; textlayer = c;
/* do not allow custom text color on PINLAYER hilighted instances */ /* do not allow custom text color on PINLAYER hilighted instances */
if( !(xctx->inst[n].color == PINLAYER)) { if( !(xctx->inst[n].color == PINLAYER)) {
@ -490,7 +489,6 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
slant = CAIRO_FONT_SLANT_NORMAL; slant = CAIRO_FONT_SLANT_NORMAL;
if(symptr->text[j].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC; if(symptr->text[j].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(symptr->text[j].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE; if(symptr->text[j].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(xctx->cairo_ctx); cairo_save(xctx->cairo_ctx);
cairo_save(xctx->cairo_save_ctx); cairo_save(xctx->cairo_save_ctx);
cairo_select_font_face (xctx->cairo_ctx, textfont, slant, weight); cairo_select_font_face (xctx->cairo_ctx, textfont, slant, weight);

View File

@ -405,21 +405,18 @@ static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot,
if(xctx->inst[n].ptr == -1) return; if(xctx->inst[n].ptr == -1) return;
if( (layer != PINLAYER && !enable_layer[layer]) ) return; if( (layer != PINLAYER && !enable_layer[layer]) ) return;
if(layer==0) if(layer==0) {
{
x1=X_TO_SVG(xctx->inst[n].x1); x1=X_TO_SVG(xctx->inst[n].x1);
x2=X_TO_SVG(xctx->inst[n].x2); x2=X_TO_SVG(xctx->inst[n].x2);
y1=Y_TO_SVG(xctx->inst[n].y1); y1=Y_TO_SVG(xctx->inst[n].y1);
y2=Y_TO_SVG(xctx->inst[n].y2); y2=Y_TO_SVG(xctx->inst[n].y2);
if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2)) if(OUTSIDE(x1,y1,x2,y2,xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2)) {
{
xctx->inst[n].flags|=1; xctx->inst[n].flags|=1;
return; return;
} }
else xctx->inst[n].flags&=~1; else xctx->inst[n].flags&=~1;
} }
else if(xctx->inst[n].flags&1) else if(xctx->inst[n].flags&1) {
{
dbg(1, "draw_symbol(): skipping inst %d\n", n); dbg(1, "draw_symbol(): skipping inst %d\n", n);
return; return;
} }
@ -429,16 +426,14 @@ static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot,
x0=xctx->inst[n].x0 + xoffset; x0=xctx->inst[n].x0 + xoffset;
y0=xctx->inst[n].y0 + yoffset; y0=xctx->inst[n].y0 + yoffset;
symptr = (xctx->inst[n].ptr+ xctx->sym); symptr = (xctx->inst[n].ptr+ xctx->sym);
for(j=0;j< symptr->lines[layer];j++) for(j=0;j< symptr->lines[layer];j++) {
{
line = (symptr->line[layer])[j]; line = (symptr->line[layer])[j];
ROTATION(rot, flip, 0.0,0.0,line.x1,line.y1,x1,y1); ROTATION(rot, flip, 0.0,0.0,line.x1,line.y1,x1,y1);
ROTATION(rot, flip, 0.0,0.0,line.x2,line.y2,x2,y2); ROTATION(rot, flip, 0.0,0.0,line.x2,line.y2,x2,y2);
ORDER(x1,y1,x2,y2); ORDER(x1,y1,x2,y2);
svg_drawline(layer, line.bus, x0+x1, y0+y1, x0+x2, y0+y2, line.dash); svg_drawline(layer, line.bus, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
} }
for(j=0;j< symptr->polygons[layer];j++) for(j=0;j< symptr->polygons[layer];j++) {
{
polygon = (symptr->poly[layer])[j]; polygon = (symptr->poly[layer])[j];
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
int k; int k;
@ -454,8 +449,7 @@ static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot,
my_free(962, &y); my_free(962, &y);
} }
} }
for(j=0;j< symptr->arcs[layer];j++) for(j=0;j< symptr->arcs[layer];j++) {
{
double angle; double angle;
arc = (symptr->arc[layer])[j]; arc = (symptr->arc[layer])[j];
if(flip) { if(flip) {
@ -469,8 +463,7 @@ static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot,
svg_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash); svg_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
} }
if( enable_layer[layer] ) for(j=0;j< symptr->rects[layer];j++) if( enable_layer[layer] ) for(j=0;j< symptr->rects[layer];j++) {
{
box = (symptr->rect[layer])[j]; box = (symptr->rect[layer])[j];
ROTATION(rot, flip, 0.0,0.0,box.x1,box.y1,x1,y1); ROTATION(rot, flip, 0.0,0.0,box.x1,box.y1,x1,y1);
ROTATION(rot, flip, 0.0,0.0,box.x2,box.y2,x2,y2); ROTATION(rot, flip, 0.0,0.0,box.x2,box.y2,x2,y2);
@ -478,11 +471,9 @@ static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot,
svg_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash); svg_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
} }
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) || if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
(sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) ) (sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) ) {
{
const char *txtptr; const char *txtptr;
for(j=0;j< symptr->texts;j++) for(j=0;j< symptr->texts;j++) {
{
text = symptr->text[j]; text = symptr->text[j];
/* if(text.xscale*FONTWIDTH* xctx->mooz<1) continue; */ /* if(text.xscale*FONTWIDTH* xctx->mooz<1) continue; */
txtptr= translate(n, text.txt_ptr); txtptr= translate(n, text.txt_ptr);
@ -498,7 +489,6 @@ static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot,
my_snprintf(svg_font_family, S(svg_font_family), svg_font_name); my_snprintf(svg_font_family, S(svg_font_family), svg_font_name);
my_snprintf(svg_font_style, S(svg_font_style), "normal"); my_snprintf(svg_font_style, S(svg_font_style), "normal");
my_snprintf(svg_font_weight, S(svg_font_weight), "normal"); my_snprintf(svg_font_weight, S(svg_font_weight), "normal");
textfont = symptr->text[j].font; textfont = symptr->text[j].font;
if( (textfont && textfont[0])) { if( (textfont && textfont[0])) {
my_snprintf(svg_font_family, S(svg_font_family), textfont); my_snprintf(svg_font_family, S(svg_font_family), textfont);
@ -556,7 +546,6 @@ static void fill_svg_colors()
} }
void svg_draw(void) void svg_draw(void)
{ {
double dx, dy; double dx, dy;
@ -678,12 +667,9 @@ void svg_draw(void)
{ {
textlayer = xctx->text[i].layer; textlayer = xctx->text[i].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER; if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
my_snprintf(svg_font_family, S(svg_font_family), svg_font_name); my_snprintf(svg_font_family, S(svg_font_family), svg_font_name);
my_snprintf(svg_font_style, S(svg_font_style), "normal"); my_snprintf(svg_font_style, S(svg_font_style), "normal");
my_snprintf(svg_font_weight, S(svg_font_weight), "normal"); my_snprintf(svg_font_weight, S(svg_font_weight), "normal");
textfont = xctx->text[i].font; textfont = xctx->text[i].font;
if( (textfont && textfont[0])) { if( (textfont && textfont[0])) {
my_snprintf(svg_font_family, S(svg_font_family), textfont); my_snprintf(svg_font_family, S(svg_font_family), textfont);