summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Sceaux <nicolas.sceaux@free.fr>2007-06-17 10:32:50 +0200
committerNicolas Sceaux <nicolas.sceaux@free.fr>2007-06-17 10:32:50 +0200
commitdcbb0d114e3107090cc807965cec582eee1d7375 (patch)
tree3acfd3b4566012cf009f689d8ab2991fc8fc0981
parent34b75de61aed178f6eedbc6a4790ff6cacee179a (diff)
label&page-ref: apply label to the next score or markup, iso. to the previous one.
-rw-r--r--Documentation/user/non-music.itely9
-rw-r--r--input/regression/page-label.ly8
-rw-r--r--lily/paper-book.cc18
3 files changed, 25 insertions, 10 deletions
diff --git a/Documentation/user/non-music.itely b/Documentation/user/non-music.itely
index eded3eca1b..2ee1f37f3b 100644
--- a/Documentation/user/non-music.itely
+++ b/Documentation/user/non-music.itely
@@ -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" "?" }
diff --git a/input/regression/page-label.ly b/input/regression/page-label.ly
index 9f40328cf4..6f1e5c8e88 100644
--- a/input/regression/page-label.ly
+++ b/input/regression/page-label.ly
@@ -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
diff --git a/lily/paper-book.cc b/lily/paper-book.cc
index 72648b682f..90003b86fd 100644
--- a/lily/paper-book.cc
+++ b/lily/paper-book.cc
@@ -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_);
}