Add incremental_select tcl variable. It is normally set. If set show selected objects while dragging a selection rectangle. If unset show selection at end of drag operation. Fix possible endless loop whiel zooming on X axis if raw file has only one point (OP). Also if graph specifies custom plot switch to that raw file to get correct x range.

This commit is contained in:
stefan schippers 2023-11-09 16:41:53 +01:00
parent 8231cd65db
commit 769c7d4663
5 changed files with 42 additions and 11 deletions

View File

@ -3459,6 +3459,7 @@ void fix_restore_rect(double x1, double y1, double x2, double y2)
/* 20150927 select=1: select objects, select=0: unselect objects */
void select_rect(int what, int select)
{
int incremental_select = tclgetboolvar("incremental_select");
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)
@ -3475,10 +3476,11 @@ void select_rect(int what, int select)
/* 20171026 update unselected objects while dragging */
rebuild_selected_array();
draw_selection(xctx->gc[SELLAYER], 0);
/* if(xctx->nl_sel) { */
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);
/* } */
}
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);

View File

@ -512,13 +512,28 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
/* parameters for absolute positioning by mouse drag in bottom graph area */
if( event == MotionNotify && (state & Button1Mask) && xctx->graph_bottom ) {
int idx = get_raw_index(find_nth(get_tok_value(r->prop_ptr, "sweep", 0), ", ", "\"", 0, 1));
int dset = dataset == -1 ? 0 : dataset;
int idx;
int dset;
double wwx1, wwx2, pp, delta, ccx, ddx;
char *rawfile = NULL;
char *sim_type = NULL;
int switched = 0;
my_strdup2(_ALLOC_ID_, &rawfile, get_tok_value(r->prop_ptr, "rawfile", 0));
my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr, "sim_type", 0));
switched = extra_rawfile(2, rawfile, sim_type);
my_free(_ALLOC_ID_, &rawfile);
my_free(_ALLOC_ID_, &sim_type);
idx = get_raw_index(find_nth(get_tok_value(r->prop_ptr, "sweep", 0), ", ", "\"", 0, 1));
dset = dataset == -1 ? 0 : dataset;
if(idx < 0 ) idx = 0;
delta = gr->gw;
wwx1 = get_raw_value(dset, idx, 0);
wwx2 = get_raw_value(dset, idx, xctx->raw->npoints[dset] - 1);
if(wwx1 == wwx2) wwx2 += 1e-6;
if(gr->logx) {
wwx1 = mylog10(wwx1);
wwx2 = mylog10(wwx2);
@ -528,6 +543,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
pp = (xctx->mousex_snap - ddx) / ccx;
xx1 = pp - delta / 2.0;
xx2 = pp + delta / 2.0;
if(switched) extra_rawfile(5, NULL, NULL); /* switch back to previous raw file */
}
else if(button == Button3 && (xctx->ui_state & GRAPHPAN) && !xctx->graph_left && !xctx->graph_top) {
/* parameters for zoom area by mouse drag */
@ -547,7 +565,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
for(i=0; i< xctx->rects[GRIDLAYER]; ++i) {
r = &xctx->rect[GRIDLAYER][i];
need_redraw = 0;
if( !(r->flags & 1) ) continue;
if( !(r->flags & 1) ) continue; /* 1: graph; 3: graph_unlocked */
gr->gx1 = gr->master_gx1;
gr->gx2 = gr->master_gx2;
gr->gw = gr->master_gw;

View File

@ -4954,8 +4954,8 @@ proc alert_ {txtlabel {position +200+300} {nowait {0}} {yesno 0}} {
} else {
wm geometry .alert "+$X+$Y"
}
label .alert.l1 -font {Sans 12 bold} \
-text " \n ${txtlabel} \n" -wraplength 700
label .alert.l1 -font {Sans 10 bold} \
-text " \n ${txtlabel} \n" -wraplength 750
if { $yesno} {
set oktxt Yes
} else {
@ -7714,6 +7714,12 @@ set_ne incr_hilight 1
set_ne enable_stretch 0
set_ne constrained_move 0
set_ne unselect_partial_sel_wires 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.
set_ne incremental_select 1
set_ne draw_crosshair 0
set_ne draw_grid 1
set_ne big_grid_points 0

View File

@ -182,6 +182,11 @@
#### default: not enabled (0)
# set unselect_partial_sel_wires 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)
# set_ne incremental_select 0
#### if set to 1 automatically join/trim wires while editing
#### this may slow down on rally big designs. Can be disabled via menu
#### default: 0

View File

@ -94,8 +94,8 @@ y1=-53
y2=43
subdivy=1
x1=0.295931
x2=9.29594
x1=0
x2=9
divx=6
subdivx=8
@ -118,8 +118,8 @@ y1=37
y2=180
divy=4
subdivy=1
x1=0.295931
x2=9.29594
x1=0
x2=9
divx=6
subdivx=8