]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-book.cc
Fix typo in warning message
[lilypond.git] / lily / paper-book.cc
index 26f7be7e19518acc329c1fc891fe8737042616e8..9907e56d95a16b94d1f90d0e4c040c96e9c86d2a 100644 (file)
@@ -1,9 +1,20 @@
 /*
-  paper-book.cc -- implement Paper_book
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 2004--2011 Jan Nieuwenhuizen <janneke@gnu.org>
 
-  (c) 2004--2009 Jan Nieuwenhuizen <janneke@gnu.org>
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "paper-book.hh"
@@ -123,7 +134,7 @@ Paper_book::output_aux (SCM output_channel,
       scm_call_3 (proc,
                  performances (),
                  output_channel,
-                 scm_long2num (*first_performance_number));
+                 scm_from_long (*first_performance_number));
       *first_performance_number += scm_ilength (performances_);
     }
 
@@ -144,7 +155,7 @@ Paper_book::output_aux (SCM output_channel,
       if (scores_ == SCM_EOL)
        return 0;
       paper_->set_variable (ly_symbol2scm ("first-page-number"),
-                           scm_long2num (*first_page_number));
+                           scm_from_long (*first_page_number));
       paper_->set_variable (ly_symbol2scm ("is-last-bookpart"),
                            ly_bool2scm (is_last));
       /* Generate all stencils to trigger font loads.  */
@@ -234,7 +245,7 @@ Paper_book::classic_output_aux (SCM output,
       scm_call_3 (proc,
                  performances (),
                  output,
-                 scm_long2num (*first_performance_number));
+                 scm_from_long (*first_performance_number));
       *first_performance_number += scm_ilength (performances_);
     }
   
@@ -505,7 +516,9 @@ Paper_book::get_system_specs ()
                                  paper_->self_scm (),
                                  page_properties,
                                  scm_car (s));
-         for (SCM list = texts ; scm_is_pair (list) ; list = scm_cdr (list))
+         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
@@ -514,17 +527,22 @@ Paper_book::get_system_specs ()
                                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));
-             ps->set_property ("is-title", SCM_BOOL_T); 
-             if (scm_is_pair (scm_cdr (list)))
+             
+             SCM footnotes = get_footnotes (unsmob_stencil (t)->expr ());
+             ps->set_property ("footnotes", footnotes);
+             ps->set_property ("is-title", SCM_BOOL_T);
+             if (list == texts)
+               first = ps;
+             else
                {
-                 /* 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));
+                 // 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 ();
@@ -537,6 +555,14 @@ Paper_book::get_system_specs ()
              // 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);
+           }
        }
       else
        assert (0);