]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/slur-proto-engraver.hh
Doc-ca: nitpick in web.texi
[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 #include <map>
26
27 class Slur_proto_engraver : public Engraver
28 {
29 protected:
30   Slur_proto_engraver (const char* double_property_name,
31     const char* grob_name, const char* object_name, const char* event_name) :
32       double_property_name_ (double_property_name),
33       grob_name_ (grob_name), object_name_ (object_name),
34       event_name_ (event_name) {}
35
36   struct Event_info {
37     Stream_event *slur_, *note_;
38     Event_info (Stream_event *slur, Stream_event *note)
39       : slur_ (slur), note_ (note)
40     { }
41   };
42   // protected so that subclasses can see them
43   vector<Event_info> start_events_;
44   vector<Event_info> stop_events_;
45
46   typedef std::multimap<Stream_event *, Spanner *> Note_slurs;
47   Drul_array<Note_slurs> note_slurs_;
48   vector<Grob *> slurs_;
49   vector<Grob *> end_slurs_;
50   vector<Grob_info> objects_to_acknowledge_;
51   const char* double_property_name_;
52   const char* grob_name_;
53   const char* object_name_;
54   const char* event_name_;
55   virtual SCM event_symbol () = 0;
56
57   void acknowledge_extra_object (Grob_info);
58   void stop_translation_timestep ();
59   void process_music ();
60
61   bool can_create_slur (const string&, vsize, vsize *, Stream_event *);
62   void create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken);
63   bool try_to_end (Event_info evi);
64
65   virtual void set_melisma (bool);
66   virtual void finalize ();
67   virtual void derived_mark () const;
68
69 public:
70   void acknowledge_inline_accidental (Grob_info);
71   void acknowledge_fingering (Grob_info);
72   void acknowledge_note_column (Grob_info);
73   void acknowledge_script (Grob_info);
74   void acknowledge_dots (Grob_info);
75   void acknowledge_text_script (Grob_info);
76   void acknowledge_end_tie (Grob_info);
77   void acknowledge_tuplet_number (Grob_info);
78   void listen_note (Stream_event *ev);
79   void listen_slur (Stream_event *ev, Stream_event *note);
80   // You'd think the following is the same as defaulting `note' to 0,
81   // but template resolution for trampolines disagrees.  Huh.
82   void listen_slur (Stream_event *ev) { listen_slur (ev, 0); }
83   // no TRANSLATOR_DECLARATIONS (Slur_proto_engraver) needed since this
84   // class is abstract
85   DECLARE_TRANSLATOR_CALLBACKS (Slur_proto_engraver);
86 };
87
88 #endif // SLUR_PROTO_ENGRAVER_HH