From 45e73c21395bfa26f928c216fc6ee72fc9fa68d9 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 7 Nov 2006 18:27:31 +0000 Subject: [PATCH] run cvs up before patching. use (sign dir) for computing attachment points. another (sign dir) fix for note markup use stem::calc-duration-log for rest. don't use guile -e main execution. Examine Stem::duration_log() for preventing merge of quarter and halfnote. Fixes collision-heads.ly. Add separate regtest for that. trim example. excise cmr10 formatting. use SCM_ASSERT_TYPE for graphing functions. nitpicks. --- ChangeLog | 38 +++++++++++++++++++ buildscripts/git-update-changelog.py | 4 +- input/regression/collision-heads.ly | 15 +------- .../collision-merge-differently-headed.ly | 25 ++++++++++++ lily/all-font-metrics.cc | 15 +------- lily/break-substitution.cc | 2 + lily/cluster.cc | 4 +- lily/dynamic-text-spanner.cc | 3 +- lily/engraver.cc | 10 ++--- lily/grob-property.cc | 11 +++--- lily/note-collision.cc | 13 ++++--- scm/define-grobs.scm | 3 +- scm/define-markup-commands.scm | 9 +++-- scripts/lilypond-invoke-editor.scm | 4 +- 14 files changed, 102 insertions(+), 54 deletions(-) create mode 100644 input/regression/collision-merge-differently-headed.ly diff --git a/ChangeLog b/ChangeLog index c4407c4a61..43a22c48b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2006-11-07 Han-Wen Nienhuys + + * lily/break-substitution.cc: + * lily/dynamic-text-spanner.cc: + nitpicks. + + * lily/engraver.cc: + * lily/grob-property.cc: + use SCM_ASSERT_TYPE for graphing functions. + + * lily/cluster.cc: + formatting. + + * lily/all-font-metrics.cc: + excise cmr10 + + * input/regression/collision-heads.ly: + trim example. + + * lily/note-collision.cc: + * input/regression/collision-merge-differently-headed.ly: + Examine Stem::duration_log() for preventing merge of quarter and halfnote. Fixes collision-heads.ly. Add separate regtest for that. + + * scripts/lilypond-invoke-editor.scm: + don't use guile -e main execution. + + * scm/define-grobs.scm: + use stem::calc-duration-log for rest. + + * scm/define-markup-commands.scm: + another (sign dir) fix for note markup + + * scm/define-markup-commands.scm: + use (sign dir) for computing attachment points. + + * buildscripts/git-update-changelog.py: + run cvs up before patching. + 2006-11-06 Han-Wen Nienhuys * lily/note-head.cc: diff --git a/buildscripts/git-update-changelog.py b/buildscripts/git-update-changelog.py index e3bc06384f..465e407ce1 100644 --- a/buildscripts/git-update-changelog.py +++ b/buildscripts/git-update-changelog.py @@ -224,13 +224,13 @@ Run this file from the CVS directory, with commits from the repository in --git- try: previously_done = dict((c, 1) for c in open ('.git-commits-done').read ().split ('\n')) - except OSError: + except IOError: previously_done = {} - commits = [c for c in commits if not previously_done.has_key (c.committish)] commits = [c for c in commits if not previously_done.has_key (c.committish)] commits = sorted (commits, cmp=Commit.compare) + system ('cvs up') file_adddel = [] collated_log = '' diff --git a/input/regression/collision-heads.ly b/input/regression/collision-heads.ly index adb2505364..5dc3a2c24e 100644 --- a/input/regression/collision-heads.ly +++ b/input/regression/collision-heads.ly @@ -1,11 +1,7 @@ -\version "2.7.39" +\version "2.9.29" \header { texidoc = - - "If @code{merge-differently-headed} is enabled, then -open note heads may be merged with black noteheads, but only -if the black note heads are from 8th or shorter notes. -" + "Open and black note heads are not merged by default." } @@ -15,15 +11,8 @@ if the black note heads are from 8th or shorter notes. \context Staff \relative c'' << { c2 c8 c4. - - \override Staff.NoteCollision #'merge-differently-headed = ##t - c2 c8 c4. - c2 }\\ { c8 c4. c2 - - c8 c4. c2 - c4 } >> diff --git a/input/regression/collision-merge-differently-headed.ly b/input/regression/collision-merge-differently-headed.ly new file mode 100644 index 0000000000..62e6e6b7a8 --- /dev/null +++ b/input/regression/collision-merge-differently-headed.ly @@ -0,0 +1,25 @@ +\version "2.7.39" +\header { + texidoc = + + "If @code{merge-differently-headed} is enabled, then +open note heads may be merged with black noteheads, but only +if the black note heads are from 8th or shorter notes. +" + +} + +\layout { ragged-right= ##t } + + +\context Staff \relative c'' << + { + \override Staff.NoteCollision #'merge-differently-headed = ##t + c2 c8 c4. + c2 + }\\ + { + c8 c4. c2 + c4 + } +>> diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 4159cd5a32..4d95f9e6c1 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -15,8 +15,6 @@ #include "scm-hash.hh" #include "warn.hh" -static char const *default_font_str0_ = "cmr10"; - All_font_metrics::All_font_metrics (string path) { otf_dict_ = new Scheme_hash_table; @@ -158,20 +156,9 @@ All_font_metrics::find_font (string name) { Font_metric *f = find_otf (name); - - if (!f) - { - warning (_f ("can't find font: `%s'", name.c_str ())); - warning (_ ("loading default font")); - } - - string def_name = default_font_str0_; - if (!f) { - error (_f ("can't find default font: `%s'", def_name.c_str ())); - error (_f ("(search path: `%s')", search_path_.to_string ())); - error (_ ("giving up")); + error (_f ("can't find font: `%s'", name.c_str ())); } return f; diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc index b01f242120..20ae27b01f 100644 --- a/lily/break-substitution.cc +++ b/lily/break-substitution.cc @@ -322,6 +322,8 @@ Spanner::fast_substitute_grob_array (SCM sym, /* We store items on the left, spanners on the right in this vector. + + FIXME: will not multithread. */ static Substitution_entry *vec; static int vec_room; diff --git a/lily/cluster.cc b/lily/cluster.cc index 6cb0060e67..27ef9dd08a 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -203,7 +203,9 @@ ADD_INTERFACE (Cluster, "cluster-interface", "The property @code{style} controls the shape of cluster segments. Valid values " "include @code{leftsided-stairs}, @code{rightsided-stairs}, @code{centered-stairs}, " "and @code{ramp}.\n", - "style padding columns"); + "style " + "padding " + "columns "); struct Cluster_beacon { diff --git a/lily/dynamic-text-spanner.cc b/lily/dynamic-text-spanner.cc index 32ef531c14..59eb1c3a58 100644 --- a/lily/dynamic-text-spanner.cc +++ b/lily/dynamic-text-spanner.cc @@ -51,7 +51,8 @@ Dynamic_text_spanner::print (SCM smob) Grob *me = unsmob_grob (smob); Spanner *spanner = dynamic_cast (me); - Grob *common = spanner->get_bound (LEFT)->common_refpoint (spanner->get_bound (RIGHT), X_AXIS); + Grob *common = spanner->get_bound (LEFT) + ->common_refpoint (spanner->get_bound (RIGHT), X_AXIS); Output_def *layout = me->layout (); Interval span_points; diff --git a/lily/engraver.cc b/lily/engraver.cc index f66aff808c..b61850eb2f 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -98,12 +98,12 @@ LY_DEFINE (ly_set_grob_creation_callback, "ly:set-grob-creation-callback", "the grob to be created and the corresponding line number in the " "C++ source file.") { - if (!ly_is_procedure (cb)) - warning (_ ("not setting creation callback: not a procedure")); - else - creation_callback = cb; + SCM_ASSERT_TYPE(ly_is_procedure (cb), cb, SCM_ARG1, __FUNCTION__, + "procedure"); - return SCM_EOL; + creation_callback = cb; + + return SCM_UNSPECIFIED; } #endif diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 707f4c118a..f1242994d5 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -32,11 +32,12 @@ LY_DEFINE (ly_set_grob_modification_callback, "ly:set-grob-modification-callback "which the modification was requested, the property to be changed and " "the new value for the property.") { - if (!ly_is_procedure (cb)) - warning (_ ("not setting modification callback: not a procedure")); - else - modification_callback = cb; - return SCM_EOL; + + SCM_ASSERT_TYPE(ly_is_procedure (cb), cb, SCM_ARG1, __FUNCTION__, + "procedure"); + + modification_callback = cb; + return SCM_UNSPECIFIED; } #endif diff --git a/lily/note-collision.cc b/lily/note-collision.cc index bce6d08a60..ddfbf19983 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -39,6 +39,9 @@ check_meshing_chords (Grob *me, if (!Note_column::get_stem (cu) || !Note_column::get_stem (cd)) return; + Drul_array stems (Note_column::get_stem (cd), + Note_column::get_stem (cu)); + Grob *nu = Note_column::first_head (cu); Grob *nd = Note_column::first_head (cd); @@ -90,10 +93,10 @@ check_meshing_chords (Grob *me, /* Should never merge quarter and half notes, as this would make them indistinguishable. */ if (merge_possible - && ((Rhythmic_head::duration_log (nu) == 1 - && Rhythmic_head::duration_log (nd) == 2) - || (Rhythmic_head::duration_log (nu) == 2 - && Rhythmic_head::duration_log (nd) == 1))) + && ((Stem::duration_log (stems[UP]) == 1 + && Stem::duration_log (stems[DOWN]) == 2) + || (Stem::duration_log (stems[UP]) == 2 + && Stem::duration_log (stems[DOWN]) == 1))) merge_possible = false; /* @@ -535,4 +538,4 @@ ADD_INTERFACE (Note_collision_interface, "note-collision-interface", /* properties */ "merge-differently-dotted " "merge-differently-headed " - "positioning-done"); + "positioning-done "); diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 920aaafbf6..be0de886f5 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1312,7 +1312,7 @@ (Rest . ( (stencil . ,ly:rest::print) - (duration-log . ,note-head::calc-duration-log) + (duration-log . ,stem::calc-duration-log) (X-extent . ,ly:rest::width) (Y-extent . ,ly:rest::height) (Y-offset . ,ly:rest::y-offset-callback) @@ -1707,7 +1707,6 @@ . ( (stencil . ,ly:text-interface::print) (Y-offset . ,ly:staff-symbol-referencer::callback) - (duration-log . ,note-head::calc-duration-log) (font-size . -2) (stem-attachment . (0.0 . 1.35)) (font-series . bold) diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 73e243a6a1..71407e60cd 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -1190,6 +1190,7 @@ figured bass notation" (define-markup-command (note-by-number layout props log dot-count dir) (number? number? number?) "Construct a note symbol, with stem. By using fractional values for @var{dir}, you can obtain longer or shorter stems." + (define (get-glyph-name-candidates dir log style) (map (lambda (dir-name) (format "noteheads.~a~a~a" dir-name (min log 2) @@ -1211,22 +1212,22 @@ figured bass notation" (size-factor (magstep (chain-assoc-get 'font-size props 0))) (style (chain-assoc-get 'style props '())) (stem-length (* size-factor (max 3 (- log 1)))) - (head-glyph-name (get-glyph-name font (get-glyph-name-candidates dir log style))) + (head-glyph-name (get-glyph-name font (get-glyph-name-candidates (sign dir) log style))) (head-glyph (ly:font-get-glyph font head-glyph-name)) (attach-indices (ly:note-head::stem-attachment font head-glyph-name)) (stem-thickness (* size-factor 0.13)) (stemy (* dir stem-length)) (attach-off (cons (interval-index (ly:stencil-extent head-glyph X) - (* dir (car attach-indices))) - (* dir ; fixme, this is inconsistent between X & Y. + (* (sign dir) (car attach-indices))) + (* (sign dir) ; fixme, this is inconsistent between X & Y. (interval-index (ly:stencil-extent head-glyph Y) (cdr attach-indices))))) (stem-glyph (and (> log 0) (ly:round-filled-box (ordered-cons (car attach-off) - (+ (car attach-off) (* (- dir) stem-thickness))) + (+ (car attach-off) (* (- (sign dir)) stem-thickness))) (cons (min stemy (cdr attach-off)) (max stemy (cdr attach-off))) (/ stem-thickness 3)))) diff --git a/scripts/lilypond-invoke-editor.scm b/scripts/lilypond-invoke-editor.scm index b07304e232..048ac3f53b 100755 --- a/scripts/lilypond-invoke-editor.scm +++ b/scripts/lilypond-invoke-editor.scm @@ -1,5 +1,4 @@ -#!@GUILE@ \ --e main -s +#!@GUILE@ -s !# ;;;; lilypond-invoke-editor.scm -- Invoke an editor in file:line:column mode ;;;; @@ -146,3 +145,4 @@ Options: (run-editor uri) (run-browser uri))))) +(main (command-line)) -- 2.39.2