/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
vector <Grob *> maybe_flags_;
Stream_event *rhythmic_ev_;
Stream_event *tremolo_ev_;
+ bool tuplet_start_;
TRANSLATOR_DECLARATIONS (Stem_engraver);
protected:
- void make_stem (Grob_info);
+ void make_stem (Grob_info, bool);
DECLARE_TRANSLATOR_LISTENER (tremolo);
+ DECLARE_TRANSLATOR_LISTENER (tuplet_span);
DECLARE_ACKNOWLEDGER (rhythmic_head);
void stop_translation_timestep ();
void finalize ();
stem_ = 0;
tremolo_ = 0;
rhythmic_ev_ = 0;
+ tuplet_start_ = false;
}
void
-Stem_engraver::make_stem (Grob_info gi)
+Stem_engraver::make_stem (Grob_info gi, bool tuplet_start)
{
/* Announce the cause of the head as cause of the stem. The
stem needs a rhythmic structure to fit it into a beam. */
stem_ = make_item ("Stem", gi.grob ()->self_scm ());
+ if (tuplet_start)
+ stem_->set_property ("tuplet-start", SCM_BOOL_T);
(void) make_item ("StemStub", gi.grob ()->self_scm ());
if (tremolo_ev_)
{
the first and last (quarter) note both get one tremolo flag. */
int requested_type
- = robust_scm2int (tremolo_ev_->get_property ("tremolo-type"), 0);
- SCM f = get_property ("tremoloFlags");
- if (!requested_type)
- {
- if (scm_is_number (f))
- requested_type = scm_to_int (f);
- else
- requested_type = 8;
- }
- else
- context ()->set_property ("tremoloFlags", scm_from_int (requested_type));
+ = robust_scm2int (tremolo_ev_->get_property ("tremolo-type"), 8);
/*
we take the duration log from the Event, since the duration-log
return;
if (!stem_)
- make_stem (gi);
+ make_stem (gi, tuplet_start_);
int ds = Stem::duration_log (stem_);
int dc = d->duration_log ();
stem_->set_object ("flag", flag->self_scm ());
maybe_flags_.push_back (flag);
}
+ if (tuplet_start_)
+ stem_->set_property ("tuplet-start", SCM_BOOL_T);
}
void
}
stem_ = 0;
}
+ tuplet_start_ = false;
tremolo_ev_ = 0;
}
+IMPLEMENT_TRANSLATOR_LISTENER (Stem_engraver, tuplet_span);
+void
+Stem_engraver::listen_tuplet_span (Stream_event *ev)
+{
+ Direction dir = to_dir (ev->get_property ("span-direction"));
+ if (dir == START)
+ {
+ // set stem property if stem already exists
+ if (stem_)
+ stem_->set_property ("tuplet-start", SCM_BOOL_T);
+ tuplet_start_ = true; // stash the value for use in later creation
+ }
+}
+
IMPLEMENT_TRANSLATOR_LISTENER (Stem_engraver, tremolo);
void
Stem_engraver::listen_tremolo (Stream_event *ev)
"StemTremolo ",
/* read */
- "tremoloFlags "
"stemLeftBeamCount "
"stemRightBeamCount "
"whichBar ",