do not backannotate if cursor_b is not enabled when swapping or setting with CLI the cursor_b position

This commit is contained in:
stefan schippers 2025-08-21 21:18:35 +02:00
parent 3b104995fc
commit 3c65268de6
2 changed files with 50 additions and 42 deletions

View File

@ -771,51 +771,53 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
} }
/* swap cursors */ /* swap cursors */
else if((key == 's' && access_cond) ) { else if((key == 's' && access_cond) ) {
double tmp, cursor1, cursor2; if( (xctx->graph_flags & 2) && (xctx->graph_flags & 4)) {
int floaters = there_are_floaters(); double tmp, cursor1, cursor2;
int floaters = there_are_floaters();
if(r->flags & 4) { /* private_cursor */
const char *s = get_tok_value(r->prop_ptr, "cursor1_x", 0); if(r->flags & 4) { /* private_cursor */
if(s[0]) { const char *s = get_tok_value(r->prop_ptr, "cursor1_x", 0);
cursor1 = atof_spice(s); if(s[0]) {
cursor1 = atof_spice(s);
} else {
cursor1 = xctx->graph_cursor1_x;
}
} else { } else {
cursor1 = xctx->graph_cursor1_x; cursor1 = xctx->graph_cursor1_x;
} }
} else {
cursor1 = xctx->graph_cursor1_x; if(r->flags & 4) { /* private_cursor */
} const char *s = get_tok_value(r->prop_ptr, "cursor2_x", 0);
if(s[0]) {
if(r->flags & 4) { /* private_cursor */ cursor2 = atof_spice(s);
const char *s = get_tok_value(r->prop_ptr, "cursor2_x", 0); } else {
if(s[0]) { cursor2 = xctx->graph_cursor2_x;
cursor2 = atof_spice(s); }
} else { } else {
cursor2 = xctx->graph_cursor2_x; cursor2 = xctx->graph_cursor2_x;
} }
} else {
cursor2 = xctx->graph_cursor2_x; tmp = cursor2;
cursor2 = cursor1;
cursor1 = tmp;
if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1)));
} else {
xctx->graph_cursor1_x = cursor1;
}
if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2)));
} else {
xctx->graph_cursor2_x = cursor2;
}
if(tclgetboolvar("live_cursor2_backannotate")) {
backannotate_at_cursor_b_pos(r, gr);
if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */
need_fullredraw = 1;
}
else need_all_redraw = 1;
} }
tmp = cursor2;
cursor2 = cursor1;
cursor1 = tmp;
if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1)));
} else {
xctx->graph_cursor1_x = cursor1;
}
if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2)));
} else {
xctx->graph_cursor2_x = cursor2;
}
if(tclgetboolvar("live_cursor2_backannotate")) {
backannotate_at_cursor_b_pos(r, gr);
if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */
need_fullredraw = 1;
}
else need_all_redraw = 1;
} }
/* measurement tooltip */ /* measurement tooltip */
else if((key == 'm') && access_cond) { else if((key == 'm') && access_cond) {

View File

@ -5346,13 +5346,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
#endif #endif
} }
else if(!strcmp(argv[2], "cursor2_x")) { /* set graph cursor2 position */ else if(!strcmp(argv[2], "cursor2_x")) { /* set graph cursor2 position */
int floaters = there_are_floaters();
xctx->graph_cursor2_x = atof_spice(argv[3]); xctx->graph_cursor2_x = atof_spice(argv[3]);
if(xctx->rects[GRIDLAYER] > 0) { if(xctx->rects[GRIDLAYER] > 0) {
Graph_ctx *gr = &xctx->graph_struct; Graph_ctx *gr = &xctx->graph_struct;
xRect *r = &xctx->rect[GRIDLAYER][0]; xRect *r = &xctx->rect[GRIDLAYER][0];
if(r->flags & 1) { if(r->flags & 1) {
backannotate_at_cursor_b_pos(r, gr); if(xctx->graph_flags & 4) {
backannotate_at_cursor_b_pos(r, gr);
if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */
}
} }
} }
} }
@ -5933,8 +5937,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->graph_cursor2_x = xctx->graph_cursor1_x; xctx->graph_cursor2_x = xctx->graph_cursor1_x;
xctx->graph_cursor1_x = tmp; xctx->graph_cursor1_x = tmp;
if(tclgetboolvar("live_cursor2_backannotate")) { if(tclgetboolvar("live_cursor2_backannotate")) {
backannotate_at_cursor_b_pos(r, gr); if(xctx->graph_flags & 4) {
if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */ backannotate_at_cursor_b_pos(r, gr);
if(floaters) set_modify(-2); /* update floater caches to reflect actual backannotation */
}
} }
} }
} }