From: hanwen Date: Fri, 19 Sep 2003 01:07:39 +0000 (+0000) Subject: * input/regression/hairpin-dashed.ly: new file. X-Git-Tag: release/2.1.3~141 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e1a0287667191464750061b3266c28f40026dcfa;p=lilypond.git * input/regression/hairpin-dashed.ly: new file. * scripts/convert-ly.py (conv): warn about dash-length. * lily/dynamic-engraver.cc (try_music): end (de)crescendo automatically if we get a new one. * lily/lookup.cc (dashed_line): new function * lily/line-spanner.cc (dashed_line_molecule): cleanups. Use dash-fraction. --- diff --git a/ChangeLog b/ChangeLog index bad9fb76a4..4cd5909050 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-09-19 Han-Wen Nienhuys + + * input/regression/hairpin-dashed.ly: new file. + + * scripts/convert-ly.py (conv): warn about dash-length. + + * lily/dynamic-engraver.cc (try_music): end (de)crescendo + automatically if we get a new one. + + * lily/lookup.cc (dashed_line): new function + + * lily/line-spanner.cc (dashed_line_molecule): cleanups. Use + dash-fraction. + 2003-09-18 Heikki Junes * buildscripts/lilypond.words.py: extract note names. @@ -10,6 +24,14 @@ 2003-09-18 Han-Wen Nienhuys + * lily/breathing-sign.cc: remove railtracks() function. + + * input/regression/arpeggio-bracket.ly (texidoc): add file. + + * lily/arpeggio.cc (brew_chord_bracket): clean-up + (brew_molecule): bugfix don't make arpeggio shorter when + arpeggio-direction is set. + * debian/rules: small corrections in the (Pedro K) * Documentation/user/tutorial.itely (Tutorial): use lyinc in diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 956048b805..d3cd143765 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -3557,18 +3557,19 @@ making or a music identifier @code{\foo} containing the syllable @subsection Ambitus @cindex ambitus -The term @emph{ambitus} denotes a range of pitches for a given voice in -a part of music. It also may denote the pitch range that a musical -instrument is capable of playing. Most musical instruments have their -ambitus standardized (or at least there is agreement upon the minimal -ambitus of a particular type of instrument), such that a composer or -arranger of a piece of music can easily meet the ambitus constraints of -the targeted instrument. However, the ambitus of the human voice -depends on individual physiological state, including education and -training of the voice. Therefore, a singer potentially has to check for -each piece of music if the ambitus of that piece meets his individual -capabilities. This is why the ambitus of a piece may be of particular -value to vocal performers. +The term @emph{ambitus} (plural: ambituses) denotes a range of pitches +for a given voice in a part of music. It also may denote the pitch +range that a musical instrument is capable of playing. Most musical +instruments have their ambitus standardized (or at least there is +agreement upon the minimal ambitus of a particular type of +instrument), such that a composer or arranger of a piece of music can +easily meet the ambitus constraints of the targeted instrument. +However, the ambitus of the human voice depends on individual +physiological state, including education and training of the voice. +Therefore, a singer potentially has to check for each piece of music +if the ambitus of that piece meets his individual capabilities. This +is why the ambitus of a piece may be of particular value to vocal +performers. The ambitus is typically notated on a per-voice basis at the very beginning of a piece, e.g. nearby the initial clef or time signature of @@ -3622,7 +3623,7 @@ ambitus per staff rather than per each voice, then add the @internalsref{Ambitus_engraver} to the @internalsref{Staff} context rather than to the @internalsref{Voice} context. -It is possible to tune individual ambiti for multiple voices on a +It is possible to tune individual ambituses for multiple voices on a single staff, for example by erasing or shifting them horizontally. An example is in @inputfileref{input/test,ambitus-mixed.ly} diff --git a/input/regression/hairpin-dashed.ly b/input/regression/hairpin-dashed.ly new file mode 100644 index 0000000000..d305f49c16 --- /dev/null +++ b/input/regression/hairpin-dashed.ly @@ -0,0 +1,7 @@ + +\score { + \notes \relative c' { + \property Voice.Hairpin \set #'dash-fraction = #0.4 + \property Voice.Hairpin \set #'dash-period = #1 + f2\< g c1 d4\> b a gis\! } + } diff --git a/input/test/ambitus-mixed.ly b/input/test/ambitus-mixed.ly index e20da8689f..74e8722b15 100644 --- a/input/test/ambitus-mixed.ly +++ b/input/test/ambitus-mixed.ly @@ -3,7 +3,7 @@ texidoc = "Ambituses can be switched off or translated by using applyoutput. -If you want to mix per-voice and per-staff ambiti, then you have to +If you want to mix per-voice and per-staff ambituses, then you have to define you have to declare a new context type derived from the @code{Voice} context or @code{Staff} context. The derived context must consist of the @code{Ambitus_engraver} and it must be accepted by diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 08d9430544..daf53c6eac 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -65,28 +65,31 @@ Arpeggio::brew_molecule (SCM smob) return SCM_EOL; } + SCM ad = me->get_grob_property ("arpeggio-direction"); Direction dir = CENTER; - if (ly_dir_p (me->get_grob_property ("arpeggio-direction"))) + if (ly_dir_p (ad)) { - dir = to_dir (me->get_grob_property ("arpeggio-direction")); + dir = to_dir (ad); } Molecule mol; Font_metric *fm =Font_interface::get_default_font (me); Molecule squiggle = fm->find_by_name ("scripts-arpeggio"); - Real arrow_space = (dir) ? Staff_symbol_referencer::staff_space (me) : 0.0; - - Real y = heads[LEFT]; - while (y < heads[RIGHT] - arrow_space) + Molecule arrow ; + if (dir) { - mol.add_at_edge (Y_AXIS, UP,squiggle, 0.0, 0); - y+= squiggle. extent (Y_AXIS).length (); + arrow = fm->find_by_name ("scripts-arpeggio-arrow-" + to_string (dir)); + heads[dir] -= dir * arrow.extent (Y_AXIS).length(); } + + for (Real y= heads[LEFT] ; y < heads[RIGHT]; + y+= squiggle. extent (Y_AXIS).length ()) + mol.add_at_edge (Y_AXIS, UP,squiggle, 0.0, 0); + mol.translate_axis (heads[LEFT], Y_AXIS); if (dir) - mol.add_at_edge (Y_AXIS, dir, - fm->find_by_name ("scripts-arpeggio-arrow-" + to_string (dir)), 0.0, 0); + mol.add_at_edge (Y_AXIS, dir,arrow, 0,0); return mol.smobbed_copy () ; } @@ -125,13 +128,7 @@ Arpeggio::brew_chord_bracket (SCM smob) Real dy = heads.length() + sp; Real x = 0.7; - Molecule l1 = Lookup::line (lt, Offset(0, 0), Offset (0, dy)); - Molecule bottom = Lookup::line (lt, Offset(0, 0), Offset (x, 0)); - Molecule top = Lookup::line (lt, Offset(0, dy), Offset (x, dy)); - Molecule mol; - mol.add_molecule (l1); - mol.add_molecule (bottom); - mol.add_molecule (top); + Molecule mol (Lookup::bracket (Y_AXIS, Interval (0, dy), lt, x)); mol.translate_axis (heads[LEFT] - sp/2.0, Y_AXIS); return mol.smobbed_copy(); } diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index bd3bc598b1..30e24dfb39 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -30,29 +30,6 @@ -/* - Simplistic caesura. - */ -MAKE_SCHEME_CALLBACK (Breathing_sign,railtracks,1); -SCM -Breathing_sign::railtracks (SCM smob) -{ - Grob * me = unsmob_grob (smob); - Real space = Staff_symbol_referencer::staff_space (me); - Real th = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness")); - SCM lt = me->get_grob_property ("thickness"); - if (gh_number_p (lt)) - th *= gh_scm2double (lt); - - Offset x1 (0, -space); - Offset x2 (space / 3, space); - Molecule l1 (Lookup::line (th, x1, x2)); - Molecule l2 (l1); - l2.translate_axis (space *0.6 , X_AXIS); - l1.add_molecule (l2); - return l1.smobbed_copy(); -} - /* Gregorian chant divisio minima. (Actually, this was the original breathing sign by Michael. -- jr) diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 12dc059501..3344f8753e 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -122,7 +122,10 @@ Dynamic_engraver::try_music (Music * m) || m->is_mus_type ("crescendo-event")) { Direction d = to_dir (m->get_mus_property ("span-direction")); + accepted_spanreqs_drul_[d] = m; + if (current_cresc_ev_ && d == START) + accepted_spanreqs_drul_[STOP] = m; return true; } return false; diff --git a/lily/hairpin.cc b/lily/hairpin.cc index af539b871b..a069fb0079 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -116,16 +116,32 @@ Hairpin::brew_molecule (SCM smob) endh = height; } + /* + should do relative to staff-symbol staff-space? + */ + + Real period = 1.0; + s = me->get_grob_property ("dash-period"); + if (gh_number_p (s)) + period = gh_scm2double (s); + + Real fraction = 1.0; + s = me->get_grob_property ("dash-fraction"); + if (gh_number_p (s)) + fraction = gh_scm2double (s); + /* TODO: set line style. */ - Molecule mol = Lookup::line (thick, + Molecule mol = Lookup::dashed_line (thick, Offset (0, starth), - Offset (width, endh)); - mol.add_molecule (Lookup::line (thick, + Offset (width, endh), + period, fraction); + mol.add_molecule (Lookup::dashed_line (thick, Offset (0, -starth), - Offset (width, -endh))); - + Offset (width, -endh), + period, fraction)); + mol.translate_axis (x_points[LEFT] - bounds[LEFT]->relative_coordinate (common, X_AXIS), X_AXIS); @@ -137,5 +153,5 @@ Hairpin::brew_molecule (SCM smob) ADD_INTERFACE (Hairpin, "hairpin-interface", "hairpin crescendo.", - "grow-direction thickness height if-text-padding"); + "dash-period dash-fraction grow-direction thickness height if-text-padding"); diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 02fcea0f80..565b907ada 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -33,6 +33,7 @@ struct Lookup static Molecule round_filled_box (Box b, Real blotdiameter); static Molecule repeat_slash (Real w, Real slope, Real th); static Molecule line (Real th, Offset from, Offset to); + static Molecule dashed_line (Real th, Offset from, Offset to, Real, Real); static Molecule horizontal_line (Interval w, Real th); static Molecule triangle (Interval, Real, Real); }; diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index cc5011dbb1..ba96f5dcfd 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -16,6 +16,7 @@ #include "font-interface.hh" #include "warn.hh" #include "align-interface.hh" +#include "lookup.hh" #include @@ -31,53 +32,43 @@ grob-properties. Make arbitrary paths. */ - -/* - slightishly clumsy interface? - - Make a Scheme expression for a line going from (0,0) to (dx,dy). - */ - -static SCM -line_atom (Grob *me, Real thick, Real dx, Real dy) +Molecule +dashed_line_molecule (Grob *me, Real thick, Offset from, Offset to) { SCM type = me->get_grob_property ("style"); - Real staff_space = Staff_symbol_referencer::staff_space (me); - - // maybe these should be in line-thickness? - Real length = staff_space; - SCM s = me->get_grob_property ("dash-length"); - if (gh_number_p (s)) - length = gh_scm2double (s) * staff_space; + if (type == ly_symbol2scm ("dotted-line") + || type == ly_symbol2scm ("dashed-line")) + { + Real fraction = (type == ly_symbol2scm ("dotted-line")) ? 0.0 : 0.4; - Real period = 2 * length + thick; - s = me->get_grob_property ("dash-period"); - if (gh_number_p (s)) - period = gh_scm2double (s) * staff_space; - if (type == ly_symbol2scm ("dotted-line")) - length = thick; - - if (type == ly_symbol2scm ("line")) - length = period + thick; + SCM s = me->get_grob_property ("dash-fraction"); + if (gh_number_p (s)) + fraction = gh_scm2double (s); + fraction = (fraction >? 0) get_grob_property ("dash-period"); + if (gh_number_p (s)) + period *= gh_scm2double (s); - return list; + return Lookup::dashed_line (thick, from, to, period, fraction); + } + else + { + return Lookup::line (thick, from, to); + } } -static SCM -zigzag_atom (Grob *me, Real thick, Real dx, Real dy) +Molecule +zigzag_molecule (Grob *me, Real thick, + Offset from, + Offset to) { + Offset dz = to -from; + Real dx = dz[X_AXIS]; + Real dy = dz[Y_AXIS]; + Real staff_space = Staff_symbol_referencer::staff_space (me); SCM ws = me->get_grob_property ("zigzag-width"); SCM ls = me->get_grob_property ("zigzag-length"); @@ -93,8 +84,13 @@ zigzag_atom (Grob *me, Real thick, Real dx, Real dy) gh_double2scm (dx), gh_double2scm (dy), SCM_UNDEFINED); - - return list; + Box b; + b.add_point (Offset (0,0)); + b.add_point (dz); + b[X_AXIS].widen (thick/2); + b[Y_AXIS].widen (thick/2); + + return Molecule (b, list); } MAKE_SCHEME_CALLBACK(Line_spanner, after_line_breaking, 1); @@ -138,7 +134,6 @@ Line_spanner::line_molecule (Grob *me, Real thick, Offset to) { Offset dz = to -from ; - Molecule mol; SCM type = me->get_grob_property ("style"); if (gh_symbol_p (type) && (type == ly_symbol2scm ("line") @@ -147,18 +142,9 @@ Line_spanner::line_molecule (Grob *me, Real thick, || type == ly_symbol2scm ("zigzag") || (type == ly_symbol2scm ("trill") && dz[Y_AXIS] != 0))) { - Box b; - b.add_point (Offset (0,0)); - b.add_point (dz); - b[X_AXIS].widen (thick/2); - b[Y_AXIS].widen (thick/2); - - SCM atom = (type == ly_symbol2scm ("zigzag")) - ? zigzag_atom (me, thick, dz[X_AXIS], dz[Y_AXIS]) - : line_atom (me, thick, dz[X_AXIS], dz[Y_AXIS]); - - mol = Molecule (b, atom); - mol.translate (from); + return (type == ly_symbol2scm ("zigzag")) + ? zigzag_molecule (me, thick, from, to) + : dashed_line_molecule (me, thick, from, to); } else if (gh_symbol_p (type) && type == ly_symbol2scm ("trill")) @@ -172,6 +158,8 @@ Line_spanner::line_molecule (Grob *me, Real thick, gh_cons (style_alist, alist_chain)); Molecule m = fm->find_by_name ("scripts-trill-element"); + Molecule mol; + do mol.add_at_edge (X_AXIS, RIGHT, m, 0,0); while (m.extent (X_AXIS).length () @@ -186,9 +174,9 @@ Line_spanner::line_molecule (Grob *me, Real thick, + mol.extent (Y_AXIS).length ())/2, Y_AXIS); mol.translate (from); + return mol; } - - return mol; + return Molecule(); } /* @@ -348,6 +336,6 @@ ADD_INTERFACE (Line_spanner, "line-spanner-interface", "gap is measured in staff-spaces.\n" "The property 'type is one of: line, dashed-line, trill, dotted-line or zigzag.\n" "\n", - "gap dash-period dash-length zigzag-width zigzag-length thickness style"); + "gap dash-period dash-fraction zigzag-width zigzag-length thickness style"); diff --git a/lily/lookup.cc b/lily/lookup.cc index 9eeb6cbdb9..9666930e3a 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -101,6 +101,34 @@ Lookup::line (Real th, Offset from, Offset to) return Molecule (box, at); } +Molecule +Lookup::dashed_line (Real thick, Offset from, Offset to, + Real dash_period, Real dash_fraction) +{ + dash_fraction = (dash_fraction >? 0) dash-fraction""") ################################ # END OF CONVERSIONS