]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-book.cc
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / paper-book.cc
index 641379ab9575555f85e5e485fe325ac1b925dab1..020c2e7b21248722977acd93f0885a4ac5ef876e 100644 (file)
@@ -271,7 +271,7 @@ set_system_penalty (SCM sys, SCM header)
 }
 
 void
-set_label (SCM sys, SCM label)
+set_labels (SCM sys, SCM labels)
 {
   if (Paper_score *ps = dynamic_cast<Paper_score*> (unsmob_music_output (sys)))
     {
@@ -279,13 +279,19 @@ set_label (SCM sys, SCM label)
       if (cols.size ())
        {
          Paper_column *col = dynamic_cast<Paper_column*> (cols[0]);
-         col->set_property ("labels", scm_cons (label, col->get_property ("labels")));
-         Paper_column *col_right = col->find_prebroken_piece (RIGHT);
-         col_right->set_property ("labels", scm_cons (label, col_right->get_property ("labels")));
+         col->set_property ("labels", 
+                            scm_append_x (scm_list_2 (col->get_property ("labels"),
+                                                      labels)));
+         Paper_column *col_right = dynamic_cast<Paper_column*> (col->find_prebroken_piece (RIGHT));
+         col_right->set_property ("labels", 
+                                  scm_append_x (scm_list_2 (col_right->get_property ("labels"),
+                                                            labels)));
        }
     }
   else if (Prob *pb = unsmob_prob (sys))
-    pb->set_property ("labels", scm_cons (label, pb->get_property ("labels")));
+    pb->set_property ("labels", 
+                     scm_append_x (scm_list_2 (pb->get_property ("labels"),
+                                               labels)));
 }
 
 SCM
@@ -331,7 +337,9 @@ Paper_book::get_system_specs ()
     = scm_call_1 (ly_lily_module_constant ("layout-extract-page-properties"),
                  paper_->self_scm ());
 
+  SCM interpret_markup_list = ly_lily_module_constant ("interpret-markup-list");
   SCM header = SCM_EOL;
+  SCM labels = SCM_EOL;
   for (SCM s = scm_reverse (scores_); scm_is_pair (s); s = scm_cdr (s))
     {
       if (ly_is_module (scm_car (s)))
@@ -354,9 +362,8 @@ Paper_book::get_system_specs ()
            }
          if (scm_is_symbol (page_marker->label ()))
            {
-             /* set previous element label */
-             if (scm_is_pair (system_specs))
-               set_label (scm_car (system_specs), 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)))
@@ -376,6 +383,11 @@ Paper_book::get_system_specs ()
 
              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
            {
@@ -384,24 +396,42 @@ Paper_book::get_system_specs ()
              */
            }
        }
-      else if (Text_interface::is_markup (scm_car (s)))
+      else if (Text_interface::is_markup_list (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);
-         ps->set_property ("page-break-permission", ly_symbol2scm ("allow"));
-         ps->set_property ("page-turn-permission", ly_symbol2scm ("allow"));
-         
-         paper_system_set_stencil (ps, *unsmob_stencil (t));
-         ps->set_property ("is-title", SCM_BOOL_T); 
-         system_specs = scm_cons (ps->self_scm (), system_specs);
-         ps->unprotect ();
-         
-         // FIXME: figure out penalty.
-         //set_system_penalty (ps, scores_[i].header_);
+         SCM texts = scm_call_3 (interpret_markup_list,
+                                 paper_->self_scm (),
+                                 page_properties,
+                                 scm_car (s));
+         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"));
+             
+             paper_system_set_stencil (ps, *unsmob_stencil (t));
+             ps->set_property ("is-title", SCM_BOOL_T); 
+             if (scm_is_pair (scm_cdr (list)))
+               {
+                 /* If an other markup is following, set this markup 
+                  * next padding and next space to 0, so that baseline-skip 
+                  * only should be taken into account for lines vertical
+                  * spacing. */
+                 ps->set_property ("next-padding", scm_double2num (0.0));
+                 ps->set_property ("next-space", scm_double2num (0.0));
+               }
+             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_);
+           }
        }
       else
        assert (0);