complete change `draw text at end as done in draw() fo preserve stacking order of objects`, in draw_symbol(), svg_draw_symbol() and ps_draw_symbol()

This commit is contained in:
stefan schippers 2025-04-21 11:35:18 +02:00
parent d2e40a8605
commit 6b12969d6d
4 changed files with 33 additions and 20 deletions

View File

@ -664,8 +664,8 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
what = NOW;
disabled = 1;
}
if( (xctx->inst[n].flags & HIDE_INST) ||
(xctx->hide_symbols==1 && (xctx->inst[n].ptr+ xctx->sym)->prop_ptr &&
if( (xctx->inst[n].flags & HIDE_INST) || ((xctx->inst[n].ptr + xctx->sym)->flags & HIDE_INST) ||
(xctx->hide_symbols==1 && (xctx->inst[n].ptr + xctx->sym)->type &&
!strcmp( (xctx->inst[n].ptr+ xctx->sym)->type, "subcircuit") ) ||
(xctx->hide_symbols == 2) ) {
hide = 1;
@ -720,7 +720,8 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
y0=xctx->inst[n].y0 + yoffset;
symptr = (xctx->inst[n].ptr+ xctx->sym);
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) goto draw_texts;
if(layer == cadlayers) goto draw_texts;
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) return;
if(!hide) {
for(j=0;j< symptr->lines[layer]; ++j)
@ -821,7 +822,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
draw_texts:
if(xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers - 1)) {
if(xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers)) {
if(c != layer) c_for_text = c;
else if(xctx->inst[n].flags & PIN_OR_LABEL) c_for_text = TEXTWIRELAYER;
else c_for_text = TEXTLAYER;
@ -921,7 +922,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
if(xctx->inst[n].ptr == -1) return;
if(!has_x) return;
if( (xctx->inst[n].flags & HIDE_INST) ||
if( (xctx->inst[n].flags & HIDE_INST) || ((xctx->inst[n].ptr + xctx->sym)->flags & HIDE_INST) ||
(xctx->hide_symbols==1 && (xctx->inst[n].ptr+ xctx->sym)->prop_ptr &&
!strcmp( (xctx->inst[n].ptr+ xctx->sym)->type, "subcircuit") ) ||
(xctx->hide_symbols == 2) ) {
@ -5197,7 +5198,11 @@ void draw(void)
((c==cadlayers - 1) && symptr->texts) )
{
if(c == 0 || c == cadlayers - 1 || draw_layer) {
draw_symbol(ADD, cc, i,c, 0, 0, 0.0, 0.0); /* ... then draw current layer */
draw_symbol(ADD, cc, i, c, 0, 0, 0.0, 0.0); /* ... then draw current layer */
if(c == cadlayers - 1) {
if(cc == c) draw_symbol(ADD, c + 1, i, c + 1, 0, 0, 0.0, 0.0); /* ... draw texts */
else draw_symbol(ADD, cc , i, c + 1, 0, 0, 0.0, 0.0); /* ... draw texts */
}
}
}
}

View File

@ -2224,7 +2224,8 @@ void draw_hilight_net(int on_window)
if( c==0 || /*draw_symbol call is needed on layer 0 to avoid redundant work (outside check) */
symptr->lines[c] || symptr->rects[c] || symptr->arcs[c] || symptr->polygons[c] ||
((c == cadlayers - 1) && symptr->texts)) {
draw_symbol(ADD, col, i,c,0,0,0.0,0.0);
draw_symbol(ADD, col, i, c, 0, 0, 0.0, 0.0);
if(c == cadlayers - 1) draw_symbol(ADD, col, i, c + 1, 0, 0, 0.0, 0.0); /* draw texts */
}
filledrect(col, END, 0.0, 0.0, 0.0, 0.0, 2, -1, -1); /* last parameter must be 2! */
drawarc(col, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);

View File

@ -919,17 +919,16 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho
if(shorted_instance(n, lvs_ignore)) {
c = PINLAYER;
what = NOW;
disabled = 2;
}
else if(xctx->inst[n].flags & IGNORE_INST) {
c = GRIDLAYER;
what = NOW;
disabled = 1;
}
if(xctx->inst[n].color != -10000) c = get_color(xctx->inst[n].color);
if( (xctx->inst[n].flags & HIDE_INST) ||
((xctx->hide_symbols==1 && (xctx->inst[n].ptr+ xctx->sym)->prop_ptr &&
if( (xctx->inst[n].flags & HIDE_INST) || ((xctx->inst[n].ptr + xctx->sym)->flags & HIDE_INST) ||
((xctx->hide_symbols==1 && (xctx->inst[n].ptr + xctx->sym)->type &&
!strcmp( (xctx->inst[n].ptr+ xctx->sym)->type, "subcircuit") )) ||
(xctx->hide_symbols == 2) ) {
hide = 1;
@ -996,7 +995,7 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho
}
else if(xctx->inst[n].flags&1)
{
dbg(1, "draw_symbol(): skipping inst %d\n", n);
dbg(1, "ps_draw_symbol(): skipping inst %d\n", n);
return;
}
flip = xctx->inst[n].flip;
@ -1007,7 +1006,8 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho
y0=xctx->inst[n].y0 + yoffset;
symptr = (xctx->inst[n].ptr+ xctx->sym);
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) goto draw_texts;
if(layer == cadlayers) goto draw_texts;
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) return;
if(!hide) {
if(symptr->lines[layer] || symptr->polygons[layer] || symptr->arcs[layer]) {
@ -1108,7 +1108,7 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho
} /* if( (!hide && xctx->enable_layer[layer]) || ... */
draw_texts:
if(xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers - 1)) {
if(xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers)) {
const char *txtptr;
if(c != layer) c_for_text = c;
else if(xctx->inst[n].flags & PIN_OR_LABEL) c_for_text = TEXTWIRELAYER;
@ -1485,7 +1485,10 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
/* bring outside previous for(c=0...) loop since ps_embedded_graph() calls ps_draw_symbol() */
for(c=0;c<cadlayers; ++c) {
for(i=0;i<xctx->instances; ++i) {
ps_draw_symbol(c, i,c,what,0,0,0.0,0.0);
ps_draw_symbol(c, i, c, what, 0,0, 0.0, 0.0);
if(c == cadlayers - 1) {
ps_draw_symbol(c + 1 , i, c + 1, what, 0, 0, 0.0, 0.0); /* ... draw texts */
}
}
}
prepare_netlist_structs(0); /* NEEDED: data was cleared by trim_wires() */

View File

@ -652,8 +652,8 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
}
if(xctx->inst[n].color != -10000) c = get_color(xctx->inst[n].color);
if( (xctx->inst[n].flags & HIDE_INST) ||
((xctx->hide_symbols==1 && (xctx->inst[n].ptr+ xctx->sym)->prop_ptr &&
if( (xctx->inst[n].flags & HIDE_INST) || ((xctx->inst[n].ptr + xctx->sym)->flags & HIDE_INST) ||
((xctx->hide_symbols==1 && (xctx->inst[n].ptr + xctx->sym)->type &&
!strcmp( (xctx->inst[n].ptr+ xctx->sym)->type, "subcircuit") )) ||
(xctx->hide_symbols == 2) ) {
hide = 1;
@ -694,7 +694,8 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
y0=xctx->inst[n].y0 + yoffset;
symptr = (xctx->inst[n].ptr+ xctx->sym);
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) goto draw_texts;
if(layer == cadlayers) goto draw_texts;
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) return;
if(!hide) {
for(j=0;j< symptr->lines[layer]; ++j) {
@ -787,7 +788,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
}
draw_texts:
if( xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers - 1)) {
if( xctx->sym_txt && !(xctx->inst[n].flags & HIDE_SYMBOL_TEXTS) && (layer == cadlayers)) {
const char *txtptr;
if(c != layer) c_for_text = c;
else if(xctx->inst[n].flags & PIN_OR_LABEL) c_for_text = TEXTWIRELAYER;
@ -805,7 +806,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
textlayer = c_for_text;
/* do not allow custom text color on hilighted instances */
if(disabled == 1) textlayer = GRIDLAYER;
if(disabled == 1) textlayer = GRIDLAYER;
else if(disabled == 2) textlayer = PINLAYER;
else if( xctx->inst[n].color == -10000) {
int lay;
@ -1077,6 +1078,9 @@ void svg_draw(void)
}
for(i=0;i<xctx->instances; ++i) {
svg_draw_symbol(c,i,c,0,0,0.0,0.0);
if(c == cadlayers - 1) {
svg_draw_symbol(c + 1 , i, c + 1, 0, 0, 0.0, 0.0); /* ... draw texts */
}
}
}
prepare_netlist_structs(0); /* NEEDED: data was cleared by trim_wires() */