mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-23 05:31:53 +02:00
sch2fig/: support mirrored symbols (matrix -1 0 0 -1)
This commit is contained in:
parent
ed02cafaf5
commit
3588992947
@ -264,6 +264,13 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
|
||||
};
|
||||
|
||||
text_rot(&name_txt, matrix_to_angle(m));
|
||||
if (matrix_is_mirrored(m)) {
|
||||
if ((name_txt.rot % 180) == 0)
|
||||
name_txt.hor = text_flip(name_txt.hor);
|
||||
else
|
||||
name_txt.vert = text_flip(name_txt.vert);
|
||||
}
|
||||
|
||||
switch (name_txt.rot) {
|
||||
case 180:
|
||||
text_flip_x(&name_txt);
|
||||
@ -295,6 +302,13 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
|
||||
};
|
||||
|
||||
text_rot(&num_txt, matrix_to_angle(m) % 180);
|
||||
if (matrix_is_mirrored(m)) {
|
||||
if ((num_txt.rot % 180) == 0)
|
||||
num_txt.hor = text_flip(num_txt.hor);
|
||||
else
|
||||
num_txt.vert = text_flip(num_txt.vert);
|
||||
}
|
||||
|
||||
if (comp->show_pin_num)
|
||||
text_fig(&num_txt, COLOR_PIN_NUMBER, LAYER_PIN_NUMBER);
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
@ -34,12 +35,31 @@ unsigned matrix_to_angle(int m[6])
|
||||
return 180;
|
||||
if (eq(m, 0, 1, 1, 0))
|
||||
return 270;
|
||||
if (eq(m, -1, 0, 0, -1))
|
||||
return 0;
|
||||
fprintf(stderr, "unrecognized matrix %d %d %d %d\n",
|
||||
m[1], m[2], m[4], m[5]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
bool matrix_is_mirrored(int m[6])
|
||||
{
|
||||
if (eq(m, 1, 0, 0, -1))
|
||||
return 0;
|
||||
if (eq(m, 0, -1, -1, 0))
|
||||
return 0;
|
||||
if (eq(m, -1, 0, 0, 1))
|
||||
return 0;
|
||||
if (eq(m, 0, 1, 1, 0))
|
||||
return 0;
|
||||
|
||||
if (eq(m, -1, 0, 0, -1))
|
||||
return 1;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
||||
int angle_add(int a, int b)
|
||||
{
|
||||
a += b;
|
||||
|
@ -42,6 +42,7 @@ static inline int my(int x, int y, int m[6])
|
||||
|
||||
|
||||
unsigned matrix_to_angle(int m[6]);
|
||||
bool matrix_is_mirrored(int m[6]);
|
||||
int angle_add(int a, int b);
|
||||
|
||||
#endif /* !MISC_H */
|
||||
|
@ -177,6 +177,13 @@ static void dump_field(const struct sch_field *field, int m[6])
|
||||
break;
|
||||
}
|
||||
|
||||
if (matrix_is_mirrored(m)) {
|
||||
if ((txt.rot % 180) == 0)
|
||||
txt.hor = text_flip(txt.hor);
|
||||
else
|
||||
txt.vert = text_flip(txt.vert);
|
||||
}
|
||||
|
||||
text_fig(&txt, COLOR_FIELD, LAYER_FIELD);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user