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