From: fred Date: Tue, 26 Mar 2002 23:57:10 +0000 (+0000) Subject: lilypond-1.3.96 X-Git-Tag: release/1.5.59~1247 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=108e53d129c6d0502a0d124242503774e6fec32f;p=lilypond.git lilypond-1.3.96 --- diff --git a/input/scarlatti-properties.ly b/input/scarlatti-properties.ly index 4dc3154eaa..b364b406d2 100644 --- a/input/scarlatti-properties.ly +++ b/input/scarlatti-properties.ly @@ -3,20 +3,32 @@ \version "1.3.93"; -rh=\property Thread.noteHeadStyle=##f -lh=\property Thread.noteHeadStyle = #'diamond -n=\property Thread.fontSize=#0 -sm=\property Thread.fontSize=#-1 +rh=\property Thread.NoteHead \push #'style = #'default +lh=\property Thread.NoteHead \push #'style = #'diamond + +n = \property Thread.NoteHead \pop #'font-size % = #'diamond %\property Thread.fontSize=#0 +sm=\property Thread.NoteHead \push #'font-size = #-1 + % su=\property Voice.verticalDirection=#1 % sd=\property Voice.verticalDirection=#-1 su=\property Voice.Stem \push #'direction = #1 sd=\property Voice.Stem \push #'direction = #-1 -zs=\property Voice.forceHorizontalShift=#0.0 + +%{ ls=\property Voice.forceHorizontalShift=#-0.6 sls=\property Voice.forceHorizontalShift=#-0.22 rs=\property Voice.forceHorizontalShift=#0.6 srs=\property Voice.forceHorizontalShift=#0.22 +%} +zs = \property Voice.NoteColumn \pop #'force-hshift % #0.0 +ls = \property Voice.NoteColumn \push #'force-hshift = #-0.6 +sls= \property Voice.NoteColumn \push #'force-hshift = #-0.22 +rs = \property Voice.NoteColumn \push #'force-hshift = #0.6 +srs= \property Voice.NoteColumn \push #'force-hshift = #0.22 + + + ab=\property Voice.noAutoBeaming=##f xb=\property Voice.noAutoBeaming=##t diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 8bc3f13f25..12c8683d78 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -54,7 +54,7 @@ Align_interface::do_side_processing (Score_element * me, Axis a) = Pointer_group_interface__extract_elements ( me, (Score_element*) 0, "elements"); for (int i=0; i < all_elts.size(); i++) { - Interval y = all_elts[i]->extent(a) + all_elts[i]->relative_coordinate (me, a); + Interval y = all_elts[i]->extent(me, a); if (!y.empty_b()) { Score_element *e =dynamic_cast(all_elts[i]); diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index b8d87a0112..1ffdb1325c 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -87,7 +87,7 @@ Break_align_interface::do_alignment (Score_element *me) for (int i=0; i < all_elems.size(); i++) { - Interval y = all_elems[i]->extent(X_AXIS); + Interval y = all_elems[i]->extent(all_elems[i], X_AXIS); if (!y.empty_b()) elems.push (dynamic_cast (all_elems[i])); } @@ -175,13 +175,13 @@ Break_align_interface::do_alignment (Score_element *me) Real pre_space = elems[0]->relative_coordinate (column, X_AXIS); - Real xl = elems[0]->extent (X_AXIS)[LEFT]; + Real xl = elems[0]->extent (elems[0],X_AXIS)[LEFT]; if (!isinf (xl)) pre_space += xl; else programming_error ("Infinity reached. "); - Real xr = elems.top ()->extent (X_AXIS)[RIGHT]; + Real xr = elems.top ()->extent (elems.top (), X_AXIS)[RIGHT]; Real spring_len = elems.top ()->relative_coordinate (column, X_AXIS); if (!isinf (xr)) spring_len += xr; diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 616e431253..3e021dbc02 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -15,73 +15,34 @@ #include "debug.hh" #include "paper-column.hh" -void -Crescendo::set_interface (Score_element*s) -{ - s->set_elt_property ("dynamic-drul", gh_cons (SCM_EOL, SCM_EOL)); -} - - - -MAKE_SCHEME_CALLBACK(Crescendo,brew_molecule,1); - -/* - - TODO: - - * should span the crescendo on any dynamic-text items, and - calculate their dimensions to determine shortening; junk shortening - code and related elt props. - - * separate the dashed-line version and the hairpin version into two - brew_molecule functions. +MAKE_SCHEME_CALLBACK (Crescendo, brew_molecule, 1); - * generalise dashed-line into generic text spanner, for ottava, accelerando, etc. - - -*/ SCM Crescendo::brew_molecule (SCM smob) { Score_element *me= unsmob_element (smob); - Spanner * sp = dynamic_cast(me); - Real ss = me->paper_l ()->get_var ("staffspace"); - Real sl = me->paper_l ()->get_var ("stafflinethickness"); + Spanner *span = dynamic_cast(me); + Real staff_space = me->paper_l ()->get_var ("staffspace"); + Real line = me->paper_l ()->get_var ("stafflinethickness"); - Real absdyn_dim = gh_scm2double (me->get_elt_property ("shorten-for-letter")); - Real extra_left = sp->get_broken_left_end_align (); + Real broken_left = span->get_broken_left_end_align (); - SCM dir = me->get_elt_property("grow-direction"); - SCM dyns = me->get_elt_property ("dynamic-drul"); - - if (!isdir_b (dir) || !gh_pair_p (dyns)) + SCM s = me->get_elt_property("grow-direction"); + if (!isdir_b (s)) { me->suicide (); return SCM_EOL; } - Direction gd = to_dir (dir); + Direction grow_dir = to_dir (s); - bool dynleft= unsmob_element (gh_car (dyns)); - bool dynright = unsmob_element (gh_cdr (dyns)); - - if (dynleft) - extra_left += absdyn_dim; - - Real width = sp->spanner_length()- sp->get_broken_left_end_align (); - - if (dynleft) - { - width -= absdyn_dim; - } - if (dynright) - { - width -= absdyn_dim; - } + Real width = span->spanner_length (); + width -= span->get_broken_left_end_align (); if (width < 0) { - warning (_ ("crescendo") + " " + _ ("too small")); + warning (_ ((grow_dir < 0) ? "decrescendo too small" + : "crescendo too small")); width = 0; } @@ -89,68 +50,28 @@ Crescendo::brew_molecule (SCM smob) Direction d = LEFT; do { - Paper_column* s = dynamic_cast(sp->get_bound (d)); // UGH + Paper_column* s = dynamic_cast (span->get_bound (d)); // UGH broken[d] = (!s->musical_b ()); } while (flip (&d) != LEFT); - - Molecule m; + bool continued = broken[Direction (-grow_dir)]; + Real height = staff_space * gh_scm2double (me->get_elt_property ("height")); + Real thick = line * gh_scm2double (me->get_elt_property ("thickness")); - Real pad = 0; - SCM s = me->get_elt_property ("start-text"); - if (gh_string_p (s)) - { - Molecule start_text (me->lookup_l ()->text ("italic", - ly_scm2string (s), - me->paper_l ())); - m.add_molecule (start_text); - - pad = me->paper_l ()->get_var ("staffspace") / 2; // ugh. - - width -= start_text.extent (X_AXIS).length (); - width -= pad; - width = width >? 0; - } - - SCM at; - s =me->get_elt_property ("spanner"); - Real height; - - if (gh_string_p (s) && ly_scm2string (s) == "dashed-line") - { - Real thick = gh_scm2double (me->get_elt_property ("dash-thickness")) * sl ; - Real dash = gh_scm2double (me->get_elt_property ("dash-length")) * ss; - - height = thick; - at = gh_list (ly_symbol2scm (ly_scm2string (s).ch_C ()), - gh_double2scm (thick), - gh_double2scm (dash), - gh_double2scm (width), - SCM_UNDEFINED); - } - else - { - bool continued = broken[Direction (-gd)]; - height = ss * gh_scm2double (me->get_elt_property ("height")); - Real thick = sl * gh_scm2double (me->get_elt_property ("thickness")); - - const char* hairpin = (gd < 0)? "decrescendo" : "crescendo"; - - at = gh_list (ly_symbol2scm (hairpin), + const char* type = (grow_dir < 0) ? "decrescendo" : "crescendo"; + SCM hairpin = gh_list (ly_symbol2scm (type), gh_double2scm (thick), gh_double2scm (width), gh_double2scm (height), gh_double2scm (continued ? height/2 : 0.0), SCM_UNDEFINED); - } - Box b (Interval (0, width), Interval (-2*height, 2*height)); - Molecule span (b, at); - m.add_at_edge (X_AXIS, RIGHT, span, pad); - m.translate_axis (extra_left, X_AXIS); + Box b (Interval (0, width), Interval (-2*height, 2*height)); + Molecule mol (b, hairpin); + mol.translate_axis (broken_left, X_AXIS); - return m.create_scheme (); + return mol.create_scheme (); } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index a1fc434742..d7bc14459f 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -107,6 +107,9 @@ Dynamic_engraver::do_try_music (Music * m) if (line_spanner_) line_spanner_->suicide (); line_spanner_ = 0; + if (cresc_p_) + cresc_p_->suicide (); + cresc_p_ = 0; } else if ((s->span_type_str_ == "crescendo" || s->span_type_str_ == "decrescendo")) @@ -225,64 +228,49 @@ Dynamic_engraver::do_process_music () else { current_cresc_req_ = accepted_spanreqs_drul_[START]; - cresc_p_ = new Spanner (get_property ("Crescendo")); - Crescendo::set_interface (cresc_p_); - cresc_p_->set_elt_property - ("grow-direction", - gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo") - ? BIGGER : SMALLER)); - - SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C()); - if (gh_string_p (s)) - { - cresc_p_->set_elt_property ("start-text", s); - daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_ - + "Text", SCM_UNDEFINED); - } - - s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C()); - /* TODO: Use symbols. */ - if (gh_string_p (s)) //&& ly_scm2string (s) != "hairpin") + SCM s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner").ch_C()); + + if (!gh_string_p (s) || ly_scm2string (s) == "hairpin") + { + cresc_p_ = new Spanner (get_property ("Crescendo")); + cresc_p_->set_elt_property ("grow-direction", + gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo") + ? BIGGER : SMALLER)); + + } + /* + This is a convenient (and legacy) interface to TextSpanners + for use in (de)crescendi. + Hmm. + */ + else { - cresc_p_->set_elt_property ("spanner", s); + cresc_p_ = new Spanner (get_property ("TextSpanner")); + cresc_p_->set_elt_property ("type", s); daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_ + "Spanner", SCM_UNDEFINED); + s = get_property ((accepted_spanreqs_drul_[START]->span_type_str_ + "Text").ch_C()); + if (gh_string_p (s)) + { + cresc_p_->set_elt_property ("edge-text", + gh_cons (s, ly_str02scm (""))); + daddy_trans_l_->set_property (accepted_spanreqs_drul_[START]->span_type_str_ + + "Text", SCM_UNDEFINED); + } } - + Score_element *cc = unsmob_element (get_property ("currentMusicalColumn")); cresc_p_->set_bound (LEFT, cc); - - /* - We know how wide the text is, if we can be sure that the - text already has relevant pointers into the paperdef, - and it has its font-size property set. - - Since font-size may be set by a context higher up, we - can not be sure of the size. - - - We shouldn't try to do this stuff here, the Item should - do it when the score is finished. We could maybe - set a callback to have the Item do the alignment if - it is not a special symbol, like Crescendo. - */ - - if (text_p_) { - index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"), - LEFT, text_p_->self_scm ()); - - if (finished_cresc_p_ - // I don't see why, but we need this check - && gh_pair_p (finished_cresc_p_->get_elt_property ("dynamic-drul"))) - index_set_cell (finished_cresc_p_->get_elt_property ("dynamic-drul"), - RIGHT, text_p_->self_scm ()); + Side_position::set_direction (text_p_, LEFT); + Side_position::set_axis (text_p_, X_AXIS); + Side_position::add_support (text_p_, cresc_p_); } Axis_group_interface::add_element (line_spanner_, cresc_p_); diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index eb64b7d134..3ff71c7743 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -37,9 +37,7 @@ Hyphen_spanner::brew_molecule (SCM smob) do { - Real x = sp->get_bound (d)->relative_coordinate (common, X_AXIS); - Interval ext = sp->get_bound (d)->extent (X_AXIS); - bounds[d] = (x + ext[-d]); + bounds[d] = sp->get_bound (d)->extent (common, X_AXIS)[-d]; } while (flip (&d) != LEFT); diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index e7e4a16c52..0fe05d8396 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -19,8 +19,7 @@ struct Crescendo { public: - DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM )); - static void set_interface(Score_element*); + DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); static bool has_interface (Score_element*); }; diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 99742defe0..81fa3115fc 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -18,8 +18,8 @@ for administration of what was done already */ enum Score_element_status { - ORPHAN=0, // not yet added to pstaff - VIRGIN, // added to pstaff + ORPHAN=0, // not yet added to Paper_score + VIRGIN, PRECALCING, PRECALCED, // calcs before spacing done POSTCALCING, // busy calculating. This is used to trap cyclic deps. @@ -152,7 +152,8 @@ public: public: bool empty_b (Axis a) const; - Interval extent (Axis) const; + + Interval extent (Score_element * refpoint, Axis) const; /** translate in one direction diff --git a/lily/include/spaceable-element.hh b/lily/include/spaceable-element.hh index 9b71907707..577f8902e1 100644 --- a/lily/include/spaceable-element.hh +++ b/lily/include/spaceable-element.hh @@ -12,6 +12,7 @@ #include "lily-guile.hh" #include "lily-proto.hh" + /* properties : @@ -21,7 +22,6 @@ dir-list -- list of stem directions. */ - struct Spaceable_element { /// set a minimum distance diff --git a/lily/include/text-spanner.hh b/lily/include/text-spanner.hh new file mode 100644 index 0000000000..34f4432b96 --- /dev/null +++ b/lily/include/text-spanner.hh @@ -0,0 +1,22 @@ +/* + text-spanner.hh -- declare Text_spanner + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + + +#ifndef TEXT_SPANNER_HH +#define TEXT_SPANNER_HH + +#include "lily-guile.hh" + +class Text_spanner +{ +public: + DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); + static bool has_interface (Score_element*); +}; + +#endif /* TEXT_SPANNER_HH */ diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index fb09d42307..744e3d6e21 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -21,8 +21,10 @@ SCM Lyric_extender::brew_molecule (SCM smob) { Spanner *sp = dynamic_cast (unsmob_element (smob)); - - Real leftext = sp->get_bound (LEFT)->extent (X_AXIS).length (); + + // ugh: refp + Real leftext = sp->get_bound (LEFT)->extent (sp->get_bound (LEFT), + X_AXIS).length (); Real ss = sp->paper_l ()->get_var ("staffspace"); Real sl = sp->paper_l ()->get_var ("stafflinethickness"); Real righttrim = 0.5; // default to half a staffspace gap on the right diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 43ef9b974a..a1f329fc37 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -128,7 +128,7 @@ Spacing_spanner::do_measure (Score_element*me, Link_array cols) } else { - Interval ext (rc->extent (X_AXIS)); + Interval ext (rc->extent (rc, X_AXIS)); right_dist = ext.empty_b() ? 0.0 : - ext [LEFT]; } @@ -186,7 +186,7 @@ Real Spacing_spanner::default_bar_spacing (Score_element*me, Score_element *lc, Score_element *rc, Moment shortest) { - Real symbol_distance = lc->extent (X_AXIS)[RIGHT] ; + Real symbol_distance = lc->extent (lc,X_AXIS)[RIGHT] ; Real durational_distance = 0; Moment delta_t = Paper_column::when_mom (rc) - Paper_column::when_mom (lc); diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 2db2edad8a..46d14dcfea 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -126,8 +126,11 @@ Stem_tremolo::brew_molecule (SCM smob) */ Real whole_note_correction; if (Stem::invisible_b (stem )) - whole_note_correction = -Stem::get_direction (stem ) - * Stem::support_head (stem )->extent (X_AXIS).length () / 2; + { + Score_element *hed = Stem::support_head (stem ); + whole_note_correction = -Stem::get_direction (stem ) + *hed->extent (hed, X_AXIS).length () / 2; + } else whole_note_correction = 0; diff --git a/lily/syllable-group.cc b/lily/syllable-group.cc index f1438f69f8..66dc8830c4 100644 --- a/lily/syllable-group.cc +++ b/lily/syllable-group.cc @@ -67,9 +67,9 @@ Syllable_group::add_lyric(Score_element * lyric) lyric_list_.push(lyric); /* record longest and shortest lyrics */ if( longest_lyric_l_ ) { - if(lyric->extent(X_AXIS).length() > (longest_lyric_l_->extent(X_AXIS)).length()) + if(lyric->extent(lyric,X_AXIS).length() > (longest_lyric_l_->extent(longest_lyric_l_, X_AXIS)).length()) longest_lyric_l_ = lyric; - if(lyric->extent(X_AXIS).length() < (shortest_lyric_l_->extent(X_AXIS)).length()) + if(lyric->extent(lyric, X_AXIS).length() < (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length()) shortest_lyric_l_ = lyric; } else @@ -90,7 +90,7 @@ Syllable_group::add_extender(Score_element * extender) // Right: Real ss = extender->paper_l ()->get_var ("staffspace"); extender->set_elt_property("right-trim-amount", - gh_double2scm(-notehead_l_->extent(X_AXIS).length()/ss)); + gh_double2scm(-notehead_l_->extent(notehead_l_, X_AXIS).length()/ss)); } } @@ -122,7 +122,7 @@ Syllable_group::set_lyric_align(const char *punc, Score_element *default_notehea lyric->set_parent(notehead_l_, X_AXIS); lyric->add_offset_callback (Side_position::centered_on_parent_proc, X_AXIS); // reference is on the right of the notehead; move it left half way, and add translation - lyric->translate_axis (group_translation_f_-(notehead_l_->extent(X_AXIS)).center(), X_AXIS); + lyric->translate_axis (group_translation_f_-(notehead_l_->extent(notehead_l_, X_AXIS)).center(), X_AXIS); } } return (notehead_l_); @@ -142,11 +142,11 @@ Syllable_group::amount_to_translate() Real translate = 0.0; if(alignment_i_ != CENTER) { // FIXME: do we really know the lyric extent here? Some font sizing comes later? - if((longest_lyric_l_->extent(X_AXIS)).length() < - (shortest_lyric_l_->extent(X_AXIS)).length() * 2 ) - translate = alignment_i_*(longest_lyric_l_->extent(X_AXIS)).length()/2; - else - translate = alignment_i_*(shortest_lyric_l_->extent(X_AXIS)).length(); + Real l1 = longest_lyric_l_->extent(longest_lyric_l_, X_AXIS).length() / 2; + Real l2 = shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS).length(); + + translate = l1 extent(X_AXIS)).length()/2; + translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length()/2; break; case RIGHT: // move right so smallest lyric is left-aligned on notehead - translation += (shortest_lyric_l_->extent(X_AXIS)).length(); + translation += (shortest_lyric_l_->extent(shortest_lyric_l_, X_AXIS)).length(); break; } group_translation_f_ += translation; diff --git a/lily/tie.cc b/lily/tie.cc index f395296288..39bc2306de 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -137,31 +137,29 @@ Tie::get_control_points (SCM smob) Real left_x; if (Note_head::has_interface (me->get_bound (LEFT))) - left_x = l->extent (X_AXIS)[RIGHT] + x_gap_f; + left_x = l->extent (l, X_AXIS)[RIGHT] + x_gap_f; else - left_x = l->extent (X_AXIS).length () / 2; + left_x = l->extent (l, X_AXIS).length () / 2; Real width; if (Note_head::has_interface (me->get_bound (LEFT)) && Note_head::has_interface (me->get_bound (RIGHT))) { - width = r->relative_coordinate (commonx, X_AXIS) - + r->extent (X_AXIS)[LEFT] - - l->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS)[RIGHT] + width = + + r->extent (commonx,X_AXIS)[LEFT] + - l->extent (commonx, X_AXIS)[RIGHT] -2 * x_gap_f; } else { if (Note_head::has_interface (me->get_bound (LEFT))) width = r->relative_coordinate (commonx, X_AXIS) - - l->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS)[RIGHT] + - l->extent (commonx, X_AXIS)[RIGHT] - 2 * x_gap_f; else - width = r->relative_coordinate (commonx, X_AXIS) - - l->extent (X_AXIS).length () / 2 - + r->extent (X_AXIS)[LEFT] + width = + - l->extent (l, X_AXIS).length () / 2 + + r->extent (commonx, X_AXIS)[LEFT] - l->relative_coordinate (commonx, X_AXIS) - 2 * x_gap_f; } @@ -180,7 +178,8 @@ Tie::get_control_points (SCM smob) Offset leave_dir = b.control_[1] - b.control_[0]; - Real dx = (head (me, headdir)->extent (X_AXIS).length () + x_gap_f)/2.0; + Score_element *hed =head (me, headdir); + Real dx = (hed->extent (hed, X_AXIS).length () + x_gap_f)/2.0; Real max_gap = leave_dir[Y_AXIS] * dx / leave_dir[X_AXIS]; /*