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)
|
void draw_crosshair(int what)
|
||||||
{
|
{
|
||||||
int sdw, sdp;
|
int sdw, sdp;
|
||||||
int xhair_size = tclgetintvar("crosshair_size");;
|
int xhair_size = tclgetintvar("crosshair_size");
|
||||||
dbg(1, "draw_crosshair(): what=%d\n", what);
|
dbg(1, "draw_crosshair(): what=%d\n", what);
|
||||||
sdw = xctx->draw_window;
|
sdw = xctx->draw_window;
|
||||||
sdp = xctx->draw_pixmap;
|
sdp = xctx->draw_pixmap;
|
||||||
|
|
@ -2598,7 +2598,7 @@ int rstate; /* (reduced state, without ShiftMask) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Select by area. Shift pressed */
|
/* 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->ui_state & (PLACE_SYMBOL | PLACE_TEXT)) && !xctx->shape_point_selected &&
|
||||||
!xctx->drag_elements && !(xctx->ui_state & STARTPAN) ) {
|
!xctx->drag_elements && !(xctx->ui_state & STARTPAN) ) {
|
||||||
if(mx != xctx->mx_save || my != xctx->my_save) {
|
if(mx != xctx->mx_save || my != xctx->my_save) {
|
||||||
|
|
@ -2616,7 +2616,19 @@ int rstate; /* (reduced state, without ShiftMask) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(draw_xhair) {
|
if(draw_xhair) {
|
||||||
draw_crosshair(2);
|
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);
|
if(snap_cursor && wire_draw_active) draw_snap_cursor(2);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
169
src/findnet.c
169
src/findnet.c
|
|
@ -25,18 +25,18 @@
|
||||||
static double distance; /* safe to keep even with multiple schematics */
|
static double distance; /* safe to keep even with multiple schematics */
|
||||||
static Selected sel; /* safe to keep even with multiple schematics */
|
static Selected sel; /* safe to keep even with multiple schematics */
|
||||||
|
|
||||||
static void find_closest_net(double mx,double my)
|
static void find_closest_net(double mx, double my)
|
||||||
/* returns the net that is closest to the mouse pointer */
|
/* returns the net that is closest to the mouse pointer */
|
||||||
/* if there are nets and distance < CADWIREMINDIST */
|
/* if there are nets and distance < CADWIREMINDIST */
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
int i,w=-1;
|
int i, w=-1;
|
||||||
double threshold;
|
double threshold;
|
||||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||||
|
|
||||||
for(i=0;i<xctx->wires; ++i)
|
for(i=0;i<xctx->wires; ++i)
|
||||||
{
|
{
|
||||||
if( (tmp = dist(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2,mx,my)) < distance )
|
if( (tmp = dist(xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, mx, my)) < distance )
|
||||||
{
|
{
|
||||||
w = i; distance = tmp;
|
w = i; distance = tmp;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ static void find_closest_bezier(double mx, double my, int c, int i, int *l, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_closest_polygon(double mx,double my)
|
static void find_closest_polygon(double mx, double my)
|
||||||
/* returns the polygon that is closest to the mouse pointer */
|
/* returns the polygon that is closest to the mouse pointer */
|
||||||
/* if there are lines and distance < CADWIREMINDIST */
|
/* if there are lines and distance < CADWIREMINDIST */
|
||||||
{
|
{
|
||||||
|
|
@ -138,7 +138,7 @@ static void find_closest_polygon(double mx,double my)
|
||||||
y1 = p->y[j];
|
y1 = p->y[j];
|
||||||
x2 = p->x[j+1];
|
x2 = p->x[j+1];
|
||||||
y2 = p->y[j+1];
|
y2 = p->y[j+1];
|
||||||
ORDER(x1,y1,x2,y2);
|
ORDER(x1, y1, x2, y2);
|
||||||
if( (tmp = dist(x1, y1, x2, y2, mx, my)) < distance )
|
if( (tmp = dist(x1, y1, x2, y2, mx, my)) < distance )
|
||||||
{
|
{
|
||||||
l = i; distance = tmp;col = c;
|
l = i; distance = tmp;col = c;
|
||||||
|
|
@ -155,12 +155,12 @@ static void find_closest_polygon(double mx,double my)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void find_closest_line(double mx,double my)
|
static void find_closest_line(double mx, double my)
|
||||||
/* returns the line that is closest to the mouse pointer */
|
/* returns the line that is closest to the mouse pointer */
|
||||||
/* if there are lines and distance < CADWIREMINDIST */
|
/* if there are lines and distance < CADWIREMINDIST */
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
int i,c,l=-1, col = 0;
|
int i, c, l = -1, col = 0;
|
||||||
double threshold;
|
double threshold;
|
||||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||||
for(c=0;c<cadlayers; ++c)
|
for(c=0;c<cadlayers; ++c)
|
||||||
|
|
@ -168,7 +168,7 @@ static void find_closest_line(double mx,double my)
|
||||||
if(!xctx->enable_layer[c]) continue;
|
if(!xctx->enable_layer[c]) continue;
|
||||||
for(i=0;i<xctx->lines[c]; ++i)
|
for(i=0;i<xctx->lines[c]; ++i)
|
||||||
{
|
{
|
||||||
if( (tmp = dist(xctx->line[c][i].x1,xctx->line[c][i].y1,xctx->line[c][i].x2,xctx->line[c][i].y2,mx,my))
|
if( (tmp = dist(xctx->line[c][i].x1, xctx->line[c][i].y1, xctx->line[c][i].x2, xctx->line[c][i].y2, mx, my))
|
||||||
< distance )
|
< distance )
|
||||||
{
|
{
|
||||||
l = i; distance = tmp;col = c;
|
l = i; distance = tmp;col = c;
|
||||||
|
|
@ -182,31 +182,101 @@ static void find_closest_line(double mx,double my)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 20171022 snap wire to closest pin or net endpoint */
|
|
||||||
void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
/* 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;
|
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;
|
double x0, x1, x2, y0, y1, y2, xx, yy, dist, min_dist_x = 0, min_dist_y = 0;
|
||||||
xRect rect;
|
xRect rect;
|
||||||
short rot, flip;
|
short rot, flip;
|
||||||
char *type=NULL;
|
char *type = NULL;
|
||||||
double curr_dist;
|
double curr_dist;
|
||||||
|
|
||||||
curr_dist = DBL_MAX;
|
curr_dist = DBL_MAX;
|
||||||
for(i=0;i<xctx->instances; ++i) {
|
for(i = 0;i < xctx->instances; ++i) {
|
||||||
x0=xctx->inst[i].x0;
|
x0=xctx->inst[i].x0;
|
||||||
y0=xctx->inst[i].y0;
|
y0=xctx->inst[i].y0;
|
||||||
rot = xctx->inst[i].rot;
|
rot = xctx->inst[i].rot;
|
||||||
flip = xctx->inst[i].flip;
|
flip = xctx->inst[i].flip;
|
||||||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
my_strdup(_ALLOC_ID_, &type, (xctx->inst[i].ptr+ xctx->sym)->type);
|
||||||
if(!type) continue;
|
if(!type) continue;
|
||||||
|
|
||||||
no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||||
if(IS_LABEL_OR_PIN(type)) no_of_pin_rects=1;
|
if(IS_LABEL_OR_PIN(type)) no_of_pin_rects=1;
|
||||||
for(j=0; j<no_of_pin_rects; ++j) {
|
for(j=0; j<no_of_pin_rects; ++j) {
|
||||||
rect = ((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER])[j];
|
rect = ((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER])[j];
|
||||||
ROTATION(rot, flip, 0.0,0.0,rect.x1,rect.y1,x1,y1);
|
ROTATION(rot, flip, 0.0, 0.0, rect.x1, rect.y1, x1, y1);
|
||||||
ROTATION(rot, flip, 0.0,0.0,rect.x2,rect.y2,x2,y2);
|
ROTATION(rot, flip, 0.0, 0.0, rect.x2, rect.y2, x2, y2);
|
||||||
x1 += x0;
|
x1 += x0;
|
||||||
y1 += y0;
|
y1 += y0;
|
||||||
x2 += x0;
|
x2 += x0;
|
||||||
|
|
@ -221,8 +291,8 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0;i<xctx->wires; ++i) {
|
for(i = 0;i < xctx->wires; ++i) {
|
||||||
xx=xctx->wire[i].x1;
|
xx = xctx->wire[i].x1;
|
||||||
yy = xctx->wire[i].y1;
|
yy = xctx->wire[i].y1;
|
||||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||||
if(dist < curr_dist) {
|
if(dist < curr_dist) {
|
||||||
|
|
@ -230,7 +300,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
||||||
min_dist_x = xx;
|
min_dist_x = xx;
|
||||||
min_dist_y = yy;
|
min_dist_y = yy;
|
||||||
}
|
}
|
||||||
xx=xctx->wire[i].x2;
|
xx = xctx->wire[i].x2;
|
||||||
yy = xctx->wire[i].y2;
|
yy = xctx->wire[i].y2;
|
||||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||||
if(dist < curr_dist) {
|
if(dist < curr_dist) {
|
||||||
|
|
@ -243,11 +313,12 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
||||||
*y = min_dist_y;
|
*y = min_dist_y;
|
||||||
my_free(_ALLOC_ID_, &type);
|
my_free(_ALLOC_ID_, &type);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void find_closest_arc(double mx,double my)
|
static void find_closest_arc(double mx, double my)
|
||||||
{
|
{
|
||||||
double dist, angle, angle1, angle2;
|
double dist, angle, angle1, angle2;
|
||||||
int i,c,r=-1, col;
|
int i, c, r=-1, col;
|
||||||
int match;
|
int match;
|
||||||
double threshold;
|
double threshold;
|
||||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||||
|
|
@ -257,7 +328,7 @@ static void find_closest_arc(double mx,double my)
|
||||||
if(!xctx->enable_layer[c]) continue;
|
if(!xctx->enable_layer[c]) continue;
|
||||||
for(i=0;i<xctx->arcs[c]; ++i)
|
for(i=0;i<xctx->arcs[c]; ++i)
|
||||||
{
|
{
|
||||||
dist = sqrt(pow(mx-xctx->arc[c][i].x,2) + pow(my-xctx->arc[c][i].y,2)) - xctx->arc[c][i].r;
|
dist = sqrt(pow(mx-xctx->arc[c][i].x, 2) + pow(my-xctx->arc[c][i].y, 2)) - xctx->arc[c][i].r;
|
||||||
dist *= dist; /* square distance */
|
dist *= dist; /* square distance */
|
||||||
angle = fmod(atan2(xctx->arc[c][i].y-my, mx-xctx->arc[c][i].x)*180./XSCH_PI, 360.);
|
angle = fmod(atan2(xctx->arc[c][i].y-my, mx-xctx->arc[c][i].x)*180./XSCH_PI, 360.);
|
||||||
if(angle<0.) angle +=360.;
|
if(angle<0.) angle +=360.;
|
||||||
|
|
@ -278,7 +349,7 @@ static void find_closest_arc(double mx,double my)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg(1, "find_closest_arc(): dist = %g, angle = %g\n", dist, angle);
|
dbg(1, "find_closest_arc(): dist = %g, angle = %g\n", dist, angle);
|
||||||
dbg(1, "find_closest_arc(): center=%g,%g: mouse: %g:%g\n",
|
dbg(1, "find_closest_arc(): center=%g, %g: mouse: %g:%g\n",
|
||||||
xctx->arc[c][i].x, xctx->arc[c][i].y, mx, my);
|
xctx->arc[c][i].x, xctx->arc[c][i].y, mx, my);
|
||||||
if(match ) {
|
if(match ) {
|
||||||
dbg(1, "find_closest_arc(): i = %d\n", i);
|
dbg(1, "find_closest_arc(): i = %d\n", i);
|
||||||
|
|
@ -288,29 +359,29 @@ static void find_closest_arc(double mx,double my)
|
||||||
}
|
}
|
||||||
} /* end for i */
|
} /* end for i */
|
||||||
} /* end for c */
|
} /* end for c */
|
||||||
if( r!=-1 && distance <= threshold ) /* * pow(xctx->arc[col][r].r,2)) */
|
if( r!=-1 && distance <= threshold ) /* * pow(xctx->arc[col][r].r, 2)) */
|
||||||
{
|
{
|
||||||
sel.n = r; sel.type = ARC; sel.col = col;
|
sel.n = r; sel.type = ARC; sel.col = col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void find_closest_box(double mx,double my, int override_lock)
|
static void find_closest_box(double mx ,double my, int override_lock)
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
double ds = xctx->cadhalfdotsize;
|
double ds = xctx->cadhalfdotsize;
|
||||||
|
|
||||||
int i,c,r=-1, col = 0;
|
int i, c, r=-1, col = 0;
|
||||||
for(c=0;c<cadlayers; ++c)
|
for(c=0;c<cadlayers; ++c)
|
||||||
{
|
{
|
||||||
if(!xctx->enable_layer[c]) continue;
|
if(!xctx->enable_layer[c]) continue;
|
||||||
for(i=0;i<xctx->rects[c]; ++i)
|
for(i=0;i<xctx->rects[c]; ++i)
|
||||||
{
|
{
|
||||||
if( POINTINSIDE(mx,my,xctx->rect[c][i].x1 - ds, xctx->rect[c][i].y1 - ds,
|
if( POINTINSIDE(mx, my, xctx->rect[c][i].x1 - ds, xctx->rect[c][i].y1 - ds,
|
||||||
xctx->rect[c][i].x2 + ds, xctx->rect[c][i].y2 + ds) )
|
xctx->rect[c][i].x2 + ds, xctx->rect[c][i].y2 + ds) )
|
||||||
{
|
{
|
||||||
tmp=dist_from_rect(mx,my,xctx->rect[c][i].x1,xctx->rect[c][i].y1,
|
tmp=dist_from_rect(mx, my, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
|
||||||
xctx->rect[c][i].x2,xctx->rect[c][i].y2);
|
xctx->rect[c][i].x2, xctx->rect[c][i].y2);
|
||||||
if(tmp < distance)
|
if(tmp < distance)
|
||||||
{
|
{
|
||||||
r = i; distance = tmp;col = c;
|
r = i; distance = tmp;col = c;
|
||||||
|
|
@ -324,22 +395,22 @@ static void find_closest_box(double mx,double my, int override_lock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_closest_element(double mx,double my, int override_lock)
|
static void find_closest_element(double mx, double my, int override_lock)
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
int i,r=-1;
|
int i, r=-1;
|
||||||
for(i=0;i<xctx->instances; ++i)
|
for(i=0;i<xctx->instances; ++i)
|
||||||
{
|
{
|
||||||
dbg(2, "find_closest_element(): %s: %g %g %g %g\n",
|
dbg(2, "find_closest_element(): %s: %g %g %g %g\n",
|
||||||
xctx->inst[i].instname, xctx->inst[i].x1,xctx->inst[i].y1,xctx->inst[i].x2,xctx->inst[i].y2);
|
xctx->inst[i].instname, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
||||||
if( POINTINSIDE(mx,my,xctx->inst[i].x1,xctx->inst[i].y1,xctx->inst[i].x2,xctx->inst[i].y2) )
|
if( POINTINSIDE(mx, my, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2) )
|
||||||
{
|
{
|
||||||
tmp=pow(mx-(xctx->inst[i].xx1 + xctx->inst[i].xx2)/2, 2)+pow(my-(xctx->inst[i].yy1 + xctx->inst[i].yy2)/2, 2);
|
tmp=pow(mx-(xctx->inst[i].xx1 + xctx->inst[i].xx2)/2, 2)+pow(my-(xctx->inst[i].yy1 + xctx->inst[i].yy2)/2, 2);
|
||||||
if(tmp*0.1 < distance)
|
if(tmp*0.1 < distance)
|
||||||
{
|
{
|
||||||
r = i; distance = tmp*0.1;
|
r = i; distance = tmp*0.1;
|
||||||
}
|
}
|
||||||
dbg(2, "find_closest_element(): finding closest element, instances=%d, dist=%.16g\n",i,tmp);
|
dbg(2, "find_closest_element(): finding closest element, instances=%d, dist=%.16g\n", i, tmp);
|
||||||
}
|
}
|
||||||
} /* end for i */
|
} /* end for i */
|
||||||
if( r!=-1 && (override_lock || strboolcmp(get_tok_value(xctx->inst[r].prop_ptr, "lock", 0), "true")) ) {
|
if( r!=-1 && (override_lock || strboolcmp(get_tok_value(xctx->inst[r].prop_ptr, "lock", 0), "true")) ) {
|
||||||
|
|
@ -347,11 +418,11 @@ static void find_closest_element(double mx,double my, int override_lock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_closest_text(double mx,double my)
|
static void find_closest_text(double mx, double my)
|
||||||
{
|
{
|
||||||
short rot,flip;
|
short rot, flip;
|
||||||
double xx1,xx2,yy1,yy2;
|
double xx1, xx2, yy1, yy2;
|
||||||
int i,r=-1, tmp;
|
int i, r=-1, tmp;
|
||||||
double threshold, dtmp;
|
double threshold, dtmp;
|
||||||
#if HAS_CAIRO==1
|
#if HAS_CAIRO==1
|
||||||
int customfont;
|
int customfont;
|
||||||
|
|
@ -370,17 +441,17 @@ static void find_closest_text(double mx,double my)
|
||||||
xctx->text[i].xscale, xctx->text[i].yscale, rot, flip,
|
xctx->text[i].xscale, xctx->text[i].yscale, rot, flip,
|
||||||
xctx->text[i].hcenter, xctx->text[i].vcenter,
|
xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||||
xctx->text[i].x0, xctx->text[i].y0,
|
xctx->text[i].x0, xctx->text[i].y0,
|
||||||
&xx1,&yy1, &xx2,&yy2, &tmp, &dtmp);
|
&xx1, &yy1, &xx2, &yy2, &tmp, &dtmp);
|
||||||
my_free(_ALLOC_ID_, &estr);
|
my_free(_ALLOC_ID_, &estr);
|
||||||
#if HAS_CAIRO==1
|
#if HAS_CAIRO==1
|
||||||
if(customfont) {
|
if(customfont) {
|
||||||
cairo_restore(xctx->cairo_ctx);
|
cairo_restore(xctx->cairo_ctx);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(POINTINSIDE(mx,my,xx1,yy1, xx2, yy2))
|
if(POINTINSIDE(mx, my, xx1, yy1, xx2, yy2))
|
||||||
{
|
{
|
||||||
r = i; distance = 0;
|
r = i; distance = 0;
|
||||||
dbg(2, "find_closest_text(): finding closest text, texts=%d, dist=%.16g\n",i,distance);
|
dbg(2, "find_closest_text(): finding closest text, texts=%d, dist=%.16g\n", i, distance);
|
||||||
}
|
}
|
||||||
} /* end for i */
|
} /* end for i */
|
||||||
if( distance <= threshold && r!=-1)
|
if( distance <= threshold && r!=-1)
|
||||||
|
|
@ -389,19 +460,19 @@ static void find_closest_text(double mx,double my)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Selected find_closest_obj(double mx,double my, int override_lock)
|
Selected find_closest_obj(double mx, double my, int override_lock)
|
||||||
{
|
{
|
||||||
sel.n = 0L; sel.col = 0; sel.type = 0;
|
sel.n = 0L; sel.col = 0; sel.type = 0;
|
||||||
distance = DBL_MAX;
|
distance = DBL_MAX;
|
||||||
find_closest_line(mx,my);
|
find_closest_line(mx, my);
|
||||||
find_closest_polygon(mx,my);
|
find_closest_polygon(mx, my);
|
||||||
/* dbg(1, "1 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
|
/* dbg(1, "1 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
|
||||||
find_closest_box(mx,my, override_lock);
|
find_closest_box(mx, my, override_lock);
|
||||||
find_closest_arc(mx,my);
|
find_closest_arc(mx, my);
|
||||||
/* dbg(1, "2 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
|
/* dbg(1, "2 find_closest_obj(): sel.n=%d, sel.col=%d, sel.type=%d\n", sel.n, sel.col, sel.type); */
|
||||||
find_closest_text(mx,my);
|
find_closest_text(mx, my);
|
||||||
find_closest_net(mx,my);
|
find_closest_net(mx, my);
|
||||||
find_closest_element(mx,my, override_lock);
|
find_closest_element(mx, my, override_lock);
|
||||||
return sel; /*sel.type = 0 if nothing found */
|
return sel; /*sel.type = 0 if nothing found */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -773,9 +773,6 @@ struct hilight_hashentry
|
||||||
int time; /*delta-time for sims */
|
int time; /*delta-time for sims */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* spice raw file specific data */
|
/* spice raw file specific data */
|
||||||
char **names;
|
char **names;
|
||||||
|
|
@ -801,9 +798,6 @@ typedef struct {
|
||||||
double sweep1, sweep2;
|
double sweep1, sweep2;
|
||||||
} Raw;
|
} Raw;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* for netlist.c */
|
/* for netlist.c */
|
||||||
typedef struct instpinentry Instpinentry;
|
typedef struct instpinentry Instpinentry;
|
||||||
struct instpinentry
|
struct instpinentry
|
||||||
|
|
|
||||||
|
|
@ -9103,7 +9103,8 @@ set_ne flat_netlist 0
|
||||||
set_ne netlist_show 0
|
set_ne netlist_show 0
|
||||||
set_ne color_ps 1
|
set_ne color_ps 1
|
||||||
set_ne ps_page_title 1 ;# add a title in the top left page corner
|
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 crosshair_size 0
|
||||||
set_ne ps_paper_size {a4 842 595}
|
set_ne ps_paper_size {a4 842 595}
|
||||||
set_ne transparent_svg 0
|
set_ne transparent_svg 0
|
||||||
|
|
@ -9128,7 +9129,6 @@ set_ne load_file_dialog_fullpath 1
|
||||||
set_ne incremental_select 1
|
set_ne incremental_select 1
|
||||||
set_ne select_touch 1
|
set_ne select_touch 1
|
||||||
|
|
||||||
set_ne draw_crosshair 0
|
|
||||||
set_ne draw_grid 1
|
set_ne draw_grid 1
|
||||||
set_ne big_grid_points 0
|
set_ne big_grid_points 0
|
||||||
set_ne draw_grid_axes 1
|
set_ne draw_grid_axes 1
|
||||||
|
|
|
||||||
|
|
@ -279,8 +279,8 @@
|
||||||
#### enable drawing crosshairs at mouse coordinates. Default: disabled (0)
|
#### enable drawing crosshairs at mouse coordinates. Default: disabled (0)
|
||||||
# set draw_crosshair 1
|
# set draw_crosshair 1
|
||||||
|
|
||||||
#### set crosshair layer; Default 3 (TEXTLAYER)
|
#### set crosshair layer; Default 8 (Yellow)
|
||||||
# set crosshair_layer 3
|
# set crosshair_layer 8
|
||||||
|
|
||||||
#### set crosshair size; Default: 0 (full screen spanning crosshair)
|
#### set crosshair size; Default: 0 (full screen spanning crosshair)
|
||||||
# set crosshair_size 5
|
# set crosshair_size 5
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue