1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 08:45:19 +02:00

sch2fig/: fix pin name offsets

This commit is contained in:
Werner Almesberger 2016-07-23 23:20:53 -03:00
parent 97f8969716
commit 9f8a09b2d5

View File

@ -131,22 +131,22 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
switch (pin->orient) { switch (pin->orient) {
case 'U': case 'U':
dy = pin->length; dy = 1;
rot = 90; rot = 90;
hor = text_min; hor = text_min;
break; break;
case 'D': case 'D':
dy = -pin->length; dy = -1;
rot = 90; rot = 90;
hor = text_max; hor = text_max;
break; break;
case 'R': case 'R':
dx = pin->length; dx = 1;
rot = 0; rot = 0;
hor = text_min; hor = text_min;
break; break;
case 'L': case 'L':
dx = -pin->length; dx = -1;
rot = 0; rot = 0;
hor = text_max; hor = text_max;
break; break;
@ -155,14 +155,17 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
} }
x[0] = mx(pin->x, pin->y, m); x[0] = mx(pin->x, pin->y, m);
y[0] = my(pin->x, pin->y, m); y[0] = my(pin->x, pin->y, m);
x[1] = mx(pin->x + dx, pin->y + dy, m); x[1] = mx(pin->x + dx * pin->length, pin->y + dy * pin->length, m);
y[1] = my(pin->x + dx, pin->y + dy, m); y[1] = my(pin->x + dx * pin->length, pin->y + dy * pin->length, m);
fig_poly(2, x, y, COLOR_COMP_DWG, LAYER_COMP_DWG); fig_poly(2, x, y, COLOR_COMP_DWG, LAYER_COMP_DWG);
dx *= pin->length + comp->name_offset;
dy *= pin->length + comp->name_offset;
struct text txt = { struct text txt = {
.s = pin->name, .s = pin->name,
.x = mx(pin->x + dx + comp->name_offset, pin->y + dy, m), .x = mx(pin->x + dx, pin->y + dy, m),
.y = my(pin->x + dx + comp->name_offset, pin->y + dy, m), .y = my(pin->x + dx, pin->y + dy, m),
.size = pin->name_size, .size = pin->name_size,
.rot = rot, .rot = rot,
.hor = hor, .hor = hor,
@ -186,6 +189,7 @@ static void draw_text(const struct text_obj *text, int m[6])
.hor = text_mid, .hor = text_mid,
.vert = text_mid, .vert = text_mid,
}; };
text_fig(&txt, COLOR_COMP_DWG, WIDTH_COMP_DWG); text_fig(&txt, COLOR_COMP_DWG, WIDTH_COMP_DWG);
} }