source file of the GNU LilyPond music typesetter
- (c) 2001--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 2001--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "accidental-interface.hh"
#include "international.hh"
#include "item.hh"
#include "output-def.hh"
+#include "paper-column.hh"
#include "pitch.hh"
#include "stencil.hh"
Stencil close
= font->find_by_name ("accidentals.rightparen");
- m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0, 0);
- m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0, 0);
+ m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0);
+ m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0);
return m;
}
-/*
- Hmm. Need separate callback, or perhaps #'live bool property.
- */
-MAKE_SCHEME_CALLBACK (Accidental_interface, after_line_breaking, 1);
+
+/* This callback exists for the sole purpose of allowing us to override
+ its pure equivalent to accidental-interface::pure-height */
+MAKE_SCHEME_CALLBACK (Accidental_interface, height, 1);
SCM
-Accidental_interface::after_line_breaking (SCM smob)
+Accidental_interface::height (SCM smob)
{
- Grob *me = unsmob_grob (smob);
- Grob *tie = unsmob_grob (me->get_object ("tie"));
+ return Grob::stencil_height (smob);
+}
- if (tie && !tie->original ()
- && !to_boolean (me->get_property ("forced")))
- {
- me->suicide ();
- }
-
- 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::print (SCM smob)
{
Grob *me = unsmob_grob (smob);
+ Grob *tie = unsmob_grob (me->get_object ("tie"));
+ if (tie && !tie->original ()
+ && !to_boolean (me->get_property ("forced")))
+ {
+ me->suicide ();
+ return SCM_EOL;
+ }
+
Font_metric *fm = Font_interface::get_default_font (me);
SCM alist = me->get_property ("glyph-name-alist");
- SCM glyph_name = ly_assoc_get (me->get_property ("alteration"),
- alist, SCM_BOOL_F);
+ SCM alt = me->get_property ("alteration");
+ SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F);
if (!scm_is_string (glyph_name))
{
- me->warning ("Could not find glyph-name for alteration");
+ me->warning (_f ("Could not find glyph-name for alteration %s",
+ ly_scm2rational (alt).to_string ().c_str ()));
return SCM_EOL;
}
if (acc.is_empty ())
me->warning (_ ("natural alteration glyph not found"));
else
- mol.add_at_edge (X_AXIS, LEFT, acc, 0.1, 0);
+ mol.add_at_edge (X_AXIS, LEFT, acc, 0.1);
}
if (to_boolean (me->get_property ("parenthesized")))