fix toggle_ignore function. If multiple elements selected with different *_ignore attributes flip each one of them accordingly. Baseline code added for text floaters

This commit is contained in:
stefan schippers 2023-05-12 14:54:22 +02:00
parent 9ea93e9938
commit 9ea9d529f7
4 changed files with 18 additions and 7 deletions

View File

@ -628,6 +628,8 @@ int set_text_flags(xText *t)
t->flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
str = get_tok_value(t->prop_ptr, "hide", 0);
t->flags |= strcmp(str, "true") ? 0 : HIDE_TEXT;
str = get_tok_value(t->prop_ptr, "floater", 0);
t->flags |= xctx->tok_size ? TEXT_FLOATER : 0;
}
return 0;
}

View File

@ -3729,11 +3729,19 @@ void draw(void)
if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) {
for(i=0;i<xctx->texts; ++i)
{
const char *txt_ptr = xctx->text[i].txt_ptr;
textlayer = xctx->text[i].layer;
if(!xctx->show_hidden_texts && (xctx->text[i].flags & HIDE_TEXT)) continue;
if(xctx->only_probes) textlayer = GRIDLAYER;
else if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
dbg(1, "draw(): drawing string %d = %s\n",i, xctx->text[i].txt_ptr);
dbg(1, "draw(): drawing string %d = %s\n",i, txt_ptr);
if(xctx->text[i].flags & TEXT_FLOATER) {
int inst = get_instance(get_tok_value(xctx->text[i].prop_ptr, "floater", 0));
if(inst >= 0) {
dbg(1, "floater: %s\n", xctx->text[i].txt_ptr);
txt_ptr = translate(inst, xctx->text[i].txt_ptr);
}
}
#if HAS_CAIRO==1
if(!xctx->enable_layer[textlayer]) continue;
textfont = xctx->text[i].font;
@ -3757,7 +3765,7 @@ void draw(void)
cairo_font_face_destroy(xctx->cairo_font);
}
#endif
draw_string(textlayer, ADD, xctx->text[i].txt_ptr,
draw_string(textlayer, ADD, txt_ptr,
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0,xctx->text[i].y0,
xctx->text[i].xscale, xctx->text[i].yscale);

View File

@ -56,7 +56,7 @@ static int get_symbol(const char *s)
return i;
}
static int get_instance(const char *s)
int get_instance(const char *s)
{
int i, found=0;
for(i=0;i<xctx->instances; ++i) {
@ -3716,11 +3716,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
i = xctx->sel_array[n].n;
if(first) {
xctx->push_undo();
if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) {
remove = 1;
}
first = 0;
}
first = 0;
remove = 0;
if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) remove = 1;
if(remove) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL));
} else {

View File

@ -289,6 +289,7 @@ extern char win_temp_dir[PATH_MAX];
#define TEXT_ITALIC 4
/* flag (.flags field) to hide text in symbols when displaying instances */
#define HIDE_TEXT 8
#define TEXT_FLOATER 16
#define S(a) (sizeof(a)/sizeof(a[0]))
#define BUS_WIDTH 4
@ -1362,6 +1363,7 @@ extern void new_polygon(int what);
extern void compile_font(void);
extern void rebuild_selected_array(void);
extern int get_instance(const char *s);
extern void edit_property(int x);
extern int xschem(ClientData clientdata, Tcl_Interp *interp,
int argc, const char * argv[]);