From 34113c1c5f6b174fc8fdc4f1d64fc49e89bde609 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Wed, 25 Oct 2023 20:30:20 +0200 Subject: [PATCH] added tab ctx menu `Save` --- doc/xschem_man/developer_info.html | 7 ++++++- src/resources.tcl | 6 ++++++ src/scheduler.c | 2 ++ src/xschem.tcl | 11 ++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 0afa86ae..aefaa1aa 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -518,6 +518,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" +
  • abort_operation
  • @@ -950,7 +951,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
        
  • new_process [f]
  •     Start a new xschem process for a schematic.
        If 'f' is given load specified schematic. 
    -
  • new_schematic create|destroy|destroy_all|switch winpath file
  • +   
  • new_schematic create|destroy|destroy_all|switch winpath file [draw]
  •     Open/destroy a new tab or window 
          create: create new empty window or with 'file' loaded if 'file' given.
                  The winpath must be given (even {} is ok).
    @@ -962,6 +963,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
                   if the 'force'argument is given do not issue a warning if modified
                   tabs are about to be closed.
          switch: switch context to specified 'winpath' window or specified schematic name
    +              If 'draw' is given and set to 0 do not redraw after switching tab
    +              (only tab i/f)
        Main window/tab has winpath set to .drw,
        Additional windows/tabs have winpath set to .x1.drw, .x2.drw and so on...
  • only_probes
  • @@ -1388,6 +1391,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
     
     
     
    +
    +
     
     
     
    diff --git a/src/resources.tcl b/src/resources.tcl
    index 4bec3205..50a90a89 100644
    --- a/src/resources.tcl
    +++ b/src/resources.tcl
    @@ -573,6 +573,12 @@ ABIALAAAAAAQABAAAAVCoCSOZGmeqBg5ixOlUgLMc4Iec2AE83ESAMVIUYMNZy+jhOdQSgyAhZMJ
     eziIgKTpgaABbKeu14fyfmGMAs2ZHpRCADs=
     "
     
    +image create photo CtxmenuSave
    +CtxmenuSave put "
    +R0lGODlhEAAQAPEAAAAAAI2Njejo6AAAACH5BAEAAAMALAAAAAAQABAAAAImhI8nM+naDJv0RECv
    +tlVaPn2eRAXm9jxXiqzs+IoxPLuvzeLpUAAAOw==
    +"
    +
     image create photo CtxmenuTerm
     CtxmenuTerm put "
     R0lGODlhEAAQAPMAAAAAACIiIjAwMHR0dHh4eHx8fOXl5ejo6O/v7/f39wAAAAAAAAAAAAAAAAAA
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 723d8b2d..cdcdf4a1 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -2700,6 +2700,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
          *              if the 'force'argument is given do not issue a warning if modified
          *              tabs are about to be closed.
          *     switch: switch context to specified 'winpath' window or specified schematic name
    +     *              If 'draw' is given and set to 0 do not redraw after switching tab
    +     *              (only tab i/f)
          *   Main window/tab has winpath set to .drw,
          *   Additional windows/tabs have winpath set to .x1.drw, .x2.drw and so on...
          */
    diff --git a/src/xschem.tcl b/src/xschem.tcl
    index 4ff50216..7e324b08 100644
    --- a/src/xschem.tcl
    +++ b/src/xschem.tcl
    @@ -5602,6 +5602,11 @@ proc tab_ctx_cmd {tab_but what} {
           eval execute 0 $editor [xschem get netlist_name fallback]
           cd $save
           xschem new_schematic switch $old {} 0 ;# no draw
    +    } elseif {$what eq {save}} {
    +      set old [xschem get current_win_path]
    +      xschem new_schematic switch $win_path {} 0 ;# no draw
    +      xschem save
    +      xschem new_schematic switch $old {} 0 ;# no draw
         } elseif {$what eq {close}} {
           set old [xschem get current_win_path]
           set ntabs [xschem get ntabs]
    @@ -5688,7 +5693,10 @@ proc tab_context_menu {tab_but} {
            -highlightthickness 0 -image CtxmenuEdit -compound left \
           -font [subst $font] -command "set retval 5; tab_ctx_cmd $tab_but netlist; destroy .ctxmenu"
       }
    -  button .ctxmenu.b7 -text {Close tab} -padx 3 -pady 0 -anchor w -activebackground grey50 \
    +  button .ctxmenu.b7 -text {Save} -padx 3 -pady 0 -anchor w -activebackground grey50 \
    +     -highlightthickness 0 -image CtxmenuSave -compound left \
    +    -font [subst $font] -command "set retval 7; tab_ctx_cmd $tab_but save; destroy .ctxmenu"
    +  button .ctxmenu.b8 -text {Close tab} -padx 3 -pady 0 -anchor w -activebackground grey50 \
          -highlightthickness 0 -image CtxmenuDelete -compound left \
         -font [subst $font] -command "set retval 7; tab_ctx_cmd $tab_but close; destroy .ctxmenu"
     
    @@ -5704,6 +5712,7 @@ proc tab_context_menu {tab_but} {
         pack .ctxmenu.b5 -fill x -expand true
       }
       pack .ctxmenu.b7 -fill x -expand true
    +  pack .ctxmenu.b8 -fill x -expand true
       wm geometry .ctxmenu "+$x+$y"
       update
       # if window has been destroyed (by mouse pointer exiting) do nothing