summaryrefslogtreecommitdiff
path: root/lily/phrasing-slur-engraver.cc
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2006-08-02 21:41:15 +0000
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2006-08-02 21:41:15 +0000
commitcc676c5aadd45985251b5d60fa23eed1ed98f6e6 (patch)
tree17c5e3002256d8e2ebb87c03f7ee6b994d324131 /lily/phrasing-slur-engraver.cc
parentbfc84a7427e16e0916b4bd2e7418572f868999cc (diff)
*** empty log message ***
Diffstat (limited to 'lily/phrasing-slur-engraver.cc')
-rw-r--r--lily/phrasing-slur-engraver.cc48
1 files changed, 18 insertions, 30 deletions
diff --git a/lily/phrasing-slur-engraver.cc b/lily/phrasing-slur-engraver.cc
index b3b9abbe00..d9c6e3e039 100644
--- a/lily/phrasing-slur-engraver.cc
+++ b/lily/phrasing-slur-engraver.cc
@@ -14,8 +14,11 @@
#include "note-column.hh"
#include "slur.hh"
#include "spanner.hh"
+#include "stream-event.hh"
#include "warn.hh"
+#include "translator.icc"
+
/*
It is possible that a slur starts and ends on the same note. At
least, it is for phrasing slurs: a note can be both beginning and
@@ -24,14 +27,12 @@
class Phrasing_slur_engraver : public Engraver
{
- Drul_array<Music *> events_;
- Music *running_slur_start_;
+ Drul_array<Stream_event *> events_;
+ Stream_event *running_slur_start_;
vector<Grob*> slurs_;
vector<Grob*> end_slurs_;
protected:
- virtual bool try_music (Music *);
-
void acknowledge_extra_object (Grob_info);
DECLARE_ACKNOWLEDGER (accidental);
DECLARE_ACKNOWLEDGER (dynamic_line_spanner);
@@ -41,6 +42,7 @@ protected:
DECLARE_ACKNOWLEDGER (slur);
DECLARE_ACKNOWLEDGER (text_script);
DECLARE_ACKNOWLEDGER (tie);
+ DECLARE_TRANSLATOR_LISTENER (phrasing_slur);
void stop_translation_timestep ();
virtual void finalize ();
@@ -55,30 +57,18 @@ Phrasing_slur_engraver::Phrasing_slur_engraver ()
events_[START] = events_[STOP] = 0;
}
-bool
-Phrasing_slur_engraver::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Phrasing_slur_engraver, phrasing_slur);
+void
+Phrasing_slur_engraver::listen_phrasing_slur (Stream_event *ev)
{
- if (m->is_mus_type ("phrasing-slur-event"))
- {
- /*
- Let's not start more than one slur per moment.
- */
- Direction d = to_dir (m->get_property ("span-direction"));
- if (d == START)
- {
- events_[START] = m;
- return true;
- }
- else if (d == STOP)
- {
- if (slurs_.empty ())
- return false;
-
- events_[STOP] = m;
- return true;
- }
- }
- return false;
+ /*
+ Let's not start more than one slur per moment.
+ */
+ Direction d = to_dir (ev->get_property ("span-direction"));
+ if (d == START)
+ events_[START] = ev;
+ else if (d == STOP && !slurs_.empty ())
+ events_[STOP] = ev;
}
void
@@ -157,7 +147,7 @@ Phrasing_slur_engraver::process_music ()
if (events_[START] && slurs_.empty ())
{
- Music *ev = events_[START];
+ Stream_event *ev = events_[START];
Grob *slur = make_spanner ("PhrasingSlur", events_[START]->self_scm ());
Direction updown = to_dir (ev->get_property ("direction"));
@@ -175,8 +165,6 @@ Phrasing_slur_engraver::stop_translation_timestep ()
events_[START] = events_[STOP] = 0;
}
-#include "translator.icc"
-
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, accidental);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, dynamic_line_spanner);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, fingering)