/*
- rhythmic-head.cc -- implement
+ rhythmic-head.cc -- implement Rhythmic_head
source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "rhythmic-head.hh"
#include "lookup.hh"
#include "rest.hh"
#include "dots.hh"
-#include "axis-group-element.hh"
-#include "p-score.hh"
+#include "paper-score.hh"
+#include "stem.hh"
+#include "staff-symbol-referencer.hh"
-void
-Rhythmic_head::do_add_processing ()
+
+Item*
+Rhythmic_head::dots_l () const
{
- if (dots_i_ && !dots_l_)
- {
- Dots *d = new Dots;
- add (d);
- pscore_l_->typeset_element (d);
- axis_group_l_a_[Y_AXIS]->add_element (d);
- axis_group_l_a_[X_AXIS]->add_element (d);
- }
- if (dots_l_)
- {
- dots_l_->no_dots_i_ = dots_i_;
- }
+ SCM s = get_elt_pointer ("dot");
+ return dynamic_cast<Item*> (unsmob_element (s));
}
-void
-Rhythmic_head::add (Dots *dot_l)
+int
+Rhythmic_head::balltype_i () const
{
- dots_l_ = dot_l;
- dot_l->add_dependency (this);
+ SCM s = get_elt_property ("duration-log");
+
+ return gh_number_p (s) ? gh_scm2int (s) : 0;
}
-
-Rhythmic_head::Rhythmic_head ()
+Stem*
+Rhythmic_head::stem_l () const
{
- dots_l_ =0;
- balltype_i_ =0;
- dots_i_ = 0;
+ SCM s = get_elt_pointer ("stem");
+ return dynamic_cast<Stem*> (unsmob_element (s));
}
-void
-Rhythmic_head::do_substitute_dependent (Score_elem*o,Score_elem*n)
+int
+Rhythmic_head::dot_count () const
{
- if (o == dots_l_)
- dots_l_ = n ? (Dots*)n->item () :0;
+ return dots_l ()
+ ? gh_scm2int (dots_l ()->get_elt_property ("dot-count")) : 0;
+}
+
+GLUE_SCORE_ELEMENT(Rhythmic_head,after_line_breaking);
+SCM
+Rhythmic_head::member_after_line_breaking ()
+{
+ if (Item *d = dots_l ())
+ {
+ Staff_symbol_referencer_interface si (d);
+ Staff_symbol_referencer_interface me (d);
+ si.set_position(int (me.position_f ()));
+ }
+
+ return SCM_UNDEFINED;
}
-IMPLEMENT_IS_TYPE_B1(Rhythmic_head, Item);
+
void
-Rhythmic_head::do_print () const
+Rhythmic_head::add_dots (Item *dot_l)
{
-#ifndef NPRINT
- DOUT << "balltype = "<< balltype_i_ << "dots = " << dots_i_;
-#endif
+ set_elt_pointer ("dot", dot_l->self_scm_);
+ dot_l->add_dependency (this);
}
+
+Rhythmic_head::Rhythmic_head (SCM s)
+ : Item (s)
+{
+}