]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/sequential-iterator.hh
* input/regression/grace-auto-beam.ly: new file
[lilypond.git] / lily / include / sequential-iterator.hh
1 /*   
2   sequential-iterator.hh -- declare Sequential_iterator
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef SEQUENTIAL_ITERATOR_HH
10 #define SEQUENTIAL_ITERATOR_HH
11
12 #include "music-iterator.hh"
13
14 /*
15
16   This is a lookahead list for grace notes.
17
18    {  ... X \grace Y  Z ... }
19
20    normally, the ending of X is the start of Z. In case of a grace
21    note, we take off a little at the end of X. What is stored: START
22    (start point of X), LENGTH (length of X), GRACE_START (start_music
23    of Y), and the next fixup element.
24
25   This is also done for nested musics, i.e.
26
27   voiceA = \notes { \grace b16 c'2 }
28   voiceB = \notes { c'2 \voiceA }
29
30   the iterator for voiceB will contain a fixup entry with (START=0/1,
31   LENGTH=2/1, GRACE_START=(0G-1/16) ) 
32    
33   Graces at the start of a sequential music iterator are handled
34   by initting here_mom_ with Music::start_music (); no fixups are needed.
35
36 */
37 struct Grace_fixup 
38 {
39   Moment start_;
40   Moment length_;
41
42   Rational grace_start_;  
43   Grace_fixup *next_;
44 };
45
46 /** Sequential_music iteration: walk each element in turn, and
47   construct an iterator for every element.
48   
49  */
50 class Sequential_iterator :  public Music_iterator
51 {
52 public:
53   Grace_fixup * grace_fixups_;
54   
55   VIRTUAL_COPY_CONS (Music_iterator);
56   static SCM constructor_cxx_function;
57   Sequential_iterator ();
58   Sequential_iterator (Sequential_iterator const&);
59   virtual ~Sequential_iterator ();
60
61   virtual void construct_children ();
62   virtual Moment pending_moment () const;
63   virtual bool ok () const;
64   virtual void skip (Moment);
65   virtual SCM get_music (Moment)const;
66
67 protected:
68   virtual void process (Moment);
69   virtual Music_iterator *try_music_in_children (Music *) const;
70
71 protected:
72   Moment here_mom_;
73   Music_iterator * iter_p_;
74   SCM cursor_;
75   
76   virtual void next_element (bool side_effect);
77   virtual void descend_to_child ();
78   virtual SCM get_music_list ()const;
79 };
80
81 #endif /* SEQUENTIAL_ITERATOR_HH */