]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-spacing-engraver.cc
release: 1.5.27
[lilypond.git] / lily / note-spacing-engraver.cc
1 #if 0
2 /*   
3   note-spacing-engraver.cc --  implement  Note_spacing_engraver.
4
5   source file of the GNU LilyPond music typesetter
6
7   (c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8
9 */
10
11 #include "grob.hh"
12 #include "moment.hh"
13 #include "engraver.hh"
14 #include "note-spacing.hh"
15 #include "note-column.hh"
16
17 /*
18   Originally, we tried to have this functionality at Staff_level
19   
20   - by simply using the sequence of Separation-item as
21   spacing-sequences. Unfortunately, this fucks up if there are
22   different kinds of tuplets combined (8th and 8ths triplets combined
23   made the program believe there were 1/12 th notes.).
24
25
26   - We also created them from Rhythmic_column_engraver, but this has
27   the problem that voices can appear and disappear at will, leaving
28   lots of loose ends (the StaffSpacing don't know where to connect the
29   last note of the voice on the right with)
30   
31  */
32
33 struct Grob_moment_tuple
34 {
35   Link_array<Grob> current_heads_;
36   Link_array<Grob> todo_heads_;
37   
38   Moment length_;
39   
40   static int time_compare (Grob_moment_tuple const &a, Grob_moment_tuple const &b)
41   {
42     return Moment::compare (a.length_, b.length_);
43   }
44 };
45
46 class Note_spacing_engraver : public Engraver
47 {
48 public:
49   TRANSLATOR_DECLARATIONS(Note_spacing_engraver);
50
51
52 protected:
53   Array<Grob_moment_tuple> lengths_found_;
54
55   virtual void acknowledge_grob (Grob_info);
56 };
57
58 Note_spacing_engraver::Note_spacing_engraver()
59 {
60 }
61
62
63 void
64 Note_spacing_engraver::acknowledge_grob (Grob_info gi)
65 {
66   if (Note_head::has_interface (gi.grob_l_))
67     {
68       Music *m = gi.music_cause();
69       Moment now = now_mom ();
70       Moment len = m->length_mom(); 
71       if (now.grace_part_ && len.main_part_)
72         {
73           len.grace_part_ += len.main_part_;
74           len.main_part_ = 0;
75         }
76       
77       for (int  i=0; i <  
78     }
79   Note_column::has_interface (gi.grob_l_))
80     {
81       Grob *head  =Note_column::first_head (gi.grob_l_);
82
83       head->
84     }
85 }
86
87
88
89 ENTER_DESCRIPTION(Note_spacing_engraver,
90 /* descr */       "This engraver creates spacing objects. It should be placed at staff
91 level, but will also function at voice level.
92
93 ",
94 /* creats*/       "NoteSpacing",
95 /* acks  */       "rhythmic-column-interface",
96 /* reads */       "",
97 /* write */       "");
98
99 #endif