2 span-bar.cc -- implement Span_bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "dimensions.hh"
12 #include "paper-def.hh"
13 #include "molecule.hh"
14 #include "align-element.hh"
18 Span_bar::add_bar (Score_element
*b
)
20 spanning_l_arr_
.push (b
);
25 Span_bar::do_substitute_element_pointer (Score_element
*o
, Score_element
*n
)
27 spanning_l_arr_
.unordered_substitute (o
, n
);
32 Span_bar::do_width () const
34 Molecule m
= lookup_l ()->bar (type_str_
, 40 PT
);
36 return m
.extent (X_AXIS
);
40 Span_bar::do_pre_processing ()
42 Bar::do_pre_processing ();
46 dim_cache_
[Y_AXIS
]->set_empty (false); // a hack to make mark scripts work.
50 Span_bar::do_post_processing ()
52 Bar::do_post_processing ();
56 Span_bar::evaluate_empty ()
58 if (spanning_l_arr_
.size () < 1)
60 set_elt_property (transparent_scm_sym
, SCM_BOOL_T
);
63 if (type_str_
.empty_b ())
65 set_elt_property (transparent_scm_sym
, SCM_BOOL_T
);
68 else if (type_str_
== "|:")
72 else if (type_str_
== ":|")
76 else if (type_str_
== ":|:")
83 Span_bar::get_spanned_interval () const
86 for (int i
=0; i
< spanning_l_arr_
.size (); i
++)
88 Dimension_cache
*common
=
89 common_group (spanning_l_arr_
[i
], Y_AXIS
);
91 Real y
= spanning_l_arr_
[i
]->dim_cache_
[Y_AXIS
]->relative_coordinate (common
)
92 -dim_cache_
[Y_AXIS
]->relative_coordinate (common
);
94 y_int
.unite (y
+ spanning_l_arr_
[i
]->extent(Y_AXIS
));
100 Span_bar::do_height () const
102 return get_spanned_interval ();
106 Span_bar::do_brew_molecule_p () const
108 Interval
iv (get_spanned_interval ());
109 Molecule
*output
= new Molecule
;
112 output
->add_molecule (lookup_l ()->bar (type_str_
, iv
.length ()));
113 output
->translate_axis (iv
.center (), Y_AXIS
);
117 programming_error("Huh? My children deflated (FIXME)");
124 Span_bar::Span_bar ()