[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gEDA-dev: tragesym improvements
Hi,
I made some improvements to tragesym in order to avoid problems with
pins on top/bottom:
-the difference between symwidth and calculated
symbol width will be added as pad to left and right sides
-if there are pins at top/bottom, place symbol name at center instead
of top-left
-vertical pin spacing can be less than 500 now
Small example attached.
Keep up the good work!
--
Aapo Tahkola
--- new/tragesym 2007-02-13 04:02:18.000000000 +0200
+++ tragesym 2007-02-13 05:14:01.000000000 +0200
@@ -282,10 +282,6 @@
elif pin[P_POS] == "t": #right pin
numptop=numptop+1
- # If there are pins on the top, then o_vdist should be 500 at least
- if ( (numptop > 0) and (o_vdist < 500) ):
- o_vdist = 500
-
# Calculate the position of the pins in the left and right side.
plefty, prighty = 0, 0
if numpleft > numpright:
@@ -301,10 +297,16 @@
bottomlefty += pinlength
# Calculate the minimum symwidth and increase it if necessary
- if numpbottom > numptop:
- calculated_symwidth=(numpbottom-1)*o_hdist+2*o_hdist
+ calculated_top_symwidth=(numptop-1)*o_hdist+2*o_hdist
+ calculated_bottom_symwidth=(numpbottom-1)*o_hdist+2*o_hdist
+
+ if calculated_bottom_symwidth > calculated_top_symwidth:
+ calculated_symwidth=calculated_bottom_symwidth
else:
- calculated_symwidth=(numptop-1)*o_hdist+2*o_hdist
+ calculated_symwidth=calculated_top_symwidth
+
+ if (numptop + numpbottom > 0):
+ print "warning: use sym_width to adjust symbol width if texts overlap."
if o_symwidth == 0:
o_symwidth = calculated_symwidth
@@ -322,7 +324,10 @@
ptopx, ptopy= bottomleftx + o_hdist, bottomlefty + high + pinlength
pbottomx, pbottomy = bottomleftx + o_hdist, bottomlefty - pinlength
-
+ # Lets add some pad if sym_width was defined
+ ptopx = ptopx + (o_symwidth - calculated_top_symwidth) / 2
+ pbottomx = pbottomx + (o_symwidth - calculated_bottom_symwidth) / 2
+
f = open(filename, "w")
### Draw the symbol version
@@ -468,7 +473,13 @@
### draw the attributes
urefx, urefy = bottomleftx+o_symwidth, bottomlefty + high + 100
- namex, namey = bottomleftx, bottomlefty+high+100
+
+ # Center name if we have top/bottom pins
+ if numptop + numpbottom > 0:
+ namex, namey = (bottomleftx + o_symwidth) / 2, (bottomlefty + high) / 2 + 100
+ else:
+ namex, namey = bottomleftx, bottomlefty+high+100
+
textx = namex
texty = namey + 200
if numptop > 0:
rtl8201.src
_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev