2 multi-measure-rest.cc -- implement Multi_measure_rest
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999, 1999 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "multi-measure-rest.hh"
12 #include "paper-def.hh"
13 #include "p-col.hh" // urg
18 #include "text-def.hh"
19 #include "molecule.hh"
23 Multi_measure_rest::Multi_measure_rest ()
29 Multi_measure_rest::do_print () const
31 DOUT
<< "measures_i_ " << measures_i_
;
35 Multi_measure_rest::do_brew_molecule_p () const
39 * variable-sized multi-measure rest symbol: |====| ??
40 * build 3, 5, 6, 7, 8 symbols (how far, property?)
41 from whole, brevis and longa rests
43 Molecule
* mol_p
= new Molecule
;
44 if (!column_arr_
.size ())
48 if (measures_i_
== 1 || measures_i_
== 2 || measures_i_
== 4)
50 s
= (lookup_l ()->rest (- intlog2(measures_i_
), 0));
51 s
.translate_axis (-s
.extent ()[X_AXIS
].length () / 2, X_AXIS
);
55 s
= (lookup_l ()->rest (-4, 0));
57 mol_p
->add_molecule (s
);
58 Real interline_f
= paper ()->interline_f ();
61 mol_p
->translate_axis (interline_f
, Y_AXIS
);
67 text
.text_str_
= to_str (measures_i_
);
68 text
.style_str_
= "number";
69 text
.align_dir_
= CENTER
;
70 Molecule s
= text
.get_molecule (paper (), UP
);
71 s
.translate_axis (3.0 * interline_f
, Y_AXIS
);
72 mol_p
->add_molecule (s
);
79 Multi_measure_rest::do_add_processing ()
81 if (column_arr_
.size ())
83 set_bounds (LEFT
, column_arr_
[0 >? column_arr_
.size () - 2]);
84 set_bounds (RIGHT
, column_arr_
[column_arr_
.size () - 1]);
89 Multi_measure_rest::do_post_processing ()
91 if (column_arr_
.size ())
92 translate_axis (extent (X_AXIS
).length () / 2, X_AXIS
);
96 Multi_measure_rest::do_substitute_element_pointer (Score_element
* o
, Score_element
* n
)
98 if (Item
* c
= dynamic_cast <Item
*> (o
))
99 column_arr_
.substitute (c
, dynamic_cast<Item
*> (n
));
103 Multi_measure_rest::add_column (Item
* c
)
105 column_arr_
.push (c
);
111 Multi_measure_rest::get_rods () const
115 r
.item_l_drul_
= spanned_drul_
;
116 r
.distance_f_
= paper ()->get_var ("mmrest_x_minimum");