[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: auto-place-attribs.scm
User: cnieves
Date: 06/12/13 16:24:02
Modified: . auto-place-attribs.scm
Log:
* scheme/auto-place-attribs.scm:
- Define object types here (by now). This shouldn't be here,
and should be defined in libgeda if anyone objects.
- in get-reference, the object bounds should include the pins
if the object is a pin, but otherwise don't .
This makes the object bounds correctly calculated for pins.
Thanks to Ales for reporting this bug.
- Corrected typo (horiz-pos should be vertical-pos) in
calcule-new-string-bounds.
Revision Changes Path
1.4 +26 -4 eda/geda/gaf/gschem/scheme/auto-place-attribs.scm
(In the diff below, changes in quantity of whitespace are not shown.)
Index: auto-place-attribs.scm
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/scheme/auto-place-attribs.scm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- auto-place-attribs.scm 5 Dec 2006 22:56:13 -0000 1.3
+++ auto-place-attribs.scm 13 Dec 2006 21:24:02 -0000 1.4
@@ -24,6 +24,23 @@
; Copyright (C) 2006 Carlos Nieves Onega
+; Define object types, as in libgeda/include/o_types.h
+; TODO: Do this inside libgeda?
+(define OBJ_LINE "L")
+(define OBJ_BOX "B")
+(define OBJ_PICTURE "G")
+(define OBJ_CIRCLE "V")
+(define OBJ_NET "N")
+(define OBJ_BUS "U")
+(define OBJ_COMPLEX "C")
+(define OBJ_TEXT "T")
+(define OBJ_PIN "P")
+(define OBJ_ARC "A")
+(define OBJ_ROUTE "R")
+(define OBJ_THRU_HOLE "H")
+(define OBJ_PLACEHOLDER "X")
+
+
; Given a bound, defined as a list of the form ( (x1 x2) (y1 y2) ) with:
; - (x1, y1): bottom left corner.
; - (x2, y2): upper right corner.
@@ -496,8 +513,13 @@
(define (get-reference object position-string)
(if (not (string-index position-string #\ ))
(error "get-reference : Wrong reference format"))
- (let* ( ; Get the object bounds without attributes neither pins.
- (bounds (get-object-bounds object (list "all") (list "P")))
+ (let* ( (object-type (get-object-type object))
+ ; Get the object bounds:
+ ; - If it's a pin: including everything.
+ ; - otherwise: without attributes neither pins.
+ (bounds (if (string=? object-type OBJ_PIN)
+ (get-object-bounds object (list "all") (list))
+ (get-object-bounds object (list "all") (list OBJ_PIN))))
(horiz-bounds (car bounds))
(vertical-bounds (cdr bounds))
(space-pos (string-index position-string #\ ))
@@ -637,9 +659,9 @@
; Calcule the y of the left bottom point of the text.
(lb_y (if (string=? vertical-pos "Lower")
y
- (if (string=? horiz-pos "Middle")
+ (if (string=? vertical-pos "Middle")
(- y (inexact->exact (/ y_size 2)))
- (if (string=? horiz-pos "Upper")
+ (if (string=? vertical-pos "Upper")
(- y y_size)
(error (string-append
"calcule-new-attrib-bounds : Unknown reference (vertical): "
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs