From 393b9995a68387816c3d945fbc0808504804fc5f Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 2 Feb 2001 11:29:22 +0100 Subject: [PATCH] patch::: 1.3.127.jcn3 1.3.127.jcn3 ============ * Small beam cleanup, changed y-position-hs,height-hs user overrides to staff-position,height (height:name suggestions?), now in staff-spaces. --- CHANGES | 6 ++ Documentation/user/refman.itely | 15 ++++- Documentation/user/tricks.itely | 16 ++--- VERSION | 2 +- input/features/beam-position.ly | 4 +- lily/beam.cc | 98 +++++++++++++------------------ scm/beam.scm | 2 +- scm/generic-property.scm | 4 +- scm/grob-property-description.scm | 7 +-- scm/interface-description.scm | 2 +- 10 files changed, 79 insertions(+), 77 deletions(-) diff --git a/CHANGES b/CHANGES index 0d4c60ba31..7a2644bad9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +1.3.127.jcn3 +============ + +* Small beam cleanup, changed y-position-hs,height-hs user overrides to + staff-position,height (height:name suggestions?), now in staff-spaces. + 1.3.127.jcn2 ============ diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 57a51016be..dce6226bdd 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -312,6 +312,13 @@ numbers and dots. @node Modifying music @section Modifying music @cindex Modifying music + +FIXME: more verbose titling: +music expressions? +Repeat? +Repeated music? +Repeating music expressions? + @menu * Relative:: * Transpose:: @@ -1157,6 +1164,10 @@ warning message will appear and no ties will be created. @subsubsection Tuplet @cindex Tuplet +A @rgrob{TupletBracket} is typeset automatically for music that +is time scaled, see @ref{Times}. + + See @ref{Times}. @c. {Volta} @@ -1164,7 +1175,9 @@ See @ref{Times}. @subsubsection Volta @cindex Volta -See @ref{Repeat}. +A @rgrob{VoltaBracket} is typeset automatically for music that contains a +repetition, see @ref{Repeat}. + @c. {Crescendo and Decrescendo} @node Crescendo and Decrescendo diff --git a/Documentation/user/tricks.itely b/Documentation/user/tricks.itely index f1525f530f..7f6a5d1fb1 100644 --- a/Documentation/user/tricks.itely +++ b/Documentation/user/tricks.itely @@ -133,26 +133,26 @@ extension can be controlled through @code{Voice.Stem}'s grob-property @end quotation The beam symbol can be tweaked through @code{Voice.Beam}'s -grob-properties @code{height-hs} and @code{y-position-hs}. +grob-properties @code{height} and @code{staff-position}, +in staff-spaces. -Set @code{height-hs} to zero, to get horizontal beams: +Set @code{height} to zero, to get horizontal beams: @quotation @lilypond[fragment,relative,verbatim] \property Voice.Beam \set #'direction = #1 - \property Voice.Beam \set #'height-hs = #0 + \property Voice.Beam \set #'height = #0 [a''8 e' d c] @end lilypond @end quotation -Both are in half spaces. Here's how you'd specify a weird looking beam -that instead of being horizontal, falls two staff spaces (ie, four half -spaces): +Here's how you'd specify a weird looking beam that instead of being +horizontal, falls two staff spaces: @quotation @lilypond[fragment,relative,verbatim] - \property Voice.Beam \set #'y-position-hs = #4 - \property Voice.Beam \set #'height-hs = #-4 + \property Voice.Beam \set #'staff-position = #2 + \property Voice.Beam \set #'height = #-2 [c'8 c] @end lilypond @end quotation diff --git a/VERSION b/VERSION index 4606ef3a63..bd5dec172a 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=127 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/features/beam-position.ly b/input/features/beam-position.ly index bf14a7fee8..b581904761 100644 --- a/input/features/beam-position.ly +++ b/input/features/beam-position.ly @@ -1,7 +1,7 @@ fragment = \notes { - \property Voice.Beam \set #'y-position-hs = #4 - \property Voice.Beam \set #'height-hs = #-4 + \property Voice.Beam \set #'staff-position = #2 + \property Voice.Beam \set #'height = #-2 [c'8 c] } diff --git a/lily/beam.cc b/lily/beam.cc index f7c2f126eb..d58054aa8f 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -11,14 +11,8 @@ /* [TODO] - * remove *-hs variables, and do all y-position stuff in staff-space. - This is not trivial, as Stem, and Stem_info both use point dimensions - (indicated by _f suffix) in several places too. - * shorter! (now +- 1000 lines) * less hairy code - * move paper vars to scm - */ @@ -331,6 +325,7 @@ Beam::least_squares (SCM smob) Real y = 0; Real dy = 0; + /* Stem_info, and thus y,dy in this function are corrected for beam-dir */ Real first_ideal = Stem::calc_stem_info (first_visible_stem (me)).idealy_f_; if (first_ideal == Stem::calc_stem_info (last_visible_stem (me)).idealy_f_) { @@ -361,8 +356,10 @@ Beam::least_squares (SCM smob) dy = dydx * dx; } - me->set_grob_property ("y", gh_double2scm (y)); - me->set_grob_property ("dy", gh_double2scm (dy)); + /* Store true, not dir-corrected values */ + Direction dir = Directional_element_interface::get (me); + me->set_grob_property ("y", gh_double2scm (y * dir)); + me->set_grob_property ("dy", gh_double2scm (dy * dir)); return SCM_UNSPECIFIED; } @@ -375,9 +372,11 @@ Beam::cancel_suspect_slope (SCM smob) if (visible_stem_count (me) <= 1) return SCM_UNSPECIFIED; - Real y = gh_scm2double (me->get_grob_property ("y")); - Real dy = gh_scm2double (me->get_grob_property ("dy")); - + /* Stem_info, and thus y,dy in this function are corrected for beam-dir */ + Direction dir = Directional_element_interface::get (me); + Real y = gh_scm2double (me->get_grob_property ("y")) * dir; + Real dy = gh_scm2double (me->get_grob_property ("dy")) * dir; + /* steep slope running against lengthened stem is suspect */ Real first_ideal = Stem::calc_stem_info (first_visible_stem (me)).idealy_f_; Real last_ideal = Stem::calc_stem_info (last_visible_stem (me)).idealy_f_; @@ -392,7 +391,8 @@ Beam::cancel_suspect_slope (SCM smob) || ((y + dy - last_ideal > lengthened) && (dydx < -steep))) { Real adjusted_y = y + dy / 2; - me->set_grob_property ("y", gh_double2scm (adjusted_y)); + /* Store true, not dir-corrected values */ + me->set_grob_property ("y", gh_double2scm (adjusted_y * dir)); me->set_grob_property ("dy", gh_double2scm (0)); } return SCM_UNSPECIFIED; @@ -417,8 +417,10 @@ Beam::slope_damping (SCM smob) if (damping) { - Real y = gh_scm2double (me->get_grob_property ("y")); - Real dy = gh_scm2double (me->get_grob_property ("dy")); + /* y,dy in this function are corrected for beam-dir */ + Direction dir = Directional_element_interface::get (me); + Real y = gh_scm2double (me->get_grob_property ("y")) * dir; + Real dy = gh_scm2double (me->get_grob_property ("dy")) * dir; // ugh -> use commonx Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) @@ -428,8 +430,9 @@ Beam::slope_damping (SCM smob) Real damped_dy = dydx * dx; Real adjusted_y = y + (dy - damped_dy) / 2; - me->set_grob_property ("y", gh_double2scm (adjusted_y)); - me->set_grob_property ("dy", gh_double2scm (damped_dy)); + /* Store true, not dir-corrected values */ + me->set_grob_property ("y", gh_double2scm (adjusted_y * dir)); + me->set_grob_property ("dy", gh_double2scm (damped_dy * dir)); } return SCM_UNSPECIFIED; } @@ -458,8 +461,10 @@ Beam::quantise_dy (SCM smob) if (a.size () > 1) { - Real y = gh_scm2double (me->get_grob_property ("y")); - Real dy = gh_scm2double (me->get_grob_property ("dy")); + /* y,dy in this function are corrected for beam-dir */ + Direction dir = Directional_element_interface::get (me); + Real y = gh_scm2double (me->get_grob_property ("y")) * dir; + Real dy = gh_scm2double (me->get_grob_property ("dy")) * dir; Real staff_space = Staff_symbol_referencer::staff_space (me); @@ -470,58 +475,37 @@ Beam::quantise_dy (SCM smob) Real quantised_dy = q * sign (dy); Real adjusted_y = y + (dy - quantised_dy) / 2; - me->set_grob_property ("y", gh_double2scm (adjusted_y)); - me->set_grob_property ("dy", gh_double2scm (quantised_dy)); + /* Store true, not dir-corrected values */ + me->set_grob_property ("y", gh_double2scm (adjusted_y * dir)); + me->set_grob_property ("dy", gh_double2scm (quantised_dy * dir)); } return SCM_UNSPECIFIED; } - -/* - What to do? Why do we have two dimensions (staff-position and - staff-space)? Do other grobs export staff-position to the user, - should we junk that? - - height-hs -> staff-position-height - y-position-hs -> staff-position - - or - - height-hs -> height / 2 - y-postion-hs -> y-position / 2 - - - UGHUGH. IF this callback is omitted, we hang. - FIXME: until here, we used only stem_info, which acts as if dir=up. -*/ +/* It's tricky to have the user override y,dy directly, so we use this + translation func. Also, if our staff_space != 1 (smaller staff, eg), + user will expect staff-position to be discrete values. */ MAKE_SCHEME_CALLBACK (Beam, user_override, 1); SCM Beam::user_override (SCM smob) { Grob *me = unsmob_grob (smob); - Real half_space = Staff_symbol_referencer::staff_space (me) / 2; - - Real y = gh_scm2double (me->get_grob_property ("y")); - Real dy = gh_scm2double (me->get_grob_property ("dy")); + Real staff_space = Staff_symbol_referencer::staff_space (me); - - SCM s = me->get_grob_property ("y-position-hs"); + SCM s = me->get_grob_property ("staff-position"); if (gh_number_p (s)) - y = gh_scm2double (s) * half_space; - else - // ughugh - y *= Directional_element_interface::get (me); + { + Real y = gh_scm2double (s) * staff_space; + me->set_grob_property ("y", gh_double2scm (y)); + } - s = me->get_grob_property ("height-hs"); + /* Name suggestions? Tilt, slope, vertical-* ? */ + s = me->get_grob_property ("height"); if (gh_number_p (s)) - dy = gh_scm2double (s) * half_space; - else - // ughugh - dy *= Directional_element_interface::get (me); - - - me->set_grob_property ("y", gh_double2scm (y)); - me->set_grob_property ("dy", gh_double2scm (dy)); + { + Real dy = gh_scm2double (s) * staff_space; + me->set_grob_property ("dy", gh_double2scm (dy)); + } return SCM_UNSPECIFIED; } diff --git a/scm/beam.scm b/scm/beam.scm index 8ae7f30044..3fa8fc33ce 100644 --- a/scm/beam.scm +++ b/scm/beam.scm @@ -120,5 +120,5 @@ ;; TODO ;; - take #forced stems into account (now done in C++)? -;; - take y-position of chord or beam into account +;; - take staff-position of chord or beam into account diff --git a/scm/generic-property.scm b/scm/generic-property.scm index f7256676a6..81b181683d 100644 --- a/scm/generic-property.scm +++ b/scm/generic-property.scm @@ -25,8 +25,8 @@ (list 'autoKneeGap number? 'auto-knee-gap) (list 'autoInterstaffKneeGap number? 'auto-interstaff-knee-gap) (list 'beamDirAlgorithm symbol? 'beam-dir-algorithm) - (list 'beamHeight number? 'height-hs) - (list 'beamVerticalPosition number? 'y-position-hs) + (list 'beamHeight number? 'height) + (list 'beamVerticalPosition number? 'staff-position) ) ) ) diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm index 8eb13e78ce..6de59927da 100644 --- a/scm/grob-property-description.scm +++ b/scm/grob-property-description.scm @@ -107,6 +107,7 @@ Align_interface::center_on_element). .") (grob-property-description 'dot-count integer? "number of dots.") (grob-property-description 'duration-log integer? "2-log of the notehead duration.") (grob-property-description 'duration-log integer? "log of the duration, ie. 0=whole note, 1 = half note, etc.") +(grob-property-description 'dy number? "set by beam: vertical travel height") (grob-property-description 'edge-height pair? "a cons that specifies the heights of the vertical egdes '(LEFT-height . RIGHT-height).") (grob-property-description 'edge-text pair? "a cons that specifies the texts to be set at the edges '(LEFT-text . RIGHT-text).") (grob-property-description 'elements list? "list of grobs, type depending on the Grob where this is set in.") @@ -156,8 +157,7 @@ is used by @ref{note-collision-interface}.") FIXME: in Tie this is a pair of grob pointers, pointing to the two heads of the tie. .") -(grob-property-description 'height number? "in staffspace .") -(grob-property-description 'height-hs number? "in halfspace. Only used by Beam.") ; Remove-me +(grob-property-description 'height number? "in staffspace.") (grob-property-description 'height-quants procedure? "function of type (beam staff-line-thickness) -> list of quants. Default value: default-beam-dy-quants. .") (grob-property-description 'horizontal-shift integer? "integer that identifies ranking of note-column for horizontal shifting. This is used by @ref{note-collision-interface}.") @@ -318,5 +318,4 @@ function of type (beam multiplicity dy staff-line-thickness) -> real. Default v (grob-property-description 'word-space number? "elongate left by this much (FIXME: cumbersome semantics).") (grob-property-description 'x-gap number? "horizontal gap between notehead and tie.") (grob-property-description 'y-free number? "minimal vertical gap between slur and noteheads or stems.") -(grob-property-description 'y-position number? "position of left edge.") -(grob-property-description 'y-position-hs number? "in half space, position of left edge. Only used by @ref{Beam}.") ;FXIME +(grob-property-description 'y number? "set by beam: position of left edge.") diff --git a/scm/interface-description.scm b/scm/interface-description.scm index 0806189af7..60f0a19779 100644 --- a/scm/interface-description.scm +++ b/scm/interface-description.scm @@ -70,7 +70,7 @@ #'thickness= weight of beams, in staffspace " '( - y-position + staff-position height flag-width-function damping -- 2.39.5