From 8be5ae7eb0ee0887d1e1853608b5410f73a88747 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Mon, 21 Feb 2022 10:53:06 +0100 Subject: [PATCH] hide attribute for text items, not only if embedded in symbols --- src/actions.c | 2 +- src/draw.c | 3 ++- src/editprop.c | 2 +- src/move.c | 2 +- src/paste.c | 2 +- src/save.c | 4 ++-- src/xschem.h | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/actions.c b/src/actions.c index 6cca5db0..9e583a46 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2558,7 +2558,7 @@ int place_text(int draw_text, double mx, double my) 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; + t->flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; my_strdup(21, &t->font, get_tok_value(t->prop_ptr, "font", 0)); textlayer = t->layer; diff --git a/src/draw.c b/src/draw.c index 2faed3c8..edef809d 100644 --- a/src/draw.c +++ b/src/draw.c @@ -515,7 +515,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(symptr->text[j].flags & 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); @@ -3035,6 +3035,7 @@ void draw(void) for(i=0;itexts;i++) { textlayer = xctx->text[i].layer; + if(xctx->text[i].flags & HIDE_TEXT) continue; if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER; dbg(1, "draw(): drawing string %d = %s\n",i, xctx->text[i].txt_ptr); #if HAS_CAIRO==1 diff --git a/src/editprop.c b/src/editprop.c index c837174f..47de054b 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -958,7 +958,7 @@ static void edit_text_property(int x) 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; + xctx->text[sel].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; if(k == 0 ) { hsize =atof(tclgetvar("hsize")); vsize =atof(tclgetvar("vsize")); diff --git a/src/move.c b/src/move.c index 859c43b0..e75ee286 100644 --- a/src/move.c +++ b/src/move.c @@ -919,7 +919,7 @@ void copy_objects(int what) 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].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; xctx->text[xctx->texts].xscale=xctx->text[n].xscale; xctx->text[xctx->texts].yscale=xctx->text[n].yscale; diff --git a/src/paste.c b/src/paste.c index 4ebfb4d4..1731499b 100644 --- a/src/paste.c +++ b/src/paste.c @@ -65,7 +65,7 @@ static void merge_text(FILE *fd) 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; + xctx->text[i].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; select_text(i,SELECTED, 1); set_modify(1); diff --git a/src/save.c b/src/save.c index 9fbc2088..e063ce6f 100644 --- a/src/save.c +++ b/src/save.c @@ -1289,7 +1289,7 @@ static void load_text(FILE *fd) 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; + xctx->text[i].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; xctx->texts++; } @@ -2807,7 +2807,7 @@ int load_sym_def(const char *name, FILE *embed_fd) 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; + tt[i].flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; lastt++; break; case 'N': /* store wires as lines on layer WIRELAYER. */ diff --git a/src/xschem.h b/src/xschem.h index f721fbd9..f4dd8bb6 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -266,7 +266,7 @@ extern char win_temp_dir[PATH_MAX]; #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 HIDE_TEXT 8 #define S(a) (sizeof(a)/sizeof(a[0])) #define BUS_WIDTH 4 @@ -463,7 +463,7 @@ typedef struct int layer; /* 20171201 for cairo */ short hcenter, vcenter; char *font; /* 20171201 for cairo */ - int flags; + int flags; /* TEXT_BOLD:1 TEXT_OBLIQUE:2 TEXT_ITALIC:4 HIDE_TEXT:8 */ } xText; typedef struct