]> git.donarmstrong.com Git - lilypond.git/blob - lily/single-malt-grouping-item.cc
patch::: 1.3.49.hwn1: deze dus
[lilypond.git] / lily / single-malt-grouping-item.cc
1 /*   
2   single-malt-grouping-item.cc --  implement Single_malt_grouping_item
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "single-malt-grouping-item.hh"
11 #include "paper-column.hh"
12 #include "debug.hh"
13
14 Single_malt_grouping_item ::Single_malt_grouping_item()
15 {
16   set_elt_property ("transparent", SCM_BOOL_T);
17   set_elt_property ("elements", SCM_EOL);
18
19   // this is weird! , but needed!
20   set_extent_callback (0, X_AXIS);
21   set_extent_callback (0,  Y_AXIS);
22
23 }
24
25 void
26 Single_malt_grouping_item::add_item (Item* i)
27 {
28   assert (i);
29   set_elt_property ("elements",
30                     gh_cons (i->self_scm_,
31                              get_elt_property ("elements")));
32
33   add_dependency (i);
34 }
35
36 Interval
37 Single_malt_grouping_item::my_width () const
38 {
39   Paper_column * pc = column_l ();
40   Interval w;
41   
42   for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
43     {
44       SCM elt = gh_car (s);
45       if (!SMOB_IS_TYPE_B(Score_element, elt))
46         continue;
47
48       
49       
50       Item *il = dynamic_cast<Item*> (SMOB_TO_TYPE (Score_element, elt));
51       if (pc != il->column_l ())
52         {
53           /* this shouldn't happen, but let's continue anyway. */
54           programming_error (_("Single_malt_grouping_item:  I've been drinking too much"));
55           continue;             /*UGH UGH*/ 
56         }
57
58       if (to_boolean (il->get_elt_property ("no-spacing-rods")))
59         {
60           continue;
61         }
62
63       Interval iv (il->extent (X_AXIS));
64       if (!iv.empty_b ())
65         {
66           Real off = il->relative_coordinate (pc, X_AXIS);
67           w.unite  (iv + off);
68         }
69     }
70
71   return w;
72  // add this->offset_ ? this-> relative_coordinate ()? 
73 }
74
75
76