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

gEDA-cvs: CVS update: tragesym



  User: werner  
  Date: 07/04/17 13:05:28

  Modified:    .        tragesym
  Log:
  	* script/tragesym: for large symbols put the attributs inside
  
  	  the symbol box. Add padding at the top and the bottom pins.
  
  	  removed o_vdist limitation. 
  
            code mostly from Patch [#1662285] written by Aapo Tahkola 
  
  
  
  
  
  
  Revision  Changes    Path
  1.7       +35 -19    eda/geda/gaf/utils/scripts/tragesym
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: tragesym
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/scripts/tragesym,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- tragesym	17 May 2006 17:13:46 -0000	1.6
  +++ tragesym	17 Apr 2007 17:05:28 -0000	1.7
  @@ -3,7 +3,7 @@
   ############################################################################
   #    tragesym  - create gEDA symbols out of structured textfiles
   #    begin      : 2001-10-20
  -#    copyright  : (C) 2001,2002,2003,2004,2006 by Werner Hoch
  +#    copyright  : (C) 2001,2002,2003,2004,2006,2007 by Werner Hoch
   #    email      : werner.ho@xxxxxx
   ############################################################################
   #                                                                          #
  @@ -31,17 +31,17 @@
   import sys, string
   
   ##################### GLOBALS ############################################
  -VERSION="0.0.9"
  +VERSION="0.0.10"
   
   CHARHIGH=26
  -preset_options = {"wordswap":"yes"
  -                  ,"rotate_labels":"no"
  -                  ,"sort_labels":"yes"
  -                  ,"generate_pinseq":"yes"    
  -                  ,"sym_width":"1400"
  -                  ,"pinwidthvertikal":"400"
  -                  ,"pinwidthvertical":"400"
  -                  ,"pinwidthhorizontal":"400"}
  +preset_options = {"wordswap":"yes",
  +                  "rotate_labels":"no",
  +                  "sort_labels":"yes",
  +                  "generate_pinseq":"yes",
  +                  "sym_width":"1400",
  +                  "pinwidthvertikal":"400",
  +                  "pinwidthvertical":"400",
  +                  "pinwidthhorizontal":"400"}
   allowed_attr = ["version", "name", "device", "refdes", "footprint", "numslots",
                   "slot", "slotdef","description", "comment", "author",
                   "documentation","value"]
  @@ -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," ")
  @@ -282,10 +286,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 +301,14 @@
   	bottomlefty += pinlength
   
       # Calculate the minimum symwidth and increase it if necessary
  -    if numpbottom > numptop:
  -	calculated_symwidth=(numpbottom-1)*o_hdist+2*o_hdist
  -    else:
  -	calculated_symwidth=(numptop-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
  +    
  +    calcutated_symwidth = max(calculated_bottom_symwidth,
  +                              calculated_top_symwidth)
  +
  +    if (numptop + numpbottom > 0):
  +	print "note: use sym_width to adjust symbol width if texts overlap."
   
       if o_symwidth == 0:
   	o_symwidth = calculated_symwidth
  @@ -322,6 +326,12 @@
       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
  +
  +    ptopx = round_closest(ptopx, 100)
  +    pbottomx = round_closest(pbottomx, 100)
   
       f = open(filename, "w")
   
  @@ -468,7 +478,13 @@
   
   ### draw the attributes
       urefx, urefy = bottomleftx+o_symwidth, 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:
  
  
  


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