From: Han-Wen Nienhuys Date: Wed, 26 May 2004 17:03:46 +0000 (+0000) Subject: * lily/parser.yy (book_body): set default bookpaper. X-Git-Tag: release/2.3.2~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=88f639976bd631c10a3938883223f7ee4b319afc;p=lilypond.git * lily/parser.yy (book_body): set default bookpaper. * scm/output-tex.scm (header): kludge: hard code linewidth. --- diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 2593e4ea2e..1347d2791e 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -8,11 +8,14 @@ @itemize @bullet +@item A new block, @code{\bookpaper} has been introduced to +hold settings for paper size and output scaling. + @item Support for fret diagrams has been contributed by Carl D. Sorensen. @file{input/test/fret-diagram.ly} contains an example. @item The @code{--safe} mode has been revisited: it makes the basic -ly: interface available, and stops malicious @TeX{} code. +@code{ly:} interface available, and stops malicious @TeX{} code. @item Music syntax can now be extended seamlessly. As an example, here is the new implementation @code{\applymusic}, diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 4ffd0586b8..30bcfc4e0d 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -169,20 +169,27 @@ number_accidentals_from_sig (bool *different, } - int p = 0; + SCM prev_acc = scm_int2num (0); for (int i= 0; i < prev_idx; i++) { if (accbarnum < 0 || (ly_c_number_p (lazyness) && curbarnum > accbarnum + ly_scm2int (lazyness))) { - p = ly_scm2int (ly_cdr (prevs[i])); + prev_acc = ly_cdr (prevs[i]); break; } } + /* + UGH. prev_acc can be #t in case of ties. What is this for? + + */ + int p = ly_c_number_p (prev_acc) ? ly_scm2int (prev_acc) : 0; + + int num; - if (a == p) + if (a == p && ly_c_number_p (prev_acc)) num = 0; else if ( (abs (a)get_notename (); int o = pitch->get_octave (); int a = pitch->get_alteration (); - SCM on_s = scm_cons (scm_int2num (o), scm_int2num (n)); + SCM key = scm_cons (scm_int2num (o), scm_int2num (n)); while (origin && origin->where_defined (ly_symbol2scm ("localKeySignature"))) { @@ -432,7 +439,7 @@ Accidental_engraver::stop_translation_timestep () that of the tied note and of the key signature. */ localsig = ly_assoc_front_x - (localsig, on_s, scm_cons (SCM_BOOL_T, scm_int2num (barnum))); + (localsig, key, scm_cons (SCM_BOOL_T, scm_int2num (barnum))); change = true; } @@ -443,7 +450,7 @@ Accidental_engraver::stop_translation_timestep () noteheads with the same notename. */ localsig = ly_assoc_front_x - (localsig, on_s, scm_cons (scm_int2num (a), scm_int2num (barnum))); + (localsig, key, scm_cons (scm_int2num (a), scm_int2num (barnum))); change = true; } diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 7c1ae9279e..f8138e15c0 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -80,5 +80,6 @@ SCM ly_parser_bookify (SCM, SCM); SCM ly_parser_scorify (SCM, SCM); Music_output_def *get_paper (My_lily_parser *parser); +Book_paper_def *get_bookpaper (My_lily_parser *parser); #endif /* MY_LILY_PARSER_HH */ diff --git a/lily/include/page.hh b/lily/include/page.hh index 00838a8dfc..e082b6ab18 100644 --- a/lily/include/page.hh +++ b/lily/include/page.hh @@ -18,9 +18,10 @@ class Page DECLARE_SMOBS (Page, ); public: + Paper_def *paper_; // todo: make private? + Book_paper_def * bookpaper () const; static int page_count_; static Real MIN_COVERAGE_; - Paper_def *paper_; int number_; int line_count_; SCM lines_; diff --git a/lily/page.cc b/lily/page.cc index 1052da0d69..3eeba7a5d9 100644 --- a/lily/page.cc +++ b/lily/page.cc @@ -14,10 +14,17 @@ #include "paper-line.hh" #include "stencil.hh" #include "warn.hh" +#include "book-paper-def.hh" int Page::page_count_ = 0; Real Page::MIN_COVERAGE_ = 0.66; +Book_paper_def * +Page::bookpaper () const +{ + return paper_->bookpaper_; +} + Page::Page (Paper_def *paper, int number) { copyright_ = SCM_EOL; @@ -65,6 +72,16 @@ Page::mark_smob (SCM smob) Page *p = (Page*) SCM_CELL_WORD_1 (smob); scm_gc_mark (p->header_); scm_gc_mark (p->footer_); + + if (p->paper_) + { + scm_gc_mark (p->paper_->self_scm ()); + if (p->bookpaper ()) + { + scm_gc_mark (p->bookpaper ()->self_scm ()); + } + } + scm_gc_mark (p->copyright_); scm_gc_mark (p->tagline_); //scm_gc_mark (p->lines_); diff --git a/lily/parser.yy b/lily/parser.yy index bc31074cd9..3820640b2d 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2477,8 +2477,10 @@ markup: Score *score = $2; Book *book = new Book; book->scores_.push (score); - + Music_output_def *paper = get_paper (THIS); + book->bookpaper_ = get_bookpaper (THIS); + SCM s = book->to_stencil (paper, THIS->header_); scm_gc_unprotect_object (score->self_scm ()); scm_gc_unprotect_object (book->self_scm ()); diff --git a/scm/output-tex.scm b/scm/output-tex.scm index 364f2f85f6..899f05ba85 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -254,8 +254,7 @@ "\\lilypondspecial\n" "\\lilypondpostscript\n")) -; why paper? -(define (header creator time-stamp paper page-count classic?) +(define (header creator time-stamp bookpaper page-count classic?) (string-append "% Generated by " creator "\n" "% at " time-stamp "\n"