initial support for drawing ellipses (from rectangle boxes)
This commit is contained in:
parent
83660bc531
commit
ce1d4b4bbb
|
|
@ -3269,11 +3269,11 @@ void new_rect(int what, double mousex_snap, double mousey_snap)
|
|||
int save_draw;
|
||||
RECTORDER(xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
|
||||
xctx->push_undo();
|
||||
drawrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 0);
|
||||
drawrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 0, -1, -1);
|
||||
save_draw = xctx->draw_window;
|
||||
xctx->draw_window = 1;
|
||||
/* draw fill pattern even in xcopyarea mode */
|
||||
filledrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 1);
|
||||
filledrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 1, -1, -1);
|
||||
xctx->draw_window = save_draw;
|
||||
storeobject(-1, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2,xRECT,xctx->rectcolor, 0, NULL);
|
||||
modified = 1;
|
||||
|
|
|
|||
111
src/draw.c
111
src/draw.c
|
|
@ -569,7 +569,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
}
|
||||
else if(!xctx->only_probes && (xctx->inst[n].x2 - xctx->inst[n].x1) * xctx->mooz < 3 &&
|
||||
(xctx->inst[n].y2 - xctx->inst[n].y1) * xctx->mooz < 3) {
|
||||
drawrect(c, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 0);
|
||||
drawrect(c, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 0, -1, -1);
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
|
|
@ -578,7 +578,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
}
|
||||
if(hide) {
|
||||
int color = (disabled==1) ? GRIDLAYER : (disabled == 2) ? PINLAYER : SYMLAYER;
|
||||
drawrect(color, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 2);
|
||||
drawrect(color, NOW, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 2, -1, -1);
|
||||
}
|
||||
} else if(xctx->inst[n].flags&1) {
|
||||
dbg(2, "draw_symbol(): skipping inst %d\n", n);
|
||||
|
|
@ -661,8 +661,9 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
#endif
|
||||
{
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, dash);
|
||||
if(rect->fill) filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, rect->fill);
|
||||
drawrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, dash, rect->ellipse_a, rect->ellipse_b);
|
||||
if(rect->fill) filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2, rect->fill,
|
||||
rect->ellipse_a, rect->ellipse_b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -727,7 +728,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
x0+x1, y0+y1, xscale, yscale);
|
||||
my_free(_ALLOC_ID_, &txtptr);
|
||||
#if HAS_CAIRO!=1
|
||||
drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, -1, -1);
|
||||
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
#endif
|
||||
#if HAS_CAIRO==1
|
||||
|
|
@ -1552,7 +1553,8 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
|
|||
}
|
||||
}
|
||||
|
||||
void filledrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2, int fill)
|
||||
void filledrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2, int fill,
|
||||
int e_a, int e_b)
|
||||
{
|
||||
static int iif = 0, iis = 0;
|
||||
int *i;
|
||||
|
|
@ -1560,6 +1562,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
|
|||
static XRectangle rs[CADDRAWBUFFERSIZE]; /* stippled fill */
|
||||
XRectangle *r;
|
||||
double x1,y1,x2,y2;
|
||||
double xx1,yy1,xx2,yy2;
|
||||
GC gc;
|
||||
|
||||
if(!has_x) return;
|
||||
|
|
@ -1574,22 +1577,38 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
|
|||
r = rs;
|
||||
i = &iis;
|
||||
}
|
||||
if(e_a != -1) what = NOW;
|
||||
if(what & NOW)
|
||||
{
|
||||
x1=X_TO_SCREEN(rectx1);
|
||||
y1=Y_TO_SCREEN(recty1);
|
||||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
xx1 = x1 = X_TO_SCREEN(rectx1);
|
||||
yy1 = y1 = Y_TO_SCREEN(recty1);
|
||||
xx2 = x2 = X_TO_SCREEN(rectx2);
|
||||
yy2 = y2 = Y_TO_SCREEN(recty2);
|
||||
if(!xctx->only_probes && (x2-x1)< 3.0 && (y2-y1)< 3.0) return;
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(xctx->draw_window) XFillRectangle(display, xctx->window, gc, (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
if(xctx->draw_pixmap)
|
||||
XFillRectangle(display, xctx->save_pixmap, gc, (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
if(xctx->draw_window) {
|
||||
if(e_a != -1) {
|
||||
XFillArc(display, xctx->window, gc, (int)xx1, (int)yy1,
|
||||
(unsigned int)xx2 - (unsigned int)xx1,
|
||||
(unsigned int)yy2 - (unsigned int)yy1, e_a * 64, e_b * 64);
|
||||
} else {
|
||||
XFillRectangle(display, xctx->window, gc, (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
}
|
||||
}
|
||||
if(xctx->draw_pixmap) {
|
||||
if(e_a != -1) {
|
||||
XFillArc(display, xctx->save_pixmap, gc, (int)xx1, (int)yy1,
|
||||
(unsigned int)xx2 - (unsigned int)xx1,
|
||||
(unsigned int)yy2 - (unsigned int)yy1, e_a * 64, e_b * 64);
|
||||
} else {
|
||||
XFillRectangle(display, xctx->save_pixmap, gc, (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(what & ADD)
|
||||
|
|
@ -1884,21 +1903,24 @@ void drawtemppolygon(GC gc, int what, double *x, double *y, int points, int flag
|
|||
}
|
||||
}
|
||||
|
||||
void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2, int dash)
|
||||
void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2, int dash,
|
||||
int e_a, int e_b)
|
||||
{
|
||||
static int i=0;
|
||||
static XRectangle r[CADDRAWBUFFERSIZE];
|
||||
double x1,y1,x2,y2;
|
||||
double xx1,yy1,xx2,yy2;
|
||||
char dash_arr[2];
|
||||
|
||||
if(!has_x) return;
|
||||
if(dash) what = NOW;
|
||||
if(e_a != -1) what = NOW; /* ellipse */
|
||||
if(what & NOW)
|
||||
{
|
||||
x1=X_TO_SCREEN(rectx1);
|
||||
y1=Y_TO_SCREEN(recty1);
|
||||
x2=X_TO_SCREEN(rectx2);
|
||||
y2=Y_TO_SCREEN(recty2);
|
||||
xx1 = x1 = X_TO_SCREEN(rectx1);
|
||||
yy1 = y1 = Y_TO_SCREEN(recty1);
|
||||
xx2 = x2 = X_TO_SCREEN(rectx2);
|
||||
yy2 = y2 = Y_TO_SCREEN(recty2);
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
if(dash) {
|
||||
|
|
@ -1906,14 +1928,29 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double
|
|||
XSetDashes(display, xctx->gc[c], 0, dash_arr, 1);
|
||||
XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw), xDashType, xCap, xJoin);
|
||||
}
|
||||
if(xctx->draw_window) XDrawRectangle(display, xctx->window, xctx->gc[c], (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
if(xctx->draw_window) {
|
||||
if(e_a != -1) {
|
||||
XDrawArc(display, xctx->window, xctx->gc[c], (int)xx1, (int)yy1,
|
||||
(unsigned int)xx2 - (unsigned int)xx1,
|
||||
(unsigned int)yy2 - (unsigned int)yy1, e_a * 64, e_b * 64);
|
||||
} else {
|
||||
XDrawRectangle(display, xctx->window, xctx->gc[c], (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
}
|
||||
}
|
||||
if(xctx->draw_pixmap)
|
||||
{
|
||||
XDrawRectangle(display, xctx->save_pixmap, xctx->gc[c], (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
if(e_a != -1) {
|
||||
XDrawArc(display, xctx->save_pixmap, xctx->gc[c], (int)xx1, (int)yy1,
|
||||
(unsigned int)xx2 - (unsigned int)xx1,
|
||||
(unsigned int)yy2 - (unsigned int)yy1, e_a * 64, e_b * 64);
|
||||
|
||||
} else {
|
||||
XDrawRectangle(display, xctx->save_pixmap, xctx->gc[c], (int)x1, (int)y1,
|
||||
(unsigned int)x2 - (unsigned int)x1,
|
||||
(unsigned int)y2 - (unsigned int)y1);
|
||||
}
|
||||
}
|
||||
if(dash) {
|
||||
XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw) ,LineSolid, LINECAP, LINEJOIN);
|
||||
|
|
@ -2646,9 +2683,9 @@ static void draw_graph_grid(Graph_ctx *gr, void *ct)
|
|||
|
||||
/* clipping everything outside container area */
|
||||
/* background */
|
||||
filledrect(0, NOW, gr->rx1, gr->ry1, gr->rx2, gr->ry2, 3);
|
||||
filledrect(0, NOW, gr->rx1, gr->ry1, gr->rx2, gr->ry2, 3, -1, -1);
|
||||
/* graph bounding box */
|
||||
drawrect(GRIDLAYER, NOW, gr->rx1, gr->ry1, gr->rx2, gr->ry2, 2);
|
||||
drawrect(GRIDLAYER, NOW, gr->rx1, gr->ry1, gr->rx2, gr->ry2, 2, -1, -1);
|
||||
|
||||
bbox(START, 0.0, 0.0, 0.0, 0.0);
|
||||
bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2);
|
||||
|
|
@ -2919,7 +2956,7 @@ static void draw_cursor(double active_cursorx, double other_cursorx, int cursor_
|
|||
else
|
||||
my_snprintf(tmpstr, S(tmpstr), "%s", dtoa_eng(active_cursorx));
|
||||
text_bbox(tmpstr, txtsize, txtsize, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, &tx1, &ty1, &tx2, &ty2, &tmp, &dtmp);
|
||||
filledrect(0, NOW, tx1, ty1, tx2, ty2, 3);
|
||||
filledrect(0, NOW, tx1, ty1, tx2, ty2, 3, -1, -1);
|
||||
draw_string(cursor_color, NOW, tmpstr, 2, flip, 0, 0, xx + xoffs, gr->ry2-1, txtsize, txtsize);
|
||||
}
|
||||
}
|
||||
|
|
@ -4475,8 +4512,8 @@ void draw(void)
|
|||
if(c != GRIDLAYER || !(r->flags & 1) )
|
||||
#endif
|
||||
{
|
||||
drawrect(cc, ADD, r->x1, r->y1, r->x2, r->y2, r->dash);
|
||||
if(r->fill) filledrect(cc, ADD, r->x1, r->y1, r->x2, r->y2, r->fill);
|
||||
drawrect(cc, ADD, r->x1, r->y1, r->x2, r->y2, r->dash, r->ellipse_a, r->ellipse_b);
|
||||
if(r->fill) filledrect(cc, ADD, r->x1, r->y1, r->x2, r->y2, r->fill, r->ellipse_a, r->ellipse_b);
|
||||
}
|
||||
}
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->arcs[c]; ++i) {
|
||||
|
|
@ -4514,9 +4551,9 @@ void draw(void)
|
|||
draw_symbol(ADD, cc, i,c,0,0,0.0,0.0); /* ... then draw current layer */
|
||||
}
|
||||
}
|
||||
filledrect(cc, END, 0.0, 0.0, 0.0, 0.0, 3); /* last parameter must be 3! */
|
||||
filledrect(cc, END, 0.0, 0.0, 0.0, 0.0, 3, -1, -1); /* last parameter must be 3! */
|
||||
drawarc(cc, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
|
||||
drawrect(cc, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawrect(cc, END, 0.0, 0.0, 0.0, 0.0, 0, -1, -1);
|
||||
drawline(cc, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
}
|
||||
cc = WIRELAYER; if(xctx->only_probes) cc = GRIDLAYER;
|
||||
|
|
@ -4541,7 +4578,7 @@ void draw(void)
|
|||
xctx->wire[i].x2,xctx->wire[i].y2, 0, NULL);
|
||||
}
|
||||
update_conn_cues(cc, 1, xctx->draw_window);
|
||||
filledrect(cc, END, 0.0, 0.0, 0.0, 0.0, 3); /* last parameter must be 3! */
|
||||
filledrect(cc, END, 0.0, 0.0, 0.0, 0.0, 3, -1, -1); /* fill parameter must be 3! */
|
||||
drawline(cc, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
}
|
||||
if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) {
|
||||
|
|
@ -4589,7 +4626,7 @@ void draw(void)
|
|||
}
|
||||
#endif
|
||||
#if HAS_CAIRO!=1
|
||||
drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, -1, -1);
|
||||
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
#endif
|
||||
} /* for(i=0;i<xctx->texts; ++i) */
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ static int edit_rect_property(int x)
|
|||
{
|
||||
int i, c, n;
|
||||
int drw = 0;
|
||||
const char *dash, *fill;
|
||||
const char *attr;
|
||||
int preserve, modified = 0;
|
||||
char *oldprop=NULL;
|
||||
|
||||
|
|
@ -914,16 +914,32 @@ static int edit_rect_property(int x)
|
|||
set_rect_flags(&xctx->rect[c][n]); /* set cached .flags bitmask from on attributes */
|
||||
|
||||
set_rect_extraptr(0, &xctx->rect[c][n]);
|
||||
dash = get_tok_value(xctx->rect[c][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
|
||||
attr = get_tok_value(xctx->rect[c][n].prop_ptr,"dash",0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int d = atoi(attr);
|
||||
xctx->rect[c][n].dash = (short)(d >= 0? d : 0);
|
||||
} else
|
||||
xctx->rect[c][n].dash = 0;
|
||||
|
||||
fill = get_tok_value(xctx->rect[c][n].prop_ptr,"fill", 0);
|
||||
if(!strcmp(fill, "full")) xctx->rect[c][n].fill = 3;
|
||||
else if(!strboolcmp(fill, "false")) xctx->rect[c][n].fill = 0;
|
||||
attr = get_tok_value(xctx->rect[c][n].prop_ptr,"ellipse", 0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int a;
|
||||
int b;
|
||||
if(sscanf(attr, "%d%*[ ,]%d", &a, &b) != 2) {
|
||||
a = 0;
|
||||
b = 360;
|
||||
}
|
||||
xctx->rect[c][n].ellipse_a = a;
|
||||
xctx->rect[c][n].ellipse_b = b;
|
||||
} else {
|
||||
xctx->rect[c][n].ellipse_a = -1;
|
||||
xctx->rect[c][n].ellipse_b = -1;
|
||||
}
|
||||
|
||||
attr = get_tok_value(xctx->rect[c][n].prop_ptr,"fill", 0);
|
||||
if(!strcmp(attr, "full")) xctx->rect[c][n].fill = 3;
|
||||
else if(!strboolcmp(attr, "false")) xctx->rect[c][n].fill = 0;
|
||||
else xctx->rect[c][n].fill = 1;
|
||||
|
||||
if( (oldprop && xctx->rect[c][n].prop_ptr && strcmp(oldprop, xctx->rect[c][n].prop_ptr)) ||
|
||||
|
|
|
|||
|
|
@ -2212,9 +2212,9 @@ void draw_hilight_net(int on_window)
|
|||
((c==TEXTWIRELAYER || c==TEXTLAYER) && symptr->texts)) {
|
||||
draw_symbol(ADD, col, i,c,0,0,0.0,0.0);
|
||||
}
|
||||
filledrect(col, END, 0.0, 0.0, 0.0, 0.0, 3); /* last parameter must be 3! */
|
||||
filledrect(col, END, 0.0, 0.0, 0.0, 0.0, 3, -1, -1); /* last parameter must be 3! */
|
||||
drawarc(col, END, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
|
||||
drawrect(col, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawrect(col, END, 0.0, 0.0, 0.0, 0.0, 0, -1, -1);
|
||||
drawline(col, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
src/paste.c
24
src/paste.c
|
|
@ -73,7 +73,7 @@ static void merge_box(FILE *fd)
|
|||
{
|
||||
int i,c,n;
|
||||
xRect *ptr;
|
||||
const char *dash, *fill_ptr;
|
||||
const char *attr, *fill_ptr;
|
||||
|
||||
n = fscanf(fd, "%d",&c);
|
||||
if(n != 1 || c < 0 || c >= cadlayers) {
|
||||
|
|
@ -95,13 +95,29 @@ static void merge_box(FILE *fd)
|
|||
RECTORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
|
||||
ptr[i].sel=0;
|
||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
int d = atoi(dash);
|
||||
attr = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(attr, "")) {
|
||||
int d = atoi(attr);
|
||||
ptr[i].dash = (short)(d >= 0 ? d : 0);
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
||||
attr = get_tok_value(ptr[i].prop_ptr,"ellipse",0);
|
||||
if(strcmp(attr, "")) {
|
||||
int a;
|
||||
int b;
|
||||
if(sscanf(attr, "%d%*[ ,]%d", &a, &b) != 2) {
|
||||
a = 0;
|
||||
b = 360;
|
||||
}
|
||||
ptr[i].ellipse_a = a;
|
||||
ptr[i].ellipse_b = b;
|
||||
} else {
|
||||
ptr[i].ellipse_a = -1;
|
||||
ptr[i].ellipse_b = -1;
|
||||
}
|
||||
|
||||
fill_ptr = get_tok_value(ptr[i].prop_ptr,"fill",0);
|
||||
if( !strcmp(fill_ptr, "full") )
|
||||
ptr[i].fill =3;
|
||||
|
|
|
|||
69
src/save.c
69
src/save.c
|
|
@ -2585,7 +2585,6 @@ static void load_polygon(FILE *fd)
|
|||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
||||
xctx->polygons[c]++;
|
||||
}
|
||||
|
||||
|
|
@ -2636,7 +2635,7 @@ static void load_box(FILE *fd)
|
|||
{
|
||||
int i,n,c;
|
||||
xRect *ptr;
|
||||
const char *dash, *fill_ptr;
|
||||
const char *attr, *fill_ptr;
|
||||
|
||||
dbg(3, "load_box(): start\n");
|
||||
n = fscanf(fd, "%d",&c);
|
||||
|
|
@ -2666,13 +2665,29 @@ static void load_box(FILE *fd)
|
|||
ptr[i].fill =0;
|
||||
else
|
||||
ptr[i].fill =1;
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
int d = atoi(dash);
|
||||
attr = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(attr, "")) {
|
||||
int d = atoi(attr);
|
||||
ptr[i].dash = (short)(d >= 0 ? d : 0);
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
||||
attr = get_tok_value(ptr[i].prop_ptr,"ellipse",0);
|
||||
if(strcmp(attr, "")) {
|
||||
int a;
|
||||
int b;
|
||||
if(sscanf(attr, "%d%*[ ,]%d", &a, &b) != 2) {
|
||||
a = 0;
|
||||
b = 360;
|
||||
}
|
||||
ptr[i].ellipse_a = a;
|
||||
ptr[i].ellipse_b = b;
|
||||
} else {
|
||||
ptr[i].ellipse_a = -1;
|
||||
ptr[i].ellipse_b = -1;
|
||||
}
|
||||
|
||||
set_rect_flags(&xctx->rect[c][i]); /* set cached .flags bitmask from on attributes */
|
||||
xctx->rects[c]++;
|
||||
}
|
||||
|
|
@ -3624,6 +3639,7 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb,
|
|||
bb[PINLAYER][i].flags = 0;
|
||||
bb[PINLAYER][i].extraptr = 0;
|
||||
bb[PINLAYER][i].dash = 0;
|
||||
bb[PINLAYER][i].ellipse_a = bb[PINLAYER][i].ellipse_b = -1;
|
||||
bb[PINLAYER][i].sel = 0;
|
||||
/* add to symbol pins remaining attributes from schematic pins, except name= and lab= */
|
||||
my_strdup(_ALLOC_ID_, &pin_label, get_sym_template(prop_ptr, "lab")); /* remove name=... and lab=... */
|
||||
|
|
@ -3821,7 +3837,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
xText tmptext, *tt;
|
||||
int endfile;
|
||||
char *skip_line;
|
||||
const char *dash, *fill_ptr;
|
||||
const char *attr, *fill_ptr;
|
||||
xSymbol * symbol;
|
||||
int symbols, sym_n_pins=0, generator;
|
||||
char *cmd = NULL;
|
||||
|
|
@ -4020,9 +4036,9 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
ll[c][i].bus = 1;
|
||||
else
|
||||
ll[c][i].bus = 0;
|
||||
dash = get_tok_value(ll[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
attr = get_tok_value(ll[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int d = atoi(attr);
|
||||
ll[c][i].dash = (short)(d >= 0 ? d : 0);
|
||||
} else
|
||||
ll[c][i].dash = 0;
|
||||
|
|
@ -4084,12 +4100,13 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
else
|
||||
pp[c][i].fill =0;
|
||||
|
||||
dash = get_tok_value(pp[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
attr = get_tok_value(pp[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int d = atoi(attr);
|
||||
pp[c][i].dash = (short)(d >= 0 ? d : 0);
|
||||
} else
|
||||
pp[c][i].dash = 0;
|
||||
|
||||
pp[c][i].sel = 0;
|
||||
|
||||
dbg(2, "l_s_d(): loaded polygon: ptr=%lx\n", (unsigned long)pp[c]);
|
||||
|
|
@ -4148,9 +4165,9 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
aa[c][i].fill =1;
|
||||
else
|
||||
aa[c][i].fill =0;
|
||||
dash = get_tok_value(aa[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
attr = get_tok_value(aa[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int d = atoi(attr);
|
||||
aa[c][i].dash = (short)(d >= 0 ? d : 0);
|
||||
} else
|
||||
aa[c][i].dash = 0;
|
||||
|
|
@ -4211,11 +4228,27 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
bb[c][i].fill =0;
|
||||
else
|
||||
bb[c][i].fill =1;
|
||||
dash = get_tok_value(bb[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
attr = get_tok_value(bb[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int d = atoi(attr);
|
||||
bb[c][i].dash = (short)(d >= 0 ? d : 0);
|
||||
} else bb[c][i].dash = 0;
|
||||
|
||||
attr = get_tok_value(bb[c][i].prop_ptr,"ellipse", 0);
|
||||
if( strcmp(attr, "") ) {
|
||||
int a;
|
||||
int b;
|
||||
if(sscanf(attr, "%d%*[ ,]%d", &a, &b) != 2) {
|
||||
a = 0;
|
||||
b = 360;
|
||||
}
|
||||
bb[c][i].ellipse_a = a;
|
||||
bb[c][i].ellipse_b = b;
|
||||
} else {
|
||||
bb[c][i].ellipse_a = -1;
|
||||
bb[c][i].ellipse_b = -1;
|
||||
}
|
||||
|
||||
bb[c][i].sel = 0;
|
||||
bb[c][i].extraptr = NULL;
|
||||
set_rect_flags(&bb[c][i]);
|
||||
|
|
|
|||
|
|
@ -3982,8 +3982,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(argc > 8) draw = atoi(argv[8]);
|
||||
storeobject(pos, x1,y1,x2,y2,xRECT,xctx->rectcolor,0,prop_str);
|
||||
if(draw) {
|
||||
int c = xctx->rectcolor;
|
||||
int n = xctx->rects[c] - 1;
|
||||
int e_a = xctx->rect[c][n].ellipse_a;
|
||||
int e_b = xctx->rect[c][n].ellipse_b;
|
||||
save = xctx->draw_window; xctx->draw_window = 1;
|
||||
drawrect(xctx->rectcolor,NOW, x1,y1,x2,y2, 0);
|
||||
drawrect(xctx->rectcolor,NOW, x1,y1,x2,y2, 0, e_a, e_b);
|
||||
xctx->draw_window = save;
|
||||
}
|
||||
set_modify(1);
|
||||
|
|
|
|||
26
src/store.c
26
src/store.c
|
|
@ -227,7 +227,7 @@ int storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
unsigned short sel, const char *prop_ptr)
|
||||
{
|
||||
int n, j, modified = 0;
|
||||
const char *dash, *fill_ptr;
|
||||
const char *attr, *fill_ptr;
|
||||
if(type == LINE)
|
||||
{
|
||||
check_line_storage(rectc);
|
||||
|
|
@ -254,8 +254,8 @@ int storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
xctx->line[rectc][n].bus = 1;
|
||||
else
|
||||
xctx->line[rectc][n].bus = 0;
|
||||
if(prop_ptr && (dash = get_tok_value(prop_ptr,"dash",0))[0]) {
|
||||
int d = atoi(dash);
|
||||
if(prop_ptr && (attr = get_tok_value(prop_ptr,"dash",0))[0]) {
|
||||
int d = atoi(attr);
|
||||
xctx->line[rectc][n].dash = (char) (d >= 0 ? d : 0);
|
||||
} else
|
||||
xctx->line[rectc][n].dash = 0;
|
||||
|
|
@ -284,11 +284,27 @@ int storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
my_strdup(_ALLOC_ID_, &xctx->rect[rectc][n].prop_ptr, prop_ptr);
|
||||
xctx->rect[rectc][n].sel=sel;
|
||||
if(sel == SELECTED) set_first_sel(xRECT, n, rectc);
|
||||
if(prop_ptr && (dash = get_tok_value(prop_ptr,"dash",0))[0]) {
|
||||
int d = atoi(dash);
|
||||
|
||||
if(prop_ptr && (attr = get_tok_value(prop_ptr,"dash",0))[0]) {
|
||||
int d = atoi(attr);
|
||||
xctx->rect[rectc][n].dash = (char) (d >= 0 ? d : 0);
|
||||
} else
|
||||
xctx->rect[rectc][n].dash = 0;
|
||||
|
||||
if(prop_ptr && (attr = get_tok_value(prop_ptr,"ellipse",0))[0]) {
|
||||
int a;
|
||||
int b;
|
||||
if(sscanf(attr, "%d%*[ ,]%d", &a, &b) != 2) {
|
||||
a = 0;
|
||||
b = 360;
|
||||
}
|
||||
xctx->rect[rectc][n].ellipse_a = a;
|
||||
xctx->rect[rectc][n].ellipse_b = b;
|
||||
} else {
|
||||
xctx->rect[rectc][n].ellipse_a = -1;
|
||||
xctx->rect[rectc][n].ellipse_b = -1;
|
||||
}
|
||||
|
||||
fill_ptr = get_tok_value(xctx->rect[rectc][n].prop_ptr, "fill", 0);
|
||||
if(!strcmp(fill_ptr, "full") )
|
||||
xctx->rect[rectc][n].fill =3;
|
||||
|
|
|
|||
|
|
@ -492,6 +492,7 @@ typedef struct
|
|||
void *extraptr; /* generic data pointer (images) */
|
||||
short fill;
|
||||
short dash;
|
||||
int ellipse_a, ellipse_b;
|
||||
/* bit0=1 for graph function, bit1=1 for unlocked x axis
|
||||
* bit10: image embedding (png)
|
||||
*/
|
||||
|
|
@ -1395,9 +1396,9 @@ extern void get_sym_text_size(int inst, int text_n, double *xscale, double *ysca
|
|||
extern void draw_symbol(int what,int c, int n,int layer,
|
||||
short tmp_flip, short tmp_rot, double xoffset, double yoffset);
|
||||
extern void drawrect(int c, int what, double rectx1,double recty1,
|
||||
double rectx2,double recty2, int dash);
|
||||
double rectx2,double recty2, int dash, int e_a, int e_b);
|
||||
extern void filledrect(int c, int what, double rectx1,double recty1,
|
||||
double rectx2,double recty2, int fill);
|
||||
double rectx2,double recty2, int fill, int e_a, int e_b);
|
||||
|
||||
|
||||
extern void drawtempline(GC gc, int what, double x1,double y1,double x2,double y2);
|
||||
|
|
|
|||
|
|
@ -56,14 +56,16 @@ divx=8
|
|||
node=i(vpanel) unitx=m
|
||||
color=4}
|
||||
B 4 890 -630 910 -570 {}
|
||||
B 6 810 -630 830 -570 {ellipse=0,360}
|
||||
B 7 850 -610 920 -590 {dash=4}
|
||||
B 7 850 -580 920 -560 {dash=4 fill=full}
|
||||
B 8 860 -630 880 -570 {}
|
||||
A 4 875 -215 35.35533905932738 8.13010235415598 360 {}
|
||||
A 6 940 -270 70.71067811865476 188.130102354156 89.99999999999997 {}
|
||||
A 7 884.1666666666666 -210 39.58991173406564 210.3432488842396 198.9246444160511 {}
|
||||
P 1 10 880 -490 870 -550 950 -530 910 -510 940 -480 920 -480 910 -460 890 -500 880 -480 880 -490 {dash=3}
|
||||
P 4 6 830 -470 830 -560 820 -510 780 -570 770 -530 810 -490 {bezier=1}
|
||||
P 15 11 870 -520 880 -560 900 -530 910 -550 920 -520 940 -530 920 -490 890 -500 860 -480 840 -530 870 -520 {fill=true}
|
||||
P 1 10 880 -480 870 -540 950 -520 910 -500 940 -470 920 -470 910 -450 890 -490 880 -470 880 -480 {dash=3}
|
||||
P 4 6 830 -460 830 -550 820 -500 780 -560 770 -520 810 -480 {bezier=1}
|
||||
P 15 11 870 -510 880 -550 900 -520 910 -540 920 -510 940 -520 920 -480 890 -490 860 -470 840 -520 870 -510 {fill=true}
|
||||
T {Welcome to XSCHEM!} 110 -1130 0 0 1 1 {layer=5}
|
||||
T {This is a test schematic window
|
||||
|
||||
|
|
@ -71,11 +73,12 @@ On the left you see some sample circuits. You may descend into any of these by s
|
|||
pressing the 'e' key, or by menu 'Edit -> Push Schematic'. You can return here after descending into a schematic by hitting
|
||||
'<Ctrl>-e' or by menu 'Edit -> Pop'.} 60 -1060 0 0 0.4 0.4 {}
|
||||
T {Lines} 960 -680 0 0 0.6 0.6 {layer=4}
|
||||
T {Rectangles} 960 -620 0 0 0.6 0.6 {layer=4}
|
||||
T {Rectangles /
|
||||
Ellipses} 960 -640 0 0 0.6 0.6 {layer=4}
|
||||
T {Polygons /
|
||||
Beziers} 970 -560 0 0 0.6 0.6 {layer=4}
|
||||
Beziers} 970 -550 0 0 0.6 0.6 {layer=4}
|
||||
T {Electrical
|
||||
wires} 960 -450 0 0 0.6 0.6 {layer=4}
|
||||
wires} 960 -440 0 0 0.6 0.6 {layer=4}
|
||||
T {XSCHEM OBJECTS} 860 -840 0 0 0.6 0.6 {layer=7}
|
||||
T {Components} 960 -330 0 0 0.6 0.6 {layer=4}
|
||||
T {TEXT} 840 -740 0 0 0.5 0.5 {layer=8}
|
||||
|
|
@ -96,16 +99,16 @@ T {Simulation
|
|||
Graphs
|
||||
} 1530 -550 0 0 0.6 0.6 {layer=4}
|
||||
T {Bus rippers} 580 -380 0 0 0.6 0.6 {layer=4}
|
||||
N 910 -420 940 -420 {lab=#net1}
|
||||
N 860 -390 860 -370 {lab=#net2}
|
||||
N 860 -390 920 -390 {lab=#net2}
|
||||
N 880 -430 910 -420 {lab=#net1}
|
||||
N 910 -410 940 -410 {lab=#net1}
|
||||
N 860 -380 860 -360 {lab=#net2}
|
||||
N 860 -380 920 -380 {lab=#net2}
|
||||
N 880 -420 910 -410 {lab=#net1}
|
||||
N 380 -310 640 -310 {lab=BUS[4:0]}
|
||||
N 510 -400 510 -320 {lab=BUS[1]}
|
||||
N 410 -350 410 -320 {lab=BUS[2]}
|
||||
N 460 -400 460 -320 {lab=BUS[2:1]}
|
||||
N 860 -460 860 -390 {lab=#net2}
|
||||
N 820 -420 910 -420 {lab=#net1}
|
||||
N 860 -450 860 -380 {lab=#net2}
|
||||
N 820 -410 910 -410 {lab=#net1}
|
||||
C {poweramp.sym} 160 -140 0 0 {name=x1
|
||||
tclcommand="xschem descend"}
|
||||
C {tesla.sym} 160 -700 0 0 {name=x2}
|
||||
|
|
|
|||
Loading…
Reference in New Issue