add tcl xschemrc variable "select_touch" that enables selecting objects touched by the selection rectangle if dragging to the left. Previously this behavior was enabled by "incremental_select" that shows selected elements while dragging. These two optional behaviors are now enabled/disabled by separate variables

This commit is contained in:
Stefan Schippers 2024-08-14 20:43:47 +02:00
parent 9f761176ec
commit 652268c4d0
3 changed files with 14 additions and 7 deletions

View File

@ -3739,6 +3739,7 @@ void fix_restore_rect(double x1, double y1, double x2, double y2)
void select_rect(int what, int select)
{
int incremental_select = tclgetboolvar("incremental_select");
int sel_touch = tclgetboolvar("select_touch");
dbg(1, "select_rect(): what=%d, mousex_save=%g mousey_save=%g, mousex_snap=%g mousey_snap=%g\n",
what, xctx->mx_double_save, xctx->my_double_save, xctx->mousex_snap, xctx->mousey_snap);
if(what & RUBBER)
@ -3756,10 +3757,10 @@ void select_rect(int what, int select)
rebuild_selected_array();
draw_selection(xctx->gc[SELLAYER], 0);
if(incremental_select || !xctx->nl_sel) {
if(xctx->nl_dir == 0) select_inside(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
else select_touch(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
}
if(!xctx->nl_sel || (incremental_select && xctx->nl_dir == 0))
select_inside(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
else if(incremental_select && xctx->nl_dir == 1 && sel_touch)
select_touch(xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2, xctx->nl_sel);
xctx->nl_xx1=xctx->nl_xr;xctx->nl_xx2=xctx->nl_xr2;xctx->nl_yy1=xctx->nl_yr;xctx->nl_yy2=xctx->nl_yr2;
RECTORDER(xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
drawtemprect(xctx->gc[SELLAYER],NOW, xctx->nl_xx1,xctx->nl_yy1,xctx->nl_xx2,xctx->nl_yy2);
@ -3789,9 +3790,10 @@ void select_rect(int what, int select)
{
RECTORDER(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2);
drawtemprect(xctx->gctiled, NOW, xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2);
if(!incremental_select || xctx->nl_dir == 0)
if(!sel_touch || xctx->nl_dir == 0)
select_inside(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel);
else
else
select_touch(xctx->nl_xr,xctx->nl_yr,xctx->nl_xr2,xctx->nl_yr2, xctx->nl_sel);
draw_selection(xctx->gc[SELLAYER], 0);

View File

@ -6965,7 +6965,7 @@ set tctx::global_list {
persistent_command preserve_unchanged_attrs prev_symbol ps_colors ps_paper_size rainbow_colors
tctx::rcode recentfile
retval retval_orig rotated_text search_case search_exact search_found search_schematic
search_select search_value selected_tok show_hidden_texts show_infowindow
search_select search_value select_touch selected_tok show_hidden_texts show_infowindow
show_infowindow_after_netlist
simconf_default_geometry simconf_vpos simulate_bg spiceprefix split_files svg_colors
svg_font_name sym_txt symbol symbol_width tabstop tclcmd_txt tclstop text_line_default_geometry
@ -8406,6 +8406,7 @@ set_ne load_file_dialog_fullpath 1
# once selected these can not be unselected by retracting the selection rectangle
# if not set show selected items at end of drag.
set_ne incremental_select 1
set_ne select_touch 1
set_ne draw_crosshair 0
set_ne draw_grid 1

View File

@ -200,6 +200,10 @@
#### default: not enabled (0)
# set unselect_partial_sel_wires 0
#### if set select objects if touched by selection rectangle while dragging to the left
#### Default: enabled (1)
# set select_touch 0
#### if set show selected elements while dragging the selection rectangle.
#### once selected these can not be unselected by retracting the selection rectangle
#### if not set show selected items at end of drag. Default: enabled (1)