--- /dev/null
+\version "2.13.1"
+
+\header {
+texidoc = "The visibility of left-broken line spanners and hairpins
+which end on the first note (i.e., span no time between bounds) is
+controlled by the callback @code{ly:spanner::kill-zero-spanned-time}.
+"
+}
+
+\paper { ragged-right = ##t }
+
+\relative c' {
+ \override TextSpanner #'bound-details =
+ #'((left
+ (Y . 0)
+ (padding . 0.25)
+ (attach-dir . -1)
+ (text . "L"))
+ (right
+ (Y . 0)
+ (padding . 0.25)
+ (text . "R"))
+ (left-broken
+ (padding . 5)
+ (text . #f))
+ (right-broken
+ (text . #f)))
+ c1\startTextSpan\< \break
+ \override Hairpin #'to-barline = ##f
+ \override Hairpin #'after-line-breaking = ##f
+ c2\stopTextSpan\!
+ \override TextSpanner #'after-line-breaking =
+ #ly:spanner::kill-zero-spanned-time
+ c\startTextSpan\< \break
+ c1\!\stopTextSpan
+}
#include "note-column.hh"
#include "warn.hh"
-MAKE_SCHEME_CALLBACK (Hairpin, after_line_breaking, 1);
-SCM
-Hairpin::after_line_breaking (SCM smob)
-{
- Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
- consider_suicide (me);
-
- return SCM_UNSPECIFIED;
-}
-
MAKE_SCHEME_CALLBACK (Hairpin, height, 1);
SCM
Hairpin::height (SCM smob)
return ly_interval2scm (Interval (-height, height));
}
-void
-Hairpin::consider_suicide (Spanner*me)
-{
- Drul_array<bool> broken;
- Drul_array<Item *> bounds;
- Direction d = LEFT;
- do
- {
- bounds[d] = me->get_bound (d);
- broken[d] = bounds[d]->break_status_dir () != CENTER;
- }
- while (flip (&d) != LEFT);
-
- if (broken[LEFT]
- && ly_is_equal (bounds[RIGHT]->get_column ()->get_property ("when"),
- bounds[LEFT]->get_property ("when")))
- me->suicide ();
-}
-
MAKE_SCHEME_CALLBACK (Hairpin, print, 1);
-
SCM
Hairpin::print (SCM smob)
{
- Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+ Spanner *me = unsmob_spanner (smob);
- if (Spanner *orig = dynamic_cast<Spanner*> (me->original ()))
- {
- for (vsize i = 0; i < orig->broken_intos_.size (); i++)
- Hairpin::consider_suicide (orig->broken_intos_[i]);
- }
-
SCM s = me->get_property ("grow-direction");
if (!is_direction (s))
{
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (height, (SCM));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
- DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
- static void consider_suicide (Spanner*);
DECLARE_GROB_INTERFACE();
};
public:
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
DECLARE_SCHEME_CALLBACK (bounds_width, (SCM));
+ DECLARE_SCHEME_CALLBACK (kill_zero_spanned_time, (SCM));
vector<Spanner*> broken_intos_;
#include "item.hh"
#include "lily-proto.hh"
#include "line-interface.hh"
-#include "moment.hh"
#include "output-def.hh"
#include "pointer-group-interface.hh"
#include "spanner.hh"
{
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
DECLARE_SCHEME_CALLBACK (calc_left_bound_info, (SCM));
DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM));
DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM));
{
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
- Interval_t<Moment> moments = me->spanned_time ();
- /*
- We remove the line at the start of the line. For piano voice
- indicators, it makes no sense to have them at the start of the
- line.
-
- I'm not sure what the official rules for glissandi are, but
- usually the 2nd note of the glissando is "exact", so when playing
- from the start of the line, there is no need to glide.
-
- From a typographical p.o.v. this makes sense, since the amount of
- space left of a note at the start of a line is very small.
-
- --hwn.
-
- */
- if (moments.length () == Moment (0,0))
- return SCM_EOL;
-
Drul_array<SCM> bounds (me->get_property ("left-bound-info"),
me->get_property ("right-bound-info"));
-
Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
commonx = me->common_refpoint (commonx, X_AXIS);
(c) 1996--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "pointer-group-interface.hh"
#include "libc-extension.hh"
-#include "paper-column.hh"
+#include "moment.hh"
#include "paper-column.hh"
#include "paper-score.hh"
+#include "pointer-group-interface.hh"
#include "stencil.hh"
#include "system.hh"
#include "warn.hh"
-#include "moment.hh"
Grob *
Spanner::clone () const
for (int a = X_AXIS; a < NO_AXES; a++)
{
if (Spanner *parent = dynamic_cast<Spanner *> (get_parent ((Axis)a)))
- {
- parent_rank_slice.intersect (parent->spanned_rank_interval ());
- }
+ parent_rank_slice.intersect (parent->spanned_rank_interval ());
}
for (vsize i = 1; i < break_points.size (); i++)
span->set_bound (RIGHT, bounds[RIGHT]);
if (!bounds[LEFT]->get_system ()
-
|| !bounds[RIGHT]->get_system ()
|| bounds[LEFT]->get_system () != bounds[RIGHT]->get_system ())
{
Item *
Spanner::get_bound (Direction d) const
{
- return spanned_drul_ [d];
+ return spanned_drul_[d];
}
/*
[maybe we should try keeping all columns alive?, and perhaps
inherit position from their (non-)musical brother]
-
*/
if (dynamic_cast<Paper_column *> (i))
Pointer_group_interface::add_grob (i, ly_symbol2scm ("bounded-by-me"), this);
: Grob (s)
{
break_index_ = 0;
- spanned_drul_[LEFT] = 0;
- spanned_drul_[RIGHT] = 0;
+ spanned_drul_.set (0, 0);
}
Spanner::Spanner (Spanner const &s)
: Grob (s)
{
- spanned_drul_[LEFT] = spanned_drul_[RIGHT] = 0;
+ spanned_drul_.set (0, 0);
}
Real
Grob *
Spanner::find_broken_piece (System *l) const
{
- vsize idx = binary_search (broken_intos_, (Spanner *)l, Spanner::less);
+ vsize idx = binary_search (broken_intos_, (Spanner *) l, Spanner::less);
if (idx != VPOS)
return broken_intos_ [idx];
return 0;
{
Spanner *me = unsmob_spanner (grob);
-
Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
Interval w (me->get_bound (LEFT)->relative_coordinate (common, X_AXIS),
return ly_interval2scm (w);
}
+MAKE_SCHEME_CALLBACK (Spanner, kill_zero_spanned_time, 1);
+SCM
+Spanner::kill_zero_spanned_time (SCM grob)
+{
+ Spanner *me = unsmob_spanner (grob);
+ Interval_t<Moment> moments = me->spanned_time ();
+ /*
+ Remove the line or hairpin at the start of the line. For
+ piano voice indicators, it makes no sense to have them at
+ the start of the line.
+
+ I'm not sure what the official rules for glissandi are, but
+ usually the 2nd note of the glissando is "exact", so when playing
+ from the start of the line, there is no need to glide.
+
+ From a typographical p.o.v. this makes sense, since the amount of
+ space left of a note at the start of a line is very small.
+
+ --hwn.
+
+ */
+ if (moments.length () == Moment (0, 0))
+ me->suicide ();
+
+ return SCM_UNSPECIFIED;
+}
+
ADD_INTERFACE (Spanner,
"Some objects are horizontally spanned between objects. For"
" example, slurs, beams, ties, etc. These grobs form a subtype"
return str
@rule ((2, 13, 1),
- _ ("\\bar \".\" now produces a thick barline"))
+ _ ("\\bar \".\" now produces a thick barline\n\
+ly:hairpin::after-line-breaking -> ly:spanner::kill-zero-spanned-time"))
def conv(str):
if re.search(r'\\bar\s*"."', str):
stderr_write ("\n")
stderr_write (NOT_SMART % _("\\bar \".\" now produces a thick barline.\n"))
stderr_write (UPDATE_MANUALLY)
+ str = re.sub (r'ly:hairpin::after-line-breaking', r'ly:spanner::kill-zero-spanned-time', str)
return str
# Guidelines to write rules (please keep this at the end of this file)
(padding . 1.5)
))
))
+ (after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
(stencil . ,ly:line-spanner::print)
(left-bound-info . ,ly:line-spanner::calc-left-bound-info)
(right-bound-info . ,ly:line-spanner::calc-right-bound-info)
. (
(stencil . ,ly:hairpin::print)
(springs-and-rods . ,ly:spanner::set-spacing-rods)
- (after-line-breaking . ,ly:hairpin::after-line-breaking)
+ (after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
(grow-direction . ,hairpin::calc-grow-direction)
(circled-tip . #f)
(to-barline . #t)
))
(stencil . ,ly:line-spanner::print)
-
+ (after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
(style . trill)
(staff-padding . 1.0)
(padding . 0.5)
(padding . 1.5)
))
))
+ (after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
(stencil . ,ly:line-spanner::print)
(left-bound-info . ,ly:line-spanner::calc-left-bound-info)
(right-bound-info . ,ly:line-spanner::calc-right-bound-info)