]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/stencil.cc (interpret_stencil_expression): add grob-cause
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 20 Jun 2004 21:13:27 +0000 (21:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 20 Jun 2004 21:13:27 +0000 (21:13 +0000)
stencil expression. Junk define-origin.

* scm/lily.scm (collect-scores-for-book): new function.

* ly/init.ly: print collected scores/musics.

ChangeLog
lily/grob.cc
lily/stencil.cc
ly/init.ly
scm/lily.scm
scm/output-ps.scm
scm/output-tex.scm

index e220bc8905446095925c3546837f48c9e283063f..5032c50a367470a5afba9f08cf8777c48f29ccf8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-06-20  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/stencil.cc (interpret_stencil_expression): add grob-cause
+       stencil expression. Junk define-origin.
+
        * lily/my-lily-parser.cc (parse_string): init parser variable when
        lexer_ is set, ie. in parse_string and parse_file.
 
index 477577066388d5d2059d8e62044fe4eebc6ac877..a2f74e1040e325ca91aa779ed8ae6f1a71ca216b 100644 (file)
@@ -237,23 +237,8 @@ Grob::get_uncached_stencil ()const
        mol = Stencil (m->extent_box (), SCM_EOL).smobbed_copy ();
     else
       {
-       SCM origin = ly_symbol2scm ("no-origin");
-      
-       if (store_locations_global_b)
-         {
-           SCM cause = get_property ("cause");
-           if (Music*m = unsmob_music (cause))
-             {
-               SCM music_origin = m->get_property ("origin");
-               if (unsmob_input (music_origin))
-                 origin = music_origin;
-             }
-         }
-
-       // ugr.
-       mol = Stencil (m->extent_box (),
-                      scm_list_n (origin, m->expr (), SCM_UNDEFINED)
-                      ). smobbed_copy ();
+       SCM expr = scm_list_3 (ly_symbol2scm ("grob-cause"), self_scm(), m->expr ());
+       mol = Stencil (m->extent_box (),expr). smobbed_copy ();
       }
     }  
 
index 3d7420efacbd39287a40ef222540a9fe52ff57f6..e81e228bed395e9296b87c8e58c1e38d2c278445 100644 (file)
@@ -201,24 +201,9 @@ interpret_stencil_expression (SCM expr,
       if (!ly_c_pair_p (expr))
         return;
 
-      SCM head =ly_car (expr);
-      if (unsmob_input (head))
-        {
-          Input *ip = unsmob_input (head);
-          (*func) (func_arg,
-                  scm_list_4 (ly_symbol2scm ("define-origin"),
-                              scm_makfrom0str (ip->file_string ()
-                                               .to_str0 ()),
-                              scm_int2num (ip->line_number ()),
-                              scm_int2num (ip->column_number ())));
-          expr = ly_cadr (expr);
-        }
-      else  if (head ==  ly_symbol2scm ("no-origin"))
-        {
-          (*func) (func_arg, scm_list_1 (head));
-          expr = ly_cadr (expr);
-        }
-      else if (head == ly_symbol2scm ("translate-stencil"))
+      SCM head = ly_car (expr);
+     
+      if (head == ly_symbol2scm ("translate-stencil"))
         {
           o += ly_scm2offset (ly_cadr (expr));
           expr = ly_caddr (expr);
@@ -229,6 +214,14 @@ interpret_stencil_expression (SCM expr,
            interpret_stencil_expression (ly_car (x), func, func_arg, o);
           return;
         }
+      else if (head == ly_symbol2scm ("grob-cause"))
+       {
+         SCM grob = ly_cadr (expr);
+         
+         (*func) (func_arg, scm_list_2 (head, grob));
+         interpret_stencil_expression (ly_caddr (expr), func, func_arg, o);
+         (*func) (func_arg, scm_list_1 (ly_symbol2scm ("no-origin")));
+       }
       else
         {
           (*func) (func_arg, 
index 4bfdb7fb0ee13af21eea382211c08247d958140a..d718f81ac367118480f9508764f86d7e357693b7 100644 (file)
@@ -12,6 +12,7 @@
 #(ly:set-option 'new-relative)
 #(ly:set-point-and-click #f)
 #(define  toplevel-scores '())
+#(define $globalheader #f)
 
 \maininput
 % there is a problem at the end of the input file
index 57a5f337c7409e7abaa6144a731f561e3bf0633f..558da6d475fbb912bd61a274061acaa4b8fbf201 100644 (file)
       (debug-enable 'backtrace)
       (read-enable 'positions)))
 
-(define-public (line-column-location line col file)
+(define-public (line-column-location file line col)
   "Print an input location, including column number ."
   (string-append (number->string line) ":"
                 (number->string col) " " file))
 
-(define-public (line-location line col file)
+(define-public (line-location  file line col)
   "Print an input location, without column number ."
   (string-append (number->string line) " " file))
 
     ))
 
 (define-public (collect-music-for-book parser music)
-  (collect-scores-for-book parser (score (ly:music-scorify music))))
+  (collect-scores-for-book parser (ly:music-scorify music)))
   
 ;;;;;;;;;;;;;;;;
 ; alist
index 5b00dfe908cc434f6dbd725c29401ecea5237650..aa36662364385390ad42526b479669e805842742 100644 (file)
 
 
 
-(define (define-origin file line col) "")
-
 (define (dot x y radius)
   (string-append
    " "
        (string-append "/" key " {" val "} bind def\n")
        (string-append "/" key " (" val ") def\n"))))
 
-(define (no-origin) "")
-
-
 
 (define (placebox x y s) 
   (string-append 
     (ly:number->string dx) " "
     (ly:number->string dy)
     " draw_zigzag_line"))
+
+
+(define (grob-cause grob)
+  "")
index 74f2943d38795933f38a6ef777b5b51b9eb81807..80b3bea144c0f8c671264dc5a48cd868c919e14c 100644 (file)
@@ -45,6 +45,7 @@
             draw-line
             define-origin
             no-origin
+            grob-cause
             ))
 
 (use-modules (ice-9 regex)
   (embedded-ps (list 'draw-line thick fx fy tx ty)))
 
 (define (define-origin file line col)
-  (if (procedure? point-and-click)
-      (string-append "\\special{src:" ;;; \\string ? 
-                    (point-and-click line col file)
-                    "}" )
-      ""))
+  "")
 
 ;; no-origin not yet supported by Xdvi
 (define (no-origin) "")
+
+(define (grob-cause grob)
+  (if (procedure? point-and-click)
+  
+  (let*
+      ((cause (ly:grob-property grob 'cause))
+       (music-origin (if (ly:music? cause)
+                        (ly:music-property cause 'origin)
+                         #f))
+       (location (if (ly:input-location? music-origin)
+                    (ly:input-location music-origin)
+                    #f)))
+
+    (if (pair? location)
+       (string-append "\\special{src:" ;;; \\string ? 
+                      (apply point-and-click location) "}")
+       ""))
+  ""))