]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ambitus.cc
*** empty log message ***
[lilypond.git] / lily / ambitus.cc
index 853b2830b828e8f85a7e7d2691f2ab7cd3b3fb97..b785223ebb7a852abc3dd9498c4f2ec3015ea58b 100644 (file)
@@ -3,13 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2002--2003 Juergen Reuter <reuter@ipd.uka.de>
+  (c) 2002--2004 Juergen Reuter <reuter@ipd.uka.de>
 */
 
 #include "staff-symbol-referencer.hh"
 #include "pitch.hh"
 #include "ambitus.hh"
-#include "molecule.hh"
+#include "stencil.hh"
 #include "note-head.hh"
 #include "item.hh"
 #include "font-interface.hh"
@@ -56,8 +56,8 @@ number_accidentals (SCM key_signature, Pitch *pitch,
                    bool ignore_octave_b, bool force_accidental)
 {
   int notename = pitch->get_notename ();
-  int octave = pitch->get_octave();
-  int alteration = pitch->get_alteration();
+  int octave = pitch->get_octave ();
+  int alteration = pitch->get_alteration ();
 
   if (force_accidental) // ignore key signature
     return 1;
@@ -100,14 +100,14 @@ number_accidentals (SCM key_signature, Pitch *pitch,
 }
 
 void
-add_accidentals (Item *me, Molecule *head, int num_acc,
+add_accidentals (Item *me, Stencil *head, int num_acc,
                 Pitch *pitch, String accidentals_style, Real yoffs)
 {
   if (!num_acc)
     return;
-  if (pitch->get_alteration())
+  if (pitch->get_alteration ())
     {
-      Molecule accidental (Font_interface::get_default_font (me)->
+      Stencil accidental (Font_interface::get_default_font (me)->
                           find_by_name (String ("accidentals-") +
                                         accidentals_style +
                                         to_string (pitch->get_alteration ())));
@@ -116,7 +116,7 @@ add_accidentals (Item *me, Molecule *head, int num_acc,
     }
   if (num_acc == 2)
     {
-      Molecule natural (Font_interface::get_default_font (me)->
+      Stencil natural (Font_interface::get_default_font (me)->
                        find_by_name (String ("accidentals-") +
                                      accidentals_style +
                                      to_string ("0")));
@@ -125,14 +125,14 @@ add_accidentals (Item *me, Molecule *head, int num_acc,
     }
 }
 
-MAKE_SCHEME_CALLBACK (Ambitus,brew_molecule,1);
+MAKE_SCHEME_CALLBACK (Ambitus,print,1);
 SCM
-Ambitus::brew_molecule (SCM smob)
+Ambitus::print (SCM smob)
 {
   Item *me = (Item *)unsmob_grob (smob);
-  Molecule molecule = Molecule ();
+  Stencil stencil = Stencil ();
 
-  SCM scm_note_head_style = me->get_grob_property ("note-head-style");
+  SCM scm_note_head_style = me->get_property ("note-head-style");
   String note_head_style;
   if (gh_symbol_p (scm_note_head_style))
     {
@@ -143,7 +143,7 @@ Ambitus::brew_molecule (SCM smob)
     {
       note_head_style = String ("noteheads-2");
     }
-  if (Font_interface::get_default_font (me)->find_by_name (note_head_style).empty_b ())
+  if (Font_interface::get_default_font (me)->find_by_name (note_head_style).is_empty ())
     {
       String message = "Ambitus: no such note head: `" + note_head_style + "'";
       me->warning (_ (message.to_str0 ()));
@@ -154,20 +154,20 @@ Ambitus::brew_molecule (SCM smob)
     FIXME: Use positions. 
    */
   int p_min, p_max;
-  Pitch *pitch_min = unsmob_pitch (me->get_grob_property ("pitch-min"));
+  Pitch *pitch_min = unsmob_pitch (me->get_property ("pitch-min"));
   if (!pitch_min)
     {
-      me->programming_error("Ambitus: pitch_min undefined; assuming 0");
+      me->programming_error ("Ambitus: pitch_min undefined; assuming 0");
       p_min = 0;
     }
   else
     {
       p_min = pitch_min->steps ();
     }
-  Pitch *pitch_max = unsmob_pitch (me->get_grob_property ("pitch-max"));
+  Pitch *pitch_max = unsmob_pitch (me->get_property ("pitch-max"));
   if (!pitch_max)
     {
-      me->programming_error("Ambitus: pitch_max undefined; assuming 0");
+      me->programming_error ("Ambitus: pitch_max undefined; assuming 0");
       p_max = 0;
     }
   else
@@ -179,7 +179,7 @@ Ambitus::brew_molecule (SCM smob)
       me->programming_error ("Ambitus: reverse range");
     }
 
-  SCM c0 = me->get_grob_property ("c0-position");
+  SCM c0 = me->get_property ("c0-position");
   if (gh_number_p (c0))
     {
       p_min += gh_scm2int (c0);
@@ -187,15 +187,15 @@ Ambitus::brew_molecule (SCM smob)
     }
 
   // create heads
-  Molecule head_min =
+  Stencil head_min =
     Font_interface::get_default_font (me)->find_by_name (note_head_style);
   head_min.translate_axis (0.5*p_min, Y_AXIS);
-  Molecule head_max =
+  Stencil head_max =
     Font_interface::get_default_font (me)->find_by_name (note_head_style);
   head_max.translate_axis (0.5*p_max, Y_AXIS);
 
   // join heads
-  if (to_boolean (me->get_grob_property ("join-heads")) &&
+  if (to_boolean (me->get_property ("join-heads")) &&
       ((p_max - p_min) >= 3))
     {
       Real linethickness = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
@@ -203,9 +203,9 @@ Ambitus::brew_molecule (SCM smob)
       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);
-      Molecule line = Lookup::round_filled_box (line_box, blotdiameter);
+      Stencil line = Lookup::round_filled_box (line_box, blotdiameter);
       line.translate_axis (0.5 * head_min.extent (X_AXIS).length (), X_AXIS);
-      molecule.add_molecule (line);
+      stencil.add_stencil (line);
     }
 
   // add ledger lines
@@ -214,20 +214,20 @@ Ambitus::brew_molecule (SCM smob)
   Real right_ledger_protusion = left_ledger_protusion;
   Interval l_extents = Interval (hd[LEFT] - left_ledger_protusion,
                                 hd[RIGHT] + right_ledger_protusion);
-  Molecule ledger_lines;
+  Stencil ledger_lines;
   int interspaces = Staff_symbol_referencer::line_count (me) - 1;
   ledger_lines =
-    Note_head::brew_ledger_lines (me, p_min, interspaces, l_extents, true);
+    Note_head::brew_ledger_lines (me, p_min, interspaces, l_extents, 0,true);
   ledger_lines.translate_axis (0.5 * p_min, Y_AXIS);
-  molecule.add_molecule (ledger_lines);
+  stencil.add_stencil (ledger_lines);
   ledger_lines =
-    Note_head::brew_ledger_lines (me, p_max, interspaces, l_extents, true);
+    Note_head::brew_ledger_lines (me, p_max, interspaces, l_extents, 0, true);
   ledger_lines.translate_axis (0.5 * p_max, Y_AXIS);
-  molecule.add_molecule (ledger_lines);
+  stencil.add_stencil (ledger_lines);
 
   // add accidentals
-  SCM key_signature = me->get_grob_property ("key-signature");
-  SCM scm_accidentals_style = me->get_grob_property ("accidentals-style");
+  SCM key_signature = me->get_property ("key-signature");
+  SCM scm_accidentals_style = me->get_property ("accidentals-style");
   String accidentals_style;
   if (gh_symbol_p (scm_accidentals_style))
     {
@@ -247,12 +247,12 @@ Ambitus::brew_molecule (SCM smob)
                   accidentals_style, 0.5 * p_max);
 
   // add heads
-  molecule.add_molecule (head_min);
-  molecule.add_molecule (head_max);
+  stencil.add_stencil (head_min);
+  stencil.add_stencil (head_max);
 
-  return molecule.smobbed_copy ();
+  return stencil.smobbed_copy ();
 }
 
 ADD_INTERFACE (Ambitus, "ambitus-interface",
-  "An ambitus represents the pitch range of a voice.",
+  "An object that represents the pitch range of a voice.",
   "c0-position pitch-min pitch-max accidentals note-head-style join-heads");