]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots.cc
release: 1.3.4
[lilypond.git] / lily / dots.cc
1 /*
2   dots.cc -- implement Dots
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "dots.hh"
10 #include "molecule.hh"
11 #include "paper-def.hh"
12 #include "lookup.hh"
13
14 Dots::Dots ()
15 {
16   dots_i_ =0;
17   resolve_dir_ =CENTER;
18 }
19
20 void
21 Dots::do_post_processing ()
22 {
23   if (!resolve_dir_)
24     resolve_dir_ = UP;
25   
26   if (!(position_i_ % 2))
27     position_i_ += resolve_dir_;
28
29   if (!dots_i_)
30     {
31       set_elt_property ("transparent", SCM_BOOL_T);
32       set_empty (true, X_AXIS, Y_AXIS);
33     }
34 }
35
36 Molecule* 
37 Dots::do_brew_molecule_p () const
38 {
39   Molecule *out = new Molecule;
40   Molecule fill = lookup_l ()->fill (Box (Interval (0,0),
41                                           Interval (0,0)));
42   out->add_molecule (fill);
43
44   Molecule d = lookup_l ()->dots ();
45
46   Real dw = d.dim_[X_AXIS].length ();
47   d.translate_axis (-dw, X_AXIS);
48   for (int i=dots_i_; i--; )
49     {
50       d.translate_axis (2*dw,X_AXIS);
51       out->add_molecule (d);
52     }
53   out->translate_axis (staff_line_leading_f () * position_i_ /2., Y_AXIS);
54   return out;
55 }
56
57
58