CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/08/30 23:26:04

Modified files:
        .              : ChangeLog 
        lily           : tie.cc 
        scripts        : lilypond-book.py 

Log message:
        (PREAMBLE_LY): define
        inside-lilypond-book
        (modify_preamble): new function. Insert \RequirePackage{graphics}
        when no {graphics found in preamble.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4100&tr2=1.4101&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/tie.cc.diff?tr1=1.153&tr2=1.154&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-book.py.diff?tr1=1.273&tr2=1.274&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4100 lilypond/ChangeLog:1.4101
--- lilypond/ChangeLog:1.4100   Tue Aug 30 23:05:27 2005
+++ lilypond/ChangeLog  Tue Aug 30 23:26:04 2005
@@ -1,3 +1,10 @@
+2005-08-31  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
+
+       * scripts/lilypond-book.py (PREAMBLE_LY): define
+       inside-lilypond-book
+       (modify_preamble): new function. Insert \RequirePackage{graphics}
+       when no {graphics found in preamble.  
+
 2005-08030  Graham Percival  <[EMAIL PROTECTED]>
 
        * Documentation/user/basic-notation.itely, global.itely,
Index: lilypond/lily/tie.cc
diff -u lilypond/lily/tie.cc:1.153 lilypond/lily/tie.cc:1.154
--- lilypond/lily/tie.cc:1.153  Tue Aug 23 22:34:53 2005
+++ lilypond/lily/tie.cc        Tue Aug 30 23:26:04 2005
@@ -411,7 +411,10 @@
 
   if (CENTER == get_grob_direction (me))
     set_direction (me);
-      
+
+  if (!get_grob_direction (me))
+    me->programming_error ("Tie direction not set."); 
+    
   SCM cp = me->get_property ("control-points");
   if (!scm_is_pair (cp))
     {
Index: lilypond/scripts/lilypond-book.py
diff -u lilypond/scripts/lilypond-book.py:1.273 
lilypond/scripts/lilypond-book.py:1.274
--- lilypond/scripts/lilypond-book.py:1.273     Mon Aug 29 23:40:47 2005
+++ lilypond/scripts/lilypond-book.py   Tue Aug 30 23:26:04 2005
@@ -556,7 +556,7 @@
                                p (scorify-music m p))))
 
 #(ly:set-option (quote no-point-and-click))
-
+#(define inside-lilypond-book #t)
 #(define version-seen? #t)
 %(preamble_string)s
 
@@ -693,9 +693,13 @@
                self.start = start
                self.end = end
                self.line_number = line_number
+               self.override_text = None
 
        def replacement_text (self):
-               return self.source[self.start:self.end]
+               if self.override_text:
+                       return self.override_text
+               else:
+                       return self.source[self.start:self.end]
 
 class Snippet (Chunk):
        def __init__ (self, type, match, format, line_number):
@@ -1319,6 +1323,18 @@
 
        return textwidth
 
+def modify_preamble (chunk):
+       str = chunk.replacement_text ()
+       if (re.search (r"\\begin{document}", str)
+           and not re.search ("{graphic[sx]", str)):
+               str = re.sub (r"\\begin{document}",
+                             r"\\RequirePackage{graphics}" + '\n'
+                             + r"\\begin{document}",
+                             str)
+               chunk.override_text = str 
+               
+       
+
 ext2format = {
        '.html': HTML,
        '.itely': TEXINFO,
@@ -1481,6 +1497,11 @@
                )
                ly.progress (_ ("Dissecting..."))
                chunks = find_toplevel_snippets (source, snippet_types)
+
+               if format == LATEX: 
+                       modify_preamble (chunks[0])
+                       
+               
                ly.progress ('\n')
 
                if filter_cmd:


_______________________________________________
Lilypond-cvs mailing list
Lilypond-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to