1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-10-04 07:46:01 +03:00

sch2fig/lib.c (draw_pin_name, draw_pin_num), TODO: support "outside" pin names

There's still a rotation bug affecting this, but this existed before.
This commit is contained in:
Werner Almesberger 2016-07-26 13:45:19 -03:00
parent 4c3a3a1f84
commit a36ec41dc6
2 changed files with 26 additions and 11 deletions

View File

@ -6,8 +6,6 @@
- support line thickness ?
- ~ as space (grep for ~ in out.fig)
- ~ as overline (grep for ~ in out.fig)
- support pin name not inside component
- check if pin name/number placement changes if one is disabled
- glabel: build for "right" style, then rotate poly
- break into file reading, internal storage, rendering
- show open pins / wires

View File

@ -201,19 +201,31 @@ static void draw_arc(const struct arc_obj *arc, int m[6])
static void draw_pin_name(const struct comp *comp, const struct pin_obj *pin,
int m[6], int dx, int dy, int rot, enum text_align hor)
{
int ox, oy;
int ox, oy, sx, sy;
ox = dx * (pin->length + comp->name_offset);
oy = dy * (pin->length + comp->name_offset);
if (comp->name_offset) {
ox = dx * (pin->length + comp->name_offset);
oy = dy * (pin->length + comp->name_offset);
sx = sy = 0;
} else {
ox = dx * pin->length / 2;
oy = dy * pin->length / 2;
sx = mxr(-dy * PIN_NUM_OFFSET, dx * PIN_NUM_OFFSET, m);
sy = myr(-dy * PIN_NUM_OFFSET, dx * PIN_NUM_OFFSET, m);
if (sx > 0)
sx = -sx;
if (sy > 0)
sy = -sy;
}
struct text txt = {
.s = pin->name,
.x = mx(pin->x + ox, pin->y + oy, m),
.y = my(pin->x + ox, pin->y + oy, m),
.x = mx(pin->x + ox, pin->y + oy, m) + sx,
.y = my(pin->x + ox, pin->y + oy, m) + sy,
.size = pin->name_size,
.rot = rot,
.hor = hor,
.vert = text_mid,
.hor = comp->name_offset ? hor : text_mid,
.vert = comp->name_offset ? text_mid : text_min,
};
text_rot(&txt, matrix_to_angle(m));
@ -251,6 +263,11 @@ static void draw_pin_num(const struct comp *comp, const struct pin_obj *pin,
if (sy > 0)
sy = -sy;
if (!comp->name_offset) {
sx = -sx;
sy = -sy;
}
struct text txt = {
.s = pin->number,
.x = mx(pin->x + ox, pin->y + oy, m) + sx,
@ -258,7 +275,7 @@ static void draw_pin_num(const struct comp *comp, const struct pin_obj *pin,
.size = pin->number_size,
.rot = rot,
.hor = text_mid,
.vert = text_min,
.vert = comp->name_offset ? text_min : text_max,
};
text_rot(&txt, matrix_to_angle(m) % 180);
@ -269,7 +286,7 @@ static void draw_pin_num(const struct comp *comp, const struct pin_obj *pin,
txt.vert = text_flip(txt.vert);
}
text_fig(&txt, COLOR_PIN_NUMBER, LAYER_PIN_NUMBER);
text_fig(&txt, COLOR_PIN_NUMBER, LAYER_PIN_NUMBER);
}