Index: plugins/io_eeschema/read.c =================================================================== --- plugins/io_eeschema/read.c (revision 11382) +++ plugins/io_eeschema/read.c (revision 11383) @@ -107,6 +107,7 @@ struct cache_sym_s* cur_libsym0; /* unit of the current libsym */ csch_cgrp_t* cur_sym; csch_coord_t cur_sym_x, cur_sym_y; /* in sch-rnd coord */ + int cur_sym_rot; unsigned cur_sym_mirx : 1; unsigned cur_sym_miry : 1; unsigned cur_sym_exclude_from_sim : 1; /* set to 1 if schsym had this */ Index: plugins/io_eeschema/read_disp.c =================================================================== --- plugins/io_eeschema/read_disp.c (revision 11382) +++ plugins/io_eeschema/read_disp.c (revision 11383) @@ -29,7 +29,7 @@ static int eeschema_parse_property__impl(read_ctx_t* const ctx, csch_cgrp_t* const libsym, csch_cgrp_t* const symref, - gsxl_node_t* const src_node, int force_place); + gsxl_node_t* const src_node, int parent_rot, int force_place); static int eechema_parse__ignore(read_ctx_t* ctx, csch_cgrp_t* dst, gsxl_node_t* node) @@ -502,6 +502,7 @@ ctx->cur_sym_x = csch_alien_coord_x(&ctx->alien, x); ctx->cur_sym_y = csch_alien_coord_y(&ctx->alien, y); + ctx->cur_sym_rot = rot; ctx->cur_sym_mirx = 0; ctx->cur_sym_miry = 0; ctx->cur_sym_exclude_from_sim = 0; @@ -1330,7 +1331,7 @@ if(strcmp(n->str, "property")==0) { if(eeschema_parse_property__impl(ctx, label, NULL, - n->children, 1)!=0) + n->children, rot, 1)!=0) { return -1; } @@ -1454,7 +1455,7 @@ if(strcmp(n->str, "property")==0) { if(eeschema_parse_property__impl(ctx, grp, NULL, - n->children, 1)!=0) + n->children, rot, 1)!=0) { return -1; } @@ -1648,7 +1649,7 @@ if(strcmp(n->str, "property")==0) { if(eeschema_parse_property__impl(ctx, grp, NULL, - n->children, 1)!=0) + n->children, 0, 1)!=0) { return -1; } @@ -1862,7 +1863,7 @@ static int eeschema_parse_property__impl(read_ctx_t* const ctx, csch_cgrp_t* const libsym, csch_cgrp_t* const symref, - gsxl_node_t* const src_node, int force_place) + gsxl_node_t* const src_node, int parent_rot, int force_place) { const char* key; const char* value; @@ -2107,10 +2108,35 @@ dy = csch_alien_coord_y(&ctx->alien, y) - t->spec1.y; } - dbg_printf(" justify BB={%u,%u}, d={%i,%i}, rot=%i\n", + /* rotate floater back to compansate parent rotation */ + switch(parent_rot) + { + case 0: + break; + case 90: + { csch_coord_t t = dx; dx = dy; dy = -t; } + if(rot==90) { dx -= bbh; } + break; + case 180: + dy = -dy; + if(rot==0) { dy += bbh; dx -= bbw; } + if(rot==90) { dx -= 2*bbh; } + break; + case 270: + { csch_coord_t t = dx; dx = -dy; dy = t; } + if(rot==0) { dy += bbh; } + break; + } + + dbg_printf(" justify BB={%u,%u}, d={%i,%i}, rot=%i(+%i)\n", (unsigned int)bbw, (unsigned int)bbh, - (int)dx, (int)dy, (int)rot); + (int)dx, (int)dy, (int)rot, (int)parent_rot); + if(180<=((rot+parent_rot)%360)) + { + rot = (rot + 180) % 360; + } + if(eeschema_justify_text(ctx, justify, bbw, bbh, rot, &dx, &dy, &mirx, &miry)) { @@ -2147,7 +2173,7 @@ static int eechema_parse__libsym_property(read_ctx_t* ctx, csch_cgrp_t* dst, gsxl_node_t* node) { - return eeschema_parse_property__impl(ctx, dst, NULL, node, 0); + return eeschema_parse_property__impl(ctx, dst, NULL, node, 0, 0); } static int eechema_parse__libsymdata_pin(read_ctx_t* ctx, @@ -2485,7 +2511,8 @@ { csch_cgrp_t* const libsym = ctx->cur_sym->data.ref.grp; - if(eeschema_parse_property__impl(ctx, libsym, ctx->cur_sym, node, 0)!=0) + if(eeschema_parse_property__impl(ctx, libsym, ctx->cur_sym, node, + ctx->cur_sym_rot, 0)!=0) { return -1; }