add xschemrc variable "close_ctxmenu_on_leave" (default: 1), if set to 0 a click in the canvas area is needed to close the context menu
This commit is contained in:
parent
7e64d1560b
commit
2eb46f421f
|
|
@ -553,7 +553,7 @@ int save(int confirm, int fast)
|
|||
if(!stat(name, &buf)) {
|
||||
/* ... and modification time on disk has changed since file loaded ... */
|
||||
if(xctx->time_last_modify && xctx->time_last_modify != buf.st_mtime) {
|
||||
/* ... so force a save */
|
||||
/* ... so force a save. save_schematic() will again ask to save if file has been written externally */
|
||||
force = 1;
|
||||
confirm = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4126,7 +4126,8 @@ static void handle_button_press(int event, int state, int rstate, KeySym key, in
|
|||
|
||||
state &= ~(Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ); /* ignore ButtonStates */
|
||||
if(!tabbed_interface && strcmp(win_path, xctx->current_win_path)) return;
|
||||
dbg(1, "callback(): ButtonPress ui_state=%d state=%d\n",xctx->ui_state,state);
|
||||
dbg(1, "callback(): ButtonPress ui_state=%d state=%d semaphore=%d\n",xctx->ui_state,state, xctx->semaphore);
|
||||
dbg(1, "callback(): win_path=%s\n", win_path);
|
||||
if(waves_selected(event, key, state, button)) {
|
||||
waves_callback(event, mx, my, key, button, aux, state);
|
||||
return;
|
||||
|
|
@ -4196,6 +4197,11 @@ static void handle_button_press(int event, int state, int rstate, KeySym key, in
|
|||
|
||||
/* button1 click to select another instance while edit prop dialog open */
|
||||
else if(button==Button1 && xctx->semaphore >= 2) {
|
||||
if(xctx->semaphore >= 3) { /* record clicked point coordinates when ctxmenu is shown */
|
||||
xctx->mx_save = mx; xctx->my_save = my;
|
||||
xctx->mx_double_save=xctx->mousex;
|
||||
xctx->my_double_save=xctx->mousey;
|
||||
}
|
||||
if(tcleval("winfo exists .dialog.f2.txt")[0] == '1') { /* proc enter_text */
|
||||
tcleval(".dialog.buttons.ok invoke");
|
||||
return;
|
||||
|
|
@ -4644,6 +4650,7 @@ static int handle_window_switching(int event, int tabbed_interface, const char *
|
|||
event, xctx->ui_state, win_path);
|
||||
/* This will switch context only when copying stuff across windows
|
||||
* this is the window *receiving* copied objects */
|
||||
tcleval("destroy .ctxmenu");
|
||||
if( event == EnterNotify && !stat(sel_file, &buf) && (xctx->ui_state & STARTCOPY)) {
|
||||
dbg(1, "callback(): switching window context for copy : %s --> %s, semaphore=%d\n",
|
||||
xctx->current_win_path, win_path, xctx->semaphore);
|
||||
|
|
|
|||
|
|
@ -8677,7 +8677,7 @@ proc balloon_show {w arg pos} {
|
|||
}
|
||||
|
||||
proc context_menu { } {
|
||||
|
||||
global close_ctxmenu_on_leave
|
||||
set tctx::retval 0
|
||||
if {[info tclversion] >= 8.5} {
|
||||
set font TkDefaultFont
|
||||
|
|
@ -8810,8 +8810,15 @@ proc context_menu { } {
|
|||
set x [expr {$x - ( $x + $wx - $sx )} ]
|
||||
}
|
||||
wm geometry .ctxmenu "+$x+$y";# move away from screen edges
|
||||
bind .ctxmenu <Leave> {if { {%W} eq {.ctxmenu} } {destroy .ctxmenu}}
|
||||
tkwait window .ctxmenu
|
||||
if { $close_ctxmenu_on_leave } {
|
||||
bind .ctxmenu <Leave> {if { {%W} eq {.ctxmenu} } {destroy .ctxmenu}}
|
||||
tkwait window .ctxmenu
|
||||
} else {
|
||||
set prev [bind [xschem get top_path].drw <Button>]
|
||||
bind [xschem get top_path].drw <ButtonPress> "destroy .ctxmenu; $prev"
|
||||
tkwait window .ctxmenu
|
||||
bind [xschem get top_path].drw <Button> $prev
|
||||
}
|
||||
# when context menu is destroyed an EnterNotify event is generated in the
|
||||
# main xschem window. We want to process this event before taking
|
||||
# actions based on $tctx::retval.
|
||||
|
|
@ -9707,6 +9714,7 @@ proc no_open_dialogs {} {
|
|||
## "bespice_server_getdata" only one tcp listener per process
|
||||
## "file_dialog_*" only one load_file_dialog window is allowed
|
||||
## some file_chooser(...) vars
|
||||
## close_ctxmenu_on_leave
|
||||
|
||||
set tctx::global_list {
|
||||
INITIALINSTDIR INITIALLOADDIR INITIALPROPDIR INITIALTEXTDIR PDK PDK_ROOT SKYWATER_MODELS
|
||||
|
|
@ -10029,7 +10037,7 @@ global env has_x OS autofocus_mainwindow
|
|||
if {\[winfo exists .ins\]} {
|
||||
set file_chooser(enter) 1 ;# so first time mouse enters file chooser current file will be shown
|
||||
}
|
||||
destroy .ctxmenu
|
||||
if {\$close_ctxmenu_on_leave} {destroy .ctxmenu}
|
||||
if {\$autofocus_mainwindow} {focus $topwin}
|
||||
xschem callback %W %T %x %y 0 0 0 0
|
||||
}
|
||||
|
|
@ -11474,6 +11482,9 @@ set_ne tabbed_interface 1
|
|||
## if enabled.
|
||||
set_ne open_in_new_window 0
|
||||
|
||||
## if 1 context menu will be closed if mouse exits context menu window. Otherwise a click is needed
|
||||
set_ne close_ctxmenu_on_leave 1
|
||||
|
||||
## case insensitive symbol lookup (on case insensitive filesystems only!)
|
||||
set_ne case_insensitive 0
|
||||
|
||||
|
|
|
|||
|
|
@ -632,6 +632,14 @@
|
|||
#### default: disabled (0)
|
||||
# set open_in_new_window 1
|
||||
|
||||
###########################################################################
|
||||
#### CLOSE CONTEXT MENU
|
||||
###########################################################################
|
||||
#### If enabled the context menu will be closed when moving the mouse outside
|
||||
#### of the context menu window. Otherwise a click in the drawing area is needed.
|
||||
#### default: enabled (1)
|
||||
# set close_ctxmenu_on_leave 0
|
||||
|
||||
###########################################################################
|
||||
#### ALTERNATE LOAD FILE BROWSER
|
||||
###########################################################################
|
||||
|
|
|
|||
Loading…
Reference in New Issue