reduce overlap area when clearing crosshair, add return value to find_closest_net_or_symbol_pin()
This commit is contained in:
parent
71aa4339bd
commit
6cc7883e51
|
|
@ -1354,28 +1354,28 @@ void draw_crosshair(int what)
|
|||
if(fix_broken_tiled_fill || !_unix) {
|
||||
if(xhair_size) {
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 2 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
4 * INT_WIDTH(xctx->lw) + 4 * xhair_size,
|
||||
4 * INT_WIDTH(xctx->lw) + 4 * xhair_size,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 2 * INT_WIDTH(xctx->lw) - xhair_size);
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 1 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 1 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
2 * INT_WIDTH(xctx->lw) + 2 * xhair_size,
|
||||
2 * INT_WIDTH(xctx->lw) + 2 * xhair_size,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 1 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 1 * INT_WIDTH(xctx->lw) - xhair_size);
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 2 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
4 * INT_WIDTH(xctx->lw) + 4 * xhair_size,
|
||||
4 * INT_WIDTH(xctx->lw) + 4 * xhair_size,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 2 * INT_WIDTH(xctx->lw) - xhair_size);
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 1 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 1 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
2 * INT_WIDTH(xctx->lw) + 2 * xhair_size,
|
||||
2 * INT_WIDTH(xctx->lw) + 2 * xhair_size,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 1 * INT_WIDTH(xctx->lw) - xhair_size,
|
||||
(int)Y_TO_SCREEN(xctx->prev_crossy) - 1 * INT_WIDTH(xctx->lw) - xhair_size);
|
||||
} else { /* full screen span xhair */
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
|
||||
0, (int)Y_TO_SCREEN(xctx->prev_crossy) - 2 * INT_WIDTH(xctx->lw),
|
||||
xctx->xrect[0].width, 4 * INT_WIDTH(xctx->lw),
|
||||
0, (int)Y_TO_SCREEN(xctx->prev_crossy) - 2 * INT_WIDTH(xctx->lw));
|
||||
0, (int)Y_TO_SCREEN(xctx->prev_crossy) - 1 * INT_WIDTH(xctx->lw),
|
||||
xctx->xrect[0].width, 2 * INT_WIDTH(xctx->lw),
|
||||
0, (int)Y_TO_SCREEN(xctx->prev_crossy) - 1 * INT_WIDTH(xctx->lw));
|
||||
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw), 0,
|
||||
4 * INT_WIDTH(xctx->lw), xctx->xrect[0].height,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 2 * INT_WIDTH(xctx->lw), 0);
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 1 * INT_WIDTH(xctx->lw), 0,
|
||||
2 * INT_WIDTH(xctx->lw), xctx->xrect[0].height,
|
||||
(int)X_TO_SCREEN(xctx->prev_crossx) - 1 * INT_WIDTH(xctx->lw), 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ static void find_closest_line(double mx, double my)
|
|||
|
||||
/* 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)
|
||||
int find_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
Iterator_ctx ctx;
|
||||
|
|
@ -193,6 +193,7 @@ void find_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
|||
Wireentry *wireptr;
|
||||
double curr_dist = DBL_MAX;
|
||||
double xx, yy, dist, min_dist_x = xctx->mousex_snap, min_dist_y = xctx->mousey_snap;
|
||||
int found_net_or_pin = 0;
|
||||
|
||||
x1 = X_TO_XSCHEM(xctx->areax1);
|
||||
y1 = Y_TO_XSCHEM(xctx->areay1);
|
||||
|
|
@ -218,6 +219,7 @@ void find_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
|||
curr_dist = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
found_net_or_pin = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -236,6 +238,7 @@ void find_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
|||
curr_dist = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
found_net_or_pin = 1;
|
||||
}
|
||||
xx = wire[i].x2;
|
||||
yy = wire[i].y2;
|
||||
|
|
@ -245,11 +248,13 @@ void find_closest_net_or_symbol_pin(double mx, double my, double *x, double *y)
|
|||
curr_dist = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
found_net_or_pin = 1;
|
||||
}
|
||||
}
|
||||
|
||||
*x = min_dist_x;
|
||||
*y = min_dist_y;
|
||||
return found_net_or_pin;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
|||
|
|
@ -1396,7 +1396,8 @@ extern int callback(const char *winpath, int event, int mx, int my, KeySym key,
|
|||
int button, int aux, int state);
|
||||
extern void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h);
|
||||
extern Selected find_closest_obj(double mx,double my, int override_lock);
|
||||
extern void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y);
|
||||
/*extern void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y);*/
|
||||
extern int find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y);
|
||||
|
||||
extern void drawline(int c, int what, double x1,double y1,double x2,double y2, int dash, void *ct);
|
||||
extern void draw_xhair_line(GC gc, int size, double linex1, double liney1, double linex2, double liney2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue