]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/slur-proto-engraver.hh
Issue 4625/3: Listen to and record in-chord slurs
[lilypond.git] / lily / include / slur-proto-engraver.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2013--2015 Mike Solomon <mike@mikesolomon.org>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef SLUR_PROTO_ENGRAVER_HH
21 #define SLUR_PROTO_ENGRAVER_HH
22
23 #include "engraver.hh"
24 #include "moment.hh"
25
26 class Slur_proto_engraver : public Engraver
27 {
28 protected:
29   Slur_proto_engraver (const char* double_property_name,
30     const char* grob_name, const char* object_name, const char* event_name) :
31       double_property_name_ (double_property_name),
32       grob_name_ (grob_name), object_name_ (object_name),
33       event_name_ (event_name) {}
34
35   struct Event_info {
36     Stream_event *slur_, *note_;
37     Event_info (Stream_event *slur, Stream_event *note)
38       : slur_ (slur), note_ (note)
39     { }
40   };
41   // protected so that subclasses can see them
42   std::vector<Event_info> start_events_;
43   std::vector<Event_info> stop_events_;
44   std::vector<Grob *> slurs_;
45   std::vector<Grob *> end_slurs_;
46   std::vector<Grob_info> objects_to_acknowledge_;
47   const char* double_property_name_;
48   const char* grob_name_;
49   const char* object_name_;
50   const char* event_name_;
51   virtual SCM event_symbol () = 0;
52
53   DECLARE_ACKNOWLEDGER (inline_accidental);
54   DECLARE_ACKNOWLEDGER (fingering);
55   DECLARE_ACKNOWLEDGER (note_column);
56   DECLARE_ACKNOWLEDGER (script);
57   DECLARE_ACKNOWLEDGER (dots);
58   DECLARE_ACKNOWLEDGER (text_script);
59   DECLARE_END_ACKNOWLEDGER (tie);
60   DECLARE_ACKNOWLEDGER (tuplet_number);
61
62   void listen_note (Stream_event *ev);
63   void listen_slur (Stream_event *ev, Stream_event *note = 0);
64   void acknowledge_extra_object (Grob_info);
65   void stop_translation_timestep ();
66   void process_music ();
67
68   bool can_create_slur (const std::string&, vsize, vsize *, Stream_event *);
69   void create_slur (const std::string &spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken);
70   bool try_to_end (Stream_event *ev);
71
72   virtual void set_melisma (bool);
73   virtual void finalize ();
74   virtual void derived_mark () const;
75
76 public:
77   // no TRANSLATOR_DECLARATIONS (Slur_proto_engraver) needed since this
78   // class is abstract
79 };
80
81 #endif // SLUR_PROTO_ENGRAVER_HH