]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 13 Jun 2004 12:44:54 +0000 (12:44 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 13 Jun 2004 12:44:54 +0000 (12:44 +0000)
21 files changed:
ChangeLog
VERSION
input/test/page-breaks.ly
lily/include/lily-proto.hh
lily/include/paper-book.hh
lily/include/paper-line.hh [deleted file]
lily/include/paper-system.hh [new file with mode: 0644]
lily/paper-book.cc
lily/paper-line.cc [deleted file]
lily/paper-outputter.cc
lily/paper-system.cc [new file with mode: 0644]
lily/parser.yy
lily/system.cc
ly/book-paper-defaults.ly
scm/define-markup-commands.scm
scm/framework-gnome.scm
scm/framework-ps.scm
scm/framework-tex.scm
scm/lily.scm
scm/page-layout.scm
scm/safe-lily.scm

index 21410ff98497766fce6687f67903cb930b69e727..ed7d3b2a5d5fc45f104c5bdefca9e5638448cebf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,20 @@
 
 2004-06-13  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/include/paper-system.hh: move cc/hh file from paper-line.*
+
+       * lily/include/paper-line.hh: rename to Paper_system.
+
+       * lily/include/paper-book.hh: doc class.
+
+       * lily/paper-book.cc (c_ragged_page_breaks): remove functions. 
+
+       * scm/page-layout.scm (plain-footer): add tagline/copyright. 
+       (plain-header): add instrument-name.
+       (default-page-make-stencil): bugfixes.
+
+       * lily/parser.yy (book_body): allow \header anywhere in \book{}
+
        * lily/paper-book.cc: remove copyright & tagline. Remove
        interactions with Page
 
diff --git a/VERSION b/VERSION
index b139ad6d99ebb5cd47b510a37c5d8c9afe1ccf3a..2d2e4da5de32f7ca5bb354cff971131a24d230a4 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=3
-PATCH_LEVEL=3
-MY_PATCH_LEVEL=hwn1
+PATCH_LEVEL=4
+MY_PATCH_LEVEL=
 
index ab8d98359b1bcd3de2b6ef586d9717d85d70ec1b..86668c7118df4f434db7a37a132e765fc6c9d434 100644 (file)
     piece = "Piece"
 }
 
+#(set-default-paper-size "a6")
+
 pattern =  { a b c d \break }
+\book {    
+    \score {
+       \context Staff \notes \relative c' {
+           %% 16: ideally cramped
+           %% 17: very bad without density
+                               %       \repeat unfold 17 { a b c d \break }
 
-\score {
-    \context Staff \notes \relative c' {
-       %% 16: ideally cramped
-       %% 17: very bad without density
-%      \repeat unfold 17 { a b c d \break }
+           \pattern
+           \pattern
+                               % \noPageBreak
+           \pattern
+           
+                               % the following changes the location of the break.
+                               % 
+                               % \pageBreak
+           
+           \pattern
+           \pattern
+           \pattern
+           \pattern
+           \repeat unfold 10 \pattern
+       }
 
-       \pattern
-       \pattern
-       % \noPageBreak
-       \pattern
-       
-       % the following changes the location of the break.
-       % 
-       % \pageBreak
-       
-       \pattern
-       \pattern
-       \pattern
-       \pattern
-       \repeat unfold 10 \pattern
-    }
-    \paper {
-       #(set-default-paper-size "a6")
-       #(define page-breaking ly:optimal-page-breaks)
     }
+    
 }
index 9988d989c160e6de591d43eb87a0694a6d16919d..f43f3a54bdbdb1288dcea5df83cc37c4cefeb2d3 100644 (file)
@@ -111,7 +111,7 @@ class Output_property;
 class Paper_book;
 class Paper_column;
 class Output_def;
-class Paper_line;
+class Paper_system;
 class Paper_outputter;
 class Paper_score;
 class Paper_stream;
index 3eca0424c2ffc02f5eb1d9fbe2db9fc3065500ca..3654b87107b2e82f44cdad0db8c7af4b1ec1710a 100644 (file)
@@ -24,7 +24,9 @@ struct Score_lines
 
 /*
   
-  DOCME.
+This class is rather empty. It collects systems (Paper_system), and
+exports them to the output backend, either as systems or as completely
+formatted pages.
   
 */
 class Paper_book
@@ -33,8 +35,6 @@ class Paper_book
 
   SCM lines_;
   SCM pages_;
-  SCM copyright_;
-  SCM tagline_;
 public:
   SCM header_;
   Array<Score_lines> score_lines_;
diff --git a/lily/include/paper-line.hh b/lily/include/paper-line.hh
deleted file mode 100644 (file)
index f1e9a46..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-  paper-line.hh -- declare Paper_line
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2004  Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-#ifndef PAPER_LINE_HH
-#define PAPER_LINE_HH
-
-#include "lily-proto.hh"
-#include "smobs.hh"
-#include "offset.hh"
-#include "stencil.hh"
-
-class Paper_line
-{
-  DECLARE_SMOBS (Paper_line, );
-  Stencil stencil_;
-  bool is_title_;
-  
-public:
-  Real penalty_;
-  int number_;
-
-  Paper_line (Stencil, bool);
-
-  Offset dim () const;
-  Stencil to_stencil () const;
-  SCM stencils () const;
-  bool is_title () const;
-  Real penalty () const;
-};
-
-DECLARE_UNSMOB (Paper_line, paper_line);
-
-#endif /* PAPER_LINE_HH */
diff --git a/lily/include/paper-system.hh b/lily/include/paper-system.hh
new file mode 100644 (file)
index 0000000..755e66f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+  paper-system.hh -- declare Paper_system
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004  Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+#ifndef PAPER_LINE_HH
+#define PAPER_LINE_HH
+
+#include "lily-proto.hh"
+#include "smobs.hh"
+#include "offset.hh"
+#include "stencil.hh"
+
+/*
+  A formatted "system" (A block of titling also is a Paper_system)
+
+  To save memory, we don't keep around the System grobs, but put the
+  formatted content of the grob is put into a Paper_system. Page-breaking handles
+  Paper_system objects.
+  
+ */
+class Paper_system
+{
+  DECLARE_SMOBS (Paper_system, );
+  Stencil stencil_;
+  bool is_title_;
+  
+public:
+  Real penalty_;
+  int number_;
+
+  Paper_system (Stencil, bool);
+
+  Offset dim () const;
+  Stencil to_stencil () const;
+  SCM stencils () const;
+  bool is_title () const;
+  Real penalty () const;
+};
+
+DECLARE_UNSMOB (Paper_system, paper_line);
+
+#endif /* PAPER_LINE_HH */
index cbd690772eb17196a899f8694fe78970d18d5c88..86df95ebcde703ac1c47d0d991dcdff6059db97b 100644 (file)
@@ -11,7 +11,7 @@
 #include "paper-book.hh"
 #include "output-def.hh"
 #include "paper-outputter.hh"
-#include "paper-line.hh"
+#include "paper-system.hh"
 #include "paper-score.hh"
 #include "stencil.hh"
 #include "warn.hh"
@@ -120,10 +120,6 @@ LY_DEFINE (ly_output_formats, "ly:output-formats",
   return lst; 
 }
 
-/*
-  TODO: there is too much code dup, and the interface is not
-  clear. FIXME.
- */
 void
 Paper_book::output (String outname)
 {
@@ -254,7 +250,7 @@ LY_DEFINE(ly_paper_book_book_paper, "ly:paper-book-book-paper",
 
 /*
 
-TODO: resurrect more complex user-tweaks for titling .
+TODO: resurrect more complex user-tweaks for titling
 
 */
 Stencil
@@ -329,7 +325,7 @@ Paper_book::lines ()
 
   if (!title.is_empty ())
     {
-      Paper_line *pl = new Paper_line (title, true);
+      Paper_system *pl = new Paper_system (title, true);
       
       lines_ = scm_cons (pl->self_scm (), lines_);
       scm_gc_unprotect_object (pl->self_scm ());
@@ -341,7 +337,7 @@ Paper_book::lines ()
       Stencil title = score_title (i);      
       if (!title.is_empty ())
        {
-         Paper_line *pl = new Paper_line (title, true);
+         Paper_system *pl = new Paper_system (title, true);
          lines_ = scm_cons (pl->self_scm (), lines_);
          scm_gc_unprotect_object (pl->self_scm ());
        }
@@ -358,10 +354,10 @@ Paper_book::lines ()
   lines_ = scm_reverse (lines_);
   
   int i = 0;
-  Paper_line * last = 0;
+  Paper_system * last = 0;
   for (SCM s = lines_; s != SCM_EOL; s = ly_cdr (s))
     {
-      Paper_line * p = unsmob_paper_line (ly_car (s));
+      Paper_system * p = unsmob_paper_line (ly_car (s));
       p->number_ = ++i;
 
       if (last && last->is_title ())
@@ -397,66 +393,6 @@ Paper_book::pages ()
 
 
 
-#if 0
-
-static SCM
-c_ragged_page_breaks (SCM lines,
-                     Paper_book *book,
-                     Real text_height,
-                     Real first, Real last)
-{
-  int page_number = 0;
-
-  Real book_height =0.;
-  for (SCM s = lines ; ly_c_pair_p (s);  s = ly_cdr (s))
-    {
-      book_height += unsmob_paper_line (ly_car (s))->dim ()[Y_AXIS];
-    }
-
-  int page_count = int (book_height / text_height + 0.5); // ceil?
-  SCM breaks = SCM_EOL;
-  Real page_height = text_height + first;
-  Real h = 0;
-  int number = 0;
-  for (SCM s = lines; ly_c_pair_p (s); s = ly_cdr (s))
-    {
-      Paper_line *pl = unsmob_paper_line (ly_car (s));
-      if (!pl->is_title () && h < page_height)
-       number++;
-      h += pl->dim ()[Y_AXIS];
-      if (!pl->is_title () && h > page_height)
-       {
-         breaks = ly_snoc (scm_int2num (number), breaks);
-         page_number++;
-         page_height = text_height + (page_number == page_count) * last;
-         h = 0;
-       }
-      if (ly_cdr (s) == SCM_EOL)
-       breaks = ly_snoc (scm_int2num (pl->number_), breaks);
-    }
-
-  return scm_vector (breaks);
-}
-
-LY_DEFINE (ly_ragged_page_breaks, "ly:ragged-page-breaks",
-          5, 0, 0, (SCM lines, SCM book, SCM text, SCM first, SCM last),
-          "Return a vector with line numbers of page breaks.")
-{
-  Paper_book* b = unsmob_paper_book (book);
-
-  SCM_ASSERT_TYPE (scm_pair_p (lines), lines, SCM_ARG1, __FUNCTION__, "list");
-  SCM_ASSERT_TYPE (b, book, SCM_ARG2, __FUNCTION__, "Paper_book");
-  SCM_ASSERT_TYPE (ly_c_number_p (text), text, SCM_ARG3, __FUNCTION__, "number");
-  SCM_ASSERT_TYPE (ly_c_number_p (first), first, SCM_ARG4, __FUNCTION__, "number");
-  SCM_ASSERT_TYPE (ly_c_number_p (last), last, SCM_ARG5, __FUNCTION__, "number");
-
-  return c_ragged_page_breaks (lines, b,
-                              ly_scm2double (text),
-                              ly_scm2double (first), ly_scm2double (last));
-}
-#endif
-
-
 /****************************************************************/
 
 Score_lines::Score_lines ()
diff --git a/lily/paper-line.cc b/lily/paper-line.cc
deleted file mode 100644 (file)
index 75062cc..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-  paper-line.cc -- implement Paper_line
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-#include "paper-line.hh"
-#include "stencil.hh"
-#include "string.hh"
-#include "virtual-methods.hh"
-
-#include "ly-smobs.icc"
-
-IMPLEMENT_SMOBS (Paper_line);
-IMPLEMENT_TYPE_P (Paper_line, "ly:paper-line?");
-IMPLEMENT_DEFAULT_EQUAL_P (Paper_line);
-
-
-
-Paper_line::Paper_line (Stencil s, bool is_title)
-{
-  is_title_ = is_title;
-  number_ = 0;
-  penalty_ = 0;
-  smobify_self ();
-  stencil_ = s;
-}
-
-Paper_line::~Paper_line ()
-{
-}
-
-SCM
-Paper_line::mark_smob (SCM smob)
-{
-  Paper_line *line = (Paper_line*) ly_cdr (smob);
-  return line-> stencil_.expr ();
-}
-
-int
-Paper_line::print_smob (SCM smob, SCM port, scm_print_state*)
-{
-  Paper_line *p = (Paper_line*) ly_cdr (smob);
-  scm_puts ("#<", port);
-  scm_puts (classname (p), port);
-  scm_puts (" ", port);
-  scm_puts (to_string (p->number_).to_str0 (), port);
-  scm_puts ("p ", port);
-  scm_puts (to_string (p->penalty_).to_str0 (), port);
-  if (p->is_title ())
-    scm_puts (" t", port);
-  scm_puts (" >", port);
-  return 1;
-}
-
-bool
-Paper_line::is_title () const
-{
-  return is_title_;
-}
-
-Real
-Paper_line::penalty () const
-{
-  return penalty_;
-}
-
-Offset
-Paper_line::dim () const
-{
-  return Offset (stencil_.extent (X_AXIS).length (),
-                stencil_.extent (Y_AXIS).length ());
-}
-
-Stencil
-Paper_line::to_stencil () const
-{
-  return stencil_;
-}
-
-LY_DEFINE (ly_paper_line_height, "ly:paper-line-extent",
-          2, 0, 0, (SCM line, SCM axis),
-          "Return the extent of @var{line}.")
-{
-  Paper_line *pl = unsmob_paper_line (line);
-  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-line");
-  SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
-  Axis ax = (Axis)ly_scm2int (axis);
-  return scm_make_real (pl->dim ()[ax]);
-}
-
-
-
-LY_DEFINE (ly_paper_line_title_p, "ly:paper-line-title?",
-          1, 0, 0, (SCM line),
-          "Is  @var{line} a title line?")
-{
-  Paper_line *pl = unsmob_paper_line (line);
-  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-line");
-  return SCM_BOOL (pl->is_title ());
-}
-
-LY_DEFINE (ly_paper_line_number, "ly:paper-line-number",
-          1, 0, 0, (SCM line),
-          "Return the number of @var{line}.")
-{
-  Paper_line *pl = unsmob_paper_line (line);
-  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-line");
-  return scm_int2num (pl->number_);
-}
-
-LY_DEFINE (ly_paper_line_break_score, "ly:paper-line-break-penalty",
-          1, 0, 0, (SCM line),
-          "Return the score for page break after @var{line}.")
-{
-  Paper_line *pl = unsmob_paper_line (line);
-  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-line");
-  return scm_int2num (int (pl->penalty ()));
-}
-
-LY_DEFINE (ly_paper_line_stencil, "ly:paper-line-stencil",
-          1, 0, 0, (SCM line),
-          "Return the height of @var{line}.")
-{
-  Paper_line *pl = unsmob_paper_line (line);
-  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-line");
-  return pl->to_stencil ().smobbed_copy ();
-}
-
index 1f91ffd51c3d6a08847d0a0b3f1bad5f0b31fcf9..6824f893ca29ed1c4dae4ab149107aa843907cd2 100644 (file)
 
 #include "array.hh"
 #include "dimensions.hh"
+#include "file-name.hh"
 #include "font-metric.hh"
 #include "input-smob.hh"
 #include "lily-guile.hh"
 #include "lily-version.hh"
 #include "ly-module.hh"
 #include "main.hh"
-#include "paper-book.hh"
 #include "output-def.hh"
-#include "paper-line.hh"
+#include "paper-book.hh"
 #include "paper-outputter.hh"
-#include "file-name.hh"
+#include "paper-system.hh"
 #include "scm-hash.hh"
 #include "stencil.hh"
 #include "string-convert.hh"
 #include "warn.hh"
 
-// JUNKME
-extern SCM stencil2line (Stencil *stil, bool is_title = false);
+#include "ly-smobs.icc"
+
 
 Paper_outputter::Paper_outputter (String filename, String format)
 {
@@ -49,7 +49,6 @@ Paper_outputter::~Paper_outputter ()
 {
 }
 
-#include "ly-smobs.icc"
 
 IMPLEMENT_SMOBS (Paper_outputter);
 IMPLEMENT_DEFAULT_EQUAL_P (Paper_outputter);
diff --git a/lily/paper-system.cc b/lily/paper-system.cc
new file mode 100644 (file)
index 0000000..340667b
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+  paper-system.cc -- implement Paper_system
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "paper-system.hh"
+#include "stencil.hh"
+#include "string.hh"
+#include "virtual-methods.hh"
+
+#include "ly-smobs.icc"
+
+IMPLEMENT_SMOBS (Paper_system);
+IMPLEMENT_TYPE_P (Paper_system, "ly:paper-system?");
+IMPLEMENT_DEFAULT_EQUAL_P (Paper_system);
+
+
+
+Paper_system::Paper_system (Stencil s, bool is_title)
+{
+  is_title_ = is_title;
+  number_ = 0;
+  penalty_ = 0;
+  smobify_self ();
+  stencil_ = s;
+}
+
+Paper_system::~Paper_system ()
+{
+}
+
+SCM
+Paper_system::mark_smob (SCM smob)
+{
+  Paper_system *line = (Paper_system*) ly_cdr (smob);
+  return line-> stencil_.expr ();
+}
+
+int
+Paper_system::print_smob (SCM smob, SCM port, scm_print_state*)
+{
+  Paper_system *p = (Paper_system*) ly_cdr (smob);
+  scm_puts ("#<", port);
+  scm_puts (classname (p), port);
+  scm_puts (" ", port);
+  scm_puts (to_string (p->number_).to_str0 (), port);
+  scm_puts ("p ", port);
+  scm_puts (to_string (p->penalty_).to_str0 (), port);
+  if (p->is_title ())
+    scm_puts (" t", port);
+  scm_puts (" >", port);
+  return 1;
+}
+
+bool
+Paper_system::is_title () const
+{
+  return is_title_;
+}
+
+Real
+Paper_system::penalty () const
+{
+  return penalty_;
+}
+
+Offset
+Paper_system::dim () const
+{
+  return Offset (stencil_.extent (X_AXIS).length (),
+                stencil_.extent (Y_AXIS).length ());
+}
+
+Stencil
+Paper_system::to_stencil () const
+{
+  return stencil_;
+}
+
+LY_DEFINE (ly_paper_line_height, "ly:paper-system-extent",
+          2, 0, 0, (SCM line, SCM axis),
+          "Return the extent of @var{line}.")
+{
+  Paper_system *pl = unsmob_paper_line (line);
+  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-system");
+  SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+  Axis ax = (Axis)ly_scm2int (axis);
+  return scm_make_real (pl->dim ()[ax]);
+}
+
+
+
+LY_DEFINE (ly_paper_line_title_p, "ly:paper-system-title?",
+          1, 0, 0, (SCM line),
+          "Is  @var{line} a title line?")
+{
+  Paper_system *pl = unsmob_paper_line (line);
+  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-system");
+  return SCM_BOOL (pl->is_title ());
+}
+
+LY_DEFINE (ly_paper_line_number, "ly:paper-system-number",
+          1, 0, 0, (SCM line),
+          "Return the number of @var{line}.")
+{
+  Paper_system *pl = unsmob_paper_line (line);
+  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-system");
+  return scm_int2num (pl->number_);
+}
+
+LY_DEFINE (ly_paper_line_break_score, "ly:paper-system-break-penalty",
+          1, 0, 0, (SCM line),
+          "Return the score for page break after @var{line}.")
+{
+  Paper_system *pl = unsmob_paper_line (line);
+  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-system");
+  return scm_int2num (int (pl->penalty ()));
+}
+
+LY_DEFINE (ly_paper_line_stencil, "ly:paper-system-stencil",
+          1, 0, 0, (SCM line),
+          "Return the height of @var{line}.")
+{
+  Paper_system *pl = unsmob_paper_line (line);
+  SCM_ASSERT_TYPE (pl, line, SCM_ARG1, __FUNCTION__, "paper-system");
+  return pl->to_stencil ().smobbed_copy ();
+}
+
index e2b7bda88b334556b415c67e7c6afac5bce72332..f5ebfa291c1652043a84076e73ef080fb482fb0d 100644 (file)
@@ -648,8 +648,8 @@ book_body:
                $$->scores_.push (score);
                scm_gc_unprotect_object (music->self_scm ());
        }
-       | lilypond_header {
-               $$->header_ = $1;
+       | book_body lilypond_header {
+               $$->header_ = $2;
        }
        | book_body error {
 
index 401cca393abe60baa9ee4867e257d8006d395287..f8af69c80d279e2212b7151a17ea065f8c9796eb 100644 (file)
@@ -23,7 +23,7 @@
 #include "spacing-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "paper-book.hh"
-#include "paper-line.hh"
+#include "paper-system.hh"
 
 System::System (SCM s)
   : Spanner (s)
@@ -375,9 +375,7 @@ System::get_line ()
                       scm_cons (ly_symbol2scm ("combine-stencil"),
                                 exprs));
   
-  Paper_line *pl = new Paper_line (sys_stencil, false);
-
-
+  Paper_system *pl = new Paper_system (sys_stencil, false);
 
   Item * break_point =this->get_bound(LEFT);
   pl->penalty_ =
index 0158ddeaf1db5c878df07871ae2221f6a9a1bca2..381d665530491c7c9efd28d8ea4bfddb370db629 100644 (file)
        (baseline-skip . 2)
        (word-space . 0.6)))
 
-    % #(define page-breaking ly:ragged-page-breaks)
     #(define page-breaking ly:optimal-page-breaks)
     #(define page-music-height default-page-music-height )
     #(define page-make-stencil default-page-make-stencil )
-    
-    #(define page-to-stencil ly:page-header-lines-footer-stencil)
 
     #(define make-header plain-header)
     #(define make-footer plain-footer)
-    %%#(define make-footer empty-markup)
-    #(define make-tagline TAGLINE-or-tagline-from-header)
-    #(define make-copyright copyright-from-header)
    
 }
index 15b0a71a54f72e212a2693c89fa9bb90745293dd..8de6a818a19b309a924abad892cf569eecedfc4e 100644 (file)
@@ -20,7 +20,7 @@
   (let*
       ((systems (ly:score-embedded-format score paper))
        (1st (vector-ref systems 0))
-       (stencil (ly:paper-line-stencil 1st)) )
+       (stencil (ly:paper-system-stencil 1st)) )
 
     (ly:stencil-align-to! stencil Y CENTER)
     (display (ly:stencil-extent stencil X))
index a35f22aa2dcb44cbf6bfb4ec104385df100119e9..3ad11f4d40e18dad5384916bd682edfdf38f7d9d 100644 (file)
  (guile)
  (lily))
 
+;; dump?
+(define (dump-page outputter page page-number page-count)
+  (ly:outputter-dump-stencil outputter page))
+
 (define-public (output-framework-gnome outputter book scopes fields basename)
   (let* ((bookpaper (ly:paper-book-book-paper book))
         (pages (list->vector (map ly:page-stencil
index 9da75c91cb297a1ba9f887e1df39789e571ed5f3..6787a0d04c8534c7843845496513b8ed265137cc 100644 (file)
         (y 0.0)
         (scale (* 2.83464 (ly:output-def-lookup bookpaper 'outputscale)))
         (total-y
-         (apply + (map (lambda (z) (ly:paper-line-extent z Y)) lines)))
+         (apply + (map (lambda (z) (ly:paper-system-extent z Y)) lines)))
         (x-ext '(-8 . 0))
         (lineno 0))
 
     (define (dump-line outputter system)
-      (let ((stil (ly:paper-line-stencil system)))
+      (let ((stil (ly:paper-system-stencil system)))
        
        (ly:outputter-dump-string
         outputter
          " 0.0 "
          (ly:number->string y)
          " start-system {\n set-ps-scale-to-lily-scale\n"))
-       (set! y (+ y (ly:paper-line-extent system Y)))
+       (set! y (+ y (ly:paper-system-extent system Y)))
        (ly:outputter-dump-stencil outputter stil)
        (ly:outputter-dump-string
         outputter
     (for-each
      (lambda (ell)
        (set! x-ext (interval-union x-ext
-                                  (cons 0.0 (ly:paper-line-extent ell X)))))
+                                  (cons 0.0 (ly:paper-system-extent ell X)))))
      lines)
 
   (for-each
index 57eaa677cdab62936a30423af18e67b19e4b9a32..5b157a72020f6163fa0ca6075084a4c2a62a9c3a 100644 (file)
   (ly:outputter-dump-string
    putter
    (string-append "\\leavevmode\n\\lybox{0}{0}{0}{"
-                 (ly:number->string (ly:paper-line-extent line Y))
+                 (ly:number->string (ly:paper-system-extent line Y))
                  "}{"))
 
-  (ly:outputter-dump-stencil putter (ly:paper-line-stencil line))
+  (ly:outputter-dump-stencil putter (ly:paper-system-stencil line))
   (ly:outputter-dump-string
    putter
    (if last?
index e12af1a81e6e1af05341920f3b49bf1b114a9865..945f26fb415298c18e52052ee3a36f186eac34c1 100644 (file)
@@ -456,6 +456,7 @@ L1 is copied, L2 not.
        "define-grobs.scm"
        "define-grob-interfaces.scm"
        "page-layout.scm"
+       "titling.scm"
        
        "paper.scm"
 
index 7eb72989672c998c535c0fb7a2b93489eb73f253..6f56886465ea96e04f8f8b519ec00e468b2f4dae 100644 (file)
 ;; TODO: take <optimally-broken-page-node> iso. page-number
 ;; for all of these functions ?
 
-(define-public (TAGLINE-or-tagline-from-header paper scopes)
-  (let* ((props (page-properties paper))
-        (tagline-var (ly:modules-lookup scopes 'tagline))
-        (tagline (if (markup? tagline-var) tagline-var TAGLINE)))
+(define-public (plain-header paper scopes page-number last?)
+  "Standard header for a part: page number --outside--  and instrument--centered."
 
-    (cond ((string? tagline)
-          (if (not (equal? tagline ""))
-              (interpret-markup paper props
-                                (markup #:fill-line (tagline "")))))
-         ((markup? tagline) (interpret-markup paper props tagline)))))
+  (let* ((props (page-properties paper) )
+        (pnum (markup #:bold (number->string page-number)))
+        (instr (ly:modules-lookup scopes 'instrument))
+        (line (list "" (if (markup? instr) instr "") pnum)))
 
-(define-public (copyright-from-header paper scopes)
-  (let ((props (page-properties paper))
-       (copyright (ly:modules-lookup scopes 'copyright)))
-
-    (cond ((string? copyright)
-          (if (not (equal? copyright ""))
-              (interpret-markup paper props
-                                (markup #:fill-line (copyright "")))))
-         ((markup? copyright) (interpret-markup paper props copyright)))))
+    (if (even? page-number)
+       (set! line (reverse line)))
 
+    (if (< 1 page-number)
+       (interpret-markup
+        paper props (make-fill-line-markup line))
+       '())
+    ))
 
 
-;; TODO: add instrument name.
-(define-public (plain-header paper scopes page-number)
-  (let ((props (page-properties paper) ))
-    (interpret-markup paper props
-                     (markup #:fill-line
-                             ("" #:bold (number->string page-number))))))
+;; TODO: add publisher ID on non-first page.
+(define-public (plain-footer paper scopes page-number last?)
+  "Standard footer. Empty, save for first (copyright) and last (tagline) page."
+  
+  (let*
+      ((props (page-properties paper))
+       (copyright (ly:modules-lookup scopes 'copyright))
+       (tagline-var (ly:modules-lookup scopes 'tagline))
+       (tagline (if (markup? tagline-var) tagline-var TAGLINE))
+       (stencil #f))
+
+    (if last?
+       (set! stencil
+             (ly:stencil-combine-at-edge
+              stencil Y DOWN (interpret-markup paper props tagline)
+              0.0
+              )))
 
-; TODO: insert tagline and/or copyright
-(define-public (plain-footer paper scopes page-number)
-  (let ((props (page-properties paper)))
+    (if (and (= 1 page-number)
+            (markup? copyright))
 
+       (set! stencil
+             (ly:stencil-combine-at-edge
+              stencil Y DOWN (interpret-markup paper props copyright)
+              0.0
+              )))
 
-    ;; page number already in header.
-    '()
-    
-    ))
+    stencil))
   
-
-(define (page-headfoot paper scopes number sym sepsym dir)
+(define (page-headfoot paper scopes number sym sepsym dir last?)
+  "Create a stencil including separating space."
   (let*
       ((header-proc (ly:output-def-lookup paper sym))
        (sep (ly:output-def-lookup paper sepsym))
        (stencil (ly:make-stencil "" '(0 . 0) '(0 . 0)))
        (head-stencil
        (if (procedure? header-proc)
-           (header-proc paper scopes number)
+           (header-proc paper scopes number last?)
            #f)))
 
     (if (and (number? sep) (ly:stencil? head-stencil))
     head-stencil))
 
 (define-public (default-page-music-height paper scopes number last?)
+  "Printable area for music and titles; matches default-page-make-stencil." 
   (let*
       ((h (- (ly:output-def-lookup paper 'vsize)
             (ly:output-def-lookup paper 'top-margin)
             (ly:output-def-lookup paper 'bottom-margin)))
-       (head (page-headfoot paper scopes number 'make-header 'head-sep UP))
-       (foot (page-headfoot paper scopes number 'make-footer 'foot-sep DOWN))
-       )
+       (head (page-headfoot paper scopes number 'make-header 'head-sep UP last?))
+       (foot (page-headfoot paper scopes number 'make-footer 'foot-sep DOWN last?)))
     (- h (if (ly:stencil? head)
             (interval-length (ly:stencil-extent head Y))
             0)
 
 
 (define-public (default-page-make-stencil lines paper scopes number last? )
+  "Construct a stencil representing the page from LINES.  "
   (let*
-     (
-      (top-margin  (ly:output-def-lookup paper 'top-margin))
+     ((top-margin  (ly:output-def-lookup paper 'top-margin))
 
-      ;; TODO: naming   vsize/hsize not analogous to TeX.
+      ;; TODO: naming vsize/hsize not analogous to TeX.
       
       (hsize (ly:output-def-lookup paper 'hsize))
-      (left-margin (- hsize
-                     (/ (ly:output-def-lookup paper 'linewidth) 2)))
+      (left-margin (/ (- hsize
+                        (ly:output-def-lookup paper 'linewidth)) 2))
       (vsize (ly:output-def-lookup paper 'vsize))
       (bottom-edge (- vsize
                      (ly:output-def-lookup paper 'bottom-margin)))
                     
-      (head (page-headfoot paper scopes number 'make-header 'head-sep UP))
-      (foot (page-headfoot paper scopes number 'make-footer 'foot-sep DOWN))
-      (line-stencils (map ly:paper-line-stencil lines))
+      (head (page-headfoot paper scopes number 'make-header 'head-sep UP last?))
+      (foot (page-headfoot paper scopes number 'make-footer 'foot-sep DOWN last?))
+      (line-stencils (map ly:paper-system-stencil lines))
       (height-proc (ly:output-def-lookup paper 'page-music-height))
       (music-height (height-proc paper scopes number last?))
       (spc-left (-  music-height
                   (apply + (map (lambda (x)
                                   (interval-length (ly:stencil-extent x Y)))
                        line-stencils))))
-      (stretchable-lines (remove ly:paper-line-title? (cdr lines)))
+      (stretchable-lines (remove ly:paper-system-title? (cdr lines)))
       (stretch (if (null? stretchable-lines)
                   0.0
                   (/ spc-left (length stretchable-lines))))
      (lambda (l)
        (set! page-stencil
             (ly:stencil-combine-at-edge
-             page-stencil Y DOWN (ly:paper-line-stencil l)
+             page-stencil Y DOWN (ly:paper-system-stencil l)
              (if was-title
                  0.0
                  stretch)
              ))
 
-       (set! was-title (ly:paper-line-title? l)))
+       (set! was-title (ly:paper-system-title? l)))
      lines)
 
     (if (ly:stencil? foot)
               (ly:stencil-translate
                foot
                (cons 0
-                     (+ bottom-edge (- (car (ly:stencil-extent foot Y)))))
+                     (+ (- bottom-edge) (- (car (ly:stencil-extent foot Y)))))
                ))))
-    page-stencil    
+
+    (ly:stencil-translate page-stencil (cons left-margin 0))
   ))
   
 
 ; TODO:
 ;
 ; - density scoring
-;
+; - separate function for word-wrap style breaking?
+; - raggedbottom? raggedlastbottom? 
 
-;; TODO: first-diff and last-diff are slightly arbitrary interface
-;; For the future, we might want to invoke a function from PAPER-BOOK to
-;; determine available height given
 (define-public (ly:optimal-page-breaks
                lines paper-book)
   "Return pages as a list starting with 1st page. Each page is a list
-of lines.
-
-TEXT-HEIGHT is the height of the printable area, FIRST-DIFF and
-LAST-DIFF are decrements for the 1st and last page. PAPER-BOOK is
-unused, at the moment."
+of lines. "
 
   (define (make-node prev lines page-num penalty)
     (make <optimally-broken-page-node>
@@ -206,7 +208,7 @@ unused, at the moment."
   (define bookpaper (ly:paper-book-book-paper paper-book))
   (define scopes (ly:paper-book-scopes paper-book))
   (define (line-height line)
-    (ly:paper-line-extent line Y))
+    (ly:paper-system-extent line Y))
 
   ;; FIXME: may need some tweaking: square, cubic
   (define (height-penalty available used)
@@ -225,7 +227,7 @@ unused, at the moment."
 
   (define (page-height page-number last?)
     (let
-       ((p (ly:output-def-lookup bookpaper 'page-height-function)))
+       ((p (ly:output-def-lookup bookpaper 'page-music-height)))
 
       (if (procedure? p)
          (p bookpaper scopes page-number last?)
@@ -262,7 +264,7 @@ CURRENT-BEST is the best result sofar, or #f."
           (page-height (page-height this-page-num last?))
           (space-used (cumulative-height current-lines))
           (this-page-penalty (height-penalty  page-height space-used))
-          (user-penalty (ly:paper-line-break-penalty (car current-lines)))
+          (user-penalty (ly:paper-system-break-penalty (car current-lines)))
           (total-penalty (combine-penalties
                           user-penalty this-page-penalty prev-penalty))
           (better? (or
@@ -309,7 +311,7 @@ DONE."
                      (cdr todo)))))
 
   (define (line-number node)
-    (ly:paper-line-number (car (node-lines node))))
+    (ly:paper-system-number (car (node-lines node))))
 
   (let* ((best-break-node (walk-lines '() '() lines))
         (break-nodes (get-path best-break-node '()))
@@ -331,3 +333,5 @@ DONE."
            (node-page-number node)
            (eq? node best-break-node)))
         break-nodes)))
+
+
index dc591b523e2eadc6c4658cfbfd638419b8078846..f0dbaab503f6fc3950882d4ac3dfaff3f21f04be 100644 (file)
      ly:output-def-clone
      ly:output-def-scope
      ly:output-description
-     ly:page-header-lines-footer-stencil
-     ly:page-paper-lines
-     ly:page?
      ly:paper-book?
      ly:paper-def?
      ly:paper-get-font
      ly:paper-get-number
-     ly:paper-line-break-penalty
-     ly:paper-line-extent
-     ly:paper-line-number
-     ly:paper-line-stencil
-     ly:paper-line?
+     ly:paper-system-break-penalty
+     ly:paper-system-extent
+     ly:paper-system-number
+     ly:paper-system-stencil
+     ly:paper-system?
      ly:output-def-lookup
      ly:parse-string
      ly:parser-parse-string