- {
- header = scm_car (s);
- if (header_0_ == SCM_EOL)
- 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
- {
- /*
- Ignore MIDI
- */
- }
- }
- else if (scm_is_vector (scm_car (s)))
- {
- /*
- 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::is_markup (scm_car (s)))
- {
- SCM t = Text_interface::interpret_markup (paper_->self_scm (),
- page_properties,
- scm_car (s));
-
- // TODO: init props
- Prob *ps = make_paper_system (SCM_EOL);
- paper_system_set_stencil (ps, *unsmob_stencil (t));
- ps->set_property ("is-title", SCM_BOOL_T);
- systems_ = scm_cons (ps->self_scm (), systems_);
- ps->unprotect ();
-
- // FIXME: figure out penalty.
- //set_system_penalty (ps, scores_[i].header_);
- }
+ {
+ header = scm_car (s);
+ if (scm_is_null (header_0_))
+ header_0_ = header;
+ }
+ else if (Page_marker *page_marker = unsmob<Page_marker> (scm_car (s)))
+ {
+ /* page markers are used to set page breaking/turning permission,
+ or to place bookmarking labels */
+ if (scm_is_symbol (page_marker->permission_symbol ()))
+ {
+ /* set previous element page break or turn permission */
+ if (scm_is_pair (system_specs))
+ set_page_permission (scm_car (system_specs),
+ page_marker->permission_symbol (),
+ page_marker->permission_value ());
+ }
+ if (scm_is_symbol (page_marker->label ()))
+ {
+ /* The next element label is to be set */
+ labels = scm_cons (page_marker->label (), labels);
+ }
+ }
+ else if (Music_output *mop = unsmob<Music_output> (scm_car (s)))
+ {
+ if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop))
+ {
+ SCM title = get_score_title (header);
+
+ if (scm_is_pair (system_specs))
+ set_system_penalty (scm_car (system_specs), header);
+
+ if (unsmob<Prob> (title))
+ {
+ system_specs = scm_cons (title, system_specs);
+ unsmob<Prob> (title)->unprotect ();
+ }
+
+ header = SCM_EOL;
+ system_specs = scm_cons (pscore->self_scm (), system_specs);
+ if (scm_is_pair (labels))
+ {
+ set_labels (scm_car (system_specs), labels);
+ labels = SCM_EOL;
+ }
+ }
+ else
+ {
+ /*
+ Ignore MIDI
+ */
+ }
+ }
+ else if (Text_interface::is_markup_list (scm_car (s)))
+ {
+ SCM texts = Lily::interpret_markup_list (paper_->self_scm (),
+ page_properties,
+ scm_car (s));
+ Prob *first = 0;
+ Prob *last = 0;
+ for (SCM list = texts; scm_is_pair (list); list = scm_cdr (list))
+ {
+ SCM t = scm_car (list);
+ // TODO: init props
+ Prob *ps = make_paper_system (SCM_EOL);
+ ps->set_property ("page-break-permission",
+ ly_symbol2scm ("allow"));
+ ps->set_property ("page-turn-permission",
+ ly_symbol2scm ("allow"));
+ ps->set_property ("last-markup-line", SCM_BOOL_F);
+ ps->set_property ("first-markup-line", SCM_BOOL_F);
+
+ paper_system_set_stencil (ps, *unsmob<Stencil> (t));
+
+ SCM footnotes = get_footnotes (unsmob<Stencil> (t)->expr ());
+ ps->set_property ("footnotes", footnotes);
+ ps->set_property ("is-title", SCM_BOOL_T);
+ if (scm_is_eq (list, texts))
+ first = ps;
+ else
+ {
+ // last line so far, in a multi-line paragraph
+ last = ps;
+ //Place closely to previous line, no stretching.
+ ps->set_property ("tight-spacing", SCM_BOOL_T);
+ }
+ system_specs = scm_cons (ps->self_scm (), system_specs);
+ ps->unprotect ();
+
+ if (scm_is_pair (labels))
+ {
+ set_labels (scm_car (system_specs), labels);
+ labels = SCM_EOL;
+ }
+ // FIXME: figure out penalty.
+ //set_system_penalty (ps, scores_[i].header_);
+ }
+ /* Set properties to avoid widowed/orphaned lines.
+ Single-line markup_lists are excluded, but in future
+ we may want to add the case of a very short, single line. */
+ if (first && last)
+ {
+ last->set_property ("last-markup-line", SCM_BOOL_T);
+ first->set_property ("first-markup-line", SCM_BOOL_T);
+ }
+ }