From fb8a1560c61bf4bb0e14b231d2d2f3dc9f989562 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Thu, 11 Aug 2022 10:58:57 +0200 Subject: [PATCH] added xschemrc variable `autofocus_mainwindow` (default setting: enabled (1) ), if this variable is set moving the mouse to the main drawing area when a dialog box is open (typically while editing a component attribute list) will focus the main window, so user can move / zoom/pan the schematic using the usual commands, for example to look at a different part of the schematic while editing the component. If this variable is unset a click is needed to focus the main window. This will thus not allow to move / zoom, but allows to type into the dialog box if the mouse goes out of it. --- src/xschem.tcl | 16 ++++++++++++---- src/xschemrc | 8 +++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 4c471247..f3f9b291 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -4586,7 +4586,7 @@ proc no_open_dialogs {} { ## "case_insensitive" case insensitive symbol lookup (on case insensitive filesystems only!) set tctx::global_list { - auto_hilight autotrim_wires bespice_listen_port big_grid_points bus_replacement_char + auto_hilight autofocus_mainwindow autotrim_wires bespice_listen_port big_grid_points bus_replacement_char cadgrid cadlayers cadsnap cairo_font_name change_lw color_ps colors connect_by_kissing constrained_move copy_cell custom_label_prefix custom_token dark_colors dark_colorscheme dim_bg dim_value disable_unique_names do_all_inst draw_grid draw_window @@ -4716,7 +4716,7 @@ proc clear_simulate_button {button_path simvar} { } proc set_bindings {topwin} { -global env has_x OS +global env has_x OS autofocus_mainwindow ### ### Tk event handling ### @@ -4752,8 +4752,13 @@ global env has_x OS bind $topwin "xschem callback %W %T %x %y 0 %b 0 %s" bind $topwin "xschem callback %W %T %x %y %N 0 0 %s" bind $topwin "xschem callback %W %T %x %y %N 0 0 %s" - bind $topwin "focus $topwin; xschem callback %W %T %x %y 0 0 0 %s" - bind $topwin "destroy .ctxmenu; focus $topwin; xschem callback %W %T %x %y 0 0 0 0" + if {$autofocus_mainwindow} { + bind $topwin "focus $topwin; xschem callback %W %T %x %y 0 0 0 %s" + bind $topwin "destroy .ctxmenu; focus $topwin; xschem callback %W %T %x %y 0 0 0 0" + } else { + bind $topwin "xschem callback %W %T %x %y 0 0 0 %s" + bind $topwin "destroy .ctxmenu; xschem callback %W %T %x %y 0 0 0 0" + } bind $topwin " wm withdraw .infotext; set show_infowindow 0 " bind $topwin "?" {textwindow "${XSCHEM_SHAREDIR}/xschem.help"} @@ -5525,6 +5530,9 @@ set env(LC_ALL) C set_paths print_help_and_exit +# focus the schematic window if mouse goes over it, even if a dialog box is displayed, +# without needing to click. This allows to move/zoom/pan the schematic while editing attributes. +set_ne autofocus_mainwindow 1 if {$OS == "Windows"} { set_ne XSCHEM_TMP_DIR [xschem get temp_dir] } else { diff --git a/src/xschemrc b/src/xschemrc index cb054c1e..18e819b1 100644 --- a/src/xschemrc +++ b/src/xschemrc @@ -179,7 +179,13 @@ #### instead of looking only in symbol directory. Default: disabled (0). # set search_schematic 0 - +#### focus the schematic window if mouse goes over it, even if a dialog box +#### is displayed, without needing to click. +#### This allows to move/zoom/pan the schematic while editing attributes. +#### Clicking in the schematic window usually closes the dialog box or starts +#### editing a new component if clicking on a new component. +#### default: enabled (1) +# set autofocus_mainwindow 0 ########################################################################### #### EXPORT FORMAT TRANSLATORS, PNG AND PDF ###########################################################################