]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/slur-engraver.hh
Imported Upstream version 2.19.45
[lilypond.git] / lily / include / slur-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   Copyright (C) 2016 David Kastrup <dak@gnu.org>
6
7   LilyPond is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   LilyPond is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef SLUR_ENGRAVER_HH
22 #define SLUR_ENGRAVER_HH
23
24 #include "engraver.hh"
25 #include <map>
26
27 class Slur_engraver : public Engraver
28 {
29 protected:
30   struct Event_info {
31     Stream_event *slur_, *note_;
32     Event_info (Stream_event *slur, Stream_event *note)
33       : slur_ (slur), note_ (note)
34     { }
35   };
36   // protected so that subclasses can see them
37   vector<Event_info> start_events_;
38   vector<Event_info> stop_events_;
39
40   typedef std::multimap<Stream_event *, Spanner *> Note_slurs;
41   Drul_array<Note_slurs> note_slurs_;
42   vector<Grob *> slurs_;
43   vector<Grob *> end_slurs_;
44   vector<Grob_info> objects_to_acknowledge_;
45
46   virtual SCM event_symbol () const;
47   virtual bool double_property () const;
48   virtual SCM grob_symbol () const;
49   virtual const char* object_name () const;
50
51   void acknowledge_note_column (Grob_info);
52   void acknowledge_script (Grob_info);
53
54   void listen_note (Stream_event *ev);
55   // A slur on an in-chord note is not actually announced as an event
56   // but rather produced by the note listener.
57   void listen_note_slur (Stream_event *ev, Stream_event *note);
58   void listen_slur (Stream_event *ev) { listen_note_slur (ev, 0); }
59   void acknowledge_extra_object (Grob_info);
60   void stop_translation_timestep ();
61   void process_music ();
62
63   bool can_create_slur (const string&, vsize, vsize *, Stream_event *);
64   void create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken);
65   bool try_to_end (Event_info evi);
66
67   virtual void set_melisma (bool);
68   virtual void finalize ();
69   virtual void derived_mark () const;
70
71 public:
72   TRANSLATOR_DECLARATIONS (Slur_engraver);
73 };
74
75 #endif // SLUR_ENGRAVER_HH