]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/time-signature.cc
Issue 3286: add single-C time signature style
[lilypond.git] / lily / time-signature.cc
index 1b2ed673f402cd1c93faacc8e43c284031a7816d..c85b891932cf036c74d8f768214fe4d20394d117 100644 (file)
@@ -36,7 +36,7 @@ MAKE_SCHEME_CALLBACK (Time_signature, print, 1);
 SCM
 Time_signature::print (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Grob *me = Grob::unsmob (smob);
   SCM st = me->get_property ("style");
   SCM frac = me->get_property ("fraction");
   int n = 4;
@@ -68,6 +68,14 @@ Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int d)
 
   if ((style == "default") || (style == ""))
     style = ::to_string ("C");
+  else if (style == "single-C")
+    {
+      if ((n != 2) && (n != 4))
+        return numbered_time_signature (me, n, 0);
+      /* for any d, print 2/d as cut-C, 4/d as C */
+      style = ::to_string ("C");
+      d = n;
+    }
 
   if (style == "C")
     {
@@ -104,8 +112,8 @@ Time_signature::numbered_time_signature (Grob *me, int num, int den)
   SCM sd = Text_interface::interpret_markup (me->layout ()->self_scm (), chain,
                                              ly_string2scm (::to_string (den)));
 
-  Stencil n = *unsmob_stencil (sn);
-  Stencil d = *unsmob_stencil (sd);
+  Stencil n = *Stencil::unsmob (sn);
+  Stencil d = *Stencil::unsmob (sd);
 
   n.align_to (X_AXIS, CENTER);
   d.align_to (X_AXIS, CENTER);