source file of the GNU LilyPond music typesetter
- (c) 1996--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 1996--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
TODO: This is way too hairy
dir = get_grob_direction (me);
}
else
- dir = get_default_dir (me);
+ {
+ SCM dd = me->get_property ("default-direction");
+ dir = to_dir (dd);
+ if (!dir)
+ return me->get_property ("neutral-direction");
+ }
return scm_from_int (dir);
}
-/* A separate function, since this is used elsewhere too. */
-Direction
-Stem::get_default_dir (Grob *me)
+MAKE_SCHEME_CALLBACK(Stem, calc_default_direction, 1);
+SCM
+Stem::calc_default_direction (SCM smob)
{
+ Grob *me = unsmob_grob (smob);
+
Direction dir = CENTER;
int staff_center = 0;
Interval hp = head_positions (me);
if (!hp.is_empty ())
{
- int udistance = (int) (UP *hp[UP] - staff_center);
- int ddistance = (int) (DOWN *hp[DOWN] - staff_center);
+ int udistance = (int) (UP * hp[UP] - staff_center);
+ int ddistance = (int) (DOWN * hp[DOWN] - staff_center);
- if (sign (ddistance - udistance))
- dir = Direction (sign (ddistance - udistance));
- else
- dir = to_dir (me->get_property ("neutral-direction"));
+ dir = Direction (sign (ddistance - udistance));
}
- return dir;
+
+ return scm_from_int (dir);
}
-
MAKE_SCHEME_CALLBACK (Stem, height, 1);
SCM
Stem::height (SCM smob)
"avoid-note-head "
"beam "
"beaming "
+ "default-direction "
"details "
"direction "
"duration-log "