]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/key-item.cc
release: 1.5.29
[lilypond.git] / lily / key-item.cc
index c87f51ed7f226298f7528d8af356faff8aead0ce..39848d73781581f06877a560191c4032273b1971 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>
 
   keyplacement by Mats Bengtsson
 */
@@ -37,7 +37,7 @@ int
 alteration_pos  (SCM what, int alter, int c0p)
 {
   if (gh_pair_p (what))
-    return gh_scm2int (gh_car (what)) * 7 + gh_scm2int (gh_cdr (what)) + c0p;
+    return gh_scm2int (ly_car (what)) * 7 + gh_scm2int (ly_cdr (what)) + c0p;
 
   int p = gh_scm2int (what);
 
@@ -82,20 +82,38 @@ Key_item::brew_molecule (SCM smob)
 
   Real inter = Staff_symbol_referencer::staff_space (me)/2.0;
   
+  SCM scm_style = me->get_grob_property ("style");
+  String style;
+  if (gh_symbol_p (scm_style))
+    {
+      style = ly_scm2string (scm_symbol_to_string (scm_style));
+    }
+  else
+    {
+      style = "";
+    }
+
   SCM newas = me->get_grob_property ("new-accidentals");  
   Molecule mol;
+
+  SCM c0s = me->get_grob_property ("c0-position");
+  int c0p=0;
+  if (gh_number_p (c0s))
+     c0p = gh_scm2int (c0s);
+
   /*
     SCM lists are stacks, so we work from right to left, ending with
     the cancellation signature.
   */
-  int c0p = gh_scm2int (me->get_grob_property ("c0-position"));
-  for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s))
+
+  for (SCM s = newas; gh_pair_p (s); s = ly_cdr (s))
     {
-      SCM what = gh_caar (s);
-      int alter = gh_scm2int (gh_cdar (s));
+      SCM what = ly_caar (s);
+      int alter = gh_scm2int (ly_cdar (s));
       int pos = alteration_pos (what, alter, c0p);
       
-      Molecule m = Font_interface::get_default_font (me)->find_by_name ("accidentals-" + to_str (alter));
+      Molecule m = Font_interface::get_default_font (me)->
+         find_by_name (String ("accidentals-") + style + to_str (alter));
       m.translate_axis (pos * inter, Y_AXIS);
       mol.add_at_edge (X_AXIS, LEFT, m, 0);
     }
@@ -117,15 +135,16 @@ Key_item::brew_molecule (SCM smob)
 
       Molecule natural;
       if (gh_pair_p (old))
-       natural=Font_interface::get_default_font (me)->find_by_name ("accidentals-0");
+       natural=Font_interface::get_default_font (me)->
+           find_by_name (String ("accidentals-") + style + String ("0"));
       
-      for (; gh_pair_p (old); old = gh_cdr (old))
+      for (; gh_pair_p (old); old = ly_cdr (old))
         {
-         SCM found = scm_assoc (gh_caar (old), newas);
+         SCM found = scm_assoc (ly_caar (old), newas);
          if (found == SCM_BOOL_F
-             || gh_cdr (found) != gh_cdar (old))
+             || ly_cdr (found) != ly_cdar (old))
            {
-             SCM what = gh_caar (old);
+             SCM what = ly_caar (old);
              int alter = 0;
              int pos = alteration_pos (what, alter, c0p);
 
@@ -140,10 +159,6 @@ Key_item::brew_molecule (SCM smob)
   return mol.smobbed_copy ();
 }
 
-
-
-
-
 bool
 Key_item::has_interface (Grob*m)
 {