]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/key-item.cc
release: 0.1.9
[lilypond.git] / lily / key-item.cc
index c765fd0206cc55331cd314f5d507a8653d7f0b2f..12276dcbbf8653a20993fb586ffe1ffa818f56ac 100644 (file)
@@ -22,17 +22,18 @@ const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
 
 Key_item::Key_item (int c)
 {
-    breakable_b_ =true;
-    default_b_ = false;
-    set_c_position (c);
+  breakable_b_ =true;
+  default_b_ = false;
+  set_c_position (c);
 }
 
 void
 Key_item::read (Key_engraver const & key_grav_r)
 {
-    assert (!key_grav_r.key_.multi_octave_b_);
-    const Array<int> &idx_arr =key_grav_r.accidental_idx_arr_; 
-    for (int i = 0 ; i< idx_arr.size(); i++) {
+  assert (!key_grav_r.key_.multi_octave_b_);
+  const Array<int> &idx_arr =key_grav_r.accidental_idx_arr_; 
+  for (int i = 0 ; i< idx_arr.size(); i++) 
+    {
        int note = idx_arr[i];
        int acc = ((Key &) key_grav_r.key_).oct (0).acc (note);
 
@@ -43,44 +44,47 @@ Key_item::read (Key_engraver const & key_grav_r)
 void 
 Key_item::set_c_position (int c0)
 {
-    int octaves =(abs (c0) / 7) +1 ;
-    c_position=(c0 + 7*octaves)%7;
+  int octaves =(abs (c0) / 7) +1 ;
+  c_position=(c0 + 7*octaves)%7;
 }
 
 
 void
 Key_item::add (int p, int a)
 {
-    if ((a<0 && p>FLAT_TOP_PITCH) ||
-        (a>0 && p>SHARP_TOP_PITCH)) {
-      p -= 7; /* Typeset below c_position */
+  if ((a<0 && p>FLAT_TOP_PITCH) ||
+      (a>0 && p>SHARP_TOP_PITCH)) 
+        {
+    p -= 7; /* Typeset below c_position */
     }
-    pitch.push (p);
-    acc.push (a);
+  pitch.push (p);
+  acc.push (a);
 }
 
 
 Molecule*
 Key_item::brew_molecule_p()const
 {
-    Molecule*output = new Molecule;
-    Real inter = paper()->internote_f ();
-    
-    for (int i =0; i < pitch.size(); i++) {
+  Molecule*output = new Molecule;
+  Real inter = paper()->internote_f ();
+  
+  for (int i =0; i < pitch.size(); i++) 
+    {
        Symbol s= paper()->lookup_l ()->accidental (acc[i]);
        Atom a (s);
        a.translate ((c_position + pitch[i]) * inter, Y_AXIS);
        Molecule m (a);
        output->add_right (m);  
     }
-    if ( pitch.size()) {
+  if ( pitch.size()) 
+    {
        Molecule m (paper()->lookup_l ()->fill (Box (
        Interval (0, paper()->note_width ()),
        Interval (0,0))));
 
        output->add_right (m);
     }
-    return output;
+  return output;
 }
 
 IMPLEMENT_IS_TYPE_B1(Key_item,Item);
@@ -88,7 +92,8 @@ IMPLEMENT_IS_TYPE_B1(Key_item,Item);
 void 
 Key_item::do_pre_processing()
 {
-    if (default_b_) {
+  if (default_b_) 
+    {
        empty_b_ = transparent_b_ = (break_status_i() != 1);
     }
 }