[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nested book parts
Nested book parts
Tue, 14 Oct 2008 18:06:06 -0700
I'm really sorry I took so long to do this. I honestly thought it had
already been committed (probably because it has been merged into my
working copy for such a long time).
File lily/book.cc (right):
Line 139: Book::add_bookpart ()
This method confused me for a while (because it has quite a different
purpose from add_bookpart(SCM)). I suggest renaming this method and
adding a comment along the lines of "all scores before an explicit
\bookpart are implicitly lumped into their own separate bookpart".
Line 190: Book::process (Output_def *default_paper,
This method is becoming very long. Can it be split up into multiple
if (there are bookparts)
for (s in scores)
File lily/include/book.hh (right):
Line 35: void add_bookpart ();
Can this be private? Yeah, I know everything else here is public, but
that's no reason to perpetuate the problem.
Line 38: bool error_found ();
File lily/minimal-page-breaking.cc (right):
Line 43: vsize first_page_num = robust_scm2int
(book_->paper_->c_variable ("part-first-page-number"), 1);
Do we really need new variables for properties in book parts (as opposed
to using some cascading to allow bookparts to override properties in the
parent)? I could see this leading to an explosion of properties.
File lily/page-breaking.cc (right):
Line 266: bool last_from_part = (i == lines_per_page.size () - 1);
I'm not sure this is the logic we want here. I think we want to treat
the last page in a bookpart the same as the last page in a book. This
would give the per-score ragged-last-bottom feature that some people
have been asking for.
File lily/paper-book.cc (right):
Line 112: Paper_book::output_aux (SCM output_channel,
This gets simpler if you no longer care about is_first and is_last...
Line 549: /* backwards compatibility for the old page breaker */
We can probably scrap this soon.
Book parts aim at splitting a book into several parts, in order to be
able to use eg. different page breaking functions, or to make the page
breaking problem less difficult and more likely to finish.
- Book and Paper_book instances respectively are nestable: children
book or paper_book are added to the bookparts_ slot;
- the paper_ slot of a child Book (or Book_paper) is created empty,
and has its parent set to the paper object of the parent Book (or
Paper_book), so that default paper properties are got from the
higher level paper object, and child objects only store part-wide
overrides. This way, we ensure that fonts are loaded in the higher
level paper object, so that the output framework can get all the
loaded fonts from the top level book;
- a Paper_book::top_paper() method is added to access the higher level
paper object, to access properties that are book-wide, for instance
the table used to store labels and page numbers;
- in the parser, \bookpart blocks are introduced, which can be used at
toplevel, or inside a \book block. It can contain the same things as
\book blocks (except \bookpart blocks, though that would be
possible). The associated handlers are added.
Please review this at http://codereview.appspot.com/4848
- Nested book parts,