Index: boxsym-rnd/generator.awk =================================================================== --- boxsym-rnd/generator.awk (revision 2855) +++ boxsym-rnd/generator.awk (revision 2856) @@ -120,11 +120,24 @@ else print "Invalid alignment: " how > stderr - ALIGN[loc, target_field] = int(ALIGN[loc, target_field]) + ALIGN[loc, target_field] = int(ALIGN[loc, target_field])+1 dbg("align_calc: loc=" loc " boxloc=" boxloc " how=" how " res=" ALIGN[loc, target_field] " boxloc=" ALIGN["box",boxloc] " count=" ALIGN[loc,"count"] " target_field=" target_field) } +function align_adjust_center(size, pins1, how1, pins2, how2 ,adj1,adj2) +{ + adj1 = 0 + adj2 = 0 + + if ((how1 == "center") && (pins1 == 1)) + adj1 = (size % 2) + if ((how2 == "center") && (pins2 == 1)) + adj2 = (size % 2) + + return adj1 || adj2 +} + function align_pins(sn, ALIGN, TXTBRD) { ALIGN["top","count"] = count_pins(sn, "top", ALIGN["cfg", "expand_slot"], TXTBRD) @@ -132,8 +145,8 @@ ALIGN["left","count"] = count_pins(sn, "left", ALIGN["cfg", "expand_slot"], TXTBRD) ALIGN["right","count"] = count_pins(sn, "right", ALIGN["cfg", "expand_slot"], TXTBRD) - ALIGN["box","width"] = max(max(ALIGN["top","count"], ALIGN["bottom","count"]), 1) - ALIGN["box","height"] = max(max(ALIGN["left","count"], ALIGN["right","count"]), 1) + ALIGN["box","width"] = max(max(ALIGN["top","count"]+1, ALIGN["bottom","count"]+1), 1) + ALIGN["box","height"] = max(max(ALIGN["left","count"]+1, ALIGN["right","count"]+1), 1) # dbg("TXTBRD: " ALIGN["box","width"] " " TXTBRD["left"] " " TXTBRD["right"]) delta = TXTBRD["left"] + TXTBRD["right"] @@ -144,6 +157,10 @@ if (ALIGN["box","height"] < delta) ALIGN["box","height"] = delta + ALIGN["box","height"] += align_adjust_center(ALIGN["box","height"], ALIGN["left", "count"], SLOT[sn, "pinalign", "left"], ALIGN["right", "count"], SLOT[sn, "pinalign", "right"]) + ALIGN["box","width"] += align_adjust_center(ALIGN["box","width"], ALIGN["bottom", "count"], SLOT[sn, "pinalign", "bottom"], ALIGN["top", "count"], SLOT[sn, "pinalign", "top"]) + + align_calc(ALIGN, "left", "height", "y0", SLOT[sn, "pinalign", "left"]) align_calc(ALIGN, "right", "height", "y0", SLOT[sn, "pinalign", "right"]) align_calc(ALIGN, "top", "width", "x0", SLOT[sn, "pinalign", "top"])