source file of the GNU LilyPond music typesetter
- (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
+
+ TODO: This is way too hairy
*/
+#include <math.h> // m_pi
+#include "directional-element-interface.hh"
+#include "dimension-cache.hh"
#include "stem.hh"
-#include "dimen.hh"
#include "debug.hh"
#include "paper-def.hh"
#include "note-head.hh"
#include "lookup.hh"
#include "molecule.hh"
-#include "p-col.hh"
+#include "paper-column.hh"
#include "misc.hh"
#include "beam.hh"
#include "rest.hh"
+#include "group-interface.hh"
+#include "cross-staff.hh"
+#include "staff-symbol-referencer.hh"
-const int STEMLEN=7;
-IMPLEMENT_IS_TYPE_B1 (Stem,Item);
-Stem::Stem ()
+void
+Stem::set_beaming (int i, Direction d )
{
- /*
- TODO: staff-size
- */
- abbrev_flag_i_ = 0;
- beam_l_ = 0;
- beams_left_i_ = 0;
- beams_right_i_ = 0;
-
- stem_bottom_f_ = stem_top_f_ = 0;
- flag_i_ = 4;
- dir_ =CENTER;
- staff_size_i_ = 8;
-
- stem_xoffset_f_ =0;
+ SCM pair = get_elt_property ("beaming");
+
+ if (!gh_pair_p (pair))
+ {
+ pair = gh_cons (gh_int2scm (0),gh_int2scm (0));
+ set_elt_property ("beaming", pair);
+ }
+ index_set_cell (pair, d, gh_int2scm (i));
}
int
-Stem::min_head_i () const
+Stem::beam_count (Direction d) const
{
- int m = 1000;
- for (int i =0; i < head_l_arr_.size (); i++)
- m = m <? head_l_arr_[i]->position_i_;
- return m;
+ SCM p=get_elt_property ("beaming");
+ if (gh_pair_p (p))
+ return gh_scm2int (index_cell (p,d));
+ else
+ return 0;
}
-int
-Stem::max_head_i () const
+Interval
+Stem::head_positions () const
{
- int m = -1000;
- for (int i =0; i < head_l_arr_.size (); i++)
- m = m >? head_l_arr_[i]->position_i_;
- return m;
+ if (!heads_i ())
+ {
+ Interval iv;
+ return iv;
+ }
+
-}
+ Drul_array<Note_head*> e (extremal_heads ());
-void
-Stem::do_print () const
-{
-#ifndef NPRINT
- DOUT << "flag "<< flag_i_ << " print_flag? " << !(bool)beam_l_ << "abbrev_flag_i_" << abbrev_flag_i_;
-#endif
+ return Interval (staff_symbol_referencer (e[DOWN]).position_f (),
+ staff_symbol_referencer( e[UP]).position_f ());
}
-Real
-Stem::stem_length_f () const
+
+Real
+Stem::chord_start_f () const
{
- return stem_top_f_-stem_bottom_f_ ;
+ return head_positions()[get_direction ()]
+ * Staff_symbol_referencer_interface (this).staff_space ()/2.0;
}
Real
-Stem::stem_start_f () const
+Stem::stem_end_position () const
{
- return (dir_ < 0)? stem_top_f_ : stem_bottom_f_;
+ SCM p =get_elt_property ("stem-end-position");
+ Real pos;
+ if (!gh_number_p (p))
+ {
+ Stem * me = (Stem*) this;
+ pos = get_default_stem_end_position ();
+ me->set_elt_property ("stem-end-position", gh_double2scm (pos));
+ }
+ else
+ pos = gh_scm2double (p);
+
+ return pos;
}
-Real
-Stem::stem_end_f () const
+Direction
+Stem::get_direction () const
{
- return (dir_ < 0)? stem_bottom_f_ : stem_top_f_;
+ Direction d = directional_element (this).get ();
+
+ if (!d)
+ {
+ Stem * me = (Stem*) this;
+ d = get_default_dir ();
+ // urg, AAARGH!
+ directional_element (me).set (d);
+ }
+ return d ;
}
Stem::set_stemend (Real se)
{
// todo: margins
- if (! ((dir_ > 0 && se >= max_head_i ()) ||
- (se <= min_head_i () && dir_ <0)))
- warning ("Weird stem size; check for narrow beams");
+ Direction d= get_direction ();
+
+ if (d && d * head_positions()[get_direction ()] >= se*d)
+ warning (_ ("Weird stem size; check for narrow beams"));
- stem_top_f_ = (dir_ < 0) ? max_head_i () : se;
- stem_bottom_f_ = (dir_ < 0) ? se : min_head_i ();
+ set_elt_property ("stem-end-position", gh_double2scm (se));
}
-void
-Stem::add (Note_head *n)
+int
+Stem::type_i () const
{
- n->add_dependency (this);
- head_l_arr_.push (n);
+ return first_head () ? first_head ()->balltype_i () : 2;
}
-
-void
-Stem::add (Rest *r)
+
+/*
+ Note head that determines hshift for upstems
+ */
+Score_element*
+Stem::support_head ()const
{
- rest_l_arr_.push (r);
- r->add_dependency (this); // ?
+ SCM h = get_elt_pointer ("support-head");
+ Score_element * nh = unsmob_element (h);
+ if (nh)
+ return nh;
+ else if (heads_i () == 1)
+ {
+ /*
+ UGH.
+ */
+
+ return unsmob_element (gh_car (get_elt_pointer ("heads")));
+ }
+ else
+ return first_head ();
}
-bool
-Stem::invisible_b () const
+
+int
+Stem::heads_i ()const
{
-
- return !head_l_arr_.size () ||
- head_l_arr_[0]->balltype_i_ <= 0;
+ Pointer_group_interface gi (this, "heads");
+ return gi.count ();
+}
+/*
+ The note head which forms one end of the stem.
+ */
+Note_head*
+Stem::first_head () const
+{
+ return extremal_heads ()[-get_direction ()];
}
-// if dir_ is set we return fake values.
+/*
+ START is part where stem reaches `last' head.
+ */
+Drul_array<Note_head*>
+Stem::extremal_heads () const
+{
+ const int inf = 1000000;
+ Drul_array<int> extpos;
+ extpos[DOWN] = inf;
+ extpos[UP] = -inf;
+
+ Drul_array<Note_head *> exthead;
+ exthead[LEFT] = exthead[RIGHT] =0;
+
+ for (SCM s = get_elt_pointer ("heads"); gh_pair_p (s); s = gh_cdr (s))
+ {
+ Note_head * n = dynamic_cast<Note_head*> (unsmob_element (gh_car (s)));
+ Staff_symbol_referencer_interface si (n);
+
+ int p = int(si.position_f ());
-int
-Stem::get_center_distance_from_top ()
+ Direction d = LEFT;
+ do {
+ if (d* p > d* extpos[d])
+ {
+ exthead[d] = n;
+ extpos[d] = p;
+ }
+ } while (flip (&d) != DOWN);
+ }
+
+ return exthead;
+}
+
+void
+Stem::add_head (Rhythmic_head *n)
{
- if (dir_)
- return (dir_ > 0) ? 0 : 1;
+ n->set_elt_pointer ("stem", this->self_scm_);
+ n->add_dependency (this);
+
+ Pointer_group_interface gi (this);
+ if (Note_head *nh = dynamic_cast<Note_head *> (n))
+ gi.name_ = "heads";
+ else
+ gi.name_ = "rests";
- int staff_center = staff_size_i_ / 2;
- int max = max_head_i () - staff_center;
- return max >? 0;
+ gi.add_element (n);
}
-// if dir_ is set we return fake values.
-int
-Stem::get_center_distance_from_bottom ()
+Stem::Stem (SCM s)
+ : Item (s)
{
- if (dir_)
- return (dir_ > 0) ? 1 : 0;
+ set_elt_pointer ("heads", SCM_EOL);
+ set_elt_pointer ("rests", SCM_EOL);
- int staff_center = staff_size_i_ / 2;
- int min = staff_center - min_head_i ();
- return min >? 0;
+ add_offset_callback ( &Stem::off_callback, X_AXIS);
}
-Direction
-Stem::get_default_dir ()
+bool
+Stem::invisible_b () const
{
- if (dir_)
- return dir_;
- return (get_center_distance_from_top () >=
- get_center_distance_from_bottom ()) ?
- (Direction)-1 : (Direction)1;
+ /*
+ UGH. Who determines balltype for stem?
+ */
+ Note_head * nh = dynamic_cast<Note_head*> (support_head ());
+ return !(heads_i () && nh->balltype_i () >= 1);
}
+int
+Stem::get_center_distance (Direction d) const
+{
+ int staff_center = 0;
+ int distance = (int) (d*(head_positions()[d] - staff_center));
+ return distance >? 0;
+}
-void
-Stem::set_default_dir ()
+Direction
+Stem::get_default_dir () const
{
- dir_ = get_default_dir ();
+ int du = get_center_distance (UP);
+ int dd = get_center_distance (DOWN);
+
+ if (sign (dd - du))
+ return Direction (sign (dd -du));
+
+ return Direction (int(paper_l ()->get_var ("stem_default_neutral_direction")));
}
-void
-Stem::set_default_stemlen ()
+/*
+ ugh. A is used for different purposes. This functionality should be
+ moved into scheme at some point to get rid of the silly
+ conversions. (but lets wait till we have namespaces in SCM)
+ */
+Real
+Stem::get_default_stem_end_position () const
{
- if (!dir_)
- set_default_dir ();
-
- // ugh... how about non 5-line staffs?
- bool on_ledger_line_b = ((max_head_i () < -2 && dir_ == 1)
-// || (min_head_i () > staff_size_i_ && dir_ == -1));
- || (min_head_i () > staff_size_i_ + 3 && dir_ == -1));
- if (on_ledger_line_b)
+ bool grace_b = to_boolean (get_elt_property ("grace"));
+ String type_str = grace_b ? "grace-" : "";
+ SCM s;
+ Array<Real> a;
+
+ Real length_f = 0.;
+ SCM scm_len = get_elt_property("length");
+ if (gh_number_p (scm_len))
{
- set_stemend (staff_size_i_ / 2 - 1);
+ length_f = gh_scm2double (scm_len);
}
- else
+ else
{
- Real dy = paper ()->interbeam_f ();
- Real len = STEMLEN;
- // ugh, should get nice *rule* for this
- if (abbrev_flag_i_ > 1)
- len += (abbrev_flag_i_ - 1)* dy / 2;
- set_stemend ((dir_ > 0) ? max_head_i () + len :
- min_head_i () - len);
+ s = scm_eval (ly_symbol2scm ((type_str + "stem-length").ch_C()));
+ for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
+ a.push (gh_scm2double (gh_car (q)));
+
+ // stem uses half-spaces
+ length_f = a[((flag_i () - 2) >? 0) <? (a.size () - 1)] * 2;
}
-}
-void
-Stem::set_default_extents ()
-{
- if (!stem_length_f ())
- set_default_stemlen ();
-
- set_stemend ((dir_< 0) ?
- max_head_i ()-stem_length_f (): min_head_i () +stem_length_f ());
- if (dir_ > 0){
- stem_xoffset_f_ = paper ()->note_width ()-paper ()->rule_thickness ();
- }
- else
- stem_xoffset_f_ = 0;
+
+ a.clear ();
+ s = scm_eval (ly_symbol2scm ((type_str + "stem-shorten").ch_C()));
+ for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
+ a.push (gh_scm2double (gh_car (q)));
+
+
+ // stem uses half-spaces
+
+ // fixme: use gh_list_ref () iso. array[]
+ Real shorten_f = a[((flag_i () - 2) >? 0) <? (a.size () - 1)] * 2;
+
+ /* URGURGURG
+ 'set-default-stemlen' sets direction too
+ */
+ Direction dir = get_direction ();
+ if (!dir)
+ {
+ dir = get_default_dir ();
+ directional_element (this).set (dir);
+ }
+
+ /*
+ stems in unnatural (forced) direction should be shortened,
+ according to [Roush & Gourlay]
+ */
+ if (((int)chord_start_f ())
+ && (get_direction () != get_default_dir ()))
+ length_f -= shorten_f;
+
+
+ Real st = head_positions()[dir] + dir * length_f;
+
+ bool no_extend_b = to_boolean (get_elt_property ("no-stem-extend"));
+ if (!grace_b && !no_extend_b && dir * st < 0)
+ st = 0.0;
+
+ return st;
}
/*
- TODO
-
- move into note_column.cc
+ FIXME: wrong name
+ */
+int
+Stem::flag_i () const
+{
+ SCM s = get_elt_property ("duration-log");
+ return (gh_number_p (s)) ? gh_scm2int (s) : 2;
+}
- */
void
-Stem::set_noteheads ()
+Stem::position_noteheads ()
{
- if (!head_l_arr_.size ())
+ if (!heads_i ())
return;
- head_l_arr_.sort (Note_head::compare);
- if (dir_ < 0)
- head_l_arr_.reverse ();
- head_l_arr_[0]->extremal_i_ = -1;
- head_l_arr_.top ()->extremal_i_ = 1;
- int parity=1;
- int lastpos = head_l_arr_[0]->position_i_;
- for (int i=1; i < head_l_arr_.size (); i ++)
+ Link_array<Score_element> heads =
+ Pointer_group_interface__extract_elements (this, (Score_element*)0, "heads");
+
+ heads.sort (compare_position);
+ Direction dir =get_direction ();
+
+ if (dir < 0)
+ heads.reverse ();
+
+
+ Real w = support_head ()->extent (X_AXIS)[dir];
+ for (int i=0; i < heads.size (); i++)
{
- int dy =abs (lastpos- head_l_arr_[i]->position_i_);
-
- if (dy <= 1)
+ heads[i]->translate_axis (w - heads[i]->extent (X_AXIS)[dir], X_AXIS);
+ }
+
+ bool parity= true; // todo: make this settable.
+ int lastpos = int (Staff_symbol_referencer_interface (heads[0]).position_f ());
+ for (int i=1; i < heads.size (); i ++)
+ {
+ Real p = Staff_symbol_referencer_interface (heads[i]).position_f ();
+ int dy =abs (lastpos- (int)p);
+
+ if (dy <= 1)
{
if (parity)
- head_l_arr_[i]->x_dir_ = (stem_xoffset_f_>0) ? UP:DOWN;
+ {
+ Real l = heads[i]->extent (X_AXIS).length ();
+ heads[i]->translate_axis (l * get_direction (), X_AXIS);
+ }
parity = !parity;
}
else
- parity = 0;
- lastpos = head_l_arr_[i]->position_i_;
+ parity = true;
+
+ lastpos = int (p);
+ }
+}
+
+void
+Stem::before_line_breaking ()
+{
+ stem_end_position (); // ugh. Trigger direction calc.
+ position_noteheads ();
+
+ if (invisible_b ())
+ {
+ remove_elt_property ("molecule-callback");
+ // suicide();
}
+
+ set_spacing_hints ();
}
+
+
+/**
+ set stem directions for hinting the optical spacing correction.
+
+ Modifies DIR_LIST property of the Stem's Paper_column
+
+ TODO: more advanced: supply height of noteheads as well, for more advanced spacing possibilities
+ */
void
-Stem::do_pre_processing ()
+Stem::set_spacing_hints ()
{
- if (stem_bottom_f_== stem_top_f_)
- set_default_extents ();
- set_noteheads ();
- flag_i_ = dir_ * abs (flag_i_);
- transparent_b_ = invisible_b ();
- empty_b_ = invisible_b ();
+ if (!invisible_b ())
+ {
+ SCM scmdir = gh_int2scm (get_direction ());
+ SCM dirlist = column_l ()->get_elt_property ("dir-list");
+ if (dirlist == SCM_UNDEFINED)
+ dirlist = SCM_EOL;
+
+ if (scm_sloppy_memq (scmdir, dirlist) == SCM_EOL)
+ {
+ dirlist = gh_cons (scmdir, dirlist);
+ column_l ()->set_elt_property ("dir-list", dirlist);
+ }
+ }
}
+Molecule
+Stem::flag () const
+{
+ String style;
+ SCM st = get_elt_property ("flag-style");
+ if ( gh_string_p (st))
+ {
+ style = ly_scm2string (st);
+ }
+
+ char c = (get_direction () == UP) ? 'u' : 'd';
+ Molecule m = lookup_l ()->afm_find (String ("flags-") + to_str (c) +
+ to_str (flag_i ()));
+ if (!style.empty_b ())
+ m.add_molecule(lookup_l ()->afm_find (String ("flags-") + to_str (c) + style));
+ return m;
+}
Interval
-Stem::do_width () const
+Stem::dim_callback (Score_element const *se, Axis )
{
- if (beam_l_ || abs (flag_i_) <= 4)
- return Interval (0,0); // TODO!
- Paper_def*p= paper ();
- Interval r (p->lookup_l ()->flag (flag_i_).dim.x ());
- r+= stem_xoffset_f_;
+ Stem * s = dynamic_cast<Stem*> ((Score_element*)se);
+
+ Interval r (0, 0);
+ if (unsmob_element (s->get_elt_pointer ("beam")) || abs (s->flag_i ()) <= 2)
+ ; // TODO!
+ else
+ {
+ r = s->flag ().extent (X_AXIS);
+ }
return r;
}
+const Real ANGLE = 20* (2.0*M_PI/360.0); // ugh! Should be settable.
+
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACKS(Stem)
+Molecule
+Stem::do_brew_molecule () const
+{
+ Molecule mol;
+
+ Staff_symbol_referencer_interface si (first_head ());
- Molecule
- Stem::abbrev_mol () const
- {
- Real dy = paper ()->interbeam_f ();
- Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length ();
- Real beamdy = paper ()->interline_f () / 2;
-
- int beams_i = 0;
- Real slope = paper ()->internote_f () / 4;
-
- if (beam_l_) {
- // huh?
- slope = 2 * beam_l_->slope;
- // ugh, rather calc from Abbreviation_req
- beams_i = beams_right_i_ >? beams_left_i_;
- }
- paper ()->lookup_l ()->beam (slope, 20 PT);
-
- Molecule beams;
- Atom a (paper ()->lookup_l ()->beam (slope, w));
- a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope)));
- // ugh
- if (!beams_i)
- a.translate (dy + beamdy - dir_ * dy, Y_AXIS);
- else
- a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS);
-
- for (int i = 0; i < abbrev_flag_i_; i++)
- {
- Atom b (a);
- b.translate (-dir_ * dy * (beams_i + i), Y_AXIS);
- beams.add (b);
- }
-
- return beams;
- }
-
-Molecule*
-Stem::brew_molecule_p () const
+ Real y1 = si.position_f();
+ Real y2 = stem_end_position ();
+
+ Interval stem_y(y1,y2);
+ stem_y.unite (Interval (y2,y1));
+
+ Real dy = staff_symbol_referencer (this).staff_space ()/2.0;
+ Real head_wid = 0;
+ if (support_head ())
+ head_wid = support_head ()->extent (X_AXIS).length ();
+ stem_y[Direction(-get_direction ())] += get_direction () * head_wid * tan(ANGLE)/(2*dy);
+
+ if (!invisible_b ())
+ {
+ Real stem_width = paper_l ()->get_var ("stemthickness");
+ Molecule ss =lookup_l ()->filledbox (Box (Interval (-stem_width/2, stem_width/2),
+ Interval (stem_y[DOWN]*dy, stem_y[UP]*dy)));
+ mol.add_molecule (ss);
+ }
+
+ if (!beam_l () && abs (flag_i ()) > 2)
+ {
+ Molecule fl = flag ();
+ fl.translate_axis(stem_y[get_direction ()]*dy, Y_AXIS);
+ mol.add_molecule (fl);
+ }
+
+ return mol;
+}
+
+Real
+Stem::off_callback (Score_element const* se, Axis)
{
- Molecule *mol_p =new Molecule;
+ Stem *st = dynamic_cast<Stem*> ((Score_element*)se);
+
+ Real r=0;
+ if (Note_head * f = st->first_head ())
+ {
+ Interval head_wid(0, f->extent (X_AXIS).length ());
+
+ if (to_boolean (st->get_elt_property ("stem-centered")))
+ return head_wid.center ();
- Real bot = stem_bottom_f_;
- Real top = stem_top_f_;
-
- assert (bot!=top);
-
- Paper_def *p =paper ();
+ Real rule_thick = st->paper_l ()->get_var ("stemthickness");
+ Direction d = st->get_direction ();
+ r = head_wid[d] - d * rule_thick ;
+ }
+ return r;
+}
- Real dy = p->internote_f ();
- if (!invisible_b ())
+
+
+Beam*
+Stem::beam_l ()const
+{
+ SCM b= get_elt_pointer ("beam");
+ return dynamic_cast<Beam*> (unsmob_element (b));
+}
+
+
+// ugh still very long.
+Stem_info
+Stem::calc_stem_info () const
+{
+ assert (beam_l ());
+
+ Direction beam_dir = directional_element (beam_l ()).get ();
+ if (!beam_dir)
{
- Symbol ss =p->lookup_l ()->stem (bot*dy,top*dy);
- mol_p->add (Atom (ss));
+ programming_error ("Beam dir not set.");
+ beam_dir = UP;
}
+
+ Staff_symbol_referencer_interface st (this);
+ Real staff_space = st.staff_space ();
+ Real half_space = staff_space / 2;
+ Real interbeam_f = paper_l ()->interbeam_f (beam_l ()->get_multiplicity ());
+ Real thick = gh_scm2double (beam_l ()->get_elt_property ("beam-thickness"));
+ int multiplicity = beam_l ()->get_multiplicity ();
+
+ Stem_info info;
+ info.idealy_f_ = chord_start_f ();
+
+ // for simplicity, we calculate as if dir == UP
+ info.idealy_f_ *= beam_dir;
+ SCM grace_prop = get_elt_property ("grace");
+
+ bool grace_b = to_boolean (grace_prop);
- if (!beam_l_ &&abs (flag_i_) > 4)
+ Array<Real> a;
+ SCM s;
+ String type_str = grace_b ? "grace-" : "";
+
+ s = scm_eval (ly_symbol2scm ((type_str + "beamed-stem-minimum-length").ch_C()));
+ a.clear ();
+ for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
+ a.push (gh_scm2double (gh_car (q)));
+
+
+ Real minimum_length = a[multiplicity <? (a.size () - 1)] * staff_space;
+ s = scm_eval (ly_symbol2scm ((type_str + "beamed-stem-length").ch_C()));
+
+ a.clear();
+ for (SCM q = s; q != SCM_EOL; q = gh_cdr (q))
+ a.push (gh_scm2double (gh_car (q)));
+
+ Real stem_length = a[multiplicity <? (a.size () - 1)] * staff_space;
+
+ if (!beam_dir || (beam_dir == directional_element (this).get ()))
+ /* normal beamed stem */
{
- Symbol fl = p->lookup_l ()->flag (flag_i_);
- Molecule m (fl);
- if (flag_i_ < -4)
+ if (multiplicity)
{
- mol_p->add_at_edge (Y_AXIS, DOWN, m);
+ info.idealy_f_ += thick + (multiplicity - 1) * interbeam_f;
}
- else if (flag_i_ > 4)
+ info.miny_f_ = info.idealy_f_;
+ info.maxy_f_ = INT_MAX;
+
+ info.idealy_f_ += stem_length;
+ info.miny_f_ += minimum_length;
+
+ /*
+ lowest beam of (UP) beam must never be lower than second staffline
+
+ Hmm, reference (Wanske?)
+
+ Although this (additional) rule is probably correct,
+ I expect that highest beam (UP) should also never be lower
+ than middle staffline, just as normal stems.
+
+ */
+ bool no_extend_b = to_boolean (get_elt_property ("no-stem-extend"));
+ if (!grace_b && !no_extend_b)
{
- mol_p->add_at_edge (Y_AXIS, UP, m);
+ /* highest beam of (UP) beam must never be lower than middle
+ staffline
+ lowest beam of (UP) beam must never be lower than second staffline
+ */
+ info.miny_f_ =
+ info.miny_f_ >? 0
+ >? (- 2 * half_space - thick
+ + (multiplicity > 0) * thick
+ + interbeam_f * (multiplicity - 1));
}
- else
- assert (false);
- assert (!abbrev_flag_i_);
- }
+ }
+ else
+ /* knee */
+ {
+ info.idealy_f_ -= thick;
+ info.maxy_f_ = info.idealy_f_;
+ info.miny_f_ = -INT_MAX;
- if (abbrev_flag_i_)
- mol_p->add (abbrev_mol ());
+ info.idealy_f_ -= stem_length;
+ info.maxy_f_ -= minimum_length;
+ }
- mol_p->translate (stem_xoffset_f_, X_AXIS);
- return mol_p;
-}
+ info.idealy_f_ = (info.maxy_f_ <? info.idealy_f_) >? info.miny_f_;
-Real
-Stem::hpos_f () const
-{
- return Item::hpos_f () + stem_xoffset_f_;
-}
+ s = beam_l ()->get_elt_property ("shorten");
+ if (gh_number_p (s))
+ info.idealy_f_ -= gh_double2scm (s);
+ Real interstaff_f = -beam_dir* calc_interstaff_dist (this, beam_l ());
-void
-Stem::do_substitute_dependency (Score_elem*o,Score_elem*n)
-{
- Item * o_l = o->item ();
- Item * n_l = n? n->item () : 0;
- head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
- rest_l_arr_.substitute ((Rest*)o_l, (Rest*)n_l);
+ info.idealy_f_ += interstaff_f;
+ info.miny_f_ += interstaff_f;
+ info.maxy_f_ += interstaff_f ;
+
+ return info;
}
+