]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/parser.yy (book_body): set default bookpaper.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 26 May 2004 17:03:46 +0000 (17:03 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 26 May 2004 17:03:46 +0000 (17:03 +0000)
* scm/output-tex.scm (header): kludge: hard code linewidth.

Documentation/topdocs/NEWS.texi
lily/accidental-engraver.cc
lily/include/my-lily-parser.hh
lily/include/page.hh
lily/page.cc
lily/parser.yy
scm/output-tex.scm

index 2593e4ea2e18683188b0df51e92b232d641cdb1d..1347d2791ec03a9c4a5b5276285db678a06adfe1 100644 (file)
@@ -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},
index 4ffd0586b8d249a8980a1f80197047f72625c037..30bcfc4e0d126fdb12fe0ae94a530f77dd7e5bc5 100644 (file)
@@ -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)<abs (p) || p*a<0) && a != 0 )
     num = 2;
@@ -416,7 +423,7 @@ Accidental_engraver::stop_translation_timestep ()
       int n = pitch->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;
            }
index 7c1ae9279eb84e243286719112009aaa85af896c..f8138e15c039322324b7a29e22eecb28c42682db 100644 (file)
@@ -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 */
index 00838a8dfc5d828ca346ea6690456531bda32eb6..e082b6ab1837f9ec99674e8ae6365ecde7ae8c44 100644 (file)
@@ -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_;
index 1052da0d693bab5ea1c479af4efa4079190505b5..3eeba7a5d94f344fea88ed1e06e4a6ffa44f0d8e 100644 (file)
 #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_);
index bc31074cd9bb5b673f60fb2c610c07fda29daf9a..3820640b2deee8cdc33440717fcb5d0041a84902 100644 (file)
@@ -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 ());
index 364f2f85f6a0780caacf6150bdf63ab251f213bf..899f05ba85ca5e04feee6e96a7684261eddbc07b 100644 (file)
    "\\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"