X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fottava-engraver.cc;h=cfb88a2c3a69083c7966b68f077fde7f3303ef96;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=f4da2e415312ecd155b471833696f213f9a337e8;hpb=02c656d3b0cb895cc81b428d699d960746800e45;p=lilypond.git diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index f4da2e4153..cfb88a2c3a 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -1,15 +1,18 @@ /* - text-spanner-engraver.cc -- implement Ottava_spanner_engraver + ottava-engraver.cc -- implement Ottava_spanner_engraver source file of the GNU LilyPond music typesetter - (c) 2000--2005 Han-Wen Nienhuys + (c) 2000--2008 Han-Wen Nienhuys */ #include "protected-scm.hh" #include "note-column.hh" #include "side-position-interface.hh" #include "engraver.hh" +#include "spanner.hh" +#include "text-interface.hh" +#include "item.hh" class Ottava_spanner_engraver : public Engraver { @@ -17,9 +20,11 @@ public: TRANSLATOR_DECLARATIONS (Ottava_spanner_engraver); protected: virtual void finalize (); - virtual void acknowledge_grob (Grob_info); - virtual void process_music (); - virtual void stop_translation_timestep (); + + DECLARE_ACKNOWLEDGER (note_column); + + void process_music (); + void stop_translation_timestep (); virtual void derived_mark () const; private: Spanner *span_; @@ -51,25 +56,24 @@ Ottava_spanner_engraver::process_music () { finished_ = span_; span_ = 0; - if (scm_is_string (ott)) + if (Text_interface::is_markup (ott)) { span_ = make_spanner ("OttavaBracket", SCM_EOL); span_->set_property ("text", ott); - SCM c0 (get_property ("middleCPosition")); - SCM oc0 (get_property ("originalCentralCPosition")); - if (scm_less_p (oc0, c0) == SCM_BOOL_T) - span_->set_property ("direction", scm_int2num (DOWN)); + SCM offset (get_property ("middleCOffset")); + if (robust_scm2double (offset, 0) > 0) + span_->set_property ("direction", scm_from_int (DOWN)); } } last_ottavation_ = ott; } void -Ottava_spanner_engraver::acknowledge_grob (Grob_info info) +Ottava_spanner_engraver::acknowledge_note_column (Grob_info info) { - Item *it = dynamic_cast (info.grob ()); - if (span_ && it && Note_column::has_interface (info.grob ())) + Item *it = info.item (); + if (span_ && it) { Side_position_interface::add_support (span_, it); @@ -121,10 +125,22 @@ Ottava_spanner_engraver::finalize () last_ottavation_ = SCM_EOL; } +#include "translator.icc" + +ADD_ACKNOWLEDGER (Ottava_spanner_engraver, note_column); + ADD_TRANSLATOR (Ottava_spanner_engraver, - /* descr */ "Create a text spanner when the ottavation property changes..", - /* creats*/ "OttavaBracket", - /* accepts */ "", - /* acks */ "note-column-interface", - /* reads */ "ottavation", - /* write */ ""); + /* doc */ + "Create a text spanner when the ottavation property changes.", + + /* create */ + "OttavaBracket ", + + /* read */ + "ottavation " + "originalMiddleCPosition " + "currentMusicalColumn ", + + /* write */ + "" + );