source file of the GNU LilyPond music typesetter
- (c) 2008 Han-Wen Nienhuys <hanwen@lilypond.org>
+ (c) 2008--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
*/
#include "engraver.hh"
+#include "hairpin.hh"
+#include "international.hh"
#include "item.hh"
-#include "pointer-group-interface.hh"
-#include "text-interface.hh"
#include "note-column.hh"
+#include "pointer-group-interface.hh"
#include "self-alignment-interface.hh"
#include "spanner.hh"
#include "stream-event.hh"
+#include "text-interface.hh"
#include "translator.icc"
virtual void process_music ();
virtual void stop_translation_timestep ();
private:
+ SCM get_property_setting (Stream_event *evt, char const *evprop, char const *ctxprop);
+
Drul_array<Stream_event *> accepted_spanevents_drul_;
Spanner *current_spanner_;
Spanner *finished_spanner_;
ASSIGN_EVENT_ONCE (accepted_spanevents_drul_[d], ev);
}
+SCM
+New_dynamic_engraver::get_property_setting (Stream_event *evt, char const *evprop, char const *ctxprop)
+{
+ SCM spanner_type = evt->get_property (evprop);
+ if (spanner_type == SCM_EOL)
+ spanner_type = get_property (ctxprop);
+ return spanner_type;
+}
void
New_dynamic_engraver::process_music ()
return;
}
- SCM cresc_type = get_property ((start_type + "Spanner").c_str ());
+ SCM cresc_type = get_property_setting (current_span_event_, "span-type",
+ (start_type + "Spanner").c_str ());
if (cresc_type == ly_symbol2scm ("text"))
{
= make_spanner ("DynamicTextSpanner",
accepted_spanevents_drul_[START]->self_scm ());
- SCM text = get_property ((start_type + "Text").c_str ());
+ SCM text = get_property_setting (current_span_event_, "span-text",
+ (start_type + "Text").c_str ());
if (Text_interface::is_markup (text))
{
current_spanner_->set_property ("text", text);
if (cresc_type != ly_symbol2scm ("hairpin"))
{
// Fixme: should put value in error message.
- ly_display_scm (cresc_type);
+ string as_string = ly_scm_write_string (cresc_type);
current_span_event_
- ->origin()->warning ("unknown crescendo style; defaulting to hairpin.");
+ ->origin()->warning (_f ("unknown crescendo style: %s\ndefaulting to hairpin.", as_string.c_str()));
}
current_spanner_ = make_spanner ("Hairpin",
current_span_event_->self_scm ());
if (current_spanner_)
{
current_spanner_->set_bound (LEFT, script_);
- set_nested_property (current_spanner_,
- scm_list_3 (ly_symbol2scm ("bound-details"),
- ly_symbol2scm ("left"),
- ly_symbol2scm ("attach-dir")
- ),
- scm_from_int (RIGHT));
+
+ if (!Hairpin::has_interface (current_spanner_))
+ set_nested_property (current_spanner_,
+ scm_list_3 (ly_symbol2scm ("bound-details"),
+ ly_symbol2scm ("left"),
+ ly_symbol2scm ("attach-dir")
+ ),
+ scm_from_int (RIGHT));
}
}
/* create */
"DynamicTextSpanner "
"DynamicText "
- "Hairpin "
- "TextSpanner ",
+ "Hairpin ",
/* read */
- "currentMusicalColumn ",
+ "crescendoSpanner "
+ "crescendoText "
+ "currentMusicalColumn "
+ "decrescendoSpanner "
+ "decrescendoText ",
/* write */
""