instance attribute "hide=true" will make the instance display as a bounding box only
This commit is contained in:
parent
3ec47760a7
commit
d2d9eaa4e8
|
|
@ -123,6 +123,8 @@ name="mchanged_name" model=\"nmos\" w="20u" l="3u" m="10"
|
|||
<p> A <kbd>lock=true</kbd> attribute will make the symbol not editable. the only way to make it editable again is
|
||||
to right click on it to bring up the edit attributes dialog box and set to false. This is useful for title
|
||||
symbols. </p>
|
||||
<li><kbd>hide</kbd></li>
|
||||
<p> A <kbd>hide=true</kbd> attribute will only display the symbol bounding box.</p>
|
||||
<li><kbd>highlight</kbd></li>
|
||||
<p>If set to <kbd>true</kbd> the symbol will be highlighted when one of the nets attached to its pins are highlighted.</p>
|
||||
<li><kbd>net_name</kbd></li>
|
||||
|
|
|
|||
|
|
@ -1061,6 +1061,8 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
|
|||
}
|
||||
dbg(1, "place_symbol(): done set_inst_prop()\n"); /* 03-02-2000 */
|
||||
|
||||
if(!strcmp(get_tok_value(xctx->inst[n].prop_ptr,"hide",0), "true"))
|
||||
xctx->inst[n].flags |= HIDE_INST;
|
||||
if(!strcmp(get_tok_value(xctx->inst[n].prop_ptr,"highlight",0), "true"))
|
||||
xctx->inst[n].flags |= HILIGHT_CONN;
|
||||
type = xctx->sym[xctx->inst[n].ptr].type;
|
||||
|
|
|
|||
172
src/draw.c
172
src/draw.c
|
|
@ -437,8 +437,10 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
if(xctx->inst[n].ptr == -1) return;
|
||||
if( (layer != PINLAYER && !xctx->enable_layer[layer]) ) return;
|
||||
if(!has_x) return;
|
||||
if( (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) ) {
|
||||
if( (xctx->inst[n].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) ) {
|
||||
hide = 1;
|
||||
} else {
|
||||
hide = 0;
|
||||
|
|
@ -618,7 +620,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers; ++i)" loop */
|
||||
int j;
|
||||
int j, hide = 0;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
short flip;
|
||||
xLine *line;
|
||||
|
|
@ -636,6 +638,15 @@ 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) ||
|
||||
(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) ) {
|
||||
hide = 1;
|
||||
} else {
|
||||
hide = 0;
|
||||
}
|
||||
|
||||
flip = xctx->inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (xctx->inst[n].rot + rot ) & 0x3;
|
||||
|
|
@ -658,6 +669,17 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
return;
|
||||
}
|
||||
else xctx->inst[n].flags&=~1;
|
||||
if(hide) {
|
||||
symptr = (xctx->inst[n].ptr+ xctx->sym);
|
||||
x0=xctx->inst[n].x0;
|
||||
y0=xctx->inst[n].y0;
|
||||
x0 += xoffset;
|
||||
y0 += yoffset;
|
||||
ROTATION(rot, flip, 0.0,0.0,symptr->minx, symptr->miny,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,symptr->maxx, symptr->maxy,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
drawtemprect(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
} else if(xctx->inst[n].flags&1) {
|
||||
dbg(2, "draw_symbol(): skipping inst %d\n", n);
|
||||
return;
|
||||
|
|
@ -666,81 +688,83 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
x0=xctx->inst[n].x0 + xoffset;
|
||||
y0=xctx->inst[n].y0 + yoffset;
|
||||
symptr = (xctx->inst[n].ptr+ xctx->sym);
|
||||
for(j=0;j< symptr->lines[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->x2,line->y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
if(line->bus)
|
||||
drawtempline(gc,THICK, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
else
|
||||
drawtempline(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
for(j=0;j< symptr->polygons[layer]; ++j)
|
||||
{
|
||||
polygon = &(symptr->poly[layer])[j];
|
||||
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
for(k=0;k<polygon->points; ++k) {
|
||||
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
|
||||
x[k] += x0;
|
||||
y[k] += y0;
|
||||
if(!hide) {
|
||||
for(j=0;j< symptr->lines[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->x2,line->y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
if(line->bus)
|
||||
drawtempline(gc,THICK, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
else
|
||||
drawtempline(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
for(j=0;j< symptr->polygons[layer]; ++j)
|
||||
{
|
||||
polygon = &(symptr->poly[layer])[j];
|
||||
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
for(k=0;k<polygon->points; ++k) {
|
||||
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
|
||||
x[k] += x0;
|
||||
y[k] += y0;
|
||||
}
|
||||
drawtemppolygon(gc, NOW, x, y, polygon->points);
|
||||
my_free(_ALLOC_ID_, &x);
|
||||
my_free(_ALLOC_ID_, &y);
|
||||
}
|
||||
drawtemppolygon(gc, NOW, x, y, polygon->points);
|
||||
my_free(_ALLOC_ID_, &x);
|
||||
my_free(_ALLOC_ID_, &y);
|
||||
}
|
||||
}
|
||||
|
||||
for(j=0;j< symptr->rects[layer]; ++j)
|
||||
{
|
||||
rect = &(symptr->rect[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x1,rect->y1,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x2,rect->y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
drawtemprect(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
for(j=0;j< symptr->arcs[layer]; ++j)
|
||||
{
|
||||
arc = &(symptr->arc[layer])[j];
|
||||
if(flip) {
|
||||
angle = 270.*rot+180.-arc->b-arc->a;
|
||||
} else {
|
||||
angle = arc->a+rot*270.;
|
||||
|
||||
for(j=0;j< symptr->rects[layer]; ++j)
|
||||
{
|
||||
rect = &(symptr->rect[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x1,rect->y1,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x2,rect->y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
drawtemprect(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
angle = fmod(angle, 360.);
|
||||
if(angle<0.) angle+=360.;
|
||||
ROTATION(rot, flip, 0.0,0.0,arc->x,arc->y,x1,y1);
|
||||
drawtemparc(gc, what, x0+x1, y0+y1, arc->r, angle, arc->b);
|
||||
}
|
||||
|
||||
if(layer==PROPERTYLAYER && xctx->sym_txt)
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< symptr->texts; ++j)
|
||||
{
|
||||
text = symptr->text[j];
|
||||
if(!text.txt_ptr || !text.txt_ptr[0] || text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
if(!xctx->show_hidden_texts && (text.flags & HIDE_TEXT)) continue;
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&text);
|
||||
#endif
|
||||
if(txtptr[0]) draw_temp_string(gc, what, 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);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
for(j=0;j< symptr->arcs[layer]; ++j)
|
||||
{
|
||||
arc = &(symptr->arc[layer])[j];
|
||||
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(rot, flip, 0.0,0.0,arc->x,arc->y,x1,y1);
|
||||
drawtemparc(gc, what, x0+x1, y0+y1, arc->r, angle, arc->b);
|
||||
}
|
||||
|
||||
if(layer==PROPERTYLAYER && xctx->sym_txt)
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< symptr->texts; ++j)
|
||||
{
|
||||
text = symptr->text[j];
|
||||
if(!text.txt_ptr || !text.txt_ptr[0] || text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
if(!xctx->show_hidden_texts && (text.flags & HIDE_TEXT)) continue;
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
#if HAS_CAIRO==1
|
||||
customfont = set_text_custom_font(&text);
|
||||
#endif
|
||||
if(txtptr[0]) draw_temp_string(gc, what, 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);
|
||||
#if HAS_CAIRO==1
|
||||
if(customfont) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1376,6 +1376,9 @@ static void update_symbol(const char *result, int x)
|
|||
if(!strcmp(get_tok_value(xctx->inst[*ii].prop_ptr,"highlight",0), "true"))
|
||||
xctx->inst[*ii].flags |= HILIGHT_CONN;
|
||||
else xctx->inst[*ii].flags &= ~HILIGHT_CONN;
|
||||
if(!strcmp(get_tok_value(xctx->inst[*ii].prop_ptr,"hide",0), "true"))
|
||||
xctx->inst[*ii].flags |= HIDE_INST;
|
||||
else xctx->inst[*ii].flags &= ~HIDE_INST;
|
||||
xctx->inst[*ii].embed = !strcmp(get_tok_value(xctx->inst[*ii].prop_ptr, "embed", 2), "true");
|
||||
} /* end for(k=0;k<xctx->lastsel; ++k) */
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
|
|
|
|||
|
|
@ -281,6 +281,8 @@ static void merge_inst(int k,FILE *fd)
|
|||
new_prop_string(i, prop_ptr, k, tclgetboolvar("disable_unique_names")); /* will also assign .instname */
|
||||
/* the final tmp argument is zero for the 1st call and used in */
|
||||
/* new_prop_string() for cleaning some internal caches. */
|
||||
if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"hide",0), "true"))
|
||||
xctx->inst[i].flags |= HIDE_INST;
|
||||
if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true"))
|
||||
xctx->inst[i].flags |= HILIGHT_CONN;
|
||||
xctx->inst[i].embed = !strcmp(get_tok_value(xctx->inst[i].prop_ptr, "embed", 2), "true");
|
||||
|
|
|
|||
|
|
@ -1891,6 +1891,8 @@ static void load_inst(int k, FILE *fd)
|
|||
load_ascii_string(&prop_ptr,fd);
|
||||
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, prop_ptr);
|
||||
my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0));
|
||||
if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"hide",0), "true"))
|
||||
xctx->inst[i].flags |= HIDE_INST;
|
||||
if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true"))
|
||||
xctx->inst[i].flags |= HILIGHT_CONN;
|
||||
|
||||
|
|
@ -3225,6 +3227,9 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true"))
|
||||
symbol[symbols].flags |= HILIGHT_CONN;
|
||||
else symbol[symbols].flags &= ~HILIGHT_CONN;
|
||||
if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"hide",0), "true"))
|
||||
symbol[symbols].flags |= HIDE_INST;
|
||||
else symbol[symbols].flags &= ~HIDE_INST;
|
||||
|
||||
}
|
||||
else {
|
||||
|
|
@ -3242,6 +3247,9 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true"))
|
||||
symbol[symbols].flags |= HILIGHT_CONN;
|
||||
else symbol[symbols].flags &= ~HILIGHT_CONN;
|
||||
if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"hide",0), "true"))
|
||||
symbol[symbols].flags |= HIDE_INST;
|
||||
else symbol[symbols].flags &= ~HIDE_INST;
|
||||
}
|
||||
else {
|
||||
load_ascii_string(&aux_ptr, lcc[level].fd);
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define ELEMDEF 50 /* (initial) max # of defined elements */
|
||||
#define EMBEDDED 1 /* used for embedded symbols marking in Symbol.flags */
|
||||
#define HILIGHT_CONN 4 /* used to hilight instances if connected wire is hilighted */
|
||||
#define HIDE_INST 8 /* will only show a bounding box for specific symbol instance */
|
||||
#define CADMAXGRIDPOINTS 512
|
||||
#define CADMAXHIER 80
|
||||
#define CADCHUNKALLOC 512 /* was 256 20102004 */
|
||||
|
|
@ -537,8 +538,9 @@ typedef struct
|
|||
int color; /* hilight color */
|
||||
short flags; /* bit 0: skip field,
|
||||
* bit 1: flag for different textlayer for pin/labels,
|
||||
* 1: ordinary symbol, 0: label/pin/show
|
||||
* bit 2: highlight if connected net/label is highlighted */
|
||||
* 1: ordinary symbol, 0: label/pin/show
|
||||
* bit 2: highlight if connected net/label is highlighted
|
||||
* bit 3: hidden instance, show only bounding box (hide=true attribute)*/
|
||||
char *prop_ptr;
|
||||
char **node;
|
||||
char *lab; /* lab attribute if any (pin/label) */
|
||||
|
|
|
|||
Loading…
Reference in New Issue