add `user_startup_commands` variable that may contain tcl code to be executed after any new window creation. Useful to have custom bindings / menu / buttons in all windows.
This commit is contained in:
parent
84ca35e6f5
commit
e789988b05
|
|
@ -1666,6 +1666,7 @@ static void create_new_window(int *window_count, const char *noconfirm, const ch
|
|||
tclvareval("set_bindings ", window_path[n], NULL);
|
||||
tclvareval("set_replace_key_binding ", window_path[n], NULL);
|
||||
tclvareval("save_ctx ", window_path[n], NULL);
|
||||
tcleval("eval_user_startup_commands");
|
||||
/* restore previous context,
|
||||
* because the Expose event after new window creation does a context switch prev win -> new win
|
||||
*
|
||||
|
|
@ -2892,6 +2893,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
if(has_x) {
|
||||
tclsetintvar("tctx::max_new_windows", MAX_NEW_WINDOWS);
|
||||
tcleval("pack_widgets; set_bindings .drw");
|
||||
tcleval("eval_user_startup_commands");
|
||||
}
|
||||
|
||||
fs=tclgetintvar("fullscreen");
|
||||
|
|
|
|||
|
|
@ -9355,6 +9355,15 @@ proc source_user_tcl_files {} {
|
|||
}
|
||||
}
|
||||
|
||||
proc eval_user_startup_commands {} {
|
||||
global user_startup_commands
|
||||
if {[info exists user_startup_commands]} {
|
||||
if {[catch {uplevel #0 $user_startup_commands} res]} {
|
||||
puts "executing $user_startup_commands:\n\n$res"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc eval_postinit_commands {} {
|
||||
global postinit_commands
|
||||
if {[info exists postinit_commands]} {
|
||||
|
|
|
|||
11
src/xschemrc
11
src/xschemrc
|
|
@ -540,6 +540,17 @@
|
|||
# }
|
||||
# }
|
||||
|
||||
###########################################################################
|
||||
#### TCL COMMANDS TO BE EXECUTED AFTER ANY NEW WINDOW CREATION
|
||||
###########################################################################
|
||||
#### this hook is useful to execute user UI code (like event binding,
|
||||
#### new buttons / menu entries etc).
|
||||
# set user_startup_commands {
|
||||
# bind [xschem get current_win_path] <Key-plus> {
|
||||
# puts Hello
|
||||
# }
|
||||
# }
|
||||
|
||||
###########################################################################
|
||||
#### TCL COMMANDS TO BE EXECUTED AFTER GENERATING NETLIST
|
||||
###########################################################################
|
||||
|
|
|
|||
Loading…
Reference in New Issue