added tab ctx menu `Save`

This commit is contained in:
Stefan Schippers 2023-10-25 20:30:20 +02:00
parent 2fec681728
commit 34113c1c5f
4 changed files with 24 additions and 2 deletions

View File

@ -518,6 +518,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre>
@ -950,7 +951,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> new_process [f]</kbd></li><pre>
Start a new xschem process for a schematic.
If 'f' is given load specified schematic. </pre>
<li><kbd> new_schematic create|destroy|destroy_all|switch winpath file</kbd></li><pre>
<li><kbd> new_schematic create|destroy|destroy_all|switch winpath file [draw]</kbd></li><pre>
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...</pre>
<li><kbd> only_probes</kbd></li><pre>
@ -1388,6 +1391,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"

View File

@ -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

View File

@ -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...
*/

View File

@ -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