attaching to stem without heads (eg. a rest).
* lily/stem.cc: remove #'up-to-staff ; use #'stem-end for forcing
up to staff. Add #'rests.
remove #'support-head property
(brew_molecule): small cleanup.
(flag): remove #'grace property.
+2003-09-30 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * lily/slur.cc (get_attachment): do something sensible when
+ attaching to stem without heads (eg. a rest).
+
+ * lily/stem.cc: remove #'up-to-staff ; use #'stem-end for forcing
+ up to staff. Add #'rests.
+ remove #'support-head property
+ (brew_molecule): small cleanup.
+ (flag): remove #'grace property.
+
2003-09-29 Jan Nieuwenhuizen <janneke@gnu.org>
* cygwin/postinstall-lilypond.sh:
* input/regression/bar-scripts.ly (onestaff): raggedright
-v/pri2003-09-28 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+2003-09-28 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* lily/*.cc: remove #if 0'd code in couple of places.
* staffline or not, or shall we use individual font characters
* for both cases?
*/
- bool adjust =
- to_boolean (me->get_grob_property ("adjust-if-on-staffline"));
+ bool adjust
+ = to_boolean (me->get_grob_property ("adjust-if-on-staffline"));
int neutral_pos;
SCM ntr_pos = me->get_grob_property ("neutral-position");
void
Slur::check_slope (Grob *me)
{
-
/*
Avoid too steep slurs.
*/
s = set_extremities (me);
}
- SCM a = dir == LEFT ? ly_car (s) : ly_cdr (s);
+ SCM a = (dir == LEFT) ? ly_car (s) : ly_cdr (s);
Spanner*sp = dynamic_cast<Spanner*> (me);
String str = ly_symbol2string (a);
+
Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me);
Real hs = staff_space / 2.0;
Offset o;
- int slurdir = gh_scm2int (me->get_grob_property ("direction"));
+ Direction slurdir = to_dir (me->get_grob_property ("direction"));
Grob *stem = 0;
if (Note_column::has_interface (sp->get_bound (dir)))
{
Grob * n =sp->get_bound (dir);
- if ((stem = Note_column::get_stem (n)))
+ stem = Note_column::get_stem (n);
+ if (stem)
{
Real x_extent;
- if (Grob *head = Note_column::first_head (n))
+ Grob *head = Note_column::first_head (n);
+ if (head)
x_extent = head->extent (head, X_AXIS).length ();
else
x_extent = n->extent (n, X_AXIS).length ();
- if (str == "head")
+ if (!head)
+ {
+ o = Offset (0, n->extent (n, Y_AXIS)[slurdir]);
+ }
+ else if (str == "head")
{
o = Offset (0, Stem::head_positions (stem)
- [Directional_element_interface::get (me)] * hs);
+ [slurdir] * hs);
/*
Default position is centered in X, on outer side of head Y
*/
o += Offset (0.5 * x_extent,
0.5 * staff_space
- * Directional_element_interface::get (me));
+ * slurdir);
}
else if (str == "alongside-stem")
{
*/
o += Offset (x_extent * (1 + Stem::get_direction (stem)),
0.5 * staff_space
- * Directional_element_interface::get (me));
+ * slurdir);
}
else if (str == "stem")
{
{
Offset off = ly_scm2offset (ly_cdr (l)) * staff_space;
off[X_AXIS] *= dir;
- off[Y_AXIS] *= Directional_element_interface::get (me);
+ off[Y_AXIS] *= slurdir;
o += off;
}
("attachment-offset"),
dir)) * staff_space;
- off[Y_AXIS] *= Directional_element_interface::get (me);
+ off[Y_AXIS] *= slurdir;
o += off;
return o;
}
Grob*
Stem::support_head (Grob*me)
{
- SCM h = me->get_grob_property ("support-head");
- Grob * nh = unsmob_grob (h);
- if (nh)
- return nh;
- else if (head_count (me) == 1)
+ if (head_count (me) == 1)
{
/*
UGH.
n->set_grob_property ("stem", me->self_scm ());
n->add_dependency (me);
+ /*
+ TODO: why not store Rest pointers?
+ */
if (Note_head::has_interface (n))
{
Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), n);
Real
Stem::get_default_stem_end_position (Grob*me)
{
- /* Tab notation feature: make stem end extend out of staff. */
- SCM up_to_staff = me->get_grob_property ("up-to-staff");
- if (to_boolean (up_to_staff))
- {
- int line_count = Staff_symbol_referencer::line_count (me);
- Direction dir = get_direction (me);
- return dir * (line_count + 3.5);
- }
Real ss = Staff_symbol_referencer::staff_space (me);
int durlog = duration_log (me);
- bool grace_b = to_boolean (me->get_grob_property ("grace"));
SCM s;
Array<Real> a;
TODO: change name to extend-stems to staff/center/'()
*/
bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
- if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
+ if (!no_extend_b && dir * st < 0) // junkme?
st = 0.0;
/*
- Real y1;
-
- /*
- This is required to avoid stems passing in tablature chords...
- */
-
-
/*
TODO: make the stem start a direction ?
+
+ This is required to avoid stems passing in tablature chords...
*/
- if (to_boolean (me->get_grob_property ("avoid-note-head")))
- {
- Grob * lh = last_head (me);
- if (!lh)
- return SCM_EOL;
- y1 = Staff_symbol_referencer::get_position (lh);
- }
- else
- {
- Grob * lh = first_head (me);
- if (!lh)
- return SCM_EOL;
- y1 = Staff_symbol_referencer::get_position (lh);
- }
+ Grob *lh = to_boolean (me->get_grob_property ("avoid-note-head"))
+ ? last_head (me) : lh = first_head (me);
+
+ if (!lh)
+ return SCM_EOL;
+ Real y1 = Staff_symbol_referencer::get_position (lh);
Real y2 = stem_end_position (me);
Interval stem_y (y1 <? y2,y2 >? y1);
void
Stem::calc_stem_info (Grob *me)
{
- /* Tab notation feature: make stem end extend out of staff. */
- SCM up_to_staff = me->get_grob_property ("up-to-staff");
- if (to_boolean (up_to_staff))
- {
- int line_count = Staff_symbol_referencer::line_count (me);
- Direction dir = get_direction (me);
- Real ideal_y = dir * (line_count + 1.5);
- Real shortest_y = ideal_y;
-
- me->set_grob_property ("stem-info",
- scm_list_n (gh_double2scm (ideal_y),
- gh_double2scm (shortest_y),
- SCM_UNDEFINED));
- return;
- }
-
Direction my_dir = Directional_element_interface::get (me);
Real staff_space = Staff_symbol_referencer::staff_space (me);
Grob *beam = get_beam (me);
Obviously not for grace beams.
Also, not for knees. Seems to be a good thing. */
- SCM grace = me->get_grob_property ("grace");
- bool grace_b = to_boolean (grace);
bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
bool knee_b = to_boolean (beam->get_grob_property ("knee"));
- if (!grace_b && !no_extend_b && !knee_b)
+ if (!no_extend_b && !knee_b)
{
/* Highest beam of (UP) beam must never be lower than middle
staffline */
these are too many props.
*/
ADD_INTERFACE (Stem,"stem-interface",
- "A stem",
- "tremolo-flag french-beaming up-to-staff avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-free-lengths beamed-extreme-minimum-free-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length flag-style no-stem-extend stroke-style");
+ "A stem",
+ "tremolo-flag french-beaming "
+ "avoid-note-head adjust-if-on-staffline thickness "
+ "stem-info beamed-lengths beamed-minimum-free-lengths "
+ "beamed-extreme-minimum-free-lengths lengths beam stem-shorten "
+ "duration-log beaming neutral-direction stem-end-position "
+ "note-heads direction length flag-style "
+ "no-stem-extend stroke-style ");
(grob-property-description 'stems grob-list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.")
(grob-property-description 'stropha boolean? "is this neume a stropha?.")
(grob-property-description 'style symbol? "a string determining what style of glyph is typeset. Valid choices depend on the function that is reading this property. .")
-(grob-property-description 'support-head ly:grob? "the note head at
-one end of the stem.")
(grob-property-description 'text markup? "Text markup. See the
notation manual for more information.")
(grob-property-description 'thick-thickness number? "thickness, measured in stafflinethickness.")
(grob-property-description 'avoid-note-head boolean? "if set, the stem of a chord does not pass through all note head, but start at the last note head. Used by tablature.")
-(grob-property-description 'up-to-staff boolean? "if set, stems' lengths are set so as stems end out of the staff. Used by tablature.")
-
(grob-property-description 'use-breve-rest boolean? "boolean that
tells multi-measure-rest to use a breve rest to represent the duration
of 1 measure instead of whole rest. It defaults to false. It is set
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(adjust-if-on-staffline . #t)
(font-family . music)
- (avoid-note-head . #f)
- (up-to-staff . #f)
(meta . ((interfaces . (stem-interface font-interface item-interface ))))
))
(define-public (number-pair->string c)
- (string-append (number->string (car c)) " "
- (number->string (cdr c)) " "))
+ (string-append (ly:number->string (car c)) " "
+ (ly:number->string (cdr c)) " "))
(define (font i)
(string-append