]> git.donarmstrong.com Git - lilypond.git/commitdiff
label&page-ref: apply label to the next score or markup, iso. to the previous one.
authorNicolas Sceaux <nicolas.sceaux@free.fr>
Sun, 17 Jun 2007 08:32:50 +0000 (10:32 +0200)
committerNicolas Sceaux <nicolas.sceaux@free.fr>
Sun, 17 Jun 2007 08:32:50 +0000 (10:32 +0200)
Documentation/user/non-music.itely
input/regression/page-label.ly
lily/paper-book.cc

index eded3eca1b78a8c60cde0204aaceeb25594a9816..2ee1f37f3b9469a6a3af4fd46de944bc83945a48 100644 (file)
@@ -481,7 +481,7 @@ some pieces include a lot more information.
 @menu
 * Creating titles::             
 * Custom titles::               
-* Table of contents::                
+* Reference to page numbers::   
 @end menu
 
 
@@ -734,8 +734,8 @@ composer flush right on a single line.
 }
 @end verbatim
 
-@node Table of contents
-@subsection Table of contents
+@node Reference to page numbers
+@subsection Reference to page numbers
 
 A particular place of a score can be marked using the @code{\label}
 command, either at top-level or inside music.  This label can then be
@@ -743,13 +743,14 @@ refered to in a markup, to get the number of the page where the marked
 point is placed, using the @code{\page-ref} markup command.
 
 @verbatim
+\label #'firstScore
 \score {
   {
     c'1
     \mark A \label #'markA
     c'
   }
-} \label #'firstScore
+}
 
 \markup { The first score is on page \page-ref #'firstScore "0" "?" }
 \markup { Mark A is on page \page-ref #'markA "0" "?" }
index 9f40328cf4ce958691104ba062534783823adcb2..6f1e5c8e881c3b779cbe291285d32fd4bf167dc1 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.11.25"
+\version "2.11.26"
 
 \header {
   texidoc = "Page labels may be placed inside music or at top-level,
@@ -15,6 +15,7 @@ and refered to in markups."
 
 \pageBreak
 
+\label #'toc
 \markup \column {
   \large \fill-line { \null "Table of contents" \null }
   \toc-line #'toc "Table of contents"
@@ -23,10 +24,11 @@ and refered to in markups."
   \toc-line #'markB "Mark B"
   \toc-line #'markC "Mark C"
   \toc-line #'unknown "Unknown label"
-} \label #'toc
+}
 
 \pageBreak
 
+\label #'firstScore
 \score {
   { c'2 c'
     \mark \markup { A (page \concat { \page-ref #'markA "0" "?" ) }} \label #'markA 
@@ -39,4 +41,4 @@ and refered to in markups."
     \mark "C" \label #'markC
   }
   \header { piece = "First score" }
-} \label #'firstScore
\ No newline at end of file
+}
\ No newline at end of file
index 72648b682fe952df2d0a9a4292be258a229c3670..90003b86fdd0b27483d5ec443a0a8ebf5c100146 100644 (file)
@@ -333,6 +333,8 @@ Paper_book::get_system_specs ()
 
   SCM interpret_markup_list = ly_lily_module_constant ("interpret-markup-list");
   SCM header = SCM_EOL;
+  bool set_next_label = false;
+  SCM label;
   for (SCM s = scm_reverse (scores_); scm_is_pair (s); s = scm_cdr (s))
     {
       if (ly_is_module (scm_car (s)))
@@ -355,9 +357,9 @@ 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 */
+             set_next_label = true;
+             label = page_marker->label ();
            }
        }
       else if (Music_output *mop = unsmob_music_output (scm_car (s)))
@@ -377,6 +379,11 @@ Paper_book::get_system_specs ()
 
              header = SCM_EOL;
              system_specs = scm_cons (pscore->self_scm (), system_specs);
+             if (set_next_label)
+               {
+                 set_label (scm_car (system_specs), label);
+                 set_next_label = false;
+               }
            }
          else
            {
@@ -413,6 +420,11 @@ Paper_book::get_system_specs ()
              system_specs = scm_cons (ps->self_scm (), system_specs);
              ps->unprotect ();
              
+             if (set_next_label)
+               {
+                 set_label (scm_car (system_specs), label);
+                 set_next_label = false;
+               }
              // FIXME: figure out penalty.
              //set_system_penalty (ps, scores_[i].header_);
            }