1signature MAKE_VBOX  =
2sig
3
4  val makeVBox:  BasicTypes.dist -> BoxTypes.node -> BoxTypes.vlist -> BoxTypes.vlist -> BoxTypes.box
5  (* 1. width,
6     2. center node -> reference point,  (must be  Box0  or  Rule !!!)
7     3. above center, enumerated from bottom to top,
8     4. below center, enumerated from top to bottom
9   *)
10
11  val upVBox:    BasicTypes.dist -> BoxTypes.box -> BoxTypes.vlist -> BoxTypes.box
12  (* 1. width,
13     2. center box -> reference point,
14     3. above center, enumerated from bottom to top
15   *)
16
17  val dnVBox:    BasicTypes.dist -> BoxTypes.box -> BoxTypes.vlist -> BoxTypes.box
18  (* 1. width,
19     2. center box -> reference point,
20     3. below center, enumerated from top to bottom
21   *)
22
23   val above:    BoxTypes.node -> (BasicTypes.dist * BasicTypes.dist) -> BoxTypes.node -> BoxTypes.node
24   (* above n1 (dist1, dist) n2:
25      Nodes n1 and n2 are placed above each other.
26      dist     vertical distance between n1 and n2,
27      dist1    distance from bottom of n1 to baseline
28      The pairing of the two distances simplifies the calls of this function.
29      The result is a node since all callers expect to see a node.
30   *)
31end  (* signature MAKE_VBOX *)
32(*----------*)
33
34structure MakeVBox: MAKE_VBOX  =
35struct
36  open BasicTypes;  open BoxTypes
37  open General;  open BasicBox;  open NodeDim;  open NodeListDim
38
39  fun makeVBox  w  node  upList  dnList  =    (* node: Box0 or Rule! *)
40  let val h  =  vlistVsize upList + height node
41      val d  =  vlistVsize dnList + depth  node
42      val nodeList  =  revAppend upList (node :: dnList)
43  in  vbox  {width = w,  height = h,  depth = d}  nodeList  end
44
45  fun upVBox  w  box  upList   =   makeVBox w (Box0 box) upList []
46  fun dnVBox  w  box  dnList   =   makeVBox w (Box0 box) [] dnList
47
48  fun above n1 (dist1, dist) n2  =
49  let val w  =  Int.max (vwidth n1, vwidth n2)
50      val h  =  vsize n1 + dist1
51      val d  =  vsize n2 + dist - dist1
52      val nodeList  =  [n1, Kern dist, n2]
53  in  Box0 (vbox  {width = w,  height = h,  depth = d}  nodeList)  end
54
55end  (* structure MakeVBox *)
56