]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ambitus.cc
* lily/parser.yy (relative_music): whoops. All \relative were off
[lilypond.git] / lily / ambitus.cc
index 5ecf59a459c597368eebe9dda9de3459cf946f71..0421a1e1137567cf911b78359737b57c0d8b98e8 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (C) 2002 Juergen Reuter <reuter@ipd.uka.de>
+  (c) 2002--2003 Juergen Reuter <reuter@ipd.uka.de>
 */
 
 #include "staff-symbol-referencer.hh"
  */
 
 /**
- * Given a pitch and a key_signature, decide what accidentals to show.
- *
- * Possible return values:
- *
- * 0: do not show any accidental
- * 1: show pitch->alteration_ only
- * 2: show pitch->alteration_, preceded by a natural sign
+  Given a pitch and a key_signature, decide what accidentals to show.
+  Possible return values:
+  0: do not show any accidental
+  1: show pitch->alteration_ only
+  2: show pitch->get_alteration, preceded by a natural sign
+
+  UGH: code duplication! See accidental-engraver.
  */
 static int
 number_accidentals (SCM key_signature, Pitch *pitch,
                    bool ignore_octave_b, bool force_accidental)
 {
-  int notename = pitch->notename_;
-  int octave = pitch->octave_;
-  int alteration = pitch->alteration_;
+  int notename = pitch->get_notename ();
+  int octave = pitch->get_octave();
+  int alteration = pitch->get_alteration();
 
   if (force_accidental) // ignore key signature
     return 1;
 
+  
 #if DEBUG_AMBITUS
   scm_display (key_signature, scm_current_output_port ());
 #endif
@@ -67,7 +71,7 @@ number_accidentals (SCM key_signature, Pitch *pitch,
   if (ignore_octave_b)
     prev = ly_assoc_cdr (scm_int2num (notename), key_signature);
   else
-    prev = gh_assoc (gh_cons (scm_int2num (octave), scm_int2num (notename)),
+    prev = scm_assoc (gh_cons (scm_int2num (octave), scm_int2num (notename)),
                     key_signature);
 
   /* should really be true unless prev == SCM_BOOL_F */
@@ -78,7 +82,7 @@ number_accidentals (SCM key_signature, Pitch *pitch,
 
   /* If an accidental was not found */
   if (prev == SCM_BOOL_F)
-    prev = gh_assoc (scm_int2num (notename), key_signature);
+    prev = scm_assoc (scm_int2num (notename), key_signature);
 
   SCM prev_acc = (prev == SCM_BOOL_F) ? scm_int2num (0) : ly_cdr (prev);
   int sig_alteration = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
@@ -101,12 +105,12 @@ add_accidentals (Item *me, Molecule *head, int num_acc,
 {
   if (!num_acc)
     return;
-  if (pitch->alteration_)
+  if (pitch->get_alteration())
     {
       Molecule accidental (Font_interface::get_default_font (me)->
                           find_by_name (String ("accidentals-") +
                                         accidentals_style +
-                                        to_string (pitch->alteration_)));
+                                        to_string (pitch->get_alteration())));
       accidental.translate_axis (yoffs, Y_AXIS);
       head->add_at_edge (X_AXIS,  LEFT, accidental, 0.1, 0);
     }
@@ -146,6 +150,9 @@ Ambitus::brew_molecule (SCM smob)
       return SCM_EOL;
     }
 
+  /*
+    FIXME: Use positions. 
+   */
   int p_min, p_max;
   Pitch *pitch_min = unsmob_pitch (me->get_grob_property ("pitch-min"));
   if (!pitch_min)
@@ -191,8 +198,8 @@ Ambitus::brew_molecule (SCM smob)
   if (to_boolean (me->get_grob_property ("join-heads")) &&
       ((p_max - p_min) >= 3))
     {
-      Real linethickness = me->get_paper ()->get_var ("linethickness");
-      Real blotdiameter = me->get_paper ()->get_var ("blotdiameter");
+      Real linethickness = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
+      Real blotdiameter = me->get_paper ()->get_realvar (ly_symbol2scm ("blotdiameter"));
       Interval x_extent = 0.5 * Interval (-linethickness, +linethickness);
       Interval y_extent = 0.5 * Interval (p_min + 1.35, p_max - 1.35);
       Box line_box (x_extent, y_extent);