[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] \label, page references
From: |
Han-Wen Nienhuys |
Subject: |
Re: [patch] \label, page references |
Date: |
Sat, 26 May 2007 16:13:20 -0300 |
User-agent: |
Thunderbird 1.5.0.10 (X11/20070302) |
Nicolas Sceaux escreveu:
> Hi,
>
> Here is a patch implementing a page reference markup feature.
Hi,
I'm missing a test file.
I have a couple of concerns:
- the final evaluation happens with \layout{} block for a \score
marker, no? Wouldn't it be cleaner to look at the
> A label is attached to a score or a top-level markup using a \label
> command with a symbol argument. When the page breaking is done, a {
> label -> page-number } table is filled, which can be referenced later to
> retreive page numbers from a label. The patch introduces a new stencil
> command, delay-stencil-evaluation, and a new markup command using it:
> \page-ref.
> + else if (Prob * markup = unsmob_prob (scm_car (l)))
> + labels = markup->get_property ("labels");
> +
This looks fishy; the type checking should be stricter, music is a prob too.
> + book_->paper_->set_variable (ly_symbol2scm ("label-page-table"),
> + scm_reverse_x (label_page_table, SCM_EOL));
This is acceptable if there is no other way, but I would like the rendering
process to be a function, ie. in the ideal case, the rendering should not write
into the Output_def. Can you think of a way to store this information elsewhere,
or pass it as a parameter to the delayed evaluation? You may need to extend the
stencil evaluation process to have another parameter.
> +void
> +set_label (SCM sys, SCM label)
> +{
> + if (Paper_score *ps = dynamic_cast<Paper_score*> (unsmob_music_output
> (sys)))
> + {
> + SCM labels = ps->layout ()->c_variable ("labels");
> + ps->layout ()->set_variable (ly_symbol2scm ("labels"),
> + scm_cons (label, labels));
> + }
> + else if (Prob *pb = unsmob_prob (sys))
idem.
>
> + /* set the first system labels with the score ones */
> + if (i == 0)
> + {
> + SCM labels = pscore_->layout ()->c_variable ("labels");
> + system->set_property ("labels", labels);
> + }
Wouldn't it be more appropriate to set labels for each broken
System, so you could eg. refer to the page number of a rehearsal
mark? It would be difficult to transport the label symbol out of
the initial markup -> stencil conversion, though. You might have to
run a separate pass over all nested markups to discover the labels.
Final remark: despite my comments, I think this is way cool!
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen