add draw option in schematic_in_new_window(), create_new_tab(), create_new_window()

This commit is contained in:
stefan schippers 2023-11-20 00:12:13 +01:00
parent 2c773c4a25
commit d4cde62870
6 changed files with 29 additions and 18 deletions

View File

@ -524,6 +524,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
@ -1137,12 +1140,13 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
List a 2-item list of all pins and directions of current schematic
Example: xschem sch_pinlist
--&gt; {PLUS} {in} {OUT} {out} {MINUS} {in} {VCC} {inout} {VSS} {inout}</pre>
<li><kbd> schematic_in_new_window [new_process]</kbd></li><pre>
<li><kbd> schematic_in_new_window [new_process] [nodraw]</kbd></li><pre>
When a symbol is selected edit corresponding schematic
in a new tab/window if not already open.
If nothing selected open another window of the second
schematic (issues a warning).
if 'new_process' is given start a new xschem process </pre>
if 'new_process' is given start a new xschem process
if 'nodraw' is given do not draw loaded schematic </pre>
<li><kbd> search regex|exact select tok val [match_case]</kbd></li><pre>
Search instances / wires / rects / texts with attribute string containing 'tok'
and value 'val'
@ -1428,6 +1432,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>

View File

@ -1632,14 +1632,14 @@ void copy_hierarchy_data(Xschem_ctx *from, Xschem_ctx *to)
}
/* 20111007 duplicate current schematic if no inst selected */
void schematic_in_new_window(int new_process)
void schematic_in_new_window(int new_process, int dr)
{
char filename[PATH_MAX];
char win_path[WINDOW_PATH_SIZE];
rebuild_selected_array();
if(xctx->lastsel !=1 || xctx->sel_array[0].type!=ELEMENT) {
if(new_process) new_xschem_process(xctx->sch[xctx->currsch], 0);
else new_schematic("create", NULL, xctx->sch[xctx->currsch], 1);
else new_schematic("create", "noalert", xctx->sch[xctx->currsch], dr);
}
else {
if( /* do not descend if not subcircuit */
@ -1656,7 +1656,7 @@ void schematic_in_new_window(int new_process)
get_sch_from_sym(filename, xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym, xctx->sel_array[0].n);
if(!check_loaded(filename, win_path)) {
if(new_process) new_xschem_process(filename, 0);
else new_schematic("create", NULL, filename, 1);
else new_schematic("create", "noalert", filename, dr);
}
}
}

View File

@ -1838,7 +1838,7 @@ int rstate; /* (reduced state, without ShiftMask) */
{
int save = xctx->semaphore;
xctx->semaphore--; /* so semaphore for current context wll be saved correctly */
schematic_in_new_window(0);
schematic_in_new_window(0, 1);
xctx->semaphore = save;
break;
}
@ -1847,7 +1847,7 @@ int rstate; /* (reduced state, without ShiftMask) */
{
int save = xctx->semaphore;
xctx->semaphore--; /* so semaphore for current context wll be saved correctly */
schematic_in_new_window(1);
schematic_in_new_window(1, 1);
xctx->semaphore = save;
break;
}

View File

@ -3762,18 +3762,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
/* schematic_in_new_window [new_process]
/* schematic_in_new_window [new_process] [nodraw]
* When a symbol is selected edit corresponding schematic
* in a new tab/window if not already open.
* If nothing selected open another window of the second
* schematic (issues a warning).
* if 'new_process' is given start a new xschem process */
* if 'new_process' is given start a new xschem process
* if 'nodraw' is given do not draw loaded schematic */
else if(!strcmp(argv[1], "schematic_in_new_window"))
{
int new_process = 0;
int nodraw = 0;
int i;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 2 && !strcmp(argv[2], "new_process")) new_process = 1;
schematic_in_new_window(new_process);
for(i = 2; i < argc; i++) {
if(!strcmp(argv[i], "new_process")) new_process = 1;
if(!strcmp(argv[i], "nodraw")) nodraw = 1;
}
schematic_in_new_window(new_process, !nodraw);
Tcl_ResetResult(interp);
}

View File

@ -1475,7 +1475,7 @@ static int switch_tab(int *window_count, const char *win_path, int dr)
}
/* non NULL and not empty noconfirm is used to avoid warning for duplicated filenames */
static void create_new_window(int *window_count, const char *noconfirm, const char *fname)
static void create_new_window(int *window_count, const char *noconfirm, const char *fname, int dr)
{
Window win_id = 0LU;
char toppath[WINDOW_PATH_SIZE];
@ -1559,7 +1559,7 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
xctx->xorigin=CADINITIALX;
xctx->yorigin=CADINITIALY;
load_schematic(1, fname, 1, confirm);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
if(dr) zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
tclvareval("set_bindings ", window_path[n], NULL);
tclvareval("save_ctx ", window_path[n], NULL);
/* restore previous context,
@ -1573,7 +1573,7 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
}
/* non NULL and not empty noconfirm is used to avoid warning for duplicated filenames */
static void create_new_tab(int *window_count, const char *noconfirm, const char *fname)
static void create_new_tab(int *window_count, const char *noconfirm, const char *fname, int dr)
{
int i, confirm = 1;
char open_path[WINDOW_PATH_SIZE];
@ -1666,7 +1666,7 @@ static void create_new_tab(int *window_count, const char *noconfirm, const char
xctx->xorigin=CADINITIALX;
xctx->yorigin=CADINITIALY;
load_schematic(1,fname, 1, confirm);
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
if(dr) zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); /* draw */
/* xctx->pending_fullzoom=1; */
}
@ -1918,9 +1918,9 @@ int new_schematic(const char *what, const char *win_path, const char *fname, int
return window_count;
} else if(!strcmp(what, "create")) {
if(!tabbed_interface) {
create_new_window(&window_count, win_path, fname);
create_new_window(&window_count, win_path, fname, dr);
} else {
create_new_tab(&window_count, win_path, fname);
create_new_tab(&window_count, win_path, fname, dr);
}
} else if(!strcmp(what, "destroy")) {
if(!tabbed_interface) {

View File

@ -1261,7 +1261,7 @@ extern int floaters_from_selected_inst();
extern void select_all(void);
extern void change_linewidth(double w);
extern void copy_hierarchy_data(Xschem_ctx *from, Xschem_ctx *to);
extern void schematic_in_new_window(int new_process);
extern void schematic_in_new_window(int new_process, int dr);
extern void symbol_in_new_window(int new_process);
extern void new_xschem_process(const char *cell, int symbol);
extern void ask_new_file(void);