avoid doing unselect_all() if nothing to unselect

This commit is contained in:
stefan schippers 2023-10-27 12:42:08 +02:00
parent 6362ebb214
commit 364fb55df1
2 changed files with 51 additions and 5 deletions

View File

@ -2141,20 +2141,27 @@ int rstate; /* (reduced state, without ShiftMask) */
}
if( 0 && (key=='u') && rstate==ControlMask) /* testmode */
{
int x = 1;
static int x = 0;
if(x == 0) {
XFillRectangle(display, xctx->window, xctx->gctiled,
xctx->xrect[0].x, xctx->xrect[0].y, xctx->xrect[0].width, xctx->xrect[0].height);
} else if(x == 1) {
int i;
for(i = 0; i < xctx->xrect[0].height; i++) {
for(i = xctx->xrect[0].y; i < xctx->xrect[0].height; i++) {
XDrawLine(display, xctx->window, xctx->gctiled,
xctx->xrect[0].x, i, xctx->xrect[0].width, i);
}
} else if(x == 2) {
int i;
for(i = xctx->xrect[0].x; i < xctx->xrect[0].width; i++) {
XDrawLine(display, xctx->window, xctx->gctiled,
i, xctx->xrect[0].y, i, xctx->xrect[0].height);
}
} else if(x == 3) {
int i, j;
for(i = 0; i < xctx->xrect[0].width; i++) {
for(j = 0; j < xctx->xrect[0].height; j++) {
for(i = 0; i < xctx->xrect[0].width; i+=1) {
for(j = 0; j < xctx->xrect[0].height; j+=1) {
XDrawLine(display, xctx->window, xctx->gctiled,
i, xctx->xrect[0].y, xctx->xrect[0].width - i, j);
@ -2169,8 +2176,45 @@ int rstate; /* (reduced state, without ShiftMask) */
}
}
} else if(x == 4) {
int i, j;
XPoint p[2];
for(i = 0; i < xctx->xrect[0].width; i+=1) {
for(j = 0; j < xctx->xrect[0].height; j+=1) {
p[0].x = (short int)i;
p[0].y = (short int)(xctx->xrect[0].y);
p[1].x = (short int)(xctx->xrect[0].width - i);
p[1].y = (short int)j;
XDrawLines(display, xctx->window, xctx->gctiled,
p, 2, CoordModeOrigin);
p[0].x = (short int)(xctx->xrect[0].width - i);
p[0].y = (short int)xctx->xrect[0].y;
p[1].x = (short int)i;
p[1].y = (short int)j;
XDrawLines(display, xctx->window, xctx->gctiled,
p, 2, CoordModeOrigin);
p[0].x = (short int)i;
p[0].y = (short int)xctx->xrect[0].height;
p[1].x = (short int)(xctx->xrect[0].width - i);
p[1].y = (short int)j;
XDrawLines(display, xctx->window, xctx->gctiled,
p, 2, CoordModeOrigin);
p[0].x = (short int)(xctx->xrect[0].width - i);
p[0].y = (short int)xctx->xrect[0].height;
p[1].x = (short int)i;
p[1].y = (short int)j;
XDrawLines(display, xctx->window, xctx->gctiled,
p, 2, CoordModeOrigin);
}
}
}
here(x);
x++;
x %= 5;
break;
}
if(key=='u' && rstate==0) /* undo */

View File

@ -834,10 +834,11 @@ void unselect_all(int dr)
#if HAS_CAIRO==1
int customfont;
#endif
set_first_sel(0, -1, 0);
if((xctx->ui_state & SELECTION) || xctx->lastsel) {
dbg(1, "unselect_all(1): start\n");
xctx->ui_state = 0;
xctx->lastsel = 0;
set_first_sel(0, -1, 0);
for(i=0;i<xctx->wires; ++i)
{
if(xctx->wire[i].sel)
@ -947,6 +948,7 @@ void unselect_all(int dr)
}
}
dbg(2, "unselect_all(1): done\n");
}
}
void select_wire(int i,unsigned short select_mode, int fast)