]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-column.cc
patch::: 1.3.59.uu2.jcn1
[lilypond.git] / lily / note-column.cc
index 8dca8fc0610632b10737a4d088423cf70256438c..7c1dd5ae9cf481c0079d358102a42535ab487eec 100644 (file)
@@ -7,7 +7,7 @@
 */
 #include <math.h>              // ceil
 
-
+#include "axis-group-interface.hh"
 #include "dot-column.hh"
 #include "note-column.hh"
 #include "beam.hh"
@@ -22,7 +22,7 @@
 bool
 Note_column::rest_b () const
 {
-  SCM r = get_elt_property ("rests");
+  SCM r = get_elt_pointer ("rests");
 
   return gh_pair_p (r);
 }
@@ -38,17 +38,20 @@ Note_column::shift_compare (Note_column *const &p1, Note_column*const&p2)
   return h1 - h2;
 }
 
-Note_column::Note_column()
+Note_column::Note_column( SCM s)
+  : Item (s)
 {
-  set_elt_property ("rests", SCM_EOL);
-  set_elt_property ("note-heads", SCM_EOL);  
-  set_axes (X_AXIS, Y_AXIS);
+  set_elt_pointer ("rests", SCM_EOL);
+  set_elt_pointer ("note-heads", SCM_EOL);  
+  Axis_group_interface (this).set_interface ();
+  Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
+  Group_interface (this, "interfaces").add_thing (ly_symbol2scm ("Note_column"));
 }
 
 Stem *
 Note_column::stem_l () const
 {
-  SCM s = get_elt_property ("stem");
+  SCM s = get_elt_pointer ("stem");
   return dynamic_cast<Stem*> (unsmob_element (s));
 
 }
@@ -61,7 +64,7 @@ Note_column::head_positions_interval() const
 
   iv.set_empty ();
 
-  SCM h = get_elt_property ("note-heads");
+  SCM h = get_elt_pointer ("note-heads");
   for (; gh_pair_p (h); h = gh_cdr (h))
     {
       Score_element *se = unsmob_element (gh_car (h));
@@ -78,7 +81,7 @@ Note_column::dir () const
 {
   if (stem_l ())
     return stem_l ()->get_direction ();
-  else if (gh_pair_p (get_elt_property ("note-heads")))
+  else if (gh_pair_p (get_elt_pointer ("note-heads")))
     return (Direction)sign (head_positions_interval().center ());
 
   programming_error ("Note column without heads and stem!");
@@ -89,10 +92,10 @@ Note_column::dir () const
 void
 Note_column::set_stem (Stem * stem_l)
 {
-  set_elt_property ("stem", stem_l->self_scm_);
+  set_elt_pointer ("stem", stem_l->self_scm_);
 
   add_dependency (stem_l);
-  add_element (stem_l);
+  Axis_group_interface (this).add_element (stem_l);
 }
 
 
@@ -102,15 +105,15 @@ Note_column::add_head (Rhythmic_head *h)
 {
   if (Rest*r=dynamic_cast<Rest *> (h))
     {
-      Group_interface gi (this, "rests");
+      Pointer_group_interface gi (this, "rests");
       gi.add_element (h);
     }
   if (Note_head *nh=dynamic_cast<Note_head *> (h))
     {
-      Group_interface gi (this, "note-heads");
+      Pointer_group_interface gi (this, "note-heads");
       gi.add_element (nh);
     }
-  add_element (h);
+  Axis_group_interface (this).add_element (h);
 }
 
 /**
@@ -119,7 +122,7 @@ Note_column::add_head (Rhythmic_head *h)
 void
 Note_column::translate_rests (int dy_i)
 {
-  SCM s = get_elt_property ("rests");
+  SCM s = get_elt_pointer ("rests");
   for (; gh_pair_p (s); s = gh_cdr (s))
     {
       Score_element * se = unsmob_element (gh_car (s));
@@ -133,7 +136,7 @@ Note_column::translate_rests (int dy_i)
 void
 Note_column::set_dotcol (Dot_column *d)
 {
-  add_element (d);
+  Axis_group_interface (this).add_element (d);
 }
 
 /*
@@ -147,7 +150,7 @@ Note_column::set_dotcol (Dot_column *d)
 */
 
 void
-Note_column::do_post_processing ()
+Note_column::after_line_breaking ()
 {
   if (!stem_l () || !rest_b ())
     return;
@@ -172,14 +175,14 @@ Note_column::do_post_processing ()
     beam_y = gh_scm2double (s);
 
   
-  Real x0 = b->first_visible_stem ()->hpos_f ();
-  Real dx = b->last_visible_stem ()->hpos_f () - x0;
+  Real x0 = b->first_visible_stem ()->relative_coordinate (0, X_AXIS);
+  Real dx = b->last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0;
   Real dydx = beam_dy && dx ? beam_dy/dx : 0;
 
   Direction d = stem_l ()->get_direction ();
-  Real beamy = (stem_l ()->hpos_f () - x0) * dydx + beam_y;
+  Real beamy = (stem_l ()->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y;
 
-  s = get_elt_property ("rests");
+  s = get_elt_pointer ("rests");
   Score_element * se = unsmob_element (gh_car (s));
   Staff_symbol_referencer_interface si (se);
 
@@ -208,7 +211,7 @@ Interval
 Note_column::rest_dim () const
 {
   Interval restdim;
-  SCM s = get_elt_property ("rests");
+  SCM s = get_elt_pointer ("rests");
   for (; gh_pair_p (s); s = gh_cdr (s))
     {
       Score_element * sc = unsmob_element ( gh_car (s));