]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add ticked barlines (\bar "'"), i.e. a short tick through top-most staff-line
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 12 Dec 2008 23:23:25 +0000 (00:23 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 13 Dec 2008 23:20:46 +0000 (00:20 +0100)
For the span bar line, use an empty bar line, since ticked bar lines are not
spanned across staff groups.

input/regression/bar-line-tick.ly [new file with mode: 0644]
lily/bar-line.cc
lily/include/bar-line.hh
lily/span-bar.cc
scm/output-lib.scm

diff --git a/input/regression/bar-line-tick.ly b/input/regression/bar-line-tick.ly
new file mode 100644 (file)
index 0000000..9ddf246
--- /dev/null
@@ -0,0 +1,16 @@
+
+\header { texidoc = "A ticked bar line is a short line of the same length as a
+  staff space, centered on the top-most barline." }
+
+\version "2.11.65"
+
+\paper {  ragged-right = ##t }
+
+\relative \new StaffGroup <<
+  \new Staff {
+    c4 \bar "'" c }
+  \new Staff {
+     c c
+  }
+>>
+
index df97638dba6b9faa9f43e95d1780454e35d0a5c7..18ad550e9209e0e3b8f5ad026f324ffd4d6c099a 100644 (file)
@@ -198,6 +198,10 @@ Bar_line::compound_barline (Grob *me, string str, Real h,
     {
       m = dashed_bar_line (me, h, hair);
     }
+  else if (str == "'")
+    {
+      m = tick_bar_line (me, hair, h, rounded);
+    }
   else if (str == ".")
     {
       m = dot;
@@ -222,6 +226,22 @@ Bar_line::simple_barline (Grob *me,
                                        Interval (-h / 2, h / 2)), blot);
 }
 
+Stencil
+Bar_line::tick_bar_line (Grob *me, Real w, Real h, bool rounded)
+{
+  Real th = Staff_symbol_referencer::staff_space (me) / 2;
+  Real line_thick = Staff_symbol_referencer::line_thickness (me);
+
+  Real blot
+    = rounded
+    ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"))
+    : 0.0;
+
+  return Lookup::round_filled_box (Box (Interval (0, line_thick),
+                                        Interval (h / 2 - th, h / 2 + th)), blot);
+}
+
+
 MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_size, 1);
 SCM
 Bar_line::calc_bar_size (SCM smob)
index a6585084b6ed566c6c1b2211c8b007b3997d2630..43db11e9c9e0df074f65fc9222e94b414fa9d7b8 100644 (file)
@@ -16,6 +16,7 @@ public:
   DECLARE_GROB_INTERFACE();
 
   static Stencil dashed_bar_line (Grob *me, Real h, Real thick);
+  static Stencil tick_bar_line (Grob *me, Real w, Real h, bool rounded);
   static Stencil compound_barline (Grob *, string, Real height, bool rounded);
   static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded);
   static Interval bar_y_extent (Grob *, Grob *);
index 08a04e3cffc6d9b538f2c627703c47a6ec19c141..31d91b1fc7502bcf79d0a269a5ca90423b0d12b5 100644 (file)
@@ -190,6 +190,8 @@ Span_bar::calc_glyph_name (SCM smob)
     type = "|.|";
   else if (type == ":|.:")
     type = "|.";
+  else if (type == "'")
+    type = "";
 
   return ly_string2scm (type);
 }
index b93eddaa9ac3d00d089d6b0dbb4987fcd6a83ee0..9b813a55665a6507c855a89318290df1c0523597 100644 (file)
@@ -250,6 +250,7 @@ centered, X==1 is at the right, X == -1 is at the left."
     ("" . ("" . ""))
     (":" . (":" . ""))
     ("." . ("." . ()))
+    ("'" . ("'" . ()))
     ("empty" . (() . ()))
     ("brace" . (() . "brace"))
     ("bracket" . (() . "bracket"))