*/
#include <math.h> // ceil
-
+#include "axis-group-interface.hh"
#include "dot-column.hh"
#include "note-column.hh"
#include "beam.hh"
bool
Note_column::rest_b () const
{
- SCM r = get_elt_property ("rests");
+ SCM r = get_elt_pointer ("rests");
return gh_pair_p (r);
}
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));
}
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));
{
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!");
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);
}
{
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);
}
/**
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));
void
Note_column::set_dotcol (Dot_column *d)
{
- add_element (d);
+ Axis_group_interface (this).add_element (d);
}
/*
*/
void
-Note_column::do_post_processing ()
+Note_column::after_line_breaking ()
{
if (!stem_l () || !rest_b ())
return;
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);
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));