]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/tie-engraver.hh
bae7f6aa9a577dfcb1de09b39bfeb94255b99f6c
[lilypond.git] / lily / include / tie-engraver.hh
1 /*   
2   ctie-engraver.hh -- declare Tie_engraver
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef CTIE_ENGRAVER_HH
11 #define CTIE_ENGRAVER_HH
12
13 #include "pqueue.hh"
14 #include "engraver.hh"
15
16 struct CHead_melodic_tuple {
17   Melodic_req *req_l_ ;
18   Note_head *head_l_;
19   Moment end_;
20   CHead_melodic_tuple ();
21   CHead_melodic_tuple (Note_head*, Melodic_req*, Moment);
22   static int pitch_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &);
23   static int time_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &);  
24 };
25
26 inline int compare (CHead_melodic_tuple const &a, CHead_melodic_tuple const &b)
27 {
28   return CHead_melodic_tuple::time_compare (a,b);
29 }
30
31
32 /**
33    Manufacture ties.  Acknowledge noteheads, and put them into a
34    priority queue. If we have a Tie_req, connect the notes that finish
35    just at this time, and note that start at this time.
36
37    TODO: should share code with Beam_engraver, Extender_engraver?
38  */
39 class Tie_engraver : public Engraver
40 {
41   PQueue<CHead_melodic_tuple> past_notes_pq_;
42   Tie_req *req_l_;
43   Array<CHead_melodic_tuple> now_heads_;
44   Array<CHead_melodic_tuple> stopped_heads_;
45   Link_array<Tie> tie_p_arr_;
46   
47   void set_melisma (bool);
48 protected:
49   virtual void do_post_move_processing ();
50   virtual void do_pre_move_processing ();
51   virtual void acknowledge_element (Score_element_info);
52   virtual bool do_try_music (Music*);
53   virtual void do_process_requests ();
54   virtual void process_acknowledged ();
55
56 public:
57   VIRTUAL_COPY_CONS(Translator);
58   Tie_engraver();
59 };
60
61 #endif /* CTIE_ENGRAVER_HH */
62