]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/slur-proto-engraver.hh
Merge branch 'master' of /home/jcharles/GIT/Lily/. into translation
[lilypond.git] / lily / include / slur-proto-engraver.hh
index d0ae3c0875db2572e2e1721257b642a813f4b850..97ed1a6637bbf78877020d18678a7169a988cde6 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2013 Mike Solomon <mike@mikesolomon.org>
+  Copyright (C) 2013--2015 Mike Solomon <mike@mikesolomon.org>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
 
 #include "engraver.hh"
 #include "moment.hh"
+#include <map>
 
 class Slur_proto_engraver : public Engraver
 {
@@ -32,45 +33,56 @@ protected:
       grob_name_ (grob_name), object_name_ (object_name),
       event_name_ (event_name) {}
 
+  struct Event_info {
+    Stream_event *slur_, *note_;
+    Event_info (Stream_event *slur, Stream_event *note)
+      : slur_ (slur), note_ (note)
+    { }
+  };
   // protected so that subclasses can see them
-  vector<Stream_event *> start_events_;
-  vector<Stream_event *> stop_events_;
+  vector<Event_info> start_events_;
+  vector<Event_info> stop_events_;
+
+  typedef std::multimap<Stream_event *, Spanner *> Note_slurs;
+  Drul_array<Note_slurs> note_slurs_;
   vector<Grob *> slurs_;
   vector<Grob *> end_slurs_;
   vector<Grob_info> objects_to_acknowledge_;
-  Stream_event *break_slur_;
   const char* double_property_name_;
   const char* grob_name_;
   const char* object_name_;
   const char* event_name_;
+  virtual SCM event_symbol () = 0;
 
-  DECLARE_ACKNOWLEDGER (inline_accidental);
-  DECLARE_ACKNOWLEDGER (fingering);
-  DECLARE_ACKNOWLEDGER (note_column);
-  DECLARE_ACKNOWLEDGER (script);
-  DECLARE_ACKNOWLEDGER (dots);
-  DECLARE_ACKNOWLEDGER (text_script);
-  DECLARE_END_ACKNOWLEDGER (tie);
-  DECLARE_ACKNOWLEDGER (tuplet_number);
-
-  void internal_listen_slur (Stream_event *ev);
-  void internal_listen_break_slur (Stream_event *ev);
   void acknowledge_extra_object (Grob_info);
   void stop_translation_timestep ();
   void process_music ();
 
-  bool can_create_slur (string, vsize, vsize *, Stream_event *);
-  void create_slur (string spanner_id, Stream_event *ev_cause, Grob *g_cause, Direction dir, bool left_broken);
-  bool try_to_end (Stream_event *ev);
-  void break_slurs ();
+  bool can_create_slur (const string&, vsize, vsize *, Stream_event *);
+  void create_slur (const string &spanner_id, Event_info evi, Grob *g_cause, Direction dir, bool left_broken);
+  bool try_to_end (Event_info evi);
 
   virtual void set_melisma (bool);
   virtual void finalize ();
   virtual void derived_mark () const;
 
 public:
+  void acknowledge_inline_accidental (Grob_info);
+  void acknowledge_fingering (Grob_info);
+  void acknowledge_note_column (Grob_info);
+  void acknowledge_script (Grob_info);
+  void acknowledge_dots (Grob_info);
+  void acknowledge_text_script (Grob_info);
+  void acknowledge_end_tie (Grob_info);
+  void acknowledge_tuplet_number (Grob_info);
+  void listen_note (Stream_event *ev);
+  void listen_slur (Stream_event *ev, Stream_event *note);
+  // You'd think the following is the same as defaulting `note' to 0,
+  // but template resolution for trampolines disagrees.  Huh.
+  void listen_slur (Stream_event *ev) { listen_slur (ev, 0); }
   // no TRANSLATOR_DECLARATIONS (Slur_proto_engraver) needed since this
   // class is abstract
+  DECLARE_TRANSLATOR_CALLBACKS (Slur_proto_engraver);
 };
 
 #endif // SLUR_PROTO_ENGRAVER_HH