removed partial select of arcs, will be replaced in the future by bound box resizing and ability to draw ellipses

This commit is contained in:
stefan schippers 2024-03-01 15:04:38 +01:00
parent 2f9d9e1755
commit f903a018b2
3 changed files with 10 additions and 46 deletions

View File

@ -1283,6 +1283,7 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
{
static int i=0;
static XArc xarc[CADDRAWBUFFERSIZE];
static XRectangle xr[CADDRAWBUFFERSIZE];
double x1, y1, x2, y2; /* arc bbox */
double xx1, yy1, xx2, yy2; /* complete circle bbox in screen coords */
@ -1293,6 +1294,7 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
if(i>=CADDRAWBUFFERSIZE)
{
XDrawArcs(display, xctx->window, gc, xarc,i);
XDrawRectangles(display, xctx->window, gc, xr,i);
i=0;
}
xx1=X_TO_SCREEN(x-r);
@ -1312,6 +1314,10 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
xarc[i].height=(unsigned short)(yy2 - yy1);
xarc[i].angle1 = (short)(a*64);
xarc[i].angle2 = (short)(b*64);
xr[i].x=(short)x1;
xr[i].y=(short)y1;
xr[i].width=(unsigned short)(x2-xr[i].x);
xr[i].height=(unsigned short)(y2-xr[i].y);
++i;
}
}
@ -1335,12 +1341,16 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
} else {
XDrawArc(display, xctx->window, gc, (int)xx1, (int)yy1, (int)(xx2-xx1), (int)(yy2-yy1),
(int)(a*64), (int)(b*64));
XDrawRectangle(display, xctx->window, gc, (int)sx1, (int)sy1,
(unsigned int)x2 - (unsigned int)sx1,
(unsigned int)y2 - (unsigned int)sy1);
}
}
}
else if((what & END) && i)
{
XDrawArcs(display, xctx->window, gc, xarc,i);
XDrawRectangles(display, xctx->window, gc, xr,i);
i=0;
}
}
@ -1656,7 +1666,6 @@ void arc_bbox(double x, double y, double r, double a, double b,
*by2 = y + r;
}
}
/* printf("arc_bbox(): bx1=%g by1=%g bx2=%g by2=%g\n", *bx1, *by1, *bx2, *by2); */
}
/* Convex Nonconvex Complex */

View File

@ -428,18 +428,6 @@ void draw_selection(GC g, int interruptable)
if(xctx->arc[c][n].sel==SELECTED) {
drawtemparc(g, ADD, xctx->rx1+xctx->deltax, xctx->ry1+xctx->deltay,
xctx->arc[c][n].r, angle, xctx->arc[c][n].b);
} else if(xctx->arc[c][n].sel==SELECTED1) {
drawtemparc(g, ADD, xctx->rx1, xctx->ry1,
fabs(xctx->arc[c][n].r+xctx->deltax), angle, xctx->arc[c][n].b);
} else if(xctx->arc[c][n].sel==SELECTED3) {
angle = my_round(fmod(atan2(-xctx->deltay, xctx->deltax)*180./XSCH_PI+xctx->arc[c][n].b, 360.));
if(angle<0.) angle +=360.;
if(angle==0) angle=360.;
drawtemparc(g, ADD, xctx->rx1, xctx->ry1, xctx->arc[c][n].r, xctx->arc[c][n].a, angle);
} else if(xctx->arc[c][n].sel==SELECTED2) {
angle = my_round(fmod(atan2(-xctx->deltay, xctx->deltax)*180./XSCH_PI+angle, 360.));
if(angle<0.) angle +=360.;
drawtemparc(g, ADD, xctx->rx1, xctx->ry1, xctx->arc[c][n].r, angle, xctx->arc[c][n].b);
}
break;
case ELEMENT:
@ -1107,24 +1095,6 @@ void move_objects(int what, int merge, double dx, double dy)
xctx->arc[c][n].x = xctx->rx1+xctx->deltax;
xctx->arc[c][n].y = xctx->ry1+xctx->deltay;
xctx->arc[c][n].a = angle;
} else if(xctx->arc[c][n].sel == SELECTED1) {
xctx->arc[c][n].x = xctx->rx1;
xctx->arc[c][n].y = xctx->ry1;
if(xctx->arc[c][n].r+xctx->deltax) xctx->arc[c][n].r = fabs(xctx->arc[c][n].r+xctx->deltax);
xctx->arc[c][n].a = angle;
} else if(xctx->arc[c][n].sel == SELECTED2) {
angle = my_round(fmod(atan2(-xctx->deltay, xctx->deltax)*180./XSCH_PI+angle, 360.));
if(angle<0.) angle +=360.;
xctx->arc[c][n].x = xctx->rx1;
xctx->arc[c][n].y = xctx->ry1;
xctx->arc[c][n].a = angle;
} else if(xctx->arc[c][n].sel==SELECTED3) {
angle = my_round(fmod(atan2(-xctx->deltay, xctx->deltax)*180./XSCH_PI+xctx->arc[c][n].b, 360.));
if(angle<0.) angle +=360.;
if(angle==0) angle=360.;
xctx->arc[c][n].x = xctx->rx1;
xctx->arc[c][n].y = xctx->ry1;
xctx->arc[c][n].b = angle;
}
break;

View File

@ -1440,21 +1440,6 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
sel? select_arc(c, i, SELECTED,1): select_arc(c, i, 0,1);
}
else if( sel && en_s && POINTINSIDE(x, y, x1, y1, x2, y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_arc(c, i,SELECTED1,1);
}
else if( sel && en_s && POINTINSIDE(xb, yb, x1, y1, x2, y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_arc(c, i,SELECTED3,1);
}
else if( sel && en_s && POINTINSIDE(xa, ya, x1, y1, x2, y2) )
{
xctx->ui_state |= SELECTION; /* set xctx->ui_state to SELECTION also if unselecting by area ???? */
select_arc(c, i,SELECTED2,1);
}
}
for(i=0;i<xctx->rects[c]; ++i)
{