X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fligature-engraver.cc;h=0cb04c2c365a22175145c8846d715e497443a76f;hb=987371d22b8402ee0cfd7aa5194e1664753e252e;hp=1480a4d3c3985e8c0b4063b12144729cff4d0a92;hpb=1f4ae685939466899fdf85121a58801c867f9381;p=lilypond.git diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc index 1480a4d3c3..0cb04c2c36 100644 --- a/lily/ligature-engraver.cc +++ b/lily/ligature-engraver.cc @@ -3,17 +3,18 @@ source file of the GNU LilyPond music typesetter - (c) 2002--2005 Juergen Reuter + (c) 2002--2006 Juergen Reuter */ #include "ligature-engraver.hh" -#include "spanner.hh" -#include "score-engraver.hh" +#include "context.hh" +#include "international.hh" #include "note-head.hh" #include "rest.hh" +#include "score-engraver.hh" +#include "spanner.hh" #include "warn.hh" -#include "context.hh" #include "translator.icc" @@ -26,7 +27,7 @@ * * A concrete ligature engraver must subclass this class and provide * functions create_ligature_spanner () and typeset_ligature - * (Spanner *, Array). Subclasses of this class basically + * (Spanner *, vector). Subclasses of this class basically * fall into two categories. * * The first category consists of engravers that engrave ligatures in @@ -89,52 +90,6 @@ Ligature_engraver::try_music (Music *m) return false; } -/* - * This method should do something that comes close to the following - * .ly snippet: - * - * \property Voice.NoteHead \override #'print-function = - * < value of #'ligature-primitive-callback of Voice.NoteHead > - * - * TODO: What we are doing here on the c++ level, should actually be - * performed on the SCM level. However, I do not know how to teach - * lilypond to apply an \override and \revert on #'print-function, - * whenever lily encounters a \[ and \] in an .ly file, respectively. - * Also encounter, that lily should not crash if a user erronously - * nests \[ and \]. - */ -void -Ligature_engraver::override_stencil_callback () -{ - SCM target_callback = ly_symbol2scm ("print-function"); - SCM source_callback = ly_symbol2scm ("ligature-primitive-callback"); - SCM noteHeadProperties = updated_grob_properties (context (), ly_symbol2scm ("NoteHead")); - SCM value = scm_cdr (scm_sloppy_assq (source_callback, noteHeadProperties)); - execute_pushpop_property (context (), ly_symbol2scm ("NoteHead"), - target_callback, value); -} - -/* - * This method should do something that comes close to the following - * .ly snippet: - * - * \property Voice.NoteHead \revert #'print-function - * - * TODO: What we are doing here on the c++ level, should actually be - * performed on the SCM level. However, I do not know how to teach - * lilypond to apply an \override and \revert on #'print-function, - * whenever lily encounters a \[ and \] in an .ly file, respectively. - * Also encounter, that lily should not crash if a user erronously - * nests \[ and \]. - */ -void -Ligature_engraver::revert_stencil_callback () -{ - SCM symbol = ly_symbol2scm ("NoteHead"); - SCM key = ly_symbol2scm ("print-function"); - execute_pushpop_property (context (), symbol, key, SCM_UNDEFINED); -} - void Ligature_engraver::process_music () { @@ -156,7 +111,6 @@ Ligature_engraver::process_music () finished_ligature_ = ligature_; primitives_.clear (); ligature_ = 0; - revert_stencil_callback (); } last_bound_ = unsmob_grob (get_property ("currentMusicalColumn")); @@ -176,10 +130,6 @@ Ligature_engraver::process_music () prev_start_event_ = events_drul_[START]; ligature_ = create_ligature_spanner (); - brew_ligature_primitive_proc - = ligature_->get_property ("ligature-primitive-callback"); - if (brew_ligature_primitive_proc == SCM_EOL) - programming_error ("Ligature_engraver: ligature-primitive-callback undefined"); Grob *bound = unsmob_grob (get_property ("currentMusicalColumn")); if (!bound) @@ -191,7 +141,6 @@ Ligature_engraver::process_music () // TODO: dump cause into make_item/spanner. // announce_grob (ligature_, events_drul_[START]->self_scm ()); - override_stencil_callback (); } } @@ -244,11 +193,10 @@ Ligature_engraver::acknowledge_note_head (Grob_info info) { if (ligature_) { - primitives_.push (info); - if (info.grob ()) + primitives_.push_back (info); + if (info.grob () && (brew_ligature_primitive_proc != SCM_EOL)) { - info.grob ()->set_callback (ly_symbol2scm ("stencil"), - brew_ligature_primitive_proc); + info.grob ()->set_property ("stencil", brew_ligature_primitive_proc); } } }