]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fixes for score debugging: introduce a generic 'annotation variable,
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 25 Feb 2008 00:18:01 +0000 (21:18 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 25 Feb 2008 00:18:01 +0000 (21:18 -0300)
which defaults to quant-score if debug-XXX-scoring is set.

lily/beam.cc
lily/slur.cc
lily/tie.cc
scm/define-grob-properties.scm
scm/layout-beam.scm

index bc861aca146134c461adeebe1cd51709398b9f72..3214fe4193db21e6cf1cee47b0a7dcd135fa106a 100644 (file)
@@ -561,9 +561,15 @@ Beam::print (SCM grob)
     }
         
 #if (DEBUG_BEAM_SCORING)
-  SCM quant_score = me->get_property ("quant-score");
-  SCM debug = me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring"));
-  if (to_boolean (debug) && scm_is_string (quant_score))
+  SCM annotation = me->get_property ("annotation");
+  if (!scm_is_string (annotation))
+    {
+      SCM debug = me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-scoring"));
+      if (to_boolean (debug))
+       annotation = me->get_property ("quant-score");
+    }
+  
+  if (scm_is_string (annotation))
     {
       extract_grob_set (me, "stems", stems);      
 
@@ -578,10 +584,13 @@ Beam::print (SCM grob)
       Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
 
       Stencil score = *unsmob_stencil (Text_interface::interpret_markup
-                                   (me->layout ()->self_scm (), properties, quant_score));
+                                   (me->layout ()->self_scm (), properties, annotation));
 
       if (!score.is_empty ())
-       the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0);
+       {
+         score.translate_axis (me->relative_coordinate(commonx, X_AXIS), X_AXIS);
+         the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0);
+       }
     }
 #endif
 
@@ -1524,6 +1533,7 @@ ADD_INTERFACE (Beam,
               ,
               
               /* properties */
+              "annotation "
               "auto-knee-gap "
               "beamed-stem-shorten "
               "beaming "
index a801281cd7e9feaa5fa28274c28216477f6f9e75..2e573ebf7c44749e201b72a29a03d4ac92e94bcd 100644 (file)
@@ -130,23 +130,26 @@ Slur::print (SCM smob)
                      line_thick);
 
 #if DEBUG_SLUR_SCORING
-  SCM quant_score = me->get_property ("quant-score");
-
-  if (to_boolean (me->layout ()
-                 ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
-      && scm_is_string (quant_score))
+  SCM annotation = me->get_property ("annotation");
+  if (!scm_is_string (annotation))
+    {
+      SCM debug = me->layout ()->lookup_variable (ly_symbol2scm ("debug-slur-scoring"));
+      if (to_boolean (debug))
+       annotation = me->get_property ("quant-score");
+    }
+  
+  if (scm_is_string (annotation))
     {
       string str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
-
       if (!scm_is_number (me->get_property ("font-size")))
        properties = scm_cons (scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-6), SCM_EOL),
                             properties);
       
       Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
                                    (me->layout ()->self_scm (), properties,
-                                    quant_score));
+                                    annotation));
       a.add_at_edge (Y_AXIS, get_grob_direction (me), tm, 1.0);
     }
 #endif
@@ -388,6 +391,7 @@ ADD_INTERFACE (Slur,
               "A slur",
               
               /* properties */
+              "annotation "
               "avoid-slur "    /* UGH. */
               "control-points "
               "dash-fraction "
index 87548a7056c538bb32867091085c5a2a7cf675cd..9925aa428be2ff6d2736401636ca486bdb972782 100644 (file)
@@ -269,18 +269,21 @@ Tie::print (SCM smob)
                      line_thick);
 
 #if DEBUG_TIE_SCORING
-  SCM quant_score = me->get_property ("quant-score");
-
-  if (to_boolean (me->layout ()
-                 ->lookup_variable (ly_symbol2scm ("debug-tie-scoring")))
-      && scm_is_string (quant_score))
+  SCM annotation = me->get_property ("annotation");
+  if (!scm_is_string (annotation))
+    {
+      SCM debug = me->layout ()->lookup_variable (ly_symbol2scm ("debug-tie-scoring"));
+      if (to_boolean (debug))
+       annotation = me->get_property ("quant-score");
+    }
+  if (scm_is_string (annotation))
     {
       string str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
       Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
                                    (me->layout ()->self_scm (), properties,
-                                    quant_score));
+                                    annotation));
       tm.translate (Offset (b.control_[3][X_AXIS] + 0.5,
                            b.control_[0][Y_AXIS] * 2));
       tm = tm.in_color (1, 0, 0);
@@ -302,6 +305,7 @@ ADD_INTERFACE (Tie,
               
 
               /* properties */
+              "annotation "
               "avoid-slur "    //  UGH.
               "control-points "
               "dash-fraction "
index 2ce60beece5cb85b2468046ce95cfa2989fe9293..4ec267019c4589c04b750a9d3f4fe4a0e5ac231e 100644 (file)
@@ -42,6 +42,7 @@ be created below this barline.")
      (alteration ,number? "Alteration numbers for accidental.")
      (alteration-alist ,list? "List of @code{(@var{pitch}
 . @var{accidental})} pairs for key signature.")
+     (annotation ,string? "Annotate a grob for debug purposes.")
      (arpeggio-direction ,ly:dir? "If set, put an arrow on the
 arpeggio squiggly line.")
      (arrow-length ,number? "Arrow length.")
@@ -731,7 +732,7 @@ entries @code{name} and @code{interfaces}.")
 did its job.  This ensures that a positioning is only done once.")
      (pure-Y-extent ,number-pair? "The estimated height of a system.")
 
-     (quant-score ,string? "The Beam quanting score -- can be stored for
+     (quant-score ,string? "The beam quanting score; stored for
 debugging.")
      (quantize-position ,boolean? "If set, a vertical alignment is aligned
 to be within staff spaces.")
index ef5cde47788bb246dcabda9f1e615787636722b4..9f1840dd33d3197007467a45f7f2f0e374651b1e 100644 (file)
        (begin
          (ly:warning (_ "Error in beam quanting.  Expected (~S,~S) found ~S.")
                      want-l want-r posns)
-         (set! (ly:grob-property beam 'quant-score)
-               (format "(~S,~S)" want-l want-r)))
-       (set! (ly:grob-property beam 'quant-score) ""))
-
+         (set! (ly:grob-property beam 'annotation)
+               (format "(~S,~S)" want-l want-r))))
     posns
     ))
 
   "Check whether the slope of BEAM is correct wrt. COMPARISON."
   (let* ((slope-sign (- (cdr posns) (car posns)))
         (correct (comparison slope-sign 0)))
-
     (if (not correct)
        (begin
          (ly:warning (_ "Error in beam quanting.  Expected ~S 0, found ~S.")
-                     (procedure-name comparison) "0" slope-sign)
-         (set! (ly:grob-property beam 'quant-score)
+                     (procedure-name comparison) slope-sign)
+         (set! (ly:grob-property beam 'annotation)
                (format "~S 0" (procedure-name comparison))))
-
-       (set! (ly:grob-property beam 'quant-score) ""))
+       (set! (ly:grob-property beam 'annotation) ""))
     posns))