]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/time-signature.cc
2002-07-13 Han-Wen <hanwen@cs.uu.nl>
[lilypond.git] / lily / time-signature.cc
index cf1efd7e945c93698757c67fbdd6bb3873021264..892baf6950a0af041792ab26a02ac9795a210929 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1996--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1996--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -13,8 +13,9 @@
 #include "time-signature.hh"
 #include "paper-def.hh"
 #include "font-interface.hh"
+#include "warn.hh"
 
-MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Time_signature,brew_molecule,1);
 /*
   TODO: make different functions for special and normal timesigs.
  */
@@ -28,8 +29,8 @@ Time_signature::brew_molecule (SCM smob)
   int d = 4;
   if (gh_pair_p (frac))
     {
-      n = gh_scm2int (gh_car (frac));
-      d = gh_scm2int (gh_cdr (frac));
+      n = gh_scm2int (ly_car (frac));
+      d = gh_scm2int (ly_cdr (frac));
     }
 
   
@@ -70,17 +71,21 @@ Time_signature::special_time_signature (Grob*me, String s, int n, int d)
   String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
   
   Molecule m = feta->find_by_name (symbolname);
-  if (!m.empty_b()) 
+  if (!m.empty_b ())
     return m;
 
   /*
     Second guess: s contains the full signature name
   */
   m = feta->find_by_name ("timesig-" + s);
+  m.align_to (X_AXIS, LEFT);
   if (!m.empty_b ()) 
     return m;
 
-  // Resort to default layout with numbers
+  /*
+    If there is no such symbol, we default without warning to the
+    numbered style.
+   */
   return time_signature (me, n, d);
 }
 
@@ -109,6 +114,40 @@ Time_signature::time_signature (Grob*me,int num, int den)
       m = n;
       m.align_to (Y_AXIS, CENTER);
     }
+
+  m.align_to (X_AXIS, LEFT);
+  
   return m;
 }
 
+
+
+ADD_INTERFACE (Time_signature,"time-signature-interface",
+  "A time signature, in different styles.
+  The following values for 'style are are recognized:
+
+    @table @samp
+      @item @code{C}
+        4/4 and 2/2 are typeset as C and struck C, respectively.  All
+        other time signatures are written with two digits.
+
+      @item @code{old}
+        2/2, 3/2, 2/4, 3/4, 4/4, 6/4, 9/4, 4/8, 6/8 and 9/8 are
+        typeset with old-style mensuration marks.  All other time
+        signatures are written with two digits.
+
+      @item @code{1xxx}
+        All time signatures are typeset with a single
+        digit, e.g. 3/2 is written as 3. (Any symbol starting
+       with the digit @code{1} will do.)
+
+      @item @code{C}@var{M}@code{/}@var{N}, 
+@code{old}@var{M}@code{/}@var{N} or
+      @code{old6/8alt}
+        Tells LilyPond to use a specific symbol as time signature, 
+       regardless of the actual time signature.
+    @end table
+
+See also the test-file @file{input/test/time.ly}.
+",
+  "fraction style");