Merge branch 'StefanSchippers:master' into master
This commit is contained in:
commit
c0f1d54d55
|
|
@ -1357,7 +1357,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
void draw_crosshair(int what)
|
||||
{
|
||||
int sdw, sdp;
|
||||
int xhair_size = tclgetintvar("crosshair_size");;
|
||||
int xhair_size = tclgetintvar("crosshair_size");
|
||||
dbg(1, "draw_crosshair(): what=%d\n", what);
|
||||
sdw = xctx->draw_window;
|
||||
sdp = xctx->draw_pixmap;
|
||||
|
|
@ -2598,7 +2598,7 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
}
|
||||
}
|
||||
/* Select by area. Shift pressed */
|
||||
else if((state&Button1Mask) && (state & ShiftMask) &&
|
||||
else if((state&Button1Mask) && (state & ShiftMask) && !(xctx->ui_state & STARTWIRE) &&
|
||||
!(xctx->ui_state & (PLACE_SYMBOL | PLACE_TEXT)) && !xctx->shape_point_selected &&
|
||||
!xctx->drag_elements && !(xctx->ui_state & STARTPAN) ) {
|
||||
if(mx != xctx->mx_save || my != xctx->my_save) {
|
||||
|
|
@ -2616,7 +2616,19 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
}
|
||||
}
|
||||
if(draw_xhair) {
|
||||
if(/* (xctx->ui_state & STARTWIRE) && */ (state & ShiftMask) ) {
|
||||
double x, y, sx, sy;
|
||||
sx = xctx->mousex_snap;
|
||||
sy = xctx->mousey_snap;
|
||||
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
|
||||
xctx->mousex_snap = x;
|
||||
xctx->mousey_snap = y;
|
||||
draw_crosshair(2);
|
||||
xctx->mousex_snap = sx;
|
||||
xctx->mousey_snap = sy;
|
||||
} else {
|
||||
draw_crosshair(2);
|
||||
}
|
||||
}
|
||||
if(snap_cursor && wire_draw_active) draw_snap_cursor(2);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -182,8 +182,78 @@ static void find_closest_line(double mx,double my)
|
|||
}
|
||||
}
|
||||
|
||||
/* 20171022 snap wire to closest pin or net endpoint */
|
||||
|
||||
/* snap wire to closest pin or net endpoint (if it is inside the current screen viewport) */
|
||||
/* use spatial hash table iterators to avoid O(N) */
|
||||
void find_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
Iterator_ctx ctx;
|
||||
Instentry *instanceptr;
|
||||
Wireentry *wireptr;
|
||||
double curr_dist = DBL_MAX;
|
||||
double xx, yy, dist, min_dist_x = xctx->mousex_snap, min_dist_y = xctx->mousey_snap;
|
||||
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
x2 = X_TO_XSCHEM(xctx->areax2);
|
||||
y2 = Y_TO_XSCHEM(xctx->areay2);
|
||||
|
||||
hash_instances();
|
||||
hash_wires();
|
||||
|
||||
init_inst_iterator(&ctx, x1, y1, x2, y2);
|
||||
while(1) {
|
||||
int i, j, rects;
|
||||
xInstance * const inst = xctx->inst;
|
||||
if( !(instanceptr = inst_iterator_next(&ctx))) break;
|
||||
i = instanceptr->n;
|
||||
if(!((inst[i].ptr+ xctx->sym)->type)) continue;
|
||||
rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(j = 0; j < rects; j++) {
|
||||
get_inst_pin_coord(i, j, &xx, &yy);
|
||||
if(!POINTINSIDE(xx, yy, x1, y1, x2, y2)) continue;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < curr_dist) {
|
||||
curr_dist = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init_wire_iterator(&ctx, x1, y1, x2, y2);
|
||||
while(1) {
|
||||
int i;
|
||||
xWire * const wire = xctx->wire;
|
||||
if( !(wireptr = wire_iterator_next(&ctx))) break;
|
||||
i = wireptr->n;
|
||||
xx = wire[i].x1;
|
||||
yy = wire[i].y1;
|
||||
if(!POINTINSIDE(xx, yy, x1, y1, x2, y2)) continue;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < curr_dist) {
|
||||
curr_dist = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
}
|
||||
xx = wire[i].x2;
|
||||
yy = wire[i].y2;
|
||||
if(!POINTINSIDE(xx, yy, x1, y1, x2, y2)) continue;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < curr_dist) {
|
||||
curr_dist = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
}
|
||||
}
|
||||
|
||||
*x = min_dist_x;
|
||||
*y = min_dist_y;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void xfind_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
||||
{
|
||||
int i, j, no_of_pin_rects;
|
||||
double x0, x1, x2, y0, y1, y2, xx, yy, dist, min_dist_x = 0, min_dist_y = 0;
|
||||
|
|
@ -243,6 +313,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
*y = min_dist_y;
|
||||
my_free(_ALLOC_ID_, &type);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void find_closest_arc(double mx, double my)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -773,9 +773,6 @@ struct hilight_hashentry
|
|||
int time; /*delta-time for sims */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* spice raw file specific data */
|
||||
char **names;
|
||||
|
|
@ -801,9 +798,6 @@ typedef struct {
|
|||
double sweep1, sweep2;
|
||||
} Raw;
|
||||
|
||||
|
||||
|
||||
|
||||
/* for netlist.c */
|
||||
typedef struct instpinentry Instpinentry;
|
||||
struct instpinentry
|
||||
|
|
|
|||
|
|
@ -9103,7 +9103,8 @@ set_ne flat_netlist 0
|
|||
set_ne netlist_show 0
|
||||
set_ne color_ps 1
|
||||
set_ne ps_page_title 1 ;# add a title in the top left page corner
|
||||
set_ne crosshair_layer 3 ;# TEXTLAYER
|
||||
set_ne draw_crosshair 0
|
||||
set_ne crosshair_layer 8 ;# Yellow
|
||||
set_ne crosshair_size 0
|
||||
set_ne ps_paper_size {a4 842 595}
|
||||
set_ne transparent_svg 0
|
||||
|
|
@ -9128,7 +9129,6 @@ set_ne load_file_dialog_fullpath 1
|
|||
set_ne incremental_select 1
|
||||
set_ne select_touch 1
|
||||
|
||||
set_ne draw_crosshair 0
|
||||
set_ne draw_grid 1
|
||||
set_ne big_grid_points 0
|
||||
set_ne draw_grid_axes 1
|
||||
|
|
|
|||
|
|
@ -279,8 +279,8 @@
|
|||
#### enable drawing crosshairs at mouse coordinates. Default: disabled (0)
|
||||
# set draw_crosshair 1
|
||||
|
||||
#### set crosshair layer; Default 3 (TEXTLAYER)
|
||||
# set crosshair_layer 3
|
||||
#### set crosshair layer; Default 8 (Yellow)
|
||||
# set crosshair_layer 8
|
||||
|
||||
#### set crosshair size; Default: 0 (full screen spanning crosshair)
|
||||
# set crosshair_size 5
|
||||
|
|
|
|||
Loading…
Reference in New Issue