- return has_interface (me) && !me->extent (me, X_AXIS).is_empty ();
-}
-
-MAKE_SCHEME_CALLBACK (Bar_line, print, 1);
-SCM
-Bar_line::print (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
-
- 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);
- Real sz = robust_scm2double (barsize, 0);
- if (sz <= 0)
- return SCM_EOL;
-
- return compound_barline (me, str, sz, false).smobbed_copy ();
- }
- return SCM_EOL;
-}
-
-Stencil
-Bar_line::compound_barline (Grob *me, string str, Real h,
- bool rounded)
-{
- Real kern = robust_scm2double (me->get_property ("kern"), 1);
- Real thinkern = robust_scm2double (me->get_property ("thin-kern"), 1);
- Real hair = robust_scm2double (me->get_property ("hair-thickness"), 1);
- Real fatline = robust_scm2double (me->get_property ("thick-thickness"), 1);
-
- Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
- Real staff_space = Staff_symbol_referencer::staff_space (me);
-
- kern *= staffline;
- thinkern *= staffline;
- hair *= staffline;
- fatline *= staffline;
-
- Stencil thin = simple_barline (me, hair, h, rounded);
- Stencil thick = simple_barline (me, fatline, h, rounded);
- Stencil dot = Font_interface::get_default_font (me)->find_by_name ("dots.dot");
-
- int lines = Staff_symbol_referencer::line_count (me);
- Real dist
- = ((lines & 1 || lines == 0)
- ? 1
- : (staff_space < 2 ? 2 : .5)) * staff_space;
- Stencil colon (dot);
- colon.translate_axis (dist, Y_AXIS);
- colon.add_stencil (dot);
- colon.translate_axis (-dist / 2, Y_AXIS);
-
- Stencil m;
- Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
- Real center = 0;
- if (staff)
- {
- Interval staff_extent = staff->extent (staff, Y_AXIS);
- center = staff_extent.center ();
- }
-
- if (str == "||:")
- str = "|:";
-
- if (str == "|S" || str == "S|")
- str = "S";
-
- if (str == "")
- {
- Stencil empty = Lookup::blank (Box (Interval (0, 0), Interval (-h / 2, h / 2)));
- empty.translate_axis (center, Y_AXIS);
- return empty;
- }
- else if (str == "|")
- {
- thin.translate_axis (center, Y_AXIS);
- return thin;
- }
- else if (str == ".")
- {
- thick.translate_axis (center, Y_AXIS);
- return thick;
- }
- else if (str == "|." || (h == 0 && str == ":|"))
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- }
- else if (str == ".|" || (h == 0 && str == "|:"))
- {
- m.add_at_edge (X_AXIS, RIGHT, thick, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- }
- else if (str == ":|")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- }
- else if (str == "|:")
- {
- m.add_at_edge (X_AXIS, RIGHT, thick, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == ":|:")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, thinkern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, thick, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == ":|.|:")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == ":|.:")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == ".|.")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thick, kern);
- }
- else if (str == "|.|")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- }
- else if (str == "||")
- {
- /*
- should align to other side? this never appears
- on the system-start?
- m.add_at_edge (X_AXIS, RIGHT, thin, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
- */
- m.add_at_edge (X_AXIS, LEFT, thin, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
- }
- else if (str.find ("S") != NPOS || str == "|._.|")
- {
- // Handle all varsegno stuff
- Stencil segno;
- segno.add_at_edge (X_AXIS, LEFT, thin, thinkern);
- segno.add_at_edge (X_AXIS, RIGHT, thin, thinkern);
- segno.add_stencil (Font_interface::get_default_font (me)->find_by_name ("scripts.varsegno"));
-
- if (str == "S")
- m.add_stencil (segno);
- else if (str == "S|:" || str == ".S|:")
- {
- m.add_at_edge (X_AXIS, RIGHT, thick, 0);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- m.add_at_edge (X_AXIS, LEFT, segno, thinkern);
- }
- else if (str == ":|S" || str == ":|S.")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, segno, thinkern);
- }
- else if (str == ":|S|:" || str == ":|S.|:")
- {
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, LEFT, colon, kern);
- m.add_at_edge (X_AXIS, RIGHT, segno, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thick, thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, colon, kern);
- }
- else if (str == "|._.|") // :|S|: or :|S.|: without segno and colon
- {
- // get the width of the segno sign
- Real segno_width = segno.extent (X_AXIS).length ();
- m.add_at_edge (X_AXIS, LEFT, thick, 0);
- m.add_at_edge (X_AXIS, LEFT, thin, kern);
- m.add_at_edge (X_AXIS, RIGHT, thick, segno_width + 2 * thinkern);
- m.add_at_edge (X_AXIS, RIGHT, thin, kern);
- }
- // end varsegno block
- }
- else if (str == ":")
- {
- int c = (Staff_symbol_referencer::line_count (me));
-
- for (int i = 0; i < c - 1; i++)
- {
- Real y = (- (c - 1.0) / 2 + 0.5 + i) * staff_space;
- Stencil d (dot);
-
- d.translate_axis (y, Y_AXIS);
- m.add_stencil (d);
- }
- }
- else if (str == "dashed")
- m = dashed_bar_line (me, h, hair);
- else if (str == "'")
- m = tick_bar_line (me, h, rounded);
-
- m.translate_axis (center, Y_AXIS);
- return m;