"hide(=true)" attribute to hide specific text items in symbols
This commit is contained in:
parent
e0eb450881
commit
6c85ceaad8
|
|
@ -2436,13 +2436,15 @@ int place_text(int draw_text, double mx, double my)
|
|||
t->flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(t->prop_ptr, "weight", 0);
|
||||
t->flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(t->prop_ptr, "hide", 0);
|
||||
t->flags |= strcmp(str, "true") ? 0 : SYM_HIDE_TEXT;
|
||||
|
||||
my_strdup(21, &t->font, get_tok_value(t->prop_ptr, "font", 0));
|
||||
textlayer = t->layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
#if HAS_CAIRO==1
|
||||
textfont = t->font;
|
||||
if((textfont && textfont[0]) || t->flags) {
|
||||
if((textfont && textfont[0]) || (t->flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_font_slant_t slant;
|
||||
cairo_font_weight_t weight;
|
||||
textfont = (t->font && t->font[0]) ? t->font : tclgetvar("cairo_font_name");
|
||||
|
|
@ -2463,7 +2465,7 @@ int place_text(int draw_text, double mx, double my)
|
|||
}
|
||||
xctx->draw_window = save_draw;
|
||||
#if HAS_CAIRO==1
|
||||
if((textfont && textfont[0]) || t->flags) {
|
||||
if((textfont && textfont[0]) || (t->flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
cairo_restore(xctx->cairo_save_ctx);
|
||||
}
|
||||
|
|
|
|||
13
src/draw.c
13
src/draw.c
|
|
@ -115,7 +115,7 @@ int set_text_custom_font(xText *txt) /* 20171122 for correct text_bbox calculati
|
|||
const char *textfont;
|
||||
|
||||
textfont = txt->font;
|
||||
if((textfont && textfont[0]) || txt->flags) {
|
||||
if((textfont && textfont[0]) || (txt->flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_font_slant_t slant;
|
||||
cairo_font_weight_t weight;
|
||||
textfont = (txt->font && txt->font[0]) ? txt->font : tclgetvar("cairo_font_name");
|
||||
|
|
@ -481,6 +481,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
{
|
||||
text = symptr->text[j];
|
||||
if(text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
if(symptr->text[j].flags & SYM_HIDE_TEXT) continue;
|
||||
if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue;
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
|
|
@ -494,7 +495,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
if(xctx->inst[n].color == -PINLAYER || xctx->enable_layer[textlayer]) {
|
||||
#if HAS_CAIRO==1
|
||||
textfont = symptr->text[j].font;
|
||||
if((textfont && textfont[0]) || symptr->text[j].flags) {
|
||||
if((textfont && textfont[0]) || (symptr->text[j].flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_font_slant_t slant;
|
||||
cairo_font_weight_t weight;
|
||||
textfont = (symptr->text[j].font && symptr->text[j].font[0]) ?
|
||||
|
|
@ -519,7 +520,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
#endif
|
||||
#if HAS_CAIRO==1
|
||||
if( (textfont && textfont[0]) || symptr->text[j].flags) {
|
||||
if( (textfont && textfont[0]) || (symptr->text[j].flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
cairo_restore(xctx->cairo_save_ctx);
|
||||
}
|
||||
|
|
@ -2685,7 +2686,8 @@ void draw(void)
|
|||
#if HAS_CAIRO==1
|
||||
if(!xctx->enable_layer[textlayer]) continue;
|
||||
textfont = xctx->text[i].font;
|
||||
if( (textfont && textfont[0]) || xctx->text[i].flags) {
|
||||
if( (textfont && textfont[0]) ||
|
||||
(xctx->text[i].flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_font_slant_t slant;
|
||||
cairo_font_weight_t weight;
|
||||
textfont = (xctx->text[i].font && xctx->text[i].font[0]) ?
|
||||
|
|
@ -2706,7 +2708,8 @@ void draw(void)
|
|||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
#if HAS_CAIRO==1
|
||||
if((textfont && textfont[0]) || xctx->text[i].flags ) {
|
||||
if( (textfont && textfont[0]) ||
|
||||
(xctx->text[i].flags & (TEXT_BOLD | TEXT_OBLIQUE | TEXT_ITALIC))) {
|
||||
cairo_restore(xctx->cairo_ctx);
|
||||
cairo_restore(xctx->cairo_save_ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -854,6 +854,8 @@ static void edit_text_property(int x)
|
|||
xctx->text[sel].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "weight", 0);
|
||||
xctx->text[sel].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "hide", 0);
|
||||
xctx->text[sel].flags |= strcmp(str, "true") ? 0 : SYM_HIDE_TEXT;
|
||||
if(k == 0 ) {
|
||||
hsize =atof(tclgetvar("hsize"));
|
||||
vsize =atof(tclgetvar("vsize"));
|
||||
|
|
|
|||
|
|
@ -916,6 +916,8 @@ void copy_objects(int what)
|
|||
xctx->text[xctx->texts].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx->text[xctx->texts].prop_ptr, "weight", 0);
|
||||
xctx->text[xctx->texts].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[xctx->texts].prop_ptr, "hide", 0);
|
||||
xctx->text[xctx->texts].flags |= strcmp(str, "true") ? 0 : SYM_HIDE_TEXT;
|
||||
|
||||
xctx->text[xctx->texts].xscale=xctx->text[n].xscale;
|
||||
xctx->text[xctx->texts].yscale=xctx->text[n].yscale;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ void merge_text(FILE *fd)
|
|||
xctx->text[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "weight", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "hide", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "true") ? 0 : SYM_HIDE_TEXT;
|
||||
|
||||
select_text(i,SELECTED, 1);
|
||||
set_modify(1);
|
||||
|
|
|
|||
10
src/save.c
10
src/save.c
|
|
@ -498,10 +498,12 @@ static void load_text(FILE *fd)
|
|||
else xctx->text[i].layer = -1;
|
||||
xctx->text[i].flags = 0;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "slant", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx->text[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
xctx->text[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx->text[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "weight", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
xctx->text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "hide", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "true") ? 0 : SYM_HIDE_TEXT;
|
||||
|
||||
xctx->texts++;
|
||||
}
|
||||
|
|
@ -2000,6 +2002,8 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
tt[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(tt[i].prop_ptr, "weight", 0);
|
||||
tt[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
str = get_tok_value(tt[i].prop_ptr, "hide", 0);
|
||||
tt[i].flags |= strcmp(str, "true") ? 0 : SYM_HIDE_TEXT;
|
||||
lastt++;
|
||||
break;
|
||||
case 'N': /* store wires as lines on layer WIRELAYER. */
|
||||
|
|
|
|||
|
|
@ -267,10 +267,12 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define XDELETE 2
|
||||
#define XINSERT_NOREPLACE 3 /* do not replace token value in hash if already present */
|
||||
|
||||
/* Cairo text flags */
|
||||
/* Cairo text flags (.flags field) */
|
||||
#define TEXT_BOLD 1
|
||||
#define TEXT_OBLIQUE 2
|
||||
#define TEXT_ITALIC 4
|
||||
/* flag (.flags field) to hide text in symbols when displaying instances */
|
||||
#define SYM_HIDE_TEXT 8
|
||||
|
||||
#define S(a) (sizeof(a)/sizeof(char))
|
||||
#define BUS_WIDTH 4
|
||||
|
|
|
|||
|
|
@ -2094,7 +2094,7 @@ proc enter_text {textlabel {preserve_disabled disabled}} {
|
|||
wm geometry .dialog "+$X+$Y"
|
||||
frame .dialog.f1
|
||||
label .dialog.f1.txtlab -text $textlabel
|
||||
text .dialog.txt -width 100 -height 12
|
||||
text .dialog.txt -width 100 -height 4
|
||||
.dialog.txt delete 1.0 end
|
||||
.dialog.txt insert 1.0 $retval
|
||||
checkbutton .dialog.f1.l1 -text "preserve unchanged props" -variable preserve_unchanged_attrs \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
v {xschem version=2.9.9 file_version=1.2 }
|
||||
v {xschem version=3.0.0 file_version=1.2 }
|
||||
G {}
|
||||
K {type=subcircuit
|
||||
format="@name @pinlist @symname"
|
||||
|
|
@ -32,3 +32,4 @@ T {VSS} -125 -4 0 0 0.2 0.2 {}
|
|||
T {OUT} 125 -44 0 1 0.2 0.2 {}
|
||||
T {VPP} -125 16 0 0 0.2 0.2 {}
|
||||
T {VNN} -125 36 0 0 0.2 0.2 {}
|
||||
T {MOS Power amplifier} -110 -90 0 0 0.4 0.4 {hide=true}
|
||||
|
|
|
|||
Loading…
Reference in New Issue