]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots.cc
6fc996328c41064c9939b7f6b543612ef7368ef0
[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 }
18
19 void
20 Dots::do_post_processing ()
21 {
22   if (!dots_i_)
23     {
24       set_elt_property ("transparent", SCM_BOOL_T);
25       set_empty (X_AXIS);
26       set_empty (Y_AXIS);
27     }
28   else
29     {
30       if (!get_direction ())
31         set_direction (UP);
32
33       int p = int (position_f ());
34       if (!(p % 2))
35         set_position (p  + get_direction ());
36     }
37 }
38 Molecule* 
39 Dots::do_brew_molecule_p () const
40 {
41   Molecule *out = new Molecule;
42   Molecule fill = lookup_l ()->fill (Box (Interval (0,0),
43                                           Interval (0,0)));
44   out->add_molecule (fill);
45
46   Molecule d = lookup_l ()->afm_find (String ("dots-dot"));
47
48   Real dw = d.dim_[X_AXIS].length ();
49   d.translate_axis (-dw, X_AXIS);
50   for (int i=dots_i_; i--; )
51     {
52       d.translate_axis (2*dw,X_AXIS);
53       out->add_molecule (d);
54     }
55
56   return out;
57 }
58
59
60