diff --git a/sch2fig/dwg.c b/sch2fig/dwg.c index 27b18cd..af37b7c 100644 --- a/sch2fig/dwg.c +++ b/sch2fig/dwg.c @@ -385,6 +385,19 @@ void dwg_noconn(int x, int y) } +/* ----- Lines ------------------------------------------------------------- */ + +/* + * We can't use gfx_poly because lines are dashed and we don't have that + * property at the gfx_poly API. + */ + +void dwg_line(int sx, int sy, int ex, int ey) +{ + gfx_line(sx, sy, ex, ey, COLOR_SHEET_DWG, LAYER_LINES); +} + + /* ----- Wires and busses -------------------------------------------------- */ diff --git a/sch2fig/dwg.h b/sch2fig/dwg.h index 7a1abf8..ea683c6 100644 --- a/sch2fig/dwg.h +++ b/sch2fig/dwg.h @@ -36,6 +36,8 @@ void dwg_glabel(int x, int y, const char *s, int dir, int dim, void dwg_junction(int x, int y); void dwg_noconn(int x, int y); +void dwg_line(int sx, int sy, int ex, int ey); + void dwg_wire(int sx, int sy, int ex, int ey); void dwg_bus(int sx, int sy, int ex, int ey); diff --git a/sch2fig/fig.c b/sch2fig/fig.c index 481c733..f95341a 100644 --- a/sch2fig/fig.c +++ b/sch2fig/fig.c @@ -51,13 +51,14 @@ static inline float pt(int x) /* ----- Schematics items -------------------------------------------------- */ -void fig_line(void *ctx, int sx, int sy, int ex, int ey) +void fig_line(void *ctx, int sx, int sy, int ex, int ey, + int color, unsigned layer) { // TypeStyle FillCol AreaFil Cap FwdAr // SubTy Color Pen StyleV Rad BwdAr // Thick Depth Join Points printf("2 1 2 %d %d 7 %d -1 -1 3.0 1 1 -1 0 0 2\n", - WIDTH_LINE, COLOR_SHEET_DWG, LAYER_LINES); + WIDTH_LINE, color, layer); printf("\t%d %d %d %d\n", cx(sx), cy(sy), cx(ex), cy(ey)); } diff --git a/sch2fig/gfx.c b/sch2fig/gfx.c index 6142ae1..27dab66 100644 --- a/sch2fig/gfx.c +++ b/sch2fig/gfx.c @@ -19,9 +19,9 @@ static const struct gfx_ops *gfx_ops; static void *gfx_ctx; -void gfx_line(int sx, int sy, int ex, int ey) +void gfx_line(int sx, int sy, int ex, int ey, int color, unsigned layer) { - gfx_ops->line(gfx_ctx, sx, sy, ex, ey); + gfx_ops->line(gfx_ctx, sx, sy, ex, ey, color, layer); } diff --git a/sch2fig/gfx.h b/sch2fig/gfx.h index c6f0a17..dce5383 100644 --- a/sch2fig/gfx.h +++ b/sch2fig/gfx.h @@ -18,7 +18,8 @@ struct gfx_ops { - void (*line)(void *ctx, int sx, int sy, int ex, int ey); + void (*line)(void *ctx, int sx, int sy, int ex, int ey, + int color, unsigned layer); void (*rect)(void *ctx, int sx, int sy, int ex, int ey, int color, int fill_color, unsigned layer); void (*poly)(void *ctx, int points, int x[points], int y[points], @@ -35,7 +36,7 @@ struct gfx_ops { /* wrappers */ -void gfx_line(int sx, int sy, int ex, int ey); +void gfx_line(int sx, int sy, int ex, int ey, int color, unsigned layer); void gfx_rect(int sx, int sy, int ex, int ey, int color, int fill_color, unsigned layer); void gfx_poly(int points, int x[points], int y[points], diff --git a/sch2fig/sch.c b/sch2fig/sch.c index 032f133..50aa533 100644 --- a/sch2fig/sch.c +++ b/sch2fig/sch.c @@ -479,7 +479,7 @@ bool sch_parse(struct sch_ctx *ctx, const char *line) } if (sscanf(line, "Wire Notes Line%n", &n) == 0 && n) { ctx->state = sch_wire; - ctx->wire = gfx_line; + ctx->wire = dwg_line; return 1; }