add attribute text_layer_n=lay, where n = text object inside symbol instance to change its layer

This commit is contained in:
stefan schippers 2024-06-21 13:18:52 +02:00
parent 4e236750ed
commit d42ecf96c5
2 changed files with 30 additions and 5 deletions

View File

@ -420,6 +420,27 @@ void draw_temp_string(GC gctext, int what, const char *str, short rot, short fli
my_free(_ALLOC_ID_, &estr);
}
void get_sym_text_layer(int inst, int text_n, int *layer)
{
char attr[50];
const char *tl=NULL;
int lay;
int sym_n = xctx->inst[inst].ptr;
*layer = -1;
if(sym_n >= 0 && xctx->sym[sym_n].texts > text_n) {
if(xctx->inst[inst].prop_ptr && strstr(xctx->inst[inst].prop_ptr, "text_layer_")) {
my_snprintf(attr, S(attr), "text_layer_%d", text_n);
tl = get_tok_value(xctx->inst[inst].prop_ptr, attr, 0);
} else {
xctx->tok_size = 0;
}
if(xctx->tok_size) {
lay = atoi(tl);
if(lay >= 0 && lay < cadlayers) *layer = lay;
}
}
}
void get_sym_text_size(int inst, int text_n, double *xscale, double *yscale)
{
@ -712,13 +733,16 @@ void draw_symbol(int what,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;
/* do not allow custom text color on hilighted instances */
if(disabled == 1) textlayer = GRIDLAYER;
if(xctx->only_probes) textlayer = GRIDLAYER;
else if(disabled == 1) textlayer = GRIDLAYER;
else if(disabled == 2) textlayer = PINLAYER;
else if( xctx->inst[n].color == -10000) {
textlayer = symptr->text[j].layer;
if(xctx->only_probes) textlayer = GRIDLAYER;
else if(textlayer < 0 || textlayer >= cadlayers) textlayer = c;
int lay;
get_sym_text_layer(n, j, &lay);
if(lay != -1) textlayer = lay;
else textlayer = symptr->text[j].layer;
}
if(textlayer < 0 || textlayer >= cadlayers) textlayer = c;
/* display PINLAYER colored instance texts even if PINLAYER disabled */
if(xctx->inst[n].color == -PINLAYER || xctx->enable_layer[textlayer]) {
char *txtptr = NULL;

View File

@ -1404,6 +1404,7 @@ extern void drawline(int c, int what, double x1,double y1,double x2,double y2, i
extern void draw_string(int layer,int what, const char *str, short rot, short flip, int hcenter, int vcenter,
double x1, double y1, double xscale, double yscale);
extern void get_sym_text_size(int inst, int text_n, double *xscale, double *yscale);
extern void get_sym_text_layer(int inst, int text_n, int *layer);
extern void draw_symbol(int what,int c, int n,int layer,
short tmp_flip, short tmp_rot, double xoffset, double yoffset);
extern void drawrect(int c, int what, double rectx1,double recty1,
@ -1705,7 +1706,7 @@ extern void redraw_hilights(int clear);
extern void set_tcl_netlist_type(void);
extern int prepare_netlist_structs(int for_netlist);
extern int skip_instance(int i, int skip_short, int lvs_ignore);
extern int shorted_instance(int i, int lvs_ignore);
extern int dis_shorted_instance(int i);
extern int compare_schematics(const char *filename);
extern void create_gc(void);
extern void free_gc(void);