]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-symbol-referencer.cc
release: 1.3.9
[lilypond.git] / lily / staff-symbol-referencer.cc
index 4a0a5b7558866846c8ceebd4b84005c5ed6f38be..22b29af5397857dab5258a1f9dd9daaf2d13aeb7 100644 (file)
 
 Staff_symbol_referencer::Staff_symbol_referencer ()
 {
-  staff_sym_l_ =0;
-  position_i_ =0;
+  staff_symbol_l_ =0;
+  position_f_ =0;
 }
 
 void
-Staff_symbol_referencer::do_substitute_element_pointer (Score_element *o, Score_element*n)
+Staff_symbol_referencer::do_substitute_element_pointer (Score_element *o,
+                                                       Score_element*n)
 {
-  if (staff_sym_l_ == o)
+  if (staff_symbol_l_ == o)
     {
-      staff_sym_l_ = dynamic_cast<Staff_symbol*> (n);
+      staff_symbol_l_ = dynamic_cast<Staff_symbol*> (n);
     }
 }
 
 int
 Staff_symbol_referencer::lines_i () const
 {
-  return (staff_sym_l_) ?  staff_sym_l_->no_lines_i_ : 5;
+  return (staff_symbol_l_) ?  staff_symbol_l_->no_lines_i_ : 5;
 }
 
 void
 Staff_symbol_referencer::set_staff_symbol (Staff_symbol*s)
 {
-  staff_sym_l_ =s;
+  staff_symbol_l_ =s;
   add_dependency (s);
 }
 
 Staff_symbol*
 Staff_symbol_referencer::staff_symbol_l () const
 {
-  return staff_sym_l_;
+  return staff_symbol_l_;
 }
 
 Real
 Staff_symbol_referencer::staff_line_leading_f () const
 {
-  if (staff_sym_l_)
-    return  staff_sym_l_->staff_line_leading_f_;
+  if (staff_symbol_l_)
+    return  staff_symbol_l_->staff_line_leading_f_;
   else if (pscore_l_ && paper_l ())
     paper_l ()->get_var ("interline");
  
@@ -61,11 +62,11 @@ Staff_symbol_referencer::staff_line_leading_f () const
 Real
 Staff_symbol_referencer::position_f () const
 {
-  Real p = position_i_;
-  if (staff_sym_l_ )
+  Real p = position_f_;
+  if (staff_symbol_l_ )
     {
-      Graphical_element * c = common_refpoint (staff_sym_l_, Y_AXIS);
-      Real y = relative_coordinate (c, Y_AXIS) - staff_sym_l_->relative_coordinate (c, Y_AXIS);
+      Graphical_element * c = common_refpoint (staff_symbol_l_, Y_AXIS);
+      Real y = relative_coordinate (c, Y_AXIS) - staff_symbol_l_->relative_coordinate (c, Y_AXIS);
 
       p += 2.0 * y / staff_line_leading_f ();
     }
@@ -74,22 +75,26 @@ Staff_symbol_referencer::position_f () const
 
 
 
+/*
+  should use offset callback!
+ */
 void
 Staff_symbol_referencer::do_pre_processing ()
 {
-  translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS);
-  position_i_ =0;
+  translate_axis (position_f_ * staff_line_leading_f () /2.0, Y_AXIS);
+  position_f_ =0;
 }
 
 
 void
-Staff_symbol_referencer::set_position (int p)
+Staff_symbol_referencer::set_position (Real p)
 {
   Real halfspace =  staff_line_leading_f ()* 0.5;
   
   translate_axis (- halfspace * position_f (), Y_AXIS);
-  if (staff_sym_l_)
+  if (staff_symbol_l_)
     translate_axis (halfspace * p, Y_AXIS);
   else
-    position_i_ =   p;
+    position_f_ =   p;
 }
+