1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 05:31:53 +02:00

sch2fig/: support 180 deg rotation of components

This commit is contained in:
Werner Almesberger 2016-07-25 00:39:03 -03:00
parent 817befc29f
commit 9618846d46
4 changed files with 21 additions and 2 deletions

View File

@ -216,6 +216,13 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
};
text_rot(&name_txt, matrix_to_angle(m));
switch (name_txt.rot) {
case 180:
text_flip_x(&name_txt);
break;
default:
break;
}
if (comp->show_pin_name)
text_fig(&name_txt, COLOR_PIN_NAME, LAYER_PIN_NAME);
@ -239,7 +246,7 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
.vert = text_min,
};
text_rot(&num_txt, matrix_to_angle(m));
text_rot(&num_txt, matrix_to_angle(m) % 180);
if (comp->show_pin_num)
text_fig(&num_txt, COLOR_PIN_NUMBER, LAYER_PIN_NUMBER);

View File

@ -30,6 +30,8 @@ unsigned matrix_to_angle(int m[6])
return 0;
if (eq(m, 0, -1, -1, 0))
return 90;
if (eq(m, -1, 0, 0, 1))
return 180;
if (eq(m, 0, 1, 1, 0))
return 270;
fprintf(stderr, "unrecognized matrix %d %d %d %d\n",

View File

@ -62,12 +62,21 @@ enum text_align text_flip(enum text_align align)
case text_mid:
return text_mid;
case text_max:
return text_max;
return text_min;
default:
abort();
}
}
void text_flip_x(struct text *txt)
{
txt->rot = angle_add(txt->rot, 180);
txt->hor = text_flip(txt->hor);
// @@@ flip vert, too ?
}
static int rx(int x, int y, int rot)
{
float a = rot / 180.0 * M_PI;

View File

@ -37,6 +37,7 @@ void text_free(struct text *txt);
void text_set(struct text *txt, const char *s);
void text_rot(struct text *txt, int deg);
void text_flip_x(struct text *txt);
enum text_align text_flip(enum text_align align);
void text_fig(const struct text *txt, int color, unsigned layer);