#include "translator-def.hh"
+/*
+ TODO: the column creation logic is rather hairy. Revise it.
+ */
Score_engraver::Score_engraver ()
{
scoreline_l_ =0;
}
void
-Score_engraver::make_columns (Moment w)
+Score_engraver::make_columns ()
{
/*
ugh.
*/
- if (!command_column_l_
- || *unsmob_moment (command_column_l_->get_grob_property ("when")) != w)
+ if (!command_column_l_)
+ // || *unsmob_moment (command_column_l_->get_grob_property ("when")) != w)
{
- set_columns (new Paper_column (get_property (ly_symbol2scm ("NonMusicalPaperColumn"))),
- new Paper_column (get_property (ly_symbol2scm ("PaperColumn"))));
+ set_columns (new Paper_column (get_property ("NonMusicalPaperColumn")),
+ new Paper_column (get_property ("PaperColumn")));
- command_column_l_->set_grob_property ("when", w.smobbed_copy ());
- musical_column_l_->set_grob_property ("when", w.smobbed_copy ());
command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
Grob_info i1 (command_column_l_, 0), i2 (musical_column_l_,0);
Score_engraver::prepare (Moment w)
{
Global_translator::prepare (w);
- make_columns (w);
- post_move_processing ();
+ make_columns ();
+ start_translation_timestep ();
}
void
check_removal ();
removal_processing ();
+
}
/*
pscore_p_ = new Paper_score;
pscore_p_->paper_l_ = dynamic_cast<Paper_def*> (output_def_l_);
- SCM props = get_property (ly_symbol2scm ("LineOfScore"));
+ SCM props = get_property ("LineOfScore");
pscore_p_->typeset_line (new Line_of_score (props));
- make_columns (Moment (0));
+ make_columns ();
scoreline_l_ = pscore_p_->line_l_;
-
scoreline_l_->set_bound (LEFT, command_column_l_);
-
command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
Engraver_group_engraver::initialize ();
Score_engraver::finalize ()
{
Engraver_group_engraver::finalize ();
- scoreline_l_->set_bound (RIGHT,command_column_l_);
- command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
+
+ Grob * cc
+ = unsmob_grob (get_property ("currentCommandColumn"));
+ scoreline_l_->set_bound (RIGHT, cc);
+ cc->set_grob_property ("breakable", SCM_BOOL_T);
typeset_all ();
-
- set_columns (0,0);
}
void
Score_engraver::one_time_step ()
{
- process_music ();
- announces ();
- pre_move_processing ();
+ if (!to_boolean (get_property ("skipTypesetting")))
+ {
+ process_music ();
+ announces ();
+ }
+
+
+ stop_translation_timestep ();
check_removal ();
}
Score_engraver::announce_grob (Grob_info info)
{
announce_info_arr_.push (info);
- pscore_p_->line_l_->typeset_grob (info.elem_l_);
+ pscore_p_->line_l_->typeset_grob (info.grob_l_);
}
/* All elements are propagated to the top upon announcement. If
void
Score_engraver::do_announces ()
{
- ////// do
- Engraver_group_engraver::do_announces ();
- //////while (announce_info_arr_.size ());
+ Engraver_group_engraver::do_announces ();
}
if (! (breaks_i_%8))
progress_indication ("[" + to_str (breaks_i_) + "]");
}
+
+ command_column_l_->set_grob_property ("when", now_mom_.smobbed_copy ());
+ musical_column_l_->set_grob_property ("when", now_mom_.smobbed_copy ());
+
+ scoreline_l_->add_column (command_column_l_);
+ scoreline_l_->add_column (musical_column_l_);
+
+ command_column_l_ = 0;
+ musical_column_l_ = 0;
}
void
Score_engraver::set_columns (Paper_column *new_command_l,
Paper_column *new_musical_l)
{
- Paper_column * news[] = {new_command_l, new_musical_l};
- Paper_column **current[] = {&command_column_l_, &musical_column_l_};
-
- for (int i=00; i< 2; i++)
- {
- if (*current[i])
- {
- scoreline_l_->add_column ((*current[i]));
- }
- if (news[i])
- *current[i] = news[i];
- }
-
+ assert (!command_column_l_ && !musical_column_l_);
+ command_column_l_ = new_command_l;
+ musical_column_l_ = new_musical_l;
+
if (new_musical_l)
set_property ("currentMusicalColumn", new_musical_l->self_scm ());
if (new_command_l)
command_column_l_->remove_grob_property ("breakable");
}
-ADD_THIS_TRANSLATOR (Score_engraver);
+
+ENTER_DESCRIPTION(Score_engraver,
+/* descr */ "Top level engraver. Takes care of generating columns and the complete system (ie. LineOfScore)
+
+
+This engraver decides whether a column is breakable. The default is
+that a column is always breakable. However, when every Bar_engraver
+that does not have a barline at a certain point will call
+Score_engraver::forbid_breaks to stop linebreaks. In practice, this
+means that you can make a breakpoint by creating a barline (assuming
+that there are no beams or notes that prevent a breakpoint.)
+
+
+",
+/* creats*/ "LineOfScore PaperColumn NonMusicalPaperColumn",
+/* acks */ "grob-interface",
+/* reads */ "currentMusicalColumn currentCommandColumn",
+/* write */ "");