]> git.donarmstrong.com Git - lilypond.git/blob - lily/hara-kiri-vertical-group-spanner.cc
release: 1.3.36
[lilypond.git] / lily / hara-kiri-vertical-group-spanner.cc
1 /*
2   hara-kiri-vertical-group-spanner.cc 
3     -- implement Hara_kiri_vertical_group_spanner
4
5   source file of the GNU LilyPond music typesetter
6
7   (c)  1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
8   Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 */
10
11 #include "axis-group-interface.hh"
12 #include "hara-kiri-vertical-group-spanner.hh"
13 #include "debug.hh"
14 #include "item.hh"
15
16 Hara_kiri_group_spanner::Hara_kiri_group_spanner()
17 {
18   set_elt_property ("items-worth-living", SCM_EOL);
19   axis_group (this).set_axes(Y_AXIS,Y_AXIS);
20 }
21
22 void 
23 Hara_kiri_group_spanner::add_interesting_item (Item* n)
24 {
25   add_dependency (n);
26   set_elt_property ("items-worth-living",
27                     gh_cons (n->self_scm_,
28                              get_elt_property ("items-worth-living")));
29 }
30
31 void 
32 Hara_kiri_group_spanner::after_line_breaking ()
33 {
34   SCM worth = get_elt_property ("items-worth-living");
35   if (gh_pair_p (worth))
36     return;
37
38   Link_array<Score_element> childs = axis_group (this).get_children ();
39   for (int i = 0; i < childs.size (); i++)
40     {
41       Score_element* s = childs[i];
42
43       if ( line_l () != s->line_l ())
44         programming_error ("Killing other children too");
45       s->set_elt_property ("transparent", SCM_BOOL_T);
46       s->set_empty (X_AXIS);
47       s->set_empty (Y_AXIS);
48
49     }
50   set_empty (X_AXIS);
51   set_empty (Y_AXIS);  
52 }
53
54
55