]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.56
authorfred <fred>
Sun, 24 Mar 2002 20:09:40 +0000 (20:09 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:09:40 +0000 (20:09 +0000)
lily/bezier.cc
lily/span-score-bar-grav.cc

index 8c94e4efb60b674db00324d672f83d338b810f6d..657cfea0d720e342f346f1fb314ea8cd7abbc6ad 100644 (file)
@@ -7,6 +7,7 @@
 */
 
 #include <math.h>
+#include "offset.hh"
 #include "bezier.hh"
 #include "dimen.hh"
 #include "paper-def.hh"
@@ -14,7 +15,7 @@
 Bezier::Bezier (int steps_i)
 {
   steps_i_ = steps_i;
-  curve_ = new Point [steps_i_ + 1];
+  curve_ = new Offset [steps_i_ + 1];
 }
 
 Bezier::~Bezier ()
@@ -24,21 +25,21 @@ Bezier::~Bezier ()
 
 //from GNU gs3.33: ega.c
 void
-Bezier::calc (Point control[4])
+Bezier::calc (Offset control[4])
 {       
   Real dt = 1.0 / steps_i_;
-  Real cx = 3.0 * (control[1].x - control[0].x);
-  Real bx = 3.0 * (control[2].x - control[1].x) - cx;
-  Real ax = control[3].x - (control[0].x + cx + bx);
-  Real cy = 3.0 * (control[1].y - control[0].y);
-  Real by = 3.0 * (control[2].y - control[1].y) - cy; 
-  Real ay = control[3].y - (control[0].y + cy + by);
+  Real cx = 3.0 * (control[1].x() - control[0].x());
+  Real bx = 3.0 * (control[2].x() - control[1].x()) - cx;
+  Real ax = control[3].x() - (control[0].x() + cx + bx);
+  Real cy = 3.0 * (control[1].y () - control[0].y ());
+  Real by = 3.0 * (control[2].y () - control[1].y ()) - cy; 
+  Real ay = control[3].y () - (control[0].y () + cy + by);
   Real t = 0.0;
   int i = 0;
   while ( t <= 1.0 )
     {    
-      curve_[i].x = ((ax * t + bx) * t + cx) * t + control[0].x;
-      curve_[i++].y = ((ay * t + by) * t + cy) * t + control[0].y;
+      curve_[i].x() = ((ax * t + bx) * t + cx) * t + control[0].x();
+      curve_[i++].y () = ((ay * t + by) * t + cy) * t + control[0].y ();
       t += dt;
     }
 }
@@ -46,17 +47,17 @@ Bezier::calc (Point control[4])
 Real
 Bezier::y (Real x)
 {
-  if (x <= curve_[0].x)
-    return curve_[0].y;
+  if (x <= curve_[0].x())
+    return curve_[0].y ();
   for (int i = 1; i < steps_i_; i++ )
     {
-      if (x < curve_[i].x)
+      if (x < curve_[i].x())
        {
-         Real lin = (x - curve_[i-1].x) / (curve_[i].x - curve_[i-1].x);
-         return curve_[i-1].y + lin * (curve_[i].y - curve_[i-1].y);
+         Real lin = (x - curve_[i-1].x()) / (curve_[i].x() - curve_[i-1].x());
+         return curve_[i-1].y () + lin * (curve_[i].y () - curve_[i-1].y ());
         }
     }
-  return curve_[steps_i_-1].y;
+  return curve_[steps_i_-1].y ();
 }
 
 
@@ -105,15 +106,19 @@ Bezier_bow::calc (Real dx, Real dy, Real h, Real d)
   // ugh, ugly height hack, see lily-ps-defs.tex
   Real height = (indent + h) * d;
  
-  Point control[4] = {0, 0, indent, height, b - indent, height, b, 0 };
+  Offset control[4];
+  control[0] = Offset(0, 0);
+  control[1] = Offset(indent, height);
+  control[2] = Offset(b - indent, height);
+  control[3] = Offset( b, 0 );
  
   Real phi = dx ? atan (dy/dx) : sign (dy) * pi / 2.0;
   Real sphi = sin (phi);
   Real cphi = cos (phi);
   for (int i = 1; i < 4; i++)
     {
-      control[i].x = cphi * control[i].x - sphi * control[i].y;
-      control[i].y = sphi * control[i].x + cphi * control[i].y;
+      control[i].x() = cphi * control[i].x() - sphi * control[i].y ();
+      control[i].y () = sphi * control[i].x() + cphi * control[i].y ();
     }
   Bezier::calc (control);
 }
index 4d5f57190e4382b858dfcdf5d94ccac54735d581..78f949d1f08df8e76e604b300185ad36fe371b3a 100644 (file)
@@ -42,6 +42,17 @@ Staff_group_bar_engraver::get_span_bar_p () const
   return s;
 }
 
+void
+Staff_group_bar_engraver::acknowledge_element (Score_elem_info f)
+{
+  Span_bar_engraver::acknowledge_element (f);
+  if (f.elem_l_->is_type_b (Piano_brace::static_name ()))
+    {
+      // Piano_brace * brace = (Piano_brace*) f.elem_l_->item ()->bar ();
+      // do something.
+    }
+  
+}
 ADD_THIS_TRANSLATOR (Piano_bar_engraver);
 ADD_THIS_TRANSLATOR (Staff_group_bar_engraver);
 ADD_THIS_TRANSLATOR (Span_score_bar_engraver);