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