]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/time-signature.cc
*** empty log message ***
[lilypond.git] / lily / time-signature.cc
index 892baf6950a0af041792ab26a02ac9795a210929..e360f810338d36c95d797b6d220a65d26f0db9b9 100644 (file)
@@ -14,6 +14,7 @@
 #include "paper-def.hh"
 #include "font-interface.hh"
 #include "warn.hh"
+#include "staff-symbol-referencer.hh"
 
 MAKE_SCHEME_CALLBACK (Time_signature,brew_molecule,1);
 /*
@@ -33,21 +34,26 @@ Time_signature::brew_molecule (SCM smob)
       d = gh_scm2int (ly_cdr (frac));
     }
 
-  
+  Molecule m;
   if (gh_symbol_p (st))
     {
       String style (ly_scm2string (scm_symbol_to_string (st)));
       if (style[0]=='1')
        {
-         return time_signature (me, n, 0).smobbed_copy ();
+         m = time_signature (me, n, 0);
        }
       else
        {
-         return special_time_signature (me, style, n, d).smobbed_copy ();
+         m = special_time_signature (me, style, n, d);
        }
     }
   else
-    return time_signature (me, n,d).smobbed_copy ();
+    m = time_signature (me, n,d);
+
+  if (Staff_symbol_referencer::line_count (me) % 2 == 0)
+    m.translate_axis (Staff_symbol_referencer::staff_space (me)/2 , Y_AXIS);
+
+  return m.smobbed_copy ();
 }
 
 Molecule
@@ -68,7 +74,7 @@ Time_signature::special_time_signature (Grob*me, String s, int n, int d)
   /*
     First guess: s contains only the signature style, append fraction.
   */
-  String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
+  String symbolname = "timesig-" + s + to_string (n) + "/" + to_string (d);
   
   Molecule m = feta->find_by_name (symbolname);
   if (!m.empty_b ())
@@ -96,10 +102,10 @@ Time_signature::time_signature (Grob*me,int num, int den)
   SCM chain = Font_interface::font_alist_chain (me);
 
   Molecule n = Text_item::text2molecule (me,
-                                        ly_str02scm (to_str (num).ch_C ()),
+                                        scm_makfrom0str (to_string (num).to_str0 ()),
                                         chain);
   Molecule d = Text_item::text2molecule (me,
-                                        ly_str02scm (to_str (den).ch_C ()),
+                                        scm_makfrom0str (to_string (den).to_str0 ()),
                                         chain);
   n.align_to (X_AXIS, CENTER);
   d.align_to (X_AXIS, CENTER);