source file of the GNU LilyPond music typesetter
- (c) 2000--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "engraver.hh"
+
+#include "bar-line.hh"
#include "context.hh"
-#include "volta-bracket.hh"
+#include "international.hh"
#include "note-column.hh"
-#include "bar-line.hh"
+#include "item.hh"
#include "side-position-interface.hh"
-#include "warn.hh"
#include "staff-symbol.hh"
+#include "text-interface.hh"
+#include "volta-bracket.hh"
+#include "warn.hh"
+
+#include "translator.icc"
/*
Create Volta spanners, by reading repeatCommands property, usually
- set by Unfolded_repeat_iterator.
+ set by Volta_repeat_iterator.
*/
class Volta_engraver : public Engraver
{
TRANSLATOR_DECLARATIONS (Volta_engraver);
protected:
- virtual void acknowledge_grob (Grob_info);
+ DECLARE_END_ACKNOWLEDGER (staff_symbol);
+ DECLARE_ACKNOWLEDGER (staff_symbol);
+ DECLARE_ACKNOWLEDGER (note_column);
+ DECLARE_ACKNOWLEDGER (bar_line);
+
virtual void finalize ();
- virtual void stop_translation_timestep ();
- virtual void process_music ();
+ virtual void derived_mark () const;
+ void stop_translation_timestep ();
+ void process_music ();
Moment started_mom_;
Spanner *volta_span_;
bool staff_eligible ();
};
+void
+Volta_engraver::derived_mark () const
+{
+ scm_gc_mark (staff_);
+ scm_gc_mark (start_string_);
+}
+
Volta_engraver::Volta_engraver ()
{
staff_ = SCM_EOL;
+ start_string_ = SCM_EOL;
volta_span_ = 0;
end_volta_span_ = 0;
}
{
SCM doit = get_property ("voltaOnThisStaff");
if (scm_is_bool (doit))
- {
- return to_boolean (doit);
- }
+ return to_boolean (doit);
if (!unsmob_grob (staff_))
return false;
if (end && !volta_span_)
/* fixme: be more verbose. */
- warning (_ ("can't end volta spanner"));
+ warning (_ ("cannot end volta spanner"));
else if (end)
{
end_volta_span_ = volta_span_;
}
if (!volta_span_
- && (scm_is_string (start_string_) || scm_is_pair (start_string_)))
+ && Text_interface::is_markup (start_string_))
{
started_mom_ = now_mom ();
}
void
-Volta_engraver::acknowledge_grob (Grob_info i)
+Volta_engraver::acknowledge_note_column (Grob_info i)
{
- if (Item *item = dynamic_cast<Item *> (i.grob_))
- {
- if (Note_column::has_interface (item))
- {
- if (volta_span_)
- Volta_bracket_interface::add_column (volta_span_, item);
- }
- if (Bar_line::has_interface (item))
- {
- if (volta_span_)
- Volta_bracket_interface::add_bar (volta_span_, item);
- if (end_volta_span_)
- Volta_bracket_interface::add_bar (end_volta_span_, item);
- }
- }
- else if (Staff_symbol::has_interface (i.grob_))
- {
- /*
- We only want to know about a single staff: then we add to the
- support. */
- if (staff_ != SCM_EOL)
- staff_ = SCM_UNDEFINED;
+ if (volta_span_)
+ Volta_bracket_interface::add_column (volta_span_, i.grob ());
+}
- if (staff_ != SCM_UNDEFINED)
- staff_ = i.grob_->self_scm ();
- }
+void
+Volta_engraver::acknowledge_bar_line (Grob_info i)
+{
+ if (volta_span_)
+ Volta_bracket_interface::add_bar (volta_span_, i.item ());
+ if (end_volta_span_)
+ Volta_bracket_interface::add_bar (end_volta_span_, i.item ());
}
+void
+Volta_engraver::acknowledge_end_staff_symbol (Grob_info i)
+{
+ if (i.grob ()->self_scm () == staff_)
+ staff_ = SCM_EOL;
+}
+
+void
+Volta_engraver::acknowledge_staff_symbol (Grob_info i)
+{
+ /*
+ We only want to know about a single staff: then we add to the
+ support. */
+ if (staff_ != SCM_EOL)
+ staff_ = SCM_UNDEFINED;
+
+ if (staff_ != SCM_UNDEFINED)
+ staff_ = i.grob ()->self_scm ();
+}
+
+
void
Volta_engraver::finalize ()
{
/*
TODO: should attach volta to paper-column if no bar is found.
*/
-
+ADD_ACKNOWLEDGER (Volta_engraver, staff_symbol);
+ADD_END_ACKNOWLEDGER (Volta_engraver, staff_symbol);
+ADD_ACKNOWLEDGER (Volta_engraver, note_column);
+ADD_ACKNOWLEDGER (Volta_engraver, bar_line);
ADD_TRANSLATOR (Volta_engraver,
- /* descr */ "Make volta brackets.",
- /* creats*/ "VoltaBracket",
- /* accepts */ "",
- /* acks */ "bar-line-interface staff-symbol-interface note-column-interface",
- /* reads */ "repeatCommands voltaSpannerDuration stavesFound",
+ /* doc */ "Make volta brackets.",
+ /* create */ "VoltaBracket",
+ /* read */ "repeatCommands voltaSpannerDuration stavesFound",
/* write */ "");