From d4cde62870126b3ff3b3828bdaa91cfbad66bd2b Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 20 Nov 2023 00:12:13 +0100 Subject: [PATCH] add draw option in schematic_in_new_window(), create_new_tab(), create_new_window() --- doc/xschem_man/developer_info.html | 9 +++++++-- src/actions.c | 6 +++--- src/callback.c | 4 ++-- src/scheduler.c | 14 ++++++++++---- src/xinit.c | 12 ++++++------ src/xschem.h | 2 +- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index ba130b39..dca9d276 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -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 --> {PLUS} {in} {OUT} {out} {MINUS} {in} {VCC} {inout} {VSS} {inout} -
  • 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
  • search regex|exact select tok val [match_case]
  •     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"
     
     
     
    +
     
     
      
    diff --git a/src/actions.c b/src/actions.c
    index c8306427..9ac3f44c 100644
    --- a/src/actions.c
    +++ b/src/actions.c
    @@ -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);
         }
       }
     }
    diff --git a/src/callback.c b/src/callback.c
    index 1da9e623..464bd498 100644
    --- a/src/callback.c
    +++ b/src/callback.c
    @@ -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;
        }
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 16811e15..9ec21b2b 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -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);
         }
     
    diff --git a/src/xinit.c b/src/xinit.c
    index 192eb5af..e81e3a85 100644
    --- a/src/xinit.c
    +++ b/src/xinit.c
    @@ -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) {
    diff --git a/src/xschem.h b/src/xschem.h
    index c3f546d6..459e06ff 100644
    --- a/src/xschem.h
    +++ b/src/xschem.h
    @@ -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);