]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.9
authorfred <fred>
Sun, 24 Mar 2002 19:54:18 +0000 (19:54 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:54:18 +0000 (19:54 +0000)
lily/notehead.cc

index 860fee7258dbfb0f66232ae9ec5fb8b43f9c959b..6871240ff97166c38112074f1dab9763dd664cde 100644 (file)
   Separate notehead into 
 
 
-     Rhythmic_head
-       Note_head
-       Rest
+   Rhythmic_head
+     Note_head
+     Rest
 
-     and Stem takes Rhythmic_heads 
+   and Stem takes Rhythmic_heads 
  */
 
 
 Note_head::Note_head (int ss)
 {
-    x_dir_i_ = 0;
-    staff_size_i_=ss;
-    position_i_ = 0;
-    balltype_i_ = 0;
-    dots_i_ = 0;
-    dot_delta_y_i_ = 0;
-    extremal_i_ = 0;
-    rest_b_ = false;
+  x_dir_i_ = 0;
+  staff_size_i_=ss;
+  position_i_ = 0;
+  balltype_i_ = 0;
+  dots_i_ = 0;
+  dot_delta_y_i_ = 0;
+  extremal_i_ = 0;
+  rest_b_ = false;
 }
 
 void
 Note_head::do_pre_processing()
 {
-    // 8 ball looks the same as 4 ball:
-    if (balltype_i_ > 4 && !rest_b_)
-       balltype_i_ = 4;
-       
-    if (rest_b_) { 
-       if (balltype_i_ == 1)
+  // 8 ball looks the same as 4 ball:
+  if (balltype_i_ > 2 && !rest_b_)
+       balltype_i_ = 2;
+       
+  if (rest_b_) 
+    {
+       if (balltype_i_ == 0)
            position_i_ += 6;
-       else if (balltype_i_ == 2)
+       else if (balltype_i_ == 0)
            position_i_ += 4;
     }
 }
@@ -59,10 +60,10 @@ Note_head::do_pre_processing()
 void
 Note_head::set_rhythmic (Rhythmic_req*r_req_l)
 {
-    balltype_i_ = r_req_l->duration_.type_i_;
-    dots_i_ = r_req_l->duration_.dots_i_;
+  balltype_i_ = r_req_l->duration_.durlog_i_;
+  dots_i_ = r_req_l->duration_.dots_i_;
 }
-    
+  
 
 IMPLEMENT_IS_TYPE_B1(Note_head,Item);
 
@@ -70,9 +71,9 @@ void
 Note_head::do_print()const
 {
 #ifndef NPRINT
-    if (rest_b_)
+  if (rest_b_)
        DOUT << "REST! ";
-    DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
+  DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
         << "dots_i_ " << dots_i_;
 #endif
 }
@@ -81,15 +82,15 @@ Note_head::do_print()const
 int
 Note_head::compare (Note_head *const  &a, Note_head * const &b)
 {
-    return a->position_i_ - b->position_i_;
+  return a->position_i_ - b->position_i_;
 }
 
 void
 Note_head::set_dots()
 {
-    if (!(position_i_ %2) && rest_b_ && balltype_i_ == 1)
+  if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0)
        dot_delta_y_i_ = -1;
-    else if (!(position_i_ %2))
+  else if (!(position_i_ %2))
        dot_delta_y_i_ = 1;
 }
 
@@ -99,23 +100,25 @@ Note_head::set_dots()
 Molecule*
 Note_head::brew_molecule_p() const 
 {
-    ((Note_head*)this)->set_dots(); // UGH GUH
-    Molecule*out = 0;
-    Paper_def *p = paper();
-    Real inter_f = p->internote_f();
-    Symbol s;
-
-    // ugh
-    bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
-    
-    if (!rest_b_)
+  ((Note_head*)this)->set_dots(); // UGH GUH
+  Molecule*out = 0;
+  Paper_def *p = paper();
+  Real inter_f = p->internote_f();
+  Symbol s;
+
+  // ugh
+  bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
+  
+  if (!rest_b_)
        s = p->lookup_l()->ball (balltype_i_);
-    else {
+  else 
+    {
        s = p->lookup_l()->rest (balltype_i_, streepjes_b);
     }
-    out = new Molecule (Atom (s));
-    out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS);
-    if (dots_i_) {
+  out = new Molecule (Atom (s));
+  out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS);
+  if (dots_i_) 
+    {
        Symbol d = p->lookup_l()->dots (dots_i_);
        Molecule dm;
        dm.add (Atom (d));
@@ -123,12 +126,14 @@ Note_head::brew_molecule_p() const
        out->add_right (dm);
     }
 
-    
-    if (rest_b_) {
+  
+  if (rest_b_) 
+    {
        streepjes_b = false;
     }
-    
-    if (streepjes_b) {
+  
+  if (streepjes_b) 
+    {
        int dir = sign (position_i_);
        int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
        
@@ -139,8 +144,8 @@ Note_head::brew_molecule_p() const
            sm.translate (-inter_f* dir, Y_AXIS);
        out->add (sm);      
     }
-    
-    out->translate (inter_f*position_i_, Y_AXIS);
-    return out;
+  
+  out->translate (inter_f*position_i_, Y_AXIS);
+  return out;
 }