source file of the GNU LilyPond music typesetter
- (c) 2004--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 2004--2006 Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "paper-book.hh"
Paper_book::print_smob (SCM smob, SCM port, scm_print_state*)
{
Paper_book *b = (Paper_book *) SCM_CELL_WORD_1 (smob);
-
- scm_puts ("#<", port);
- scm_puts (classname (b), port);
- scm_puts (" ", port);
- scm_puts (">", port);
+ (void)b;
+ scm_puts ("#<Paper_book>", port);
return 1;
}
scores_ = scm_cons (s, scores_);
}
-
void
Paper_book::add_performance (SCM s)
{
performances_ = scm_cons (s, performances_);
}
-
void
Paper_book::output (SCM output_channel)
{
+ if (scm_is_pair (performances_))
+ {
+ SCM proc = ly_lily_module_constant ("paper-book-write-midis");
+
+ scm_call_2 (proc, self_scm (), output_channel);
+ }
+
if (scores_ == SCM_EOL)
return;
if (SCM_VARIABLEP (force)
&& scm_is_bool (SCM_VARIABLE_REF (force)))
{
- ps->break_before_penalty_ = to_boolean (SCM_VARIABLE_REF (force))
- ? -10000
- : 10000;
+ ps->set_property ("penalty",
+ scm_from_int(to_boolean (SCM_VARIABLE_REF (force))
+ ? -10000
+ : 10000));
}
}
}
title = score_title (header_);
if (!title.is_empty ())
{
- Paper_system *ps = new Paper_system (title, true);
+ /*
+ TODO: this should come from the \layout {} block, which should
+ override settings from \paper {}
+ */
+ SCM props = paper_->lookup_variable (ly_symbol2scm ("score-title-properties"));
+ Paper_system *ps = new Paper_system (title, props);
systems_ = scm_cons (ps->self_scm (), systems_);
- scm_gc_unprotect_object (ps->self_scm ());
+ ps->unprotect ();
set_system_penalty (ps, header);
}
}
if (!title.is_empty ())
{
- Paper_system *ps = new Paper_system (title, true);
+ SCM props = paper_->lookup_variable (ly_symbol2scm ("book-title-properties"));
+ Paper_system *ps = new Paper_system (title, props);
set_system_penalty (ps, header_);
systems_ = scm_cons (ps->self_scm (), systems_);
- scm_gc_unprotect_object (ps->self_scm ());
+ ps->unprotect ();
}
SCM page_properties
header_0_ = header;
}
else if (Music_output *mop = unsmob_music_output (scm_car (s)))
-
+
{
if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop))
{
add_score_title (header);
-
+
header = SCM_EOL;
-
+
SCM system_list = scm_vector_to_list (pscore->get_paper_systems ());
system_list = scm_reverse (system_list);
systems_ = scm_append (scm_list_2 (system_list, systems_));
else if (scm_is_vector (scm_car (s)))
{
/*
- UGH. code dup.
+ UGH. code dup.
*/
add_score_title (header);
header = SCM_EOL;
-
+
SCM system_list = scm_vector_to_list (scm_car (s));
system_list = scm_reverse (system_list);
systems_ = scm_append (scm_list_2 (system_list, systems_));
}
- else if (Text_interface::markup_p (scm_car (s)))
+ else if (Text_interface::is_markup (scm_car (s)))
{
SCM t = Text_interface::interpret_markup (paper_->self_scm (),
page_properties,
scm_car (s));
- // FIXME: title=true?
- Paper_system *ps = new Paper_system (*unsmob_stencil (t), true);
+
+ // TODO: init props
+ Paper_system *ps = new Paper_system (*unsmob_stencil (t), SCM_EOL);
+ ps->set_property ("is-title", SCM_BOOL_T);
systems_ = scm_cons (ps->self_scm (), systems_);
- scm_gc_unprotect_object (ps->self_scm ());
+ ps->unprotect ();
+
// FIXME: figure out penalty.
//set_system_penalty (ps, scores_[i].header_);
}
for (SCM s = systems_; s != SCM_EOL; s = scm_cdr (s))
{
Paper_system *ps = unsmob_paper_system (scm_car (s));
- ps->number_ = ++i;
+ ps->set_property ("number", scm_from_int (++i));
if (last
- && last->is_title ()
- && !ps->break_before_penalty_)
- ps->break_before_penalty_ = 10000;
+ && to_boolean (last->get_property ("is-title"))
+ && !scm_is_number (ps->get_property ("penalty")))
+ ps->set_property ("penalty", scm_from_int (10000));
last = ps;
}