commit 4d4e9ff70f77fe3488f46bba470caec57c777c13
Author: Joe Neeman
Date: Tue Jan 2 09:18:28 2007 +0200
Make pure-height on accidentals ignore tied accidentals after breaks.
diff --git a/lily/accidental.cc b/lily/accidental.cc
index a54a87e..ba352e5 100644
--- a/lily/accidental.cc
+++ b/lily/accidental.cc
@@ -11,6 +11,7 @@ #include "font-interface.hh"
#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_breakin
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- (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
Accidental_interface::accurate_boxes (Grob *me, Grob **common)
{
diff --git a/lily/grob.cc b/lily/grob.cc
index 139a387..91f8ce5 100644
--- a/lily/grob.cc
+++ b/lily/grob.cc
@@ -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 "
diff --git a/lily/include/accidental-interface.hh b/lily/include/accidental-interface.hh
index 1364689..2a2888c 100644
--- a/lily/include/accidental-interface.hh
+++ b/lily/include/accidental-interface.hh
@@ -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);
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index c4246b6..33493aa 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -23,6 +23,7 @@ (define-public all-grob-descriptions
(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 @@ (define-public all-grob-descriptions
(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)
@@ -120,6 +122,7 @@ (define-public all-grob-descriptions
(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)