while opening a sub-schematic in another window propagate cursora/b/ annotate info

This commit is contained in:
stefan schippers 2023-12-09 13:26:18 +01:00
parent c8ced06bbe
commit 1285ba0cd4
5 changed files with 30 additions and 11 deletions

View File

@ -1655,7 +1655,18 @@ int schematic_in_new_window(int new_process, int dr, int force)
rebuild_selected_array();
if(xctx->lastsel == 0) {
if(new_process) new_xschem_process(xctx->sch[xctx->currsch], 0);
else new_schematic("create", force ? "noalert" : "", xctx->sch[xctx->currsch], dr);
else {
int gf = xctx->graph_flags;
double c1 = xctx->graph_cursor1_x;
double c2 = xctx->graph_cursor2_x;
new_schematic("create", force ? "noalert" : "", xctx->sch[xctx->currsch], dr);
/* propagte raw cursor info to new window */
xctx->graph_flags = gf;
xctx->graph_cursor1_x = c1;
xctx->graph_cursor2_x = c2;
dbg(1, "path=%s\n", xctx->current_win_path);
}
return 1;
}
else if(xctx->lastsel > 1) {
@ -2148,6 +2159,15 @@ int descend_schematic(int instnumber)
propagate_hilights(1, 0, XINSERT_NOREPLACE);
}
dbg(1, "descend_schematic(): before zoom(): prep_hash_inst=%d\n", xctx->prep_hash_inst);
if(xctx->rects[GRIDLAYER] > 0 && tcleval("info exists ngspice::ngspice_data")[0] == '0') {
Graph_ctx *gr = &xctx->graph_struct;
xRect *r = &xctx->rect[GRIDLAYER][0];
if(r->flags & 1) {
backannotate_at_cursor_b_pos(r, gr);
}
}
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
}
return 1;

View File

@ -214,9 +214,8 @@ static double interpolate_yval(int idx, int point_not_last)
return val;
}
static void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
{
if(sch_waves_loaded() >= 0) {
int dset, first = -1, last, dataset = gr->dataset, i, p, ofs = 0, ofs_end;
double start, end;

View File

@ -4768,7 +4768,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* test
* Testmode ... */
else if(1 && !strcmp(argv[1], "test") )
else if(0 && !strcmp(argv[1], "test") )
{
Iterator_ctx ctx;
Objectentry *objectptr;
@ -4815,10 +4815,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
/* test 2 inst text_n */
else if(argc > 5 && atoi(argv[2]) == 2) {
double sx, sy;
get_sym_text_size(atoi(argv[3]), atoi(argv[4]), &sx, &sy);
dbg(0, "size=%g, %g\n", sx, sy);
else if(argc > 2 && atoi(argv[2]) == 2) {
dbg(0, "graph_flags=%d\n", xctx->graph_flags);
Tcl_ResetResult(interp);
}
}

View File

@ -1575,10 +1575,11 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
tclvareval("save_ctx ", window_path[n], NULL);
/* restore previous context,
* because the Expose event after new window creation does a context switch prev win -> new win
*
* tclvareval("restore_ctx ", prev_window, NULL);
* new_schematic("switch", prev_window, "", 1);
* tclvareval("housekeeping_ctx", NULL);
*/
tclvareval("restore_ctx ", prev_window, NULL);
new_schematic("switch", prev_window, "", 1);
tclvareval("housekeeping_ctx", NULL);
if(has_x) windowid(toppath);
}

View File

@ -1347,6 +1347,7 @@ extern int select_dangling_nets(void);
extern int Tcl_AppInit(Tcl_Interp *interp);
extern void abort_operation(void);
extern void draw_crosshair(int del);
extern void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr);
extern int callback(const char *winpath, int event, int mx, int my, KeySym key,
int button, int aux, int state);
extern void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h);