From: Han-Wen Nienhuys Date: Sun, 22 Aug 2004 16:15:57 +0000 (+0000) Subject: (print): use X-Git-Tag: release/2.3.13~50 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5a97474f4e264c5192d6bf95272c070d2484473e;p=lilypond.git (print): use Tuplet_bracket::make_bracket, so it supports bracket-flare, edge-eight and shorten-pair. --- diff --git a/ChangeLog b/ChangeLog index 20d9eb2a35..9475a90ed5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-08-22 Han-Wen Nienhuys + + * lily/horizontal-bracket.cc (print): use + Tuplet_bracket::make_bracket, so it supports bracket-flare, + edge-eight and shorten-pair. + 2004-08-22 Pedro Kroger * scm/framework-ps.scm (output-framework): set the first @@ -11,6 +17,9 @@ 2004-08-22 Han-Wen Nienhuys + * lily/slur-engraver.cc (class Slur_engraver): simplify: remove + nested slurs. + * scripts/convert-ly.py (lilypond_version_re_str): handle \version "bar" % "foo" diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index dfc11394d4..c9c60ed41a 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -1575,7 +1575,7 @@ either property is set, its value will be used only once, and then it is erased @lilypond[quote,fragment,relative=1,verbatim] -\context Staff { +{ f8[ r16 f g a] f8[ r16 \set stemLeftBeamCount = #1 f g a] } @@ -1597,10 +1597,6 @@ c16[ c c c c c c c] @end lilypond @cindex @code{subdivideBeams} -Kneed beams are inserted automatically, when a large gap is detected -between the note heads. This behavior can be tuned through the object -property @code{auto-knee-gap}. - Normally, line breaks are forbidden when beams cross bar lines. This behavior can be changed by setting @code{allowBeamBreak}. @@ -1621,13 +1617,17 @@ User manual: @ref{Changing context properties on the fly} for the @refbugs @cindex Frenched staves +Kneed beams are inserted automatically, when a large gap is detected +between the note heads. This behavior can be tuned through the object + Automatically kneed cross-staff beams cannot be used together with -hidden staves. +hidden staves. See @ref{Hiding staves}. Beams do not avoid collisions with symbols around the notes, such as texts and accidentals. +@c FIXME. @node Setting automatic beam behavior, Beam formatting, Manual beams, Beaming @@ -1726,9 +1726,9 @@ So, while it is possible to have different ending rules for eight beams and sixteenth beams, a beam that contains both eight and sixteenth notes will use the rules for the sixteenth beam. -In the example below, the autobeamer makes eight beams and sixteenth -end at 3 eights; the third beam can only be corrected by specifying -manual beaming. +In the example below, the autobeamer makes eighth beams and sixteenth +end at three eighths. The third beam can only be corrected by +specifying manual beaming. @lilypond[quote,raggedright,fragment,relative=1] #(override-auto-beam-setting '(end * * * *) 3 8) @@ -1794,9 +1794,10 @@ Staff-level. This variable, however, typesets accidentals individually for each voice. Apart from that, the rule is similar to @code{code}. - This leads to some weird and often unwanted results - because accidentals from one voice do not get canceled in other - voices + As a result, + accidentals from one voice do not get canceled in other + voices, which is often unwanted result + @c @lilypond[quote,raggedright,relative=1,fragment,verbatim] \context Staff << #(set-accidental-style 'voice) @@ -1805,11 +1806,12 @@ individually for each voice. Apart from that, the rule is similar to { c, e } >> >> @end lilypond - Hence you should only use @code{voice} if the voices +@c + The @code{voice} option should be used if the voices are to be read solely by individual musicians. If the staff is to be -used by one musician (e.g. a conductor) then you use +used by one musician (e.g. a conductor) then @code{modern} or @code{modern-cautionary} -instead. +should be used instead. @item modern @cindex @code{modern} style accidentals @@ -1860,7 +1862,7 @@ This rule reflects 20th century practice for piano notation. Very similar t @item piano-cautionary @cindex @code{#(set-accidental-style 'piano-cautionary)} - As @code{#(set-accidental-style 'piano)' , str)} but with the extra accidentals + As @code{#(set-accidental-style 'piano)} but with the extra accidentals typeset as cautionaries. @item no-reset @@ -1899,13 +1901,11 @@ mode. This means that in a chord the accidentals are typeset as if the notes in the chord happened once at a time - in the order in which they appear in the input file. -This is only a problem when accidentals in a chord depend on each -other. This problem can be solved by manually inserting @code{!} and -@code{?} for the problematic notes. +This is a problem when accidentals in a chord depend on each other, +which does not happen for the default accidental style. The problem +can be solved by manually inserting @code{!} and @code{?} for the +problematic notes. -In the default scheme, accidentals only depend on other -accidentals with the same pitch on the same staff, so no conflicts are -possible. @node Expressive marks, Repeats, Accidentals, Notation manual @section Expressive marks @@ -1937,10 +1937,9 @@ possible. A slur indicates that notes are to be played bound or @emph{legato}. - They are entered using parentheses @lilypond[quote,relative=2,fragment,verbatim] -f( g)( a) a8 b( a4 g2 f4) +f( g a) a8 b( a4 g2 f4) 2( 2) @end lilypond @@ -1957,7 +1956,7 @@ However, there is a convenient shorthand for forcing slur directions. By adding @code{_} or @code{^} before the opening parentheses, the direction is also set. For example, -@lilypond[relative=2,fragment] +@lilypond[relative=2,verbatim,fragment] c4_( c) c^( c) @end lilypond @@ -1999,8 +1998,8 @@ respectively Typographically, the phrasing slur behaves almost exactly like a normal slur. However, they are treated as different objects. A -@code{\slurUp} will have no effect on a phrasing slur; instead, you -should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and +@code{\slurUp} will have no effect on a phrasing slur; instead, use +@code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and @code{\phrasingSlurBoth}. The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} @@ -2084,9 +2083,9 @@ Program reference: @internalsref{MetronomeChangeEvent}. Some performance indications, e.g. @i{rallentando} or @i{accelerando}, are written as texts, and extended over many measures with dotted -lines. You can create such texts using text spanners: attach -@code{\startTextSpan} and @code{\stopTextSpan} to the -start and ending note of the spanner. +lines. Such texts are created using text spanners: attach +@code{\startTextSpan} and @code{\stopTextSpan} to the start and ending +note of the spanner. The string to be printed, as well as the style, is set through object properties @@ -2163,9 +2162,10 @@ The meanings of these shorthands can be changed. See @file{ly/script-init.ly} for examples. -The script is automatically placed, but if you need to force -directions, you can use @code{_} to force them down, or @code{^} to -put them up +The script is automatically placed, but the direction can be forced as +well. @code{_} will put them down, and @code{^} will put them up, + + @lilypond[quote,fragment,verbatim] c''4^^ c''4_^ @end lilypond diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index de9ccb3251..b501f22278 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -13,6 +13,7 @@ #include "directional-element-interface.hh" #include "output-def.hh" #include "staff-symbol-referencer.hh" +#include "tuplet-bracket.hh" // ugh. struct Horizontal_bracket { @@ -49,19 +50,27 @@ Horizontal_bracket::print (SCM smob) Interval ext = gs.top ()->extent (cx, X_AXIS); ext.unite (gs[0]->extent (cx, X_AXIS)); - Direction d = get_grob_direction (me); + Drul_array edge_height = robust_scm2interval (me->get_property ("edge-height"), + Interval (1.0, 1.0)); - Real thickness = Staff_symbol_referencer::line_thickness (me); - thickness *= robust_scm2double (me->get_property ("thickness"), 1.0); - Stencil b = Lookup::bracket (X_AXIS, ext, thickness, - d* 1.0, thickness/2); - - b.translate_axis ( - sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS); + Drul_array flare = robust_scm2interval (me->get_property ("bracket-flare"), + Interval (0,0)); + + Drul_array shorten = robust_scm2interval (me->get_property ("shorten-pair"), + Interval (0,0)); + + Interval empty; + Stencil b + = Tuplet_bracket::make_bracket (me, Y_AXIS, Offset (ext.length (), 0), + edge_height, empty, flare, shorten); + + b.translate_axis (ext[LEFT] - sp->get_bound (LEFT)->relative_coordinate (cx, X_AXIS), X_AXIS); return b.smobbed_copy (); } ADD_INTERFACE (Horizontal_bracket,"horizontal-bracket-interface", "A horizontal bracket encompassing notes.", - "thickness columns direction"); + "columns"); diff --git a/lily/phrasing-slur-engraver.cc b/lily/phrasing-slur-engraver.cc index 69865eae59..176350d561 100644 --- a/lily/phrasing-slur-engraver.cc +++ b/lily/phrasing-slur-engraver.cc @@ -15,10 +15,10 @@ /* TODO: - - ALGRGRRGRG - Derive this from Slur_engraver. This code is completely duplicate. + copy from new slur engraver. This code handles nesting (which + doesn't exist for slurs) + */ class Phrasing_slur_engraver : public Engraver { diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index a8cbd27598..dfce599493 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -13,15 +13,12 @@ #include "engraver.hh" #include "spanner.hh" -/* - TODO: junk nested slur functionality. - */ class Slur_engraver : public Engraver { - Link_array events_; - Link_array new_slur_evs_; - Link_array slur_stack_; - Link_array end_slurs_; + Drul_array events_; + Music * running_slur_start_; + Grob * slur_; + Moment last_start_; void set_melisma (bool); @@ -39,6 +36,8 @@ public: Slur_engraver::Slur_engraver () { + events_[START] =events_[STOP] = 0; + slur_ = 0; last_start_ = Moment (-1); } @@ -53,32 +52,18 @@ Slur_engraver::try_music (Music *m) Direction d = to_dir (m->get_property ("span-direction")); if (d == START) { - if (now_mom () > last_start_) - { - new_slur_evs_.push (m); - last_start_ = now_mom (); - } - - /* - But we swallow other slur events. - */ - + if (slur_) + return false; + + events_[START] = m; return true; } else if (d == STOP) { - /* - Swallow other events. - */ - for (int j = new_slur_evs_.size (); j--;) - { - Direction nd = to_dir (new_slur_evs_[j]->get_property ("span-direction")); - - if (nd == STOP) - return true; - } - - new_slur_evs_.push (m); + if (!slur_) + return false; + + events_[STOP] = m; return true; } } @@ -97,87 +82,51 @@ Slur_engraver::acknowledge_grob (Grob_info info) Grob *e =info.grob_; if (Note_column::has_interface (info.grob_)) { - for (int i = 0; i < slur_stack_.size (); i++) - New_slur::add_column (slur_stack_[i], e); - for (int i = 0; i < end_slurs_.size (); i++) - New_slur::add_column (end_slurs_[i], e); + if (slur_) + New_slur::add_column (slur_, e); } else { - for (int i = 0; i < slur_stack_.size (); i++) - New_slur::add_extra_encompass (slur_stack_[i], e); - for (int i = 0; i < end_slurs_.size (); i++) - New_slur::add_extra_encompass (end_slurs_[i], e); + if (slur_) + New_slur::add_extra_encompass (slur_, e); } } void Slur_engraver::finalize () { - for (int i = 0; i < slur_stack_.size (); i++) - { - /* - Let's not typeset unterminated stuff - */ - slur_stack_[i]->suicide (); - } - slur_stack_.clear (); - - for (int i=0; i < events_.size (); i++) - { - events_[i]->origin ()->warning (_ ("unterminated slur")); - } + if (slur_) + slur_->warning (_("unterminated slur")); } void Slur_engraver::process_music () { - Link_array start_slurs; - for (int i=0; i< new_slur_evs_.size (); i++) + if (events_[STOP] && events_[START]) { - Music* slur_ev = new_slur_evs_[i]; - // end slur: move the slur to other array - Direction d = to_dir (slur_ev->get_property ("span-direction")); - if (d== STOP) - { - if (slur_stack_.is_empty ()) - /* How to shut up this warning, when Voice_devnull_engraver has - eaten start event? */ - slur_ev->origin ()->warning (_f ("can't find start of slur")); - else - { - Grob* slur = slur_stack_.pop (); - - end_slurs_.push (slur); - events_.pop (); - } - } - else if (d == START) - { - /* push a new slur onto stack. - (use temp. array to wait for all slur STOPs) */ - Grob *slur = make_spanner ("Slur", slur_ev->self_scm ()); - - if (Direction updown = to_dir (slur_ev->get_property ("direction"))) - slur->set_property ("direction", scm_int2num (updown)); - - start_slurs.push (slur); - events_.push (slur_ev); - } + events_[START]->origin()->warning (_ ("Cannot start and end slur on same note")); + } + + if (events_[START] && !slur_) + { + Music *ev = events_[START]; + slur_ = make_spanner ("Slur", events_[START]->self_scm ()); + if (Direction updown = to_dir (ev->get_property ("direction"))) + slur_->set_property ("direction", scm_int2num (updown)); } - slur_stack_.concat (start_slurs); - - set_melisma (slur_stack_.size ()); - - new_slur_evs_.clear (); + set_melisma (slur_ && !events_[STOP]); } void Slur_engraver::stop_translation_timestep () { - end_slurs_.clear (); - new_slur_evs_.clear (); + if (events_[STOP]) + { + slur_ = 0; + } + + events_[START] = events_[STOP] = 0; } diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 25a8aa15cf..ffeb074edf 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -480,7 +480,11 @@ (Y-offset-callbacks . (,Side_position_interface::aligned_side)) (padding . 0.2) (direction . -1) - (meta . ((interfaces . (horizontal-bracket-interface side-position-interface spanner-interface)))) + (bracket-flare . (0.5 . 0.5)) + (meta . ((interfaces . (horizontal-bracket-interface + side-position-interface + bracket-interface line-interface + spanner-interface)))) )) (InstrumentName . (