]> git.donarmstrong.com Git - lilypond.git/commitdiff
Make pure-height on accidentals ignore tied accidentals after breaks.
authorJoe Neeman <joeneeman@gmail.com>
Tue, 2 Jan 2007 07:18:28 +0000 (09:18 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Tue, 2 Jan 2007 07:18:28 +0000 (09:18 +0200)
lily/accidental.cc
lily/grob.cc
lily/include/accidental-interface.hh
scm/define-grobs.scm

index a54a87efbc3c31e6cf07f1af9902038122439d10..ba352e5b84032a315795f68643fcdd3e52d10299 100644 (file)
@@ -11,6 +11,7 @@
 #include "international.hh"
 #include "item.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "pitch.hh"
 #include "stencil.hh"
 
@@ -49,6 +50,21 @@ Accidental_interface::after_line_breaking (SCM smob)
   return SCM_UNSPECIFIED;
 }
 
+MAKE_SCHEME_CALLBACK (Accidental_interface, pure_height, 3);
+SCM
+Accidental_interface::pure_height (SCM smob, SCM start_scm, SCM)
+{
+  Item *me = dynamic_cast<Item*> (unsmob_grob (smob));
+  int start = scm_to_int (start_scm);
+  int rank = me->get_column ()->get_rank ();
+
+  bool visible = to_boolean (me->get_property ("forced"))
+    || !unsmob_grob (me->get_object ("tie"))
+    || rank != start + 1; /* we are in the middle of a line */
+
+  return visible ? Grob::stencil_height (smob) : ly_interval2scm (Interval ());
+}
+
 vector<Box>
 Accidental_interface::accurate_boxes (Grob *me, Grob **common)
 {
index 139a387989393209390a7704246c87402d0b3295..91f8ce5016f3bd9255e3fd377ac1ae37950fd339 100644 (file)
@@ -420,11 +420,21 @@ Grob::extent (Grob *refp, Axis a) const
 Interval
 Grob::pure_height (Grob *refp, int start, int end)
 {
-  SCM proc = get_property_data ( ly_symbol2scm ("Y-extent"));
-  Interval iv = robust_scm2interval (call_pure_function (proc,
-                                                        scm_list_1 (self_scm ()),
-                                                        start, end),
-                                    Interval (0, 0));
+  SCM proc = get_property_data (ly_symbol2scm ("Y-extent"));
+  SCM pure_proc = get_property_data (ly_symbol2scm ("pure-Y-extent"));
+  SCM iv_scm;
+
+  if (ly_is_procedure (pure_proc))
+    iv_scm = scm_apply_3 (pure_proc,
+                         self_scm (),
+                         scm_from_int (start),
+                         scm_from_int (end), SCM_EOL);
+  else
+    iv_scm = call_pure_function (proc,
+                                scm_list_1 (self_scm ()),
+                                start, end);
+  
+  Interval iv = robust_scm2interval (iv_scm, Interval (0, 0));
   Real offset = pure_relative_y_coordinate (refp, start, end);
 
   SCM min_ext = get_property ("minimum-Y-extent");
@@ -626,6 +636,7 @@ ADD_INTERFACE (Grob,
               "outside-staff-horizontal-padding "
               "outside-staff-padding "
               "outside-staff-priority "
+              "pure-Y-extent "
               "rotation "
               "springs-and-rods "
               "staff-symbol "
index 13646895e63443e91477fcdcb2ff6910505ad292..2a2888c20affe6498d0165b3e30e66e31e11281d 100644 (file)
@@ -21,6 +21,7 @@ public:
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_stencils, (SCM));
   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+  DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
   
   DECLARE_GROB_INTERFACE();
   static string get_fontcharname (string style, int alteration);
index c4246b6589e5097c0626314e37b5f0338edc63ef..33493aabdf55f106378bd7c144c04d9993b37118 100644 (file)
@@ -23,6 +23,7 @@
        (glyph-name-alist . ,standard-alteration-glyph-name-alist)
        (alteration . ,accidental-interface::calc-alteration) 
        (stencil . ,ly:accidental-interface::print)
+       (pure-Y-extent . ,ly:accidental-interface::pure-height)
        (after-line-breaking
         . ,ly:accidental-interface::after-line-breaking)
        (meta . ((class . Item)
@@ -35,6 +36,7 @@
        (glyph-name-alist . ,standard-alteration-glyph-name-alist)
        (alteration . ,accidental-interface::calc-alteration) 
        (stencil . ,ly:accidental-interface::print)
+       (pure-Y-extent . ,ly:accidental-interface::pure-height)
        (after-line-breaking
         . ,ly:accidental-interface::after-line-breaking)
        (meta . ((class . Item)
        (X-offset . ,ly:side-position-interface::x-aligned-side)
        (direction . ,LEFT)
        (stencil . ,ly:accidental-interface::print)
+       (pure-Y-extent . ,ly:accidental-interface::pure-height)
        (glyph-name-alist . ,standard-alteration-glyph-name-alist)      
        (after-line-breaking . ,ly:accidental-interface::after-line-breaking)
        (side-axis . ,X)