* lily/item-scheme.cc: new file.
* lily/bar-line.cc (before_line_breaking): remove function.
remove bar-size-procedure, break-glyph-function
* lily/clef-engraver.cc (set_glyph): use glyph iso. glyph-name
* lily/clef.cc (before_line_breaking): change to calc_glyph_name.
* lily/system-start-delimiter.cc (print): suicide from
here. Remove after_line_breaking_callback.
* lily/script-interface.cc (calc_direction): use callback for direction.
* lily/side-position-interface.cc (aligned_side): don't use
Side_position_interface::get_direction directly. Use callback.
* scm/define-grobs.scm: change print-function to stencil callback everywhere.
* scm/define-grob-properties.scm (all-user-grob-properties): doc
callbacks property.
2005-10-16 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/script-engraver.cc (make_script_from_event): don't trigger callback.
+
+ * lily/item-scheme.cc: new file.
+
+ * lily/bar-line.cc (before_line_breaking): remove function.
+ remove bar-size-procedure, break-glyph-function
+
+ * lily/clef-engraver.cc (set_glyph): use glyph iso. glyph-name
+
+ * lily/clef.cc (before_line_breaking): change to calc_glyph_name.
+
+ * lily/system-start-delimiter.cc (print): suicide from
+ here. Remove after_line_breaking_callback.
+
+ * lily/script-interface.cc (calc_direction): use callback for direction.
+
+ * lily/side-position-interface.cc (aligned_side): don't use
+ Side_position_interface::get_direction directly. Use callback.
+
* lily/grob.cc (get_stencil): simplify: use callback mechanism to
calculate stencil.
(get_print_stencil): rename from get_stencil: create stencil with
\relative c' \new StaffGroup <<
\new Staff {
- \override Score.BarLine #'transparent = ##t
- a1 a1
- \revert Score.BarLine #'transparent
- \override Score.SpanBar #'transparent = ##t
+ a1
+ \once \override Score.BarLine #'transparent = ##t
+ a1
+ \once \override Score.SpanBar #'transparent = ##t
a1 a1
+ \bar "|."
}
\lyricmode <<
\new Lyrics { bla1 die bla }
return m;
}
+/*
+ Hmm. Need separate callback, or perhaps #'live bool property.
+ */
MAKE_SCHEME_CALLBACK (Accidental_interface, after_line_breaking, 1);
SCM
Accidental_interface::after_line_breaking (SCM smob)
{
Grob *me = unsmob_grob (smob);
- SCM s = me->get_property ("glyph");
- SCM barsiz_proc = me->get_property ("bar-size-procedure");
- if (scm_is_string (s) && ly_is_procedure (barsiz_proc))
+ SCM s = me->get_property ("glyph-name");
+ SCM barsize = me->get_property ("bar-size");
+
+ if (scm_is_string (s) && scm_is_number (barsize))
{
String str = ly_scm2string (s);
- SCM siz = scm_call_1 (barsiz_proc, me->self_scm ());
- Real sz = robust_scm2double (siz, 0);
+ Real sz = robust_scm2double (barsize, 0);
if (sz <= 0)
return SCM_EOL;
Interval (-h / 2, h / 2)), blot);
}
-MAKE_SCHEME_CALLBACK (Bar_line, before_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_size, 1);
SCM
-Bar_line::before_line_breaking (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
- Item *item = dynamic_cast<Item *> (me);
-
- SCM g = me->get_property ("glyph");
- SCM orig = g;
- Direction bsd = item->break_status_dir ();
- if (scm_is_string (g) && bsd)
- {
- SCM proc = me->get_property ("break-glyph-function");
- g = scm_call_2 (proc, g, scm_from_int (bsd));
- }
-
- if (!scm_is_string (g))
- {
- me->set_property ("print-function", SCM_EOL);
- me->set_extent (SCM_EOL, X_AXIS);
- // leave y_extent for spanbar?
- }
-
- if (!ly_is_equal (g, orig))
- me->set_property ("glyph", g);
-
- return SCM_UNSPECIFIED;
-}
-
-MAKE_SCHEME_CALLBACK (Bar_line, get_staff_bar_size, 1);
-SCM
-Bar_line::get_staff_bar_size (SCM smob)
+Bar_line::calc_bar_size (SCM smob)
{
Grob *me = unsmob_grob (smob);
Real ss = Staff_symbol_referencer::staff_space (me);
- SCM size = me->get_property ("bar-size");
- if (scm_is_number (size))
- return scm_from_double (scm_to_double (size) * ss);
- else if (Staff_symbol_referencer::get_staff_symbol (me))
+
+ if (Staff_symbol_referencer::get_staff_symbol (me))
{
/*
If there is no staff-symbol, we get -1 from the next
return scm_from_int (0);
}
+
ADD_INTERFACE (Bar_line,
"bar-line-interface",
/* properties */
- "bar-size-procedure "
"kern "
"thin-kern "
"hair-thickness "
"thick-thickness "
"glyph "
"bar-size "
- "break-glyph-function");
+ );
ADD_INTERFACE (Chord_name, "chord-name-interface",
"A chord name.",
+
+
"begin-of-line-visible");
void
Clef_engraver::set_glyph ()
{
- SCM glyph_sym = ly_symbol2scm ("glyph-name");
+ SCM glyph_sym = ly_symbol2scm ("glyph");
SCM glyph = get_property ("clefGlyph");
SCM basic = ly_symbol2scm ("Clef");
#include "item.hh"
#include "font-interface.hh"
-/*
- FIXME: should use symbol for #'style.
-*/
-MAKE_SCHEME_CALLBACK (Clef, before_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
SCM
-Clef::before_line_breaking (SCM smob)
+Clef::calc_glyph_name (SCM smob)
{
Item *s = unsmob_item (smob);
- SCM glyph = s->get_property ("glyph-name");
+ SCM glyph = s->get_property ("glyph");
- if (!scm_is_string (glyph))
- s->suicide ();
- else
+ if (scm_is_string (glyph))
{
String str = ly_scm2string (glyph);
&& !to_boolean (s->get_property ("full-size-change")))
{
str += "_change";
- s->set_property ("glyph-name", scm_makfrom0str (str.to_str0 ()));
}
+
+ return scm_makfrom0str (str.to_str0 ());
}
+ s->suicide ();
return SCM_UNSPECIFIED;
}
ADD_INTERFACE (Clef, "clef-interface",
"A clef sign",
- "non-default full-size-change glyph-name");
+
+ /* properties */
+ "full-size-change "
+ "glyph "
+ "glyph-name "
+ "non-default "
+ );
Side_position_interface::add_support (e, inf.grob ());
}
}
+
void
Drum_notes_engraver::acknowledge_note_column (Grob_info inf)
{
return ly_bool2scm (b);
}
-LY_DEFINE (ly_item_p, "ly:item?",
- 1, 0, 0, (SCM g),
- "Is @var{g} an @code{Item} object?")
-{
- Grob *me = unsmob_grob (g);
- bool b = dynamic_cast<Item *> (me);
- return ly_bool2scm (b);
-}
-
-LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
- 1, 0, 0, (SCM it),
- "The break status dir of item @var{it}. @code{-1} is end of "
- "line, @code{0} unbroken, and @code{1} begin of line.")
-{
- Item *me = dynamic_cast<Item *> (unsmob_grob (it));
- SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item");
- return scm_from_int (me->break_status_dir ());
-}
-
LY_DEFINE (ly_grob_key, "ly:grob-key",
1, 0, 0,
(SCM grob),
static Stencil compound_barline (Grob *, String, Real height, bool rounded);
static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded);
- DECLARE_SCHEME_CALLBACK (get_staff_bar_size, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
};
#endif // BAR_HH
struct Clef
{
- DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
static bool has_interface (Grob *);
};
static Stencil get_stencil (Grob *, Direction d);
static bool has_interface (Grob *);
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
};
void make_script_from_event (Grob *p, bool *follow, Context *tg,
static Interval get_spanned_interval (Grob *);
static void add_bar (Grob *, Grob *);
static void evaluate_glyph (Grob *);
- static void evaluate_empty (Grob *);
DECLARE_SCHEME_CALLBACK (width_callback, (SCM smob, SCM axis));
- DECLARE_SCHEME_CALLBACK (get_bar_size, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM));
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
DECLARE_SCHEME_CALLBACK (center_on_spanned_callback, (SCM element, SCM axis));
};
DECLARE_SCHEME_CALLBACK (print, (SCM));
static bool has_interface (Grob *);
- DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
static void try_collapse (Grob *);
static Stencil staff_bracket (Grob *, Real);
static Stencil old_staff_bracket (Grob *, Real);
--- /dev/null
+/*
+ item-scheme.cc -- implement Item bindings.
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "item.hh"
+
+
+LY_DEFINE (ly_item_p, "ly:item?",
+ 1, 0, 0, (SCM g),
+ "Is @var{g} an @code{Item} object?")
+{
+ Grob *me = unsmob_grob (g);
+ bool b = dynamic_cast<Item *> (me);
+ return ly_bool2scm (b);
+}
+
+LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
+ 1, 0, 0, (SCM it),
+ "The break status dir of item @var{it}. @code{-1} is end of "
+ "line, @code{0} unbroken, and @code{1} begin of line.")
+{
+ Item *me = dynamic_cast<Item *> (unsmob_grob (it));
+ SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item");
+ return scm_from_int (me->break_status_dir ());
+}
#include "script-column.hh"
+#include "directional-element-interface.hh"
#include "side-position-interface.hh"
#include "warn.hh"
#include "pointer-group-interface.hh"
for (int i = 0; i < staff_sided.size (); i++)
{
Grob *g = staff_sided[i];
- Direction d = Side_position_interface::get_direction (g);
- if (!d)
- {
- programming_error ("no direction for script");
- d = DOWN;
- g->set_property ("direction", scm_from_int (d));
- }
+ Direction d = get_grob_direction (g);
scripts_drul[d] = scm_cons (g->self_scm (), scripts_drul[d]);
}
val = scm_from_int (prio);
}
- if (p->internal_get_property (sym) == SCM_EOL)
+ if (p->get_property_data (sym) == SCM_EOL)
p->internal_set_property (sym, val);
}
{
for (int i = 0; i < scripts_.size (); i++)
{
- Music *m = scripts_[i].event_;
+ Music *music = scripts_[i].event_;
- Grob *p = make_item ("Script", m->self_scm ());
+ Grob *p = make_item ("Script", music->self_scm ());
make_script_from_event (p, &scripts_[i].follow_into_staff_, context (),
- m->get_property ("articulation-type"),
+ music->get_property ("articulation-type"),
i);
scripts_[i].script_ = p;
- SCM force_dir = m->get_property ("direction");
+ SCM force_dir = music->get_property("direction");
if (is_direction (force_dir) && to_dir (force_dir))
p->set_property ("direction", force_dir);
}
return Stencil ();
}
-/*
-todo: use proper callbacks.
-*/
-MAKE_SCHEME_CALLBACK (Script_interface, before_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Script_interface, calc_direction, 1);
SCM
-Script_interface::before_line_breaking (SCM smob)
+Script_interface::calc_direction (SCM smob)
{
Grob *me = unsmob_grob (smob);
-
Direction d = Side_position_interface::get_direction (me);
if (!d)
d = DOWN;
}
- set_grob_direction (me, d);
-
if (Grob *par = me->get_parent (X_AXIS))
{
Grob *stem = Note_column::get_stem (par);
if (stem && Stem::first_head (stem))
me->set_parent (Stem::first_head (stem), X_AXIS);
}
- return SCM_UNSPECIFIED;
+
+ return scm_from_int (d);
}
MAKE_SCHEME_CALLBACK (Script_interface, print, 1);
{
Grob *me = unsmob_grob (smob);
- Direction dir = Side_position_interface::get_direction (me);
- if (!dir)
- {
- programming_error ("script direction unknown, but stencil wanted");
- dir = DOWN;
- }
+ Direction dir = get_grob_direction (me);
+
return get_stencil (me, dir).smobbed_copy ();
}
Direction
Side_position_interface::get_direction (Grob *me)
{
- SCM d = me->get_property ("direction");
- if (is_direction (d) && to_dir (d))
- return to_dir (d);
-
Direction relative_dir = Direction (1);
SCM reldir = me->get_property ("side-relative-direction"); // should use a lambda.
if (is_direction (reldir))
if (dim.is_empty ())
dim = Interval (0, 0);
- Direction dir = Side_position_interface::get_direction (me);
+ Direction dir = get_grob_direction (me);
Real off = me->get_parent (a)->relative_coordinate (common, a);
Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1);
{
Grob *me = unsmob_grob (element_smob);
- Direction d = Side_position_interface::get_direction (me);
+ Direction d = get_grob_direction (me);
Grob *stsym = Staff_symbol_referencer::get_staff_symbol (me);
if (stsym)
Grob *me = unsmob_grob (element_smob);
Axis a = (Axis) scm_to_int (axis);
- Direction d = Side_position_interface::get_direction (me);
-
+ Direction d = get_grob_direction (me);
Real o = scm_to_double (aligned_on_support_extents (element_smob, axis));
Interval iv = me->extent (me, a);
"victim object relative to the support (left or right, up or down?)\n\n "
"The routine also takes the size the staff into account if "
"@code{staff-padding} is set. If undefined, the staff symbol is ignored.",
+
+ /* properties */
"direction "
"direction-source "
"minimum-space "
extract_grob_set (me, "elements", elements);
Grob *refp = common_refpoint_of_array (elements, me, Y_AXIS);
- Span_bar::evaluate_glyph (me);
- SCM glyph = me->get_property ("glyph");
+ SCM glyph = me->get_property ("glyph-name");
/* glyph may not be a string, when ME is killed by Hara Kiri in
between. */
(void) scm_axis;
assert ((Axis) scm_to_int (scm_axis) == X_AXIS);
- String gl = ly_scm2string (se->get_property ("glyph"));
+ String gl = ly_scm2string (se->get_property ("glyph-name"));
/*
urg.
SCM
Span_bar::before_line_breaking (SCM smob)
{
- Grob *g = unsmob_grob (smob);
- evaluate_empty (g);
- evaluate_glyph (g);
+ Grob *me = unsmob_grob (smob);
+ extract_grob_set (me, "elements", elements);
+ if (elements.is_empty ())
+ me->suicide ();
- /* No need to call Bar_line::before_line_breaking (), because the info
- in ELEMENTS already has been procced by
- Bar_line::before_line_breaking (). */
return SCM_UNSPECIFIED;
}
return scm_from_double (i.center ());
}
-void
-Span_bar::evaluate_empty (Grob *me)
-{
- /* TODO: filter all hara-kiried out of ELEMENS list, and then
- optionally do suicide. Call this cleanage function from
- center_on_spanned_callback () as well. */
- extract_grob_set (me, "elements", elements);
- if (elements.is_empty ())
- me->suicide ();
-}
-void
-Span_bar::evaluate_glyph (Grob *me)
+MAKE_SCHEME_CALLBACK(Span_bar, calc_glyph_name, 1);
+SCM
+Span_bar::calc_glyph_name (SCM smob)
{
- SCM gl = me->get_property ("glyph");
-
- if (scm_is_string (gl))
- return;
-
+ Grob *me = unsmob_grob (smob);
extract_grob_set (me, "elements", elements);
+ SCM gl = SCM_EOL;
for (int i = elements.size ();
i-- && !scm_is_string (gl);)
gl = elements[i]->get_property ("glyph");
if (!scm_is_string (gl))
{
me->suicide ();
- return;
+ return SCM_UNSPECIFIED;
}
String type = ly_scm2string (gl);
else if (type == ":|:")
type = ".|.";
- gl = scm_makfrom0str (type.to_str0 ());
- if (scm_equal_p (me->get_property ("glyph"), gl)
- != SCM_BOOL_T)
- me->set_property ("glyph", gl);
+ return scm_makfrom0str (type.to_str0 ());
}
Interval
(me->self_scm (), scm_from_int (Y_AXIS)));
}
-MAKE_SCHEME_CALLBACK (Span_bar, get_bar_size, 1);
+MAKE_SCHEME_CALLBACK (Span_bar, calc_bar_size, 1);
SCM
-Span_bar::get_bar_size (SCM smob)
+Span_bar::calc_bar_size (SCM smob)
{
Grob *me = unsmob_grob (smob);
Interval iv (get_spanned_interval (me));
ADD_INTERFACE (Span_bar, "span-bar-interface",
"A bar line that spanned between other barlines. This interface is "
" used for bar lines that connect different staves.",
+
+ /* properties */
+ "glyph-name "
"elements");
bar_size.set_empty ();
if (Bar_line::has_interface (bar_grob))
{
- SCM glyph = bar_grob->get_property ("glyph");
+ SCM glyph = bar_grob->get_property ("glyph-name");
+ Grob *staff_sym = Staff_symbol_referencer::get_staff_symbol (bar_grob);
String glyph_string = scm_is_string (glyph) ? ly_scm2string (glyph) : "";
if (glyph_string.left_string (1) == "|" || glyph_string.left_string (1) == ".")
{
- SCM sz = Bar_line::get_staff_bar_size (bar_grob->self_scm ());
- bar_size = Interval (-1, 1);
- bar_size *= robust_scm2double (sz, 1)
- / Staff_symbol_referencer::staff_space (bar_grob);
+ Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS);
+ Interval bar_size = bar_grob->extent (common, Y_AXIS);
+ bar_size *= 1.0 / Staff_symbol_referencer::staff_space (bar_grob);
}
}
return bar_size;
lt);
}
-MAKE_SCHEME_CALLBACK (System_start_delimiter, after_line_breaking, 1);
-
-SCM
-System_start_delimiter::after_line_breaking (SCM smob)
-{
- Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
-
- SCM gl = me->get_property ("glyph");
- if (ly_is_equal (gl, scm_makfrom0str ("bar-line")))
- {
- int count = 0;
- Paper_column *left_column = me->get_bound (LEFT)->get_column ();
-
- /*
- Get all coordinates, to trigger Hara kiri.
- */
- extract_grob_set (me, "elements", elts);
- Grob *common = common_refpoint_of_array (elts, me, Y_AXIS);
-
- for (int i = elts.size (); i--;)
- {
- Spanner *staff = dynamic_cast<Spanner *> (elts[i]);
- if (!staff
- || staff->get_bound (LEFT)->get_column () != left_column)
- continue;
-
- Interval v = staff->extent (common, Y_AXIS);
-
- if (!v.is_empty ())
- count++;
- }
-
- if (count <= 1)
- me->suicide ();
- }
- return SCM_UNSPECIFIED;
-}
-
MAKE_SCHEME_CALLBACK (System_start_delimiter, print, 1);
SCM
System_start_delimiter::print (SCM smob)
Interval ext;
+ int non_empty_count = 0;
for (int i = elts.size (); i--;)
{
Spanner *sp = dynamic_cast<Spanner *> (elts[i]);
+
if (sp
&& sp->get_bound (LEFT) == me->get_bound (LEFT))
{
Interval dims = sp->extent (common, Y_AXIS);
if (!dims.is_empty ())
- ext.unite (dims);
+ {
+ non_empty_count ++;
+ ext.unite (dims);
+ }
}
}
+ if (gsym == ly_symbol2scm ("bar-line")
+ && non_empty_count <= 1)
+ {
+ me->suicide ();
+ return SCM_EOL;
+ }
+
ext -= me->relative_coordinate (common, Y_AXIS);
Real len = ext.length () / staff_space;
(bar-size ,ly:dimension? "size of a bar line.")
- (bar-size-procedure ,procedure? "Procedure that computes the size of a bar line.")
(barre-type ,symbol? "Type of barre indication used in a fret diagram.
Choices include @code{curved} and @code{straight}.")
(base-shortest-duration ,ly:moment?
clef
time-signature))
@end example")
- (break-glyph-function ,procedure? "This function determines the
-appearance of a bar line at the line break. It takes a glyph and
-break-direction and returns the glyph at a line break.")
(break-overshoot ,number-pair? "How much does a broken spanner
stick out of its bounds?")
(bracket-visibility ,boolean-or-symbol? "This controls the
(glyph ,string? "a string determining what (style) of glyph is
typeset. Valid choices depend on the function that is reading this
property.")
- (glyph-name ,string? "a name of character within font.")
(glyph-name-procedure ,procedure? "Return the name of a character
within font, to use for printing a symbol.")
set, which grob to get the direction from .")
(dot ,ly:grob? "reference to Dots object.")
(figures ,ly:grob-array? "Figured bass objects for continuation line.")
+ (glyph-name ,string? "a name of character within font.")
(pedal-text ,ly:grob? "Pointer to the text of a mixed-style piano pedal.")
(stem ,ly:grob? "pointer to Stem object.")
(tremolo-flag ,ly:grob? "The tremolo object on a stem.")
. (
(break-align-symbol . staff-bar)
(glyph . "|")
- (break-glyph-function . ,default-break-barline)
(layer . 0)
- (bar-size-procedure . ,Bar_line::get_staff_bar_size)
(break-visibility . ,all-visible)
(breakable . #t)
(callbacks . ((stencil . ,Bar_line::print)
- (before-line-breaking . ,Bar_line::before_line_breaking)))
+ (glyph-name . ,bar-line::calc-glyph-name)
+ (bar-size . ,Bar_line::calc_bar_size)
+ ))
(space-alist . (
(time-signature . (extra-space . 0.75))
(custos . (minimum-space . 2.0))
(Clef
. (
(callbacks . ((stencil . ,Clef::print)
- (before-line-breaking . ,Clef::before_line_breaking)
+ (glyph-name . ,Clef::calc_glyph_name)
))
(breakable . #t)
(font-family . music)
;; todo.
(callbacks . ((stencil . ,Text_interface::print)
- (before-line-breaking . ,Script_interface::before_line_breaking)))
+ (direction . ,Script_interface::calc_direction)))
(X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
(self-alignment-X . 0)
(Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
(self-alignment-Y . 0)
(script-priority . 100)
(callbacks . ((stencil . ,Text_interface::print)
- (before-line-breaking . ,Script_interface::before_line_breaking)))
+ (direction . ,Script_interface::calc_direction)))
(font-encoding . fetaNumber)
(font-size . -5) ; don't overlap when next to heads.
(meta . ((class . Item)
;; (script-priority . 0) priorities for scripts, see script.scm
(X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
(callbacks . ((stencil . ,Script_interface::print)
- (before-line-breaking . ,Script_interface::before_line_breaking)))
+ (direction . ,Script_interface::calc_direction)))
(font-encoding . fetaMusic)
(meta . ((class . Item)
(interfaces . (script-interface
(SpanBar
. (
(break-align-symbol . staff-bar)
- (bar-size-procedure . ,Span_bar::get_bar_size)
(X-extent-callback . ,Span_bar::width_callback)
(Y-extent-callback . ())
(layer . 0)
(breakable . #t)
(callbacks . ((stencil . ,Span_bar::print)
+ (bar-size . ,Span_bar::calc_bar_size)
+ (glyph-name . ,Span_bar::calc_glyph_name)
(before-line-breaking . ,Span_bar::before_line_breaking)))
;; ugh duplication!
(glyph . "bar-line")
(thickness . 1.6)
(callbacks . ((stencil . ,System_start_delimiter::print)
- (after-line-breaking . ,System_start_delimiter::after_line_breaking)))
-
+ ))
(meta . ((class . Spanner)
(interfaces . (system-start-delimiter-interface))))))
(padding . 0.5)
(staff-padding . 0.5)
(callbacks . ((stencil . ,Text_interface::print)
- (before-line-breaking . ,Script_interface::before_line_breaking)))
+ (direction . ,Script_interface::calc_direction)))
(avoid-slur . around)
(slur-padding . 0.5)
(script-priority . 200)
;; How should a bar line behave at a break?
;;
;; Why prepend `default-' to every scm identifier?
-(define-public (default-break-barline glyph dir)
- (let ((result (assoc glyph
+(define-public (bar-line::calc-glyph-name grob)
+ (let* (
+ (glyph (ly:grob-property grob 'glyph))
+ (dir (ly:item-break-dir grob))
+ (result (assoc glyph
'((":|:" . (":|" . "|:"))
("||:" . ("||" . "|:"))
("|" . ("|" . ()))
(":" . (":" . ""))
("empty" . (() . ()))
("brace" . (() . "brace"))
- ("bracket" . (() . "bracket")) ))))
+ ("bracket" . (() . "bracket")) )))
+ (glyph-name (if (= dir CENTER)
+ glyph
+ (if (and result (string? (index-cell (cdr result) dir)))
+ (index-cell (cdr result) dir)
+ #f)))
+ )
+
+ (if glyph-name
+ (set! (ly:grob-property grob 'glyph-name) glyph-name)
+ (ly:grob-suicide! grob))))
- (if (equal? result #f)
- (ly:warning (_ "unknown bar glyph: `~S'" glyph))
- (index-cell (cdr result) dir))))
(define-public (shift-right-at-line-begin g)
"Shift an item to the right, but only at the start of the line."
Arpeggio::brew_chord_bracket
Arpeggio::width_callback
Axis_group_interface::group_extent_callback
- Bar_line::get_staff_bar_size
Bar_line::print
Breathing_sign::offset_callback
Clef::print
Slur::height
Slur::print
Spacing_spanner::set_springs
- Span_bar::get_bar_size
Span_bar::print
Span_bar::width_callback
Spanner::set_spacing_rods