source file of the GNU LilyPond music typesetter
- (c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "tie.hh"
Spanner *tie_column_;
protected:
- virtual void stop_translation_timestep ();
+ void stop_translation_timestep ();
virtual void derived_mark () const;
- virtual void start_translation_timestep ();
- virtual void acknowledge_grob (Grob_info);
+ void start_translation_timestep ();
+ DECLARE_ACKNOWLEDGER (note_head);
virtual bool try_music (Music *);
- virtual void process_music ();
+ void process_music ();
void typeset_tie (Grob *);
public:
TRANSLATOR_DECLARATIONS (Tie_engraver);
Tie_engraver::try_music (Music *mus)
{
if (mus->is_mus_type ("tie-event"))
- {
- event_ = mus;
- }
+ event_ = mus;
return true;
}
Tie_engraver::process_music ()
{
if (event_)
- {
- context ()->set_property ("tieMelismaBusy", SCM_BOOL_T);
- }
+ context ()->set_property ("tieMelismaBusy", SCM_BOOL_T);
}
void
-Tie_engraver::acknowledge_grob (Grob_info i)
+Tie_engraver::acknowledge_note_head (Grob_info i)
{
- if (Note_head::has_interface (i.grob_))
+ Grob *h = i.grob ();
+ now_heads_.push (h);
+ for (int i = heads_to_tie_.size (); i--;)
{
- Grob *h = i.grob_;
- now_heads_.push (h);
- for (int i = heads_to_tie_.size (); i--;)
+ Grob *th = heads_to_tie_[i].head_;
+ Music *right_mus = unsmob_music (h->get_property ("cause"));
+ Music *left_mus = unsmob_music (th->get_property ("cause"));
+
+ /*
+ maybe should check positions too.
+ */
+ if (right_mus && left_mus
+ && ly_is_equal (right_mus->get_property ("pitch"),
+ left_mus->get_property ("pitch")))
{
- Grob *th = heads_to_tie_[i].head_;
- Music *right_mus = unsmob_music (h->get_property ("cause"));
- Music *left_mus = unsmob_music (th->get_property ("cause"));
-
- /*
- maybe should check positions too.
- */
- if (right_mus && left_mus
- && ly_c_equal_p (right_mus->get_property ("pitch"),
- left_mus->get_property ("pitch")))
- {
- Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
- context ()->get_grob_key ("Tie"));
- announce_grob (p, heads_to_tie_[i].event_->self_scm ());
- Tie::set_interface (p); // cannot remove yet!
-
- Tie::set_head (p, LEFT, th);
- Tie::set_head (p, RIGHT, h);
-
- ties_.push (p);
- heads_to_tie_.del (i);
- }
+ Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
+ context ()->get_grob_key ("Tie"));
+ announce_grob (p, heads_to_tie_[i].event_->self_scm ());
+ Tie::set_head (p, LEFT, th);
+ Tie::set_head (p, RIGHT, h);
+
+ ties_.push (p);
+ heads_to_tie_.del (i);
}
+ }
- if (ties_.size () && ! tie_column_)
- {
- tie_column_ = make_spanner ("TieColumn", ties_[0]->self_scm ());
- }
+ if (ties_.size () && ! tie_column_)
+ tie_column_ = make_spanner ("TieColumn", ties_[0]->self_scm ());
- if (tie_column_)
- for (int i = ties_.size (); i--;)
- Tie_column::add_tie (tie_column_, ties_[i]);
- }
+ if (tie_column_)
+ for (int i = ties_.size (); i--;)
+ Tie_column::add_tie (tie_column_, ties_[i]);
}
void
{
context ()->set_property ("tieMelismaBusy",
ly_bool2scm (heads_to_tie_.size ()));
-
}
void
if (ties_.size ())
{
if (!to_boolean (get_property ("tieWaitForNote")))
- {
- heads_to_tie_.clear ();
- }
+ heads_to_tie_.clear ();
- for (int i = 0; i< ties_.size (); i++)
- {
- typeset_tie (ties_[i]);
- }
+ for (int i = 0; i < ties_.size (); i++)
+ typeset_tie (ties_[i]);
ties_.clear ();
tie_column_ = 0;
}
while (flip (&d) != LEFT);
- index_set_cell (her->get_property ("head-pair"), LEFT, new_head_drul[LEFT]->self_scm ());
- index_set_cell (her->get_property ("head-pair"), RIGHT, new_head_drul[RIGHT]->self_scm ());
-
+ Spanner *sp = dynamic_cast<Spanner*> (her);
+ sp->set_bound (LEFT, new_head_drul[LEFT]);
+ sp->set_bound (RIGHT, new_head_drul[RIGHT]);
}
+#include "translator.icc"
+
+ADD_ACKNOWLEDGER (Tie_engraver, note_head);
ADD_TRANSLATOR (Tie_engraver,
- /* descr */ "Generate ties between noteheads of equal pitch.",
- /* creats*/ "Tie TieColumn",
- /* accepts */ "tie-event",
- /* acks */ "rhythmic-head-interface",
- /* reads */ "tieMelismaBusy",
- /* write */ "");
+ /* doc */ "Generate ties between noteheads of equal pitch.",
+ /* create */
+ "Tie "
+ "TieColumn",
+
+ /* accept */ "tie-event",
+ /* read */ "tieWaitForNote",
+ /* write */ "tieMelismaBusy");