mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-27 01:15:00 +02:00
sch2fig/sch.c (dump_fields): break into two functions; make more "const"
"const" may come in handy at a later stage, when we want to keep things around for a bit longer.
This commit is contained in:
parent
1e36f32c0f
commit
ed02cafaf5
@ -150,45 +150,49 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
|
||||
}
|
||||
|
||||
|
||||
static void dump_fields(struct sch_field *fields, int m[6])
|
||||
static void dump_field(const struct sch_field *field, int m[6])
|
||||
{
|
||||
|
||||
while (fields) {
|
||||
struct text *txt = &fields->txt;
|
||||
struct sch_field *next;
|
||||
struct text txt = field->txt;
|
||||
int dx, dy;
|
||||
|
||||
next = fields->next;
|
||||
dx = txt.x - m[0];
|
||||
dy = txt.y - m[3];
|
||||
txt.x = mx(dx, dy, m);
|
||||
txt.y = my(dx, dy, m);
|
||||
|
||||
dx = txt->x - m[0];
|
||||
dy = txt->y - m[3];
|
||||
txt->x = mx(dx, dy, m);
|
||||
txt->y = my(dx, dy, m);
|
||||
text_rot(&txt, matrix_to_angle(m));
|
||||
|
||||
text_rot(txt, matrix_to_angle(m));
|
||||
|
||||
switch (txt->rot) {
|
||||
switch (txt.rot) {
|
||||
case 180:
|
||||
text_rot(txt, 180);
|
||||
txt->hor = text_flip(txt->hor);
|
||||
txt->vert = text_flip(txt->vert);
|
||||
text_rot(&txt, 180);
|
||||
txt.hor = text_flip(txt.hor);
|
||||
txt.vert = text_flip(txt.vert);
|
||||
break;
|
||||
case 270:
|
||||
text_rot(txt, 180);
|
||||
txt->vert = text_flip(txt->vert);
|
||||
txt->hor = text_flip(txt->hor);
|
||||
text_rot(&txt, 180);
|
||||
txt.vert = text_flip(txt.vert);
|
||||
txt.hor = text_flip(txt.hor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
text_fig(txt, COLOR_FIELD, LAYER_FIELD);
|
||||
text_fig(&txt, COLOR_FIELD, LAYER_FIELD);
|
||||
}
|
||||
|
||||
|
||||
static void dump_fields(struct sch_field *fields, int m[6])
|
||||
{
|
||||
while (fields) {
|
||||
struct text *txt = &fields->txt;
|
||||
struct sch_field *next = fields->next;
|
||||
|
||||
dump_field(fields, m);
|
||||
text_free(txt);
|
||||
|
||||
free(fields);
|
||||
fields = next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user