dash attribute for arcs
This commit is contained in:
parent
a44302a7fd
commit
1a2500291d
|
|
@ -1810,7 +1810,7 @@ void new_arc(int what, double sweep)
|
|||
if(sweep_angle==360.) b=360.;
|
||||
if(r>0.) {
|
||||
push_undo();
|
||||
drawarc(rectcolor, NOW, x, y, r, a, b, 0);
|
||||
drawarc(rectcolor, NOW, x, y, r, a, b, 0, 0);
|
||||
store_arc(-1, x, y, r, a, b, rectcolor, 0, NULL);
|
||||
}
|
||||
ui_state &= ~STARTARC;
|
||||
|
|
|
|||
24
src/draw.c
24
src/draw.c
|
|
@ -535,7 +535,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
|
|||
angle = fmod(angle, 360.);
|
||||
if(angle<0.) angle+=360.;
|
||||
ROTATION(0.0,0.0,arc.x,arc.y,x1,y1);
|
||||
drawarc(c,what, x0+x1, y0+y1, arc.r, angle, arc.b, arc.fill);
|
||||
drawarc(c,what, x0+x1, y0+y1, arc.r, angle, arc.b, arc.fill, arc.dash);
|
||||
}
|
||||
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< symptr->rects[layer];j++)
|
||||
|
|
@ -1100,15 +1100,14 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
|
|||
}
|
||||
|
||||
|
||||
void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill)
|
||||
void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill, int dash)
|
||||
{
|
||||
static int i=0;
|
||||
static XArc arc[CADDRAWBUFFERSIZE];
|
||||
double x1, y1, x2, y2; /* arc bbox */
|
||||
double xx1, yy1, xx2, yy2; /* complete circle bbox in screen coords */
|
||||
|
||||
|
||||
if(arc_fill) what = NOW;
|
||||
if(arc_fill || dash) what = NOW;
|
||||
|
||||
if(!has_x) return;
|
||||
if(what & ADD)
|
||||
|
|
@ -1155,6 +1154,13 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
|
|||
y2=Y_TO_SCREEN(y2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(dash) {
|
||||
char dash_arr[2];
|
||||
dash_arr[0] = dash_arr[1] = dash;
|
||||
XSetDashes(display, gc[c], 0, dash_arr, 2);
|
||||
XSetLineAttributes (display, gc[c], lw ,LineDoubleDash, CapButt , JoinBevel);
|
||||
}
|
||||
|
||||
if(draw_window) {
|
||||
XDrawArc(display, window, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
|
||||
}
|
||||
|
|
@ -1170,9 +1176,9 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
|
|||
XFillArc(display, save_pixmap, gcstipple[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(dash) {
|
||||
XSetLineAttributes (display, gc[c], lw ,LineSolid, CapRound , JoinRound);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(what & BEGIN) i=0;
|
||||
|
|
@ -1550,7 +1556,7 @@ void draw(void)
|
|||
}
|
||||
for(i=0;i<lastarc[c];i++)
|
||||
{
|
||||
drawarc(c, ADD, arc[c][i].x, arc[c][i].y, arc[c][i].r, arc[c][i].a, arc[c][i].b, arc[c][i].fill);
|
||||
drawarc(c, ADD, arc[c][i].x, arc[c][i].y, arc[c][i].r, arc[c][i].a, arc[c][i].b, arc[c][i].fill, arc[c][i].dash);
|
||||
}
|
||||
for(i=0;i<lastpolygon[c];i++) {
|
||||
/* 20180914 added fill */
|
||||
|
|
@ -1630,7 +1636,7 @@ void draw(void)
|
|||
}
|
||||
|
||||
filledrect(c, END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawarc(c, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawarc(c, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
|
||||
drawrect(c, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawline(c, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -571,8 +571,9 @@ void edit_arc_property(void)
|
|||
{
|
||||
int old_fill; /* 20180914 */
|
||||
double x1, y1, x2, y2;
|
||||
int c, i, ii;
|
||||
int c, i, ii, old_dash, drw = 0;
|
||||
char *oldprop = NULL;
|
||||
const char *dash;
|
||||
int preserve;
|
||||
|
||||
if(arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
|
|
@ -604,15 +605,28 @@ void edit_arc_property(void)
|
|||
arc[c][i].fill =1;
|
||||
else
|
||||
arc[c][i].fill =0;
|
||||
if(old_fill != arc[c][i].fill) {
|
||||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
old_dash = arc[c][i].dash;
|
||||
dash = get_tok_value(arc[c][i].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
arc[c][i].dash = atoi(dash);
|
||||
else
|
||||
arc[c][i].dash = 0;
|
||||
|
||||
|
||||
if(old_fill != arc[c][i].fill || old_dash != arc[c][i].dash) {
|
||||
if(!drw) {
|
||||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
drw = 1;
|
||||
}
|
||||
arc_bbox(arc[c][i].x, arc[c][i].y, arc[c][i].r, 0, 360, &x1,&y1,&x2,&y2);
|
||||
bbox(ADD, x1, y1, x2, y2);
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
}
|
||||
if(drw) {
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@ void draw_hilight_net(int on_window)
|
|||
draw_symbol(ADD, inst_color[i], i,c,0,0,0.0,0.0);
|
||||
}
|
||||
filledrect(inst_color[i], END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawarc(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawarc(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
|
||||
drawrect(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawline(inst_color[i], END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@ void copy_objects(int what)
|
|||
|
||||
|
||||
arc[c][n].sel=0;
|
||||
drawarc(k, ADD, rx1+deltax, ry1+deltay, arc[c][n].r, angle, arc[c][n].b, arc[c][n].fill);
|
||||
drawarc(k, ADD, rx1+deltax, ry1+deltay, arc[c][n].r, angle, arc[c][n].b, arc[c][n].fill, arc[c][n].dash);
|
||||
selectedgroup[i].n=lastarc[c];
|
||||
store_arc(-1, rx1+deltax, ry1+deltay,
|
||||
arc[c][n].r, angle, arc[c][n].b, c, SELECTED, arc[c][n].prop_ptr);
|
||||
|
|
@ -813,7 +813,7 @@ void copy_objects(int what)
|
|||
}
|
||||
}
|
||||
filledrect(k, END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawarc(k, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawarc(k, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
|
||||
drawrect(k, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
|
||||
|
|
@ -1095,7 +1095,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
arc[c][n].y = ry1;
|
||||
arc[c][n].b = angle;
|
||||
}
|
||||
drawarc(k, ADD, arc[c][n].x, arc[c][n].y, arc[c][n].r, arc[c][n].a, arc[c][n].b, arc[c][n].fill);
|
||||
drawarc(k, ADD, arc[c][n].x, arc[c][n].y, arc[c][n].r, arc[c][n].a, arc[c][n].b, arc[c][n].fill, arc[c][n].dash);
|
||||
break;
|
||||
|
||||
case xRECT:
|
||||
|
|
@ -1256,7 +1256,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
|
||||
|
||||
filledrect(k, END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawarc(k, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawarc(k, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
|
||||
drawrect(k, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawline(k, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
} /*end for(k ... */
|
||||
|
|
|
|||
15
src/save.c
15
src/save.c
|
|
@ -607,6 +607,7 @@ static void load_arc(FILE *fd)
|
|||
{
|
||||
int i,c;
|
||||
xArc *ptr;
|
||||
const char *dash;
|
||||
|
||||
dbg(3, "load_arc(): start\n");
|
||||
fscanf(fd, "%d",&c);
|
||||
|
|
@ -631,6 +632,12 @@ static void load_arc(FILE *fd)
|
|||
ptr[i].fill =1;
|
||||
else
|
||||
ptr[i].fill =0;
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
ptr[i].dash = atoi(dash);
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
lastarc[c]++;
|
||||
}
|
||||
|
||||
|
|
@ -1478,6 +1485,14 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
else
|
||||
aa[c][i].fill =0;
|
||||
|
||||
dash = get_tok_value(aa[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") )
|
||||
aa[c][i].dash = atoi(dash);
|
||||
else
|
||||
aa[c][i].dash = 0;
|
||||
aa[c][i].sel = 0;
|
||||
|
||||
|
||||
dbg(2, "l_d_s(): loaded arc: ptr=%lx\n", (unsigned long)aa[c]);
|
||||
lasta[c]++;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ void store_arc(int pos, double x, double y, double r, double a, double b,
|
|||
unsigned int rectcolor, unsigned short sel, char *prop_ptr)
|
||||
{
|
||||
int n, j;
|
||||
const char *dash;
|
||||
check_arc_storage(rectcolor);
|
||||
if(pos==-1) n=lastarc[rectcolor];
|
||||
else
|
||||
|
|
@ -173,6 +174,12 @@ void store_arc(int pos, double x, double y, double r, double a, double b,
|
|||
arc[rectcolor][n].fill =1;
|
||||
else
|
||||
arc[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(arc[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
arc[rectcolor][n].dash = atoi(dash);
|
||||
else
|
||||
arc[rectcolor][n].dash = 0;
|
||||
|
||||
lastarc[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ typedef struct /* 20181012 */
|
|||
unsigned short sel;
|
||||
char *prop_ptr;
|
||||
int fill;
|
||||
int dash;
|
||||
} xArc;
|
||||
|
||||
typedef struct
|
||||
|
|
@ -777,7 +778,7 @@ extern void drawgrid(void);
|
|||
extern void drawtemprect(GC gc, int what, double rectx1,double recty1,
|
||||
double rectx2,double recty2);
|
||||
extern void drawtemparc(GC gc, int what, double x, double y, double r, double a, double b);
|
||||
extern void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill);
|
||||
extern void drawarc(int c, int what, double x, double y, double r, double a, double b, int arc_fill, int dash);
|
||||
extern void filledarc(int c, int what, double x, double y, double r, double a, double b);
|
||||
extern void drawtemppolygon(GC gc, int what, double *x, double *y, int points);
|
||||
extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ template="name=X1 WN=15u WP=45u LLN=3u LLP=3u m=1"
|
|||
V {}
|
||||
S {}
|
||||
E {}
|
||||
B 2 60 -390 190 -90 {dash=5}
|
||||
A 15 90 -350 14.14213562373095 135 360 {dash=2}
|
||||
P 2 5 60 -390 190 -390 190 -90 60 -90 60 -390 {dash=5}
|
||||
T {@name} 60 -405 0 0 0.2 0.2 {}
|
||||
T {@symname} 63.75 -85 0 0 0.2 0.2 {}
|
||||
N 140 -260 140 -200 {lab=Z}
|
||||
|
|
|
|||
Loading…
Reference in New Issue