[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-dev: tragesym improvements



On Sat, 17 Feb 2007 14:06:21 +0100
Werner Hoch <werner.ho@xxxxxx> wrote:

> Hi Aapo,

Hi.

> 
> On Wednesday 14 February 2007 20:44, Werner Hoch wrote:
> > On Tuesday 13 February 2007 04:38, Aapo Tahkola wrote:
> > > 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!
> >
> > Thanks for the patch. I will put it to the tracker at SF and apply
> > it after testing.
> 
> The pins on the top and the bottom are not on the grid with the patch.
> The padding needs to take care about odd/even pincount and the symbol 
> width.

This should do the trick.

> 
> Regards
> Werner


-- 
Aapo Tahkola
--- tragesym.old	2007-02-17 17:05:48.000000000 +0200
+++ tragesym	2007-02-17 18:04:35.000000000 +0200
@@ -81,6 +81,10 @@
         sys.exit()
     return textout
 
+## round *unsigned* integer x to closest r
+def round_closest(x,r):
+    return x-(x+r/2)%r+r/2
+
 ## returns the words in reverse order    
 def swapwords(str): 
     list=string.split(str," ")
@@ -327,6 +331,9 @@
     # 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
+
+    ptopx = round_closest(ptopx, 100)
+    pbottomx = round_closest(pbottomx, 100)
     
     f = open(filename, "w")
 

_______________________________________________
geda-dev mailing list
geda-dev@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev