source file of the GNU LilyPond music typesetter
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "debug.hh"
#include "dimension-cache.hh"
#include "score-engraver.hh"
#include "paper-score.hh"
#include "musical-request.hh"
-#include "score-column.hh"
+#include "paper-column.hh"
#include "command-request.hh"
#include "paper-def.hh"
Score_engraver::prepare (Moment w)
{
Global_translator::prepare (w);
- set_columns (new Score_column (w), new Score_column (w));
+ set_columns (new Paper_column (w), new Paper_column (w));
command_column_l_->set_elt_property ("breakable", SCM_BOOL_T);
post_move_processing();
Score_engraver::finish()
{
if ((breaks_i_%8))
- *mlog << "[" << breaks_i_ << "]" << flush;
+ progress_indication ("[" + to_str ( breaks_i_) + "]");
check_removal();
removal_processing();
{
scoreline_l_ = pscore_p_->line_l_;
- scoreline_l_->set_bounds(LEFT, command_column_l_);
+ scoreline_l_->set_bound(LEFT, command_column_l_);
command_column_l_->set_elt_property ("breakable", SCM_BOOL_T);
Score_engraver::do_removal_processing()
{
Engraver_group_engraver::do_removal_processing();
- scoreline_l_->set_bounds(RIGHT,command_column_l_);
+ scoreline_l_->set_bound(RIGHT,command_column_l_);
command_column_l_->set_elt_property ("breakable", SCM_BOOL_T);
+
typeset_all ();
+
+
+ if (musical_column_l_->linked_b ())
+ programming_error ("Last column in score should be non-musical");
set_columns (0,0);
}
Score_engraver::announce_element (Score_element_info info)
{
announce_info_arr_.push (info);
- info.origin_trans_l_arr_.push (this);
pscore_p_->typeset_element (info.elem_l_);
}
*/
Direction d = LEFT;
do {
- if (!s->spanned_drul_[d])
+ if (!s->get_bound (d))
{
- s->set_bounds(d, command_column_l_);
+ s->set_bound(d, command_column_l_);
::warning (_f ("unbound spanner `%s'", classname(s)));
}
} while (flip(&d) != LEFT);
}
else
{
- Item *item_p = dynamic_cast <Item *> (elem_p);
-
- if (!item_p->parent_l (X_AXIS))
+ if (!elem_p->parent_l (X_AXIS))
{
- bool br = (item_p->remove_elt_property ("breakable") != SCM_UNDEFINED);
+ bool br = to_boolean (elem_p->remove_elt_property ("breakable"));
if (br)
- command_column_l_->add_element(item_p);
+ command_column_l_->add_element(elem_p);
else
- musical_column_l_->add_element(item_p);
+ musical_column_l_->add_element(elem_p);
}
}
if (!elem_p->parent_l(Y_AXIS))
void
Score_engraver::do_pre_move_processing()
{
- if (command_column_l_->get_elt_property ("breakable") != SCM_UNDEFINED)
+ if (to_boolean (command_column_l_->get_elt_property ("breakable")))
{
breaks_i_ ++;
if (! (breaks_i_%8))
- *mlog << "[" << breaks_i_ << "]" << flush;
+ progress_indication ("[" + to_str ( breaks_i_) + "]");
}
// this generates all items.
Engraver_group_engraver::do_pre_move_processing();
}
void
-Score_engraver::set_columns (Score_column *new_command_l,
- Score_column *new_musical_l)
+Score_engraver::set_columns (Paper_column *new_command_l,
+ Paper_column *new_musical_l)
{
- if (command_column_l_ && command_column_l_->linked_b())
+ 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++)
{
- pscore_p_->add_column (command_column_l_);
- scoreline_l_->add_column (command_column_l_);
- }
- else
- command_column_l_ =0;
+ if (*current[i])
+ {
+ if ((*current[i])->linked_b())
+ {
+ pscore_p_->add_column ((*current[i]));
+ scoreline_l_->add_column ((*current[i]));
+ }
+ else
+ {
+ /*
+ We're forgetting about this column. Dump it, and make SCM
+ forget it.
- if (new_command_l)
- command_column_l_ = new_command_l;
+ FIXME: we should have another way of not putting this
+ column into the spacing problem. Maybe we shouldn't
+ even prevent this.
- if (musical_column_l_ && musical_column_l_->linked_b())
- {
- pscore_p_->add_column (musical_column_l_);
- scoreline_l_->add_column (musical_column_l_);
- }
- else
- musical_column_l_ = 0;
-
- if (new_musical_l)
- {
- musical_column_l_ = new_musical_l;
+ */
+ scm_unprotect_object ((*current[i])->self_scm_);
+ *current[i] =0;
+ }
+ }
+ if (news[i])
+ *current[i] = news[i];
}
}
-
Staff_info
Score_engraver::get_staff_info() const
{
return inf;
}
-
Music_output*
Score_engraver::get_output_p ()
{
SCM pen = command_column_l_->get_elt_property ("penalty");
- Real total_penalty = (pen == SCM_UNDEFINED)
- ? 0.0
- : gh_scm2double(pen); // ugh. Should typecheck.
+ Real total_penalty = gh_number_p (pen)
+ ? gh_scm2double(pen)
+ : 0.0;
total_penalty += b->penalty_f_;
if (b->penalty_f_ > 10000.0) // ugh. arbitrary.