From: Han-Wen Nienhuys Date: Sat, 1 Dec 2001 14:35:46 +0000 (+0100) Subject: release: 1.5.24 X-Git-Tag: release/1.5.24 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=af9078fd6d63dea5141e87a1b4d7cb5b0bcba84a;p=lilypond.git release: 1.5.24 --- diff --git a/CHANGES b/CHANGES index 0d14dd62f3..5f42581186 100644 --- a/CHANGES +++ b/CHANGES @@ -1,15 +1,11 @@ -1.5.23.jcn1 -=========== - -* Rewrote new conditional guile >= 1.5 compilation switches, to keep - code clean from conditionals and have a concentrated sets of - compatitility fixes for old guile versions. - -* Fixes for guile 1.4, including embedded ps. - 1.5.23 ====== +* Bugfix: be anal about slur dimensions. + +* Bugfix: insert extra margin around pixmaps. + +* lilypond-book: magnification option for EPS 1.5.22.jcn1 =========== @@ -121,7 +117,7 @@ abc2ly fixes: - Hmm, then find that + Sketch accesses characters by name, ie, the - name characters have in default text fonts. Luckily, textrace +clefs name characters have in default text fonts. Luckily, textrace mangles the feta names too. Sadly, textrace chooses different names for characters > 128. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000..162b8efefd --- /dev/null +++ b/ChangeLog @@ -0,0 +1,55 @@ +2001-12-01 Han-Wen + + * lily/note-head.cc (head_extent): added to compute width without + ledger lines. By default, ledger lines take up width now. + + * input/regression/fingering.ly: demonstrate auto fingering. + Horizontal placement is still buggy. + + * lily/fingering-engraver.cc (class Fingering_engraver): + added. Provides support for horizontal fingering scripts + + * lily/include/grob.hh: Naming: change parent_l() into get_parent() + + * lily/side-position-interface.cc (add_staff_support): add staff + only for Y-axis side positions. + + * lily/parser.yy (request_chord): Fix mem leak. + + * lily/musical-request.cc (transpose): moved to Music::transpose() + + * lily/include/grob-info.hh: Change music pointer to SCM, so we + can store grobs as grob-creation cause as well. + + * lily/group-interface.cc (add_thing): efficiency tweak: reuse + handle when adding. Use precomputed symbols throughout lily. + + * lily/rhythmic-column-engraver.cc: make NoteSpacing grobs to keep + track of spacing issues. + + * lily/separating-line-group-engraver.cc: make StaffSpacing grobs + to keep track of staff spacing + +2001-11-30 Jan Nieuwenhuizen + + * Rewrote new conditional guile >= 1.5 compilation switches, to keep + code clean from conditionals and have a concentrated sets of + compatitility fixes for old guile versions. + + * Fixes for guile 1.4, including embedded ps. + +2001-11-30 Han-Wen Nienhuys + + * lily/stanza-number-engraver.cc (process_music): allow pairs as + well for markup texts. + + * lily/musical-request.cc (length_mom): kludge for null pointer. + + * scm/sketch.scm (sketch-output-expression): guile 1.4 compatibility + + * scm/lily.scm (sign): bugfix + + * CHANGES: Change log instated. + + * stepmake/add-html-footer.py: @BRANCH@ tag insertion. + diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 623caf7189..3876f3b648 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -64,6 +64,8 @@ documenting bugfixes. @lilypondfile[printfilename]{glissando.ly} +@lilypondfile[printfilename]{fingering.ly} + @section Dynamics @lilypondfile[printfilename]{dynamics-line.ly} diff --git a/Documentation/topdocs/INSTALL.texi b/Documentation/topdocs/INSTALL.texi index e542171569..61cf08e3b9 100644 --- a/Documentation/topdocs/INSTALL.texi +++ b/Documentation/topdocs/INSTALL.texi @@ -531,7 +531,7 @@ interfere with your build, you may want to do this before the build too: @end example - +@c Why isn't this in BUGS (where it belongs?) @section Problems For help and questions use @email{lilypond-user@@gnu.org}. Please @@ -554,6 +554,21 @@ LilyPond with gcc-3.0 you may do: Note that this is fixed in Debian/unstable for flex >= 2.5.4a-13. + + +@unnumberedsubsec Linux-2.4.0, Guile-1.4 --with-threads + +There's a bug in certain kernels around version 2.4.0, that is +triggered when using Guile 1.4 compiled with pthreads. You'll see +random segmentation fault crashes of LilyPond. Upgrade to a newer +version of Linux. If you can't do that, you may try to recompiling +Guile without threads (YMMV): + +@example + guile-1.4$ ./configure --without-threads; make all install +@end example + + @unnumberedsubsec NetBSD @itemize @bullet diff --git a/GNUmakefile.in b/GNUmakefile.in index 0a743133cc..627e5a9a92 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -17,7 +17,7 @@ SUBDIRS = buildscripts scripts flower lily \ # SCRIPTS = configure aclocal.m4 -README_FILES = CHANGES COPYING DEDICATION NEWS README.mandrake ROADMAP +README_FILES = ChangeLog CHANGES COPYING DEDICATION NEWS README.mandrake ROADMAP README_TXT_FILES = AUTHORS.txt README.txt INSTALL.txt FAQ.txt IN_FILES := $(wildcard *.in) EXTRA_DIST_FILES = lilypond-font-lock.el lilypond-mode.el lilypond-init.el vimrc VERSION $(README_FILES) $(SCRIPTS) $(IN_FILES) emacsclient.patch lexer-gcc-3.0.patch diff --git a/INSTALL.txt b/INSTALL.txt index 972e0c14e5..a2b3a793e1 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -27,6 +27,7 @@ INSTALL - compiling and installing GNU LilyPond Debian GNU/Linux Problems FLex-2.5.4a and gcc-3.0 + Linux-2.4.0, Guile-1.4 -with-threads NetBSD Solaris: AIX @@ -519,6 +520,17 @@ LilyPond with gcc-3.0 you may do: Note that this is fixed in Debian/unstable for flex >= 2.5.4a-13. +Linux-2.4.0, Guile-1.4 -with-threads +------------------------------------ + + There's a bug in certain kernels around version 2.4.0, that is +triggered when using Guile 1.4 compiled with pthreads. You'll see +random segmentation fault crashes of LilyPond. Upgrade to a newer +version of Linux. If you can't do that, you may try to recompiling +Guile without threads (YMMV): + + guile-1.4$ ./configure --without-threads; make all install + NetBSD ------ diff --git a/VERSION b/VERSION index 67692397a3..cb07dab4b8 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=5 -PATCH_LEVEL=23 -MY_PATCH_LEVEL=jcn2 +PATCH_LEVEL=24 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/flower/axis.cc b/flower/axis.cc index 0bf70a244e..299e6b5443 100644 --- a/flower/axis.cc +++ b/flower/axis.cc @@ -16,6 +16,13 @@ axis_name_str (Axis a) return to_str (char (a + 'x')); } + +Axis +other_axis (Axis a) +{ + return a == Y_AXIS ? X_AXIS : Y_AXIS; +} + /* TODO inline these. */ diff --git a/flower/include/axes.hh b/flower/include/axes.hh index 7293725c03..77653eb0f8 100644 --- a/flower/include/axes.hh +++ b/flower/include/axes.hh @@ -25,6 +25,7 @@ String axis_name_str (Axis); /** the operator ++ for Axis. */ +Axis other_axis (Axis); Axis post_incr (Axis &); Axis incr (Axis &); //Axis operator++ (Axis); diff --git a/input/regression/beam-quanting.ly b/input/regression/beam-quanting.ly new file mode 100644 index 0000000000..8339c34279 --- /dev/null +++ b/input/regression/beam-quanting.ly @@ -0,0 +1,30 @@ +\header { + +texidoc = "Beam quanting can be twiddled using grob +properties. The following example shows how Y and DY can be +unquantised and quantised to 0 and 4 respectively." + +} + +\version "1.5.23" + +%{ +Have some fun beam quanting +%} + +% no y quantising +#(define (beam-vertical-position-quants m dy x y) '()) + +% rediculous dy quanting +#(define (beam-height-quants x y) '(0 4)) + +\score { + \notes\relative c'{ + \property Voice.Beam \override #'height-quants = #beam-height-quants + \property Voice.Beam \override #'vertical-position-quant-function = + #beam-vertical-position-quants + c8 c c c + c8 e g a + c,8 f b e + } +} diff --git a/input/regression/fingering.ly b/input/regression/fingering.ly new file mode 100644 index 0000000000..15c2933584 --- /dev/null +++ b/input/regression/fingering.ly @@ -0,0 +1,26 @@ +\header { + +texidoc = "Automatic fingering tries to put fingering instructions +next to noteheads. scriptHorizontal puts the center fingerings horizontally next to +the note heads. + +For this to function, you have to @code{\apply} pitchify-scripts to +the music you're dealing with, and you have to do so outside of a +@code{\relative} block. " + +} + +\score { + + \notes\relative c' { + c4-4 + + < c-1 e-2 g-3 b-4 > +\apply #pitchify-scripts \relative c' { c4-4 + + < c-1 e-2 g-3 b-4 > + \property Voice.scriptHorizontal = ##t + + + < c-1 e-2 g-3 b-4 > + } } } diff --git a/input/test/beam-pos.ly b/input/test/beam-pos.ly index 14b92742d8..2917db77dd 100644 --- a/input/test/beam-pos.ly +++ b/input/test/beam-pos.ly @@ -5,6 +5,7 @@ filename = "beam-pos.ly" composer = "jcn" enteredby = "jcn" copyright = "PD" +title = "Beam quantization" TestedFeatures = "beam quant positions" } diff --git a/lily/a2-engraver.cc b/lily/a2-engraver.cc index 6a08f56b79..39a6a9ff3a 100644 --- a/lily/a2-engraver.cc +++ b/lily/a2-engraver.cc @@ -98,7 +98,7 @@ A2_engraver::acknowledge_grob (Grob_info i) Grob*t = text_p_; Side_position_interface::add_support (t, i.grob_l_); if (Side_position_interface::get_axis (t) == X_AXIS - && !t->parent_l (Y_AXIS)) + && !t->get_parent (Y_AXIS)) t->set_parent (i.grob_l_, Y_AXIS); } if (Stem::has_interface (i.grob_l_)) diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index cb87b5edb3..65b83a1b61 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -90,6 +90,7 @@ number_accidentals (SCM sig, Note_req * note_l) if (prev == SCM_BOOL_F) prev = scm_assoc (gh_int2scm (n), sig); SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev); + bool different = !gh_equal_p (prev_acc , gh_int2scm (a)); int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0; @@ -266,7 +267,7 @@ Accidental_engraver::stop_translation_timestep () void Accidental_engraver::acknowledge_grob (Grob_info info) { - Note_req * note_l = dynamic_cast (info.req_l_); + Note_req * note_l = dynamic_cast (info.music_cause ()); if (note_l && Rhythmic_head::has_interface (info.grob_l_)) { diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 42d7846cb4..4c5151b6d5 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -20,7 +20,7 @@ Align_interface::alignment_callback (SCM element_smob, SCM axis) { Grob * me = unsmob_grob (element_smob); Axis ax = (Axis)gh_scm2int (axis); - Grob * par = me->parent_l (ax); + Grob * par = me->get_parent (ax); if (par && !to_boolean (par->get_grob_property ("alignment-done"))) { Align_interface::align_elements_to_extents (par, ax); @@ -34,7 +34,7 @@ Align_interface::fixed_distance_alignment_callback (SCM element_smob, SCM axis) { Grob * me = unsmob_grob (element_smob); Axis ax = (Axis)gh_scm2int (axis); - Grob * par = me->parent_l (ax); + Grob * par = me->get_parent (ax); if (par && !to_boolean (par->get_grob_property ("alignment-done"))) { Align_interface::align_to_fixed_distance (par, ax); diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index 8a5513c3e6..f366159596 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -85,7 +85,7 @@ Arpeggio_engraver::create_grobs () for (int i = 0; i < stems_.size (); i++) { - Pointer_group_interface::add_element (arpeggio_, "stems", stems_[i]); + Pointer_group_interface::add_element (arpeggio_, ly_symbol2scm ("stems"), stems_[i]); } for (int i = 0; i < supports_.size (); i++) { diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 8d13e857df..54ac1c8ead 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -360,7 +360,7 @@ Auto_beam_engraver::acknowledge_grob (Grob_info info) { Item* stem_l = dynamic_cast (info.grob_l_); - Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); + Rhythmic_req *rhythmic_req = dynamic_cast (info.music_cause ()); if (!rhythmic_req) { programming_error ("Stem must have rhythmic structure"); diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 413f1b6789..e030e09b4b 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -28,8 +28,7 @@ protected: virtual Spanner* get_spanner_p () const; virtual void add_element (Grob*) ; public: -TRANSLATOR_DECLARATIONS( - Axis_group_engraver ); +TRANSLATOR_DECLARATIONS(Axis_group_engraver ); }; @@ -107,7 +106,7 @@ Axis_group_engraver::create_grobs () /* UGH UGH UGH */ for (int i=0; i < elts_.size (); i++) { - Grob *par = elts_[i]->parent_l (Y_AXIS); + Grob *par = elts_[i]->get_parent (Y_AXIS); if ((!par || !Axis_group_interface::has_interface (par)) && ! elts_[i]->empty_b (Y_AXIS)) diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 02960f6aba..34541a5a5d 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -17,11 +17,11 @@ Axis_group_interface::add_element (Grob*me,Grob *e) { Axis a = (Axis) gh_scm2int (ly_car (ax)); - if (!e->parent_l (a)) + if (!e->get_parent (a)) e->set_parent (me, a); } - Pointer_group_interface::add_element (me, "elements", e); + Pointer_group_interface::add_element (me, ly_symbol2scm ("elements"), e); me->add_dependency (e); } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 3baff066a0..f457e4cebe 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -243,12 +243,12 @@ Beam_engraver::acknowledge_grob (Grob_info info) if (Stem::beam_l (stem_l)) return; - Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); + Rhythmic_req *rhythmic_req = dynamic_cast (info.music_cause ()); if (!rhythmic_req) { String s = _ ("stem must have Rhythmic structure"); - if (info.req_l_) - info.req_l_->origin ()->warning (s); + if (info.music_cause ()) + info.music_cause ()->origin ()->warning (s); else ::warning (s); diff --git a/lily/beam.cc b/lily/beam.cc index f744b4fff6..8bedaa22af 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -40,7 +40,7 @@ void Beam::add_stem (Grob*me, Grob*s) { - Pointer_group_interface:: add_element (me, "stems", s); + Pointer_group_interface::add_element (me, ly_symbol2scm ("stems"), s); s->add_dependency (me); diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index a463ba7bf0..6cafa97a58 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -28,10 +28,6 @@ public: TRANSLATOR_DECLARATIONS(Break_align_engraver); }; - - - - void Break_align_engraver::add_column (SCM smob) { @@ -88,7 +84,7 @@ Break_align_engraver::acknowledge_grob (Grob_info inf) { if (Item * item_l = dynamic_cast (inf.grob_l_)) { - if (item_l->empty_b (X_AXIS) || item_l->parent_l (X_AXIS)) + if (item_l->empty_b (X_AXIS) || item_l->get_parent (X_AXIS)) return; SCM bp=item_l->get_grob_property ("breakable"); diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index 8349ce5e63..be0b995068 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -39,7 +39,7 @@ Break_align_interface::alignment_callback (SCM element_smob, SCM axis) Axis a = (Axis) gh_scm2int (axis); assert (a == X_AXIS); - Grob *par = me->parent_l (a); + Grob *par = me->get_parent (a); if (par && !to_boolean (par->get_grob_property ("break-alignment-done")))\ { par->set_grob_property ("break-alignment-done", SCM_BOOL_T); diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 61e1faab4b..0a78017c8f 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -80,7 +80,7 @@ Chord_name_engraver::try_music (Music* m) void Chord_name_engraver::acknowledge_grob (Grob_info i) { - if (Note_req* n = dynamic_cast (i.req_l_)) + if (Note_req* n = dynamic_cast (i.music_cause ())) add_note (n); } diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 50f16f5e5c..d3ff4fa692 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -184,15 +184,15 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info) } s->set_grob_property ("direction", d); - if (dynamic_cast (info.req_l_)) + if (dynamic_cast (info.music_cause ())) { Beam::add_stem (beam_p_, s); } else { String s = _ ("stem must have Rhythmic structure"); - if (info.req_l_) - info.req_l_->origin ()->warning (s); + if (info.music_cause ()) + info.music_cause ()->origin ()->warning (s); else ::warning (s); } diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc index eb52ebd0f8..379fde5e16 100644 --- a/lily/collision-engraver.cc +++ b/lily/collision-engraver.cc @@ -52,7 +52,7 @@ Collision_engraver::acknowledge_grob (Grob_info i) if (Note_column::has_interface (i.grob_l_)) { /*should check Y axis? */ - if (Note_column::rest_b (i.grob_l_) || i.grob_l_->parent_l (X_AXIS)) + if (Note_column::rest_b (i.grob_l_) || i.grob_l_->get_parent (X_AXIS)) return ; note_column_l_arr_.push (i.grob_l_); diff --git a/lily/collision.cc b/lily/collision.cc index 87d9a7671d..288b2a2fa0 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -24,7 +24,7 @@ Collision::force_shift_callback (SCM element_smob, SCM axis) Axis a = (Axis) gh_scm2int (axis); assert (a == X_AXIS); - me = me->parent_l (a); + me = me->get_parent (a); /* ugh. the way DONE is done is not clean */ diff --git a/lily/custos-engraver.cc b/lily/custos-engraver.cc index 0763cd7431..faec3cd556 100644 --- a/lily/custos-engraver.cc +++ b/lily/custos-engraver.cc @@ -85,7 +85,7 @@ Custos_engraver::acknowledge_grob (Grob_info info) don't look at the staff-position, since we can't be sure whether Clef_engraver already applied a vertical shift. */ - Note_req * nr = dynamic_cast (info.req_l_); + Note_req * nr = dynamic_cast (info.music_cause ()); if (nr) pitches_.push (*unsmob_pitch (nr->get_mus_property ("pitch"))); } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index ba07971a1a..f59a32c20a 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -23,7 +23,7 @@ Dot_column::force_shift_callback (SCM element_smob, SCM axis) Grob *me = unsmob_grob (element_smob); Axis a = (Axis) gh_scm2int (axis); assert (a == Y_AXIS); - me = me->parent_l (X_AXIS); + me = me->get_parent (X_AXIS); SCM l = me->get_grob_property ("dots"); do_shifts (l); return gh_double2scm (0.0); @@ -135,7 +135,7 @@ Dot_column::add_head (Grob * me, Grob *rh) { Side_position_interface::add_support (me,rh); - Pointer_group_interface ::add_element (me, "dots",d); + Pointer_group_interface::add_element (me, ly_symbol2scm ("dots"), d); d->add_offset_callback (Dot_column::force_shift_callback_proc , Y_AXIS); Axis_group_interface::add_element (me, d); } diff --git a/lily/engraver.cc b/lily/engraver.cc index 347d1a7022..90027d1309 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -23,13 +23,18 @@ Engraver::announce_grob (Grob_info inf) void Engraver::announce_grob (Grob* e, Music *m) { + /* + TODO: junk grob-info, and make a cause grob-property to store + `causes' generically. + */ + if (m && store_locations_global_b && m->origin ()->location_str ().length_i ()) { e->set_grob_property ("origin", m->get_mus_property ("origin")); } - Grob_info i (e, m); + Grob_info i (e, m ? m->self_scm () : SCM_UNDEFINED); if (!i.origin_trans_l_) i.origin_trans_l_ = this; daddy_grav_l ()->announce_grob (i); diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc new file mode 100644 index 0000000000..afdd5482bd --- /dev/null +++ b/lily/fingering-engraver.cc @@ -0,0 +1,247 @@ +/* + fingering-engraver.cc -- implement Fingering_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1998--2001 Han-Wen Nienhuys + + */ + + +#include "engraver.hh" +#include "side-position-interface.hh" +#include "item.hh" +#include "musical-request.hh" +#include "stem.hh" +#include "rhythmic-head.hh" + +class Fingering_engraver : public Engraver +{ + Link_array reqs_; + Link_array fingerings_; + + Link_array up_reqs_; + Link_array hor_reqs_; + Link_array down_reqs_; + +public: + TRANSLATOR_DECLARATIONS(Fingering_engraver); +protected: + virtual bool try_music (Music* m); + virtual void stop_translation_timestep (); + virtual void start_translation_timestep (); + virtual void process_music (); + virtual void acknowledge_grob (Grob_info); + + void make_script (Direction, Music*,Axis, int); +}; + +bool +Fingering_engraver::try_music (Music *m) +{ + if (dynamic_cast (m)) + { + if (m->get_mus_property ("text-type") != ly_symbol2scm ("finger")) + return false; + + reqs_.push (m); + return true; + } + return false; +} + +void +Fingering_engraver::acknowledge_grob (Grob_info inf) +{ + + if (Stem::has_interface (inf.grob_l_)) + { + for (int i=0; i < fingerings_.size (); i++) + { + Side_position_interface::add_support (fingerings_[i],inf.grob_l_); + } + } + else if (Rhythmic_head::has_interface (inf.grob_l_)) + { + Music * mc =inf.music_cause (); + Pitch * mp = mc? unsmob_pitch (mc->get_mus_property ("pitch")) :0; + for (int i=0; i < fingerings_.size (); i++) + { + Grob*t = fingerings_[i]; + Side_position_interface::add_support (t,inf.grob_l_); + Pitch *fp = unsmob_pitch (t->get_grob_property ("pitch")); + if (fp) + { + if (!mp) + continue; + + if (*fp == *mp) + { + Axis other = other_axis (Side_position_interface::get_axis (t)); + t->set_parent (inf.grob_l_, other); + } + } + else + { + if (!t->get_parent (X_AXIS)) + t->set_parent (inf.grob_l_, X_AXIS); + } + } + } +} + +static int +req_compare (Music * const &a,Music * const &b) +{ + Pitch *pa = unsmob_pitch (a->get_mus_property ("pitch")); + Pitch *pb = unsmob_pitch (b->get_mus_property ("pitch")); + + if (!pa && !pb) + return 0; + if (pa && !pb) + return 1; + if (!pa && pb) + return -1; + + return Pitch::compare (*pa, *pb); +} + +void +Fingering_engraver::process_music () +{ + if (!reqs_.size()) + return ; + + Link_array pitch_sorted_reqs = reqs_; + for (int i= pitch_sorted_reqs.size(); i--;) + { + SCM dir = pitch_sorted_reqs[i]->get_mus_property ("direction"); + if (isdir_b (dir) && to_dir (dir)) { + if (to_dir (dir) == UP) + up_reqs_.push (pitch_sorted_reqs[i]); + else if (to_dir (dir) == DOWN) + down_reqs_ .push (pitch_sorted_reqs[i]); + pitch_sorted_reqs.del(i); + + continue ; + } + else if (!unsmob_pitch (pitch_sorted_reqs[i]->get_mus_property ("pitch"))) + { + /* + chuck out reqs that have no pitch. We put them over the note by default. + */ + up_reqs_.push (pitch_sorted_reqs [i]); + pitch_sorted_reqs.del (i); + } + } + up_reqs_.reverse (); + down_reqs_.reverse (); + + pitch_sorted_reqs.sort (&req_compare); + + if (to_boolean (get_property ("scriptHorizontal"))) + { +#if 1 // -> 0 for testing horizontal fingerings. + + down_reqs_.push ( pitch_sorted_reqs[0]); + pitch_sorted_reqs.del (0); + + if (pitch_sorted_reqs.size()) + { + up_reqs_.push (pitch_sorted_reqs.top ()); + pitch_sorted_reqs.pop(); + } +#endif + hor_reqs_ = pitch_sorted_reqs; + } + else + { + int sz = pitch_sorted_reqs.size (); + down_reqs_.concat (pitch_sorted_reqs.slice(0, (sz + sz%2)/2 )); + up_reqs_.concat (pitch_sorted_reqs.slice((sz + sz%2)/2, sz)); + hor_reqs_ .clear (); + } + + for (int i = 0; i < down_reqs_.size();i++) + make_script (DOWN, down_reqs_[i], Y_AXIS, i); + for (int i = 0; i < up_reqs_.size();i++) + make_script (UP, up_reqs_[i], Y_AXIS, i); + for (int i = 0; i < hor_reqs_.size();i++) + make_script (CENTER, hor_reqs_[i],X_AXIS, i); +} + +void +Fingering_engraver::make_script (Direction d, Music *r,Axis a, int i) +{ + Item *fingering = new Item (get_property ("Fingering")); + + Axis other = other_axis (a); + + SCM pitch = r->get_mus_property ("pitch"); + if (unsmob_pitch (pitch)) + fingering->set_grob_property ("pitch", pitch); + + Side_position_interface::set_axis (fingering, a); + + fingering->add_offset_callback (Side_position_interface::aligned_on_self_proc, other); + fingering->add_offset_callback (Side_position_interface::centered_on_parent_proc, other); + fingering->set_grob_property ("script-priority", + gh_int2scm (100 + d* i)); + + + if (!isdir_b (fingering->get_grob_property ("direction"))) + { + if (d) + fingering->set_grob_property ("direction", gh_int2scm (d)); + else + fingering->set_grob_property ("direction", gh_int2scm (RIGHT)); + } + + fingering->set_grob_property ("text", r->get_mus_property ("text")); + + SCM nonempty = get_property ("textNonEmpty"); + if (to_boolean (nonempty)) + /* + empty fingering: signal that no rods should be applied. + */ + fingering->set_grob_property ("no-spacing-rods" , SCM_BOOL_F); + + announce_grob (fingering, r); + fingerings_.push (fingering); +} + +void +Fingering_engraver::stop_translation_timestep () +{ + if (!fingerings_.size ()) + return; + + for (int i=0; i < fingerings_.size (); i++) + { + Item *ti = fingerings_[i]; + Side_position_interface::add_staff_support (ti); + typeset_grob (ti); + } + fingerings_.clear (); +} + +void +Fingering_engraver::start_translation_timestep () +{ + reqs_.clear (); + up_reqs_.clear (); + down_reqs_.clear (); + hor_reqs_.clear (); +} + +Fingering_engraver::Fingering_engraver() +{ + +} + +ENTER_DESCRIPTION(Fingering_engraver, +/* descr */ "Create fingering-scripts", +/* creats*/ "Fingering", +/* acks */ "rhythmic-head-interface stem-interface", +/* reads */ "scriptHorizontal textNonEmpty", +/* write */ ""); diff --git a/lily/grob-info.cc b/lily/grob-info.cc index 542e9698bb..e1d60b3195 100644 --- a/lily/grob-info.cc +++ b/lily/grob-info.cc @@ -11,10 +11,10 @@ #include "translator.hh" #include "translator-group.hh" -Grob_info::Grob_info (Grob*s_l, Music *r_l) +Grob_info::Grob_info (Grob*s_l, SCM c) { grob_l_ = s_l; - req_l_ = r_l; + cause_ = c; origin_trans_l_ = 0; } @@ -22,10 +22,15 @@ Grob_info::Grob_info (Grob*s_l, Music *r_l) Grob_info::Grob_info () { grob_l_ = 0; - req_l_ = 0; + cause_ = SCM_EOL; origin_trans_l_ = 0; } +Music* +Grob_info::music_cause () +{ + return unsmob_music (cause_); +} Link_array Grob_info::origin_trans_l_arr (Translator* end) const diff --git a/lily/grob.cc b/lily/grob.cc index 4251e16c5e..fd519adb74 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -330,8 +330,7 @@ Grob::add_dependency (Grob*e) { if (e) { - Pointer_group_interface ::add_element (this, "dependencies",e); - + Pointer_group_interface::add_element (this, ly_symbol2scm ("dependencies"),e); } else programming_error ("Null dependency added"); @@ -719,7 +718,7 @@ Grob::fixup_refpoint (SCM smob) for (int a = X_AXIS; a < NO_AXES; a ++) { Axis ax = (Axis)a; - Grob * parent = me->parent_l (ax); + Grob * parent = me->get_parent (ax); if (!parent) continue; @@ -770,7 +769,7 @@ Grob::mark_smob (SCM ses) { scm_gc_mark (s->dim_cache_[a].offset_callbacks_); scm_gc_mark (s->dim_cache_[a].dimension_); - Grob *p = s->parent_l (Y_AXIS); + Grob *p = s->get_parent (Y_AXIS); if (p) scm_gc_mark (p->self_scm ()); } diff --git a/lily/group-interface.cc b/lily/group-interface.cc index 3734882cee..74bd4ad751 100644 --- a/lily/group-interface.cc +++ b/lily/group-interface.cc @@ -10,13 +10,41 @@ #include "grob.hh" +/* + This special add_thing routine is slightly more efficient than + + set_prop (name,cons (thing, get_prop (name))) + + since it can reuse the handle returned by scm_assq(). +*/ + void -Group_interface::add_thing (Grob*me, String name, SCM s) +Group_interface::add_thing (Grob*me, SCM sym, SCM thing) { - me->set_grob_property (name.ch_C (), - gh_cons (s, me->get_grob_property (name.ch_C ()))); + SCM handle = scm_sloppy_assq (sym, me->mutable_property_alist_); + if (handle != SCM_BOOL_F) + { + gh_set_cdr_x (handle, gh_cons (thing, gh_cdr (handle))); + + } + else + { + /* + There is no mutable prop yet, so create an entry, and put it in front of the + mutable prop list. + */ + handle = scm_sloppy_assq (sym, me->immutable_property_alist_); + SCM tail = (handle != SCM_BOOL_F) ? gh_cdr(handle) : SCM_EOL; + me->mutable_property_alist_ = gh_cons (gh_cons (sym, gh_cons (thing, tail)), + me->mutable_property_alist_); + } } +void +Group_interface::add_thing (Grob*me, String name, SCM thing) +{ + add_thing (me, ly_symbol2scm (name.ch_C()), thing); +} int Group_interface::count (Grob *me, String name) @@ -26,7 +54,7 @@ Group_interface::count (Grob *me, String name) void -Pointer_group_interface::add_element (Grob*me, String name, Grob*p) +Pointer_group_interface::add_element (Grob*me, SCM name, Grob*p) { Group_interface::add_thing (me, name, p->self_scm ()); } diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index 909a49d183..11ac30e8ac 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -70,7 +70,7 @@ Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (SCM element_smob, S Grob *daughter = unsmob_grob (element_smob); Axis a = (Axis) gh_scm2int (axis); assert (a == Y_AXIS); - force_hara_kiri_callback (daughter->parent_l (a)->self_scm (), axis); + force_hara_kiri_callback (daughter->get_parent (a)->self_scm (), axis); return gh_double2scm (0.0); } @@ -99,5 +99,5 @@ void Hara_kiri_group_spanner::add_interesting_item (Grob* me,Grob* n) { me->add_dependency (n); - Pointer_group_interface::add_element (me, "items-worth-living",n); + Pointer_group_interface::add_element (me, ly_symbol2scm ("items-worth-living"),n); } diff --git a/lily/include/grob-info.hh b/lily/include/grob-info.hh index ad399d4119..6d8868214c 100644 --- a/lily/include/grob-info.hh +++ b/lily/include/grob-info.hh @@ -10,6 +10,7 @@ #ifndef STAFFELEMINFO_HH #define STAFFELEMINFO_HH +#include "lily-guile.hh" #include "lily-proto.hh" #include "parray.hh" @@ -21,13 +22,19 @@ struct Grob_info { Translator * origin_trans_l_; friend class Engraver; -public: - Link_array origin_trans_l_arr (Translator*) const; Grob * grob_l_; - Music *req_l_; - - Grob_info (Grob*, Music*); + + /* + Notice that CAUSE is not GC protected ; this might be a cause for + GC errors if you don't use music or grobs as a cause. + */ + SCM cause_; + +public: + Music * music_cause (); + Link_array origin_trans_l_arr (Translator*) const; + Grob_info (Grob*, SCM); Grob_info (); }; diff --git a/lily/include/grob.hh b/lily/include/grob.hh index e9665ea31b..228a73fc60 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -176,7 +176,7 @@ public: */ void set_parent (Grob* e, Axis); - Grob *parent_l (Axis a) const { return dim_cache_[a].parent_l_; } + Grob *get_parent (Axis a) const { return dim_cache_[a].parent_l_; } DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM)); }; diff --git a/lily/include/group-interface.hh b/lily/include/group-interface.hh index 7a07bccd6d..8df58bce5b 100644 --- a/lily/include/group-interface.hh +++ b/lily/include/group-interface.hh @@ -27,12 +27,13 @@ struct Group_interface { public: static int count (Grob* , String); + static void add_thing (Grob*, SCM, SCM); static void add_thing (Grob*, String nm, SCM); }; struct Pointer_group_interface : public Group_interface { public: - static void add_element (Grob*, String nm, Grob*e); + static void add_element (Grob*, SCM nm, Grob*e); }; /** Put all score elements of ELT's property called NAME into an array, diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index cd3e27b315..4b2e2d27dc 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -77,8 +77,6 @@ struct Melodic_req :virtual Request static int compare (Melodic_req const&,Melodic_req const&); protected: - /// transpose. #delta# is relative to central c. - virtual void transpose (Pitch delta); virtual bool do_equal_b (Request const*) const; VIRTUAL_COPY_CONS (Music); diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index f44eba230e..3b03eae29f 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -21,7 +21,8 @@ class Note_head { public: DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM )); - static Molecule ledger_lines (Grob*,int,Direction,Interval); + static Interval head_extent (Grob*,Axis); + static Molecule ledger_lines (Grob*, bool, int,Direction,Interval); static Molecule ledger_line (Interval, Grob*) ; DECLARE_SCHEME_CALLBACK (brew_ez_molecule, (SCM )); static bool has_interface (Grob*); diff --git a/lily/include/note-spacing.hh b/lily/include/note-spacing.hh new file mode 100644 index 0000000000..ed92e06519 --- /dev/null +++ b/lily/include/note-spacing.hh @@ -0,0 +1,21 @@ +/* +note-spacing.hh -- declare Note_spacing + +source file of the GNU LilyPond music typesetter + +(c) 2001 Han-Wen Nienhuys + + */ + +#ifndef NOTE_SPACING_HH +#define NOTE_SPACING_HH + +#include "lily-proto.hh" + +class Note_spacing +{ +public: + static bool has_interface (Grob*); +}; + +#endif /* NOTE_SPACING_HH */ diff --git a/lily/include/staff-spacing.hh b/lily/include/staff-spacing.hh new file mode 100644 index 0000000000..9617c5c525 --- /dev/null +++ b/lily/include/staff-spacing.hh @@ -0,0 +1,21 @@ +/* +staff-spacing.hh -- declare Staff_spacing + +source file of the GNU LilyPond music typesetter + +(c) 2001 Han-Wen Nienhuys + + */ + +#ifndef STAFF_SPACING_HH +#define STAFF_SPACING_HH + +#include "lily-proto.hh" + +class Staff_spacing +{ +public: + static bool has_interface (Grob*); +}; + +#endif /* STAFF_SPACING_HH */ diff --git a/lily/item.cc b/lily/item.cc index 6fae06efb9..4447f3f64f 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -40,21 +40,21 @@ Item::breakable_b (Grob*me) if (!dynamic_cast (me)) programming_error ("only items can be breakable."); - Item * i =dynamic_cast (me->parent_l (X_AXIS)); + Item * i =dynamic_cast (me->get_parent (X_AXIS)); return (i) ? Item::breakable_b (i) : to_boolean (me->get_grob_property ("breakable")); } Paper_column * Item::column_l () const { - Item *parent = dynamic_cast (parent_l (X_AXIS)); + Item *parent = dynamic_cast (get_parent (X_AXIS)); return parent ? parent->column_l () : 0; } Line_of_score * Item::line_l () const { - Grob *g = parent_l (X_AXIS); + Grob *g = get_parent (X_AXIS); return g ? g->line_l () : 0; } diff --git a/lily/line-group-group-engraver.cc b/lily/line-group-group-engraver.cc index a324aef2d8..958e405ef7 100644 --- a/lily/line-group-group-engraver.cc +++ b/lily/line-group-group-engraver.cc @@ -24,7 +24,7 @@ Line_group_engraver_group::Line_group_engraver_group () void Line_group_engraver_group::typeset_grob (Grob *elem) { - if (!elem->parent_l (Y_AXIS)) + if (!elem->get_parent (Y_AXIS)) Axis_group_interface::add_element (staffline_p_, elem); Engraver_group_engraver::typeset_grob (elem); } diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 464cd4e6ab..5ae17470b1 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -51,7 +51,7 @@ void Line_of_score::typeset_grob (Grob * elem_p) { elem_p->pscore_l_ = pscore_l_; - Pointer_group_interface::add_element (this, "all-elements",elem_p); + Pointer_group_interface::add_element (this, ly_symbol2scm ("all-elements"),elem_p); scm_gc_unprotect_object (elem_p->self_scm ()); } @@ -63,6 +63,7 @@ Line_of_score::output_lines () { unsmob_grob (ly_car (s))->do_break_processing (); } + /* fixups must be done in broken line_of_scores, because new elements are put over there. */ @@ -77,7 +78,6 @@ Line_of_score::output_lines () } count += scm_ilength (all); } - /* needed for doing items. @@ -164,8 +164,8 @@ set_loose_columns (Line_of_score* which, Column_x_positions const *posns) right = loose; - Real rx = right->relative_coordinate (right->parent_l (X_AXIS), X_AXIS); - Real lx = left->relative_coordinate (left->parent_l (X_AXIS), X_AXIS); + Real rx = right->relative_coordinate (right->get_parent (X_AXIS), X_AXIS); + Real lx = left->relative_coordinate (left->get_parent (X_AXIS), X_AXIS); int j = 1; loose = col; @@ -365,7 +365,7 @@ Line_of_score::post_processing (bool last_line) /* generate all molecules to trigger all font loads. - (ugh. This is not very memory efficient.) */ + (ugh. This is not very memory efficient.) */ for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s)) { unsmob_grob (ly_car (s))->get_molecule (); diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 9870a13a88..ac54514748 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -223,7 +223,7 @@ Multi_measure_rest::brew_molecule (SCM smob) void Multi_measure_rest::add_column (Grob*me,Item* c) { - Pointer_group_interface::add_element (me, "columns",c); + Pointer_group_interface::add_element (me, ly_symbol2scm ("columns"),c); add_bound_item (dynamic_cast (me),c); } diff --git a/lily/music.cc b/lily/music.cc index 178a602aa7..50d20245b2 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -130,8 +130,22 @@ Music::to_relative_octave (Pitch m) void -Music::transpose (Pitch) +Music::transpose (Pitch delta) { + Pitch *p = unsmob_pitch (get_mus_property ("pitch")); + if (!p) + return ; + + Pitch np = *p; + np.transpose (delta); + + if (abs (np.alteration_i_) > 2) + { + warning (_f ("Transposition by %s makes accidental larger than two", + delta.str ())); + } + + set_mus_property ("pitch", np.smobbed_copy ()); } IMPLEMENT_TYPE_P (Music, "music?"); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 7ed6f00438..5b9c8bf6ec 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -16,22 +16,6 @@ Tremolo_req::Tremolo_req () { } -void -Melodic_req::transpose (Pitch delta) -{ - Pitch p = *unsmob_pitch (get_mus_property ("pitch")); - - p.transpose (delta); - - if (abs (p.alteration_i_) > 2) - { - warning (_f ("Transposition by %s makes accidental larger than two", - delta.str ())); - } - - set_mus_property ("pitch", p.smobbed_copy ()); -} - bool Melodic_req::do_equal_b (Request const* r) const { @@ -47,13 +31,16 @@ Rhythmic_req::do_equal_b (Request const* r) const return rh; // ; && !compare (*this, *rh); } - - Moment Rhythmic_req::length_mom () const { - Duration* d = unsmob_duration (get_mus_property ("duration")); - return d ? d->length_mom () : Moment (0); + Duration *d = unsmob_duration (get_mus_property ("duration")); + if (!d){ + Moment m ; + programming_error("Rhythmic_req has no duration"); + return m; + } + return d->length_mom (); } void diff --git a/lily/new-spacing-spanner.cc b/lily/new-spacing-spanner.cc index 5fc0aaf498..9ec228cad1 100644 --- a/lily/new-spacing-spanner.cc +++ b/lily/new-spacing-spanner.cc @@ -7,6 +7,7 @@ */ + #include "paper-column.hh" #include "dimensions.hh" #include "paper-def.hh" diff --git a/lily/note-column.cc b/lily/note-column.cc index 9a0cdf8a9b..56a29d08a3 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -100,7 +100,7 @@ Note_column::add_head (Grob*me,Grob *h) } else if (Note_head::has_interface (h)) { - Pointer_group_interface::add_element (me, "note-heads",h); + Pointer_group_interface::add_element (me, ly_symbol2scm ("note-heads"),h); } Axis_group_interface::add_element (me, h); } diff --git a/lily/note-head.cc b/lily/note-head.cc index 9c894986e3..3b322d29dc 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -16,6 +16,12 @@ #include "musical-request.hh" #include "rhythmic-head.hh" +/* + Note_head contains the code for printing note heads and the ledger lines. + + TODO: maybe it's worthwhile to split away the Ledger lines into a + separate grob. */ + #include "staff-symbol-referencer.hh" /* @@ -53,12 +59,25 @@ Note_head::ledger_line (Interval xwid, Grob *me) Molecule -Note_head::ledger_lines (Grob*me, int count, Direction dir, Interval idw) +Note_head::ledger_lines (Grob*me, + bool take_space, + int count, Direction dir, Interval idw) { Real inter_f = Staff_symbol_referencer::staff_space (me)/2; + + /* + idw ? + + (who's that ? :-) + + + --hwn + */ Molecule ledger (ledger_line (idw, me)); - ledger.set_empty (true); + if (!take_space) + ledger.set_empty (true); + Real offs = (Staff_symbol_referencer::on_staffline (me)) ? 0.0 : -dir * inter_f; @@ -75,13 +94,9 @@ Note_head::ledger_lines (Grob*me, int count, Direction dir, Interval idw) return legs; } -MAKE_SCHEME_CALLBACK (Note_head,brew_molecule,1); - -SCM -Note_head::brew_molecule (SCM smob) +Molecule +internal_brew_molecule (Grob *me, bool ledger_take_space) { - Grob *me = unsmob_grob (smob); - int sz = Staff_symbol_referencer::line_count (me)-1; int p = (int) rint (Staff_symbol_referencer::position_f (me)); int streepjes_i = abs (p) < sz @@ -91,7 +106,7 @@ Note_head::brew_molecule (SCM smob) SCM style = me->get_grob_property ("style"); if (!gh_symbol_p (style)) { - return SCM_EOL; + return Molecule(); } /* @@ -106,18 +121,34 @@ Note_head::brew_molecule (SCM smob) String name = "noteheads-" + ly_scm2string (scm_primitive_eval (exp)); Molecule out = Font_interface::get_default_font (me)->find_by_name (name); - if (streepjes_i) { Direction dir = (Direction)sign (p); Interval hd = out.extent (X_AXIS); Real hw = hd.length ()/4; - out.add_molecule (ledger_lines (me, streepjes_i, dir, + out.add_molecule (Note_head::ledger_lines (me, ledger_take_space, streepjes_i, dir, Interval (hd[LEFT] - hw, hd[RIGHT] + hw))); } - - return out.smobbed_copy (); + return out; +} + +MAKE_SCHEME_CALLBACK (Note_head,brew_molecule,1); + +SCM +Note_head::brew_molecule (SCM smob) +{ + Grob *me = unsmob_grob (smob); + return internal_brew_molecule (me, true).smobbed_copy (); +} + +/* + Compute the width the head without ledgers. + */ +Interval +Note_head::head_extent (Grob *me, Axis a) +{ + return internal_brew_molecule (me, false).extent (a); } bool @@ -129,6 +160,10 @@ Note_head::has_interface (Grob*m) MAKE_SCHEME_CALLBACK (Note_head,brew_ez_molecule,1); +/* + TODO: ledger lines are causing a mess again, now with accidentals and + ez-note heads. + */ SCM Note_head::brew_ez_molecule (SCM smob) { @@ -155,8 +190,8 @@ Note_head::brew_ez_molecule (SCM smob) Direction dir = (Direction)sign (p); Interval hd = m.extent (X_AXIS); Real hw = hd.length ()/4; - m.add_molecule (ledger_lines (me, streepjes_i, dir, - Interval (hd[LEFT] - hw, + m.add_molecule (ledger_lines (me, false, streepjes_i, dir, + Interval (hd[LEFT] - hw, hd[RIGHT] + hw))); } diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index e3eed55cd5..2a9b5e49e4 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -36,6 +36,11 @@ protected: virtual void stop_translation_timestep (); }; + +Note_heads_engraver::Note_heads_engraver() +{ +} + bool Note_heads_engraver::try_music (Music *m) { @@ -51,7 +56,6 @@ Note_heads_engraver::try_music (Music *m) return now_mom () < note_end_mom_; } return false; - } @@ -63,8 +67,6 @@ Note_heads_engraver::process_music () Item *note_p = new Item (get_property ("NoteHead")); Staff_symbol_referencer::set_interface (note_p); - - Music * req = note_req_l_arr_[i]; @@ -107,7 +109,7 @@ Note_heads_engraver::process_music () note_p_arr_.push (note_p); } } - + void Note_heads_engraver::stop_translation_timestep () { @@ -115,6 +117,7 @@ Note_heads_engraver::stop_translation_timestep () { typeset_grob (note_p_arr_[i]); } + note_p_arr_.clear (); for (int i=0; i < dot_p_arr_.size (); i++) { @@ -128,12 +131,8 @@ Note_heads_engraver::stop_translation_timestep () void Note_heads_engraver::start_translation_timestep () { - - } -Note_heads_engraver::Note_heads_engraver() -{} ENTER_DESCRIPTION(Note_heads_engraver, /* descr */ "Generate one or more noteheads from Music of type Note_req.", diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc new file mode 100644 index 0000000000..81eb2aa03b --- /dev/null +++ b/lily/note-spacing.cc @@ -0,0 +1,17 @@ +/* +note-spacing.cc -- implement + +source file of the GNU LilyPond music typesetter + +(c) 2001 Han-Wen Nienhuys + + */ + +#include "note-spacing.hh" +#include "grob.hh" + +bool +Note_spacing::has_interface (Grob* g) +{ + return g && g->has_interface (ly_symbol2scm ("note-spacing-interface")); +} diff --git a/lily/parser.yy b/lily/parser.yy index 022451ca8d..0a7437fead 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1091,15 +1091,16 @@ request_chord: THIS->push_spot (); } /*cont */ simple_element post_requests { Music_sequence *l = dynamic_cast ($3); - if (l) { - for (int i=0; i < $1->size (); i++) - l->append_music ($1->elem (i)); - for (int i=0; i < $4->size (); i++) - l->append_music ($4->elem (i)); - } - else - programming_error ("Need Sequence to add music to"); + + $1->concat (*$4); + for (int i=0; i < $1->size (); i++) { + Music * m = $1->elem (i); + l->append_music (m); + } $$ = $3; + + delete $1; + delete $4; } | command_element ; @@ -1250,8 +1251,6 @@ verbose_command_req: } | PENALTY SCM_T { - - Break_req * b = new Break_req; SCM s = $2; if (!gh_number_p (s)) @@ -1578,7 +1577,6 @@ script_abbreviation: } ; - script_dir: '_' { $$ = DOWN; } | '^' { $$ = UP; } diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index cd83bae840..f8546b7456 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -92,7 +92,7 @@ Piano_pedal_engraver::acknowledge_grob (Grob_info info) Side_position_interface::add_support (p->item_p_, info.grob_l_); if (Side_position_interface::get_axis (p->item_p_) == X_AXIS - && !p->item_p_->parent_l (Y_AXIS)) + && !p->item_p_->get_parent (Y_AXIS)) p->item_p_->set_parent (info.grob_l_, Y_AXIS); } if (Stem::has_interface (info.grob_l_)) diff --git a/lily/porrectus-engraver.cc b/lily/porrectus-engraver.cc index 2e78c1782f..c35d9afa42 100644 --- a/lily/porrectus-engraver.cc +++ b/lily/porrectus-engraver.cc @@ -92,7 +92,7 @@ Porrectus_engraver::acknowledge_grob (Grob_info info_l_) { if (Rhythmic_head::has_interface (info_l_.grob_l_)) { - Note_req *note_req_l_ = dynamic_cast (info_l_.req_l_); + Note_req *note_req_l_ = dynamic_cast (info_l_.music_cause ()); if (!note_req_l_) return; right_heads_.push (Grob_pitch_tuple (info_l_.grob_l_, note_req_l_, diff --git a/lily/property-engraver.cc b/lily/property-engraver.cc index 25ca3af774..3488f5e880 100644 --- a/lily/property-engraver.cc +++ b/lily/property-engraver.cc @@ -15,14 +15,10 @@ #include "translator-group.hh" /* - JUNKME: should use pushproperty everywhere. - + This is deprecated, since revert/override should be used */ class Property_engraver : public Engraver { - /* - UGH. Junk Dictionary - */ Scheme_hash_table *prop_dict_; // junkme void apply_properties (SCM, Grob*, Translator_group *origin); @@ -69,7 +65,7 @@ Property_engraver::initialize () void Property_engraver::acknowledge_grob (Grob_info i) { - SCM ifs = i.grob_l_->get_grob_property ("interfaces"); + SCM ifs = i.grob_l_->get_grob_property ("interfaces"); SCM props; for (; gh_pair_p (ifs); ifs = ly_cdr (ifs)) { diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index e81cef8495..a521f8aaf9 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -47,7 +47,7 @@ void Rest_collision::add_column (Grob*me,Grob *p) { me->add_dependency (p); - Pointer_group_interface::add_element (me, "elements", p); + Pointer_group_interface::add_element (me, ly_symbol2scm ("elements"), p); /* only add callback for the rests, since we don't move anything else. diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 41e3f4a851..2957a3f0cf 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -20,8 +20,11 @@ class Rhythmic_column_engraver :public Engraver { Link_array rhead_l_arr_; Grob * stem_l_; - Grob *ncol_p_; - Grob *dotcol_l_; + Grob * note_column_; + Grob * dotcol_l_; + + Grob * last_spacing_; + Grob * spacing_; TRANSLATOR_DECLARATIONS(Rhythmic_column_engraver); protected: @@ -30,15 +33,17 @@ protected: virtual void create_grobs (); virtual void stop_translation_timestep (); virtual void start_translation_timestep (); - }; Rhythmic_column_engraver::Rhythmic_column_engraver () { + spacing_ =0 ; + last_spacing_ = 0; + stem_l_ =0; - ncol_p_=0; + note_column_=0; dotcol_l_ =0; } @@ -48,34 +53,43 @@ Rhythmic_column_engraver::create_grobs () { if (rhead_l_arr_.size ()) { - if (!ncol_p_) + if (!note_column_) { - ncol_p_ = new Item (get_property ("NoteColumn")); - Note_column::set_interface (ncol_p_); - announce_grob (ncol_p_, 0); + note_column_ = new Item (get_property ("NoteColumn")); + Note_column::set_interface (note_column_); + announce_grob (note_column_, 0); + + spacing_ = new Item (get_property ("NoteSpacing")); + spacing_->set_grob_property ("left-item", note_column_->self_scm ()); + announce_grob (spacing_, 0); + + if (last_spacing_) + { + last_spacing_->set_grob_property ("right-item" , note_column_->self_scm ()); + } } for (int i=0; i < rhead_l_arr_.size (); i++) { - if (!rhead_l_arr_[i]->parent_l (X_AXIS)) - Note_column::add_head (ncol_p_, rhead_l_arr_[i]); + if (!rhead_l_arr_[i]->get_parent (X_AXIS)) + Note_column::add_head (note_column_, rhead_l_arr_[i]); } rhead_l_arr_.set_size (0); } - if (ncol_p_) + if (note_column_) { if (dotcol_l_ - && !dotcol_l_->parent_l (X_AXIS)) + && !dotcol_l_->get_parent (X_AXIS)) { - Note_column::set_dotcol (ncol_p_, dotcol_l_); + Note_column::set_dotcol (note_column_, dotcol_l_); } if (stem_l_ - && !stem_l_->parent_l (X_AXIS)) + && !stem_l_->get_parent (X_AXIS)) { - Note_column::set_stem (ncol_p_, stem_l_); + Note_column::set_stem (note_column_, stem_l_); stem_l_ = 0; } @@ -103,10 +117,10 @@ Rhythmic_column_engraver::acknowledge_grob (Grob_info i) void Rhythmic_column_engraver::stop_translation_timestep () { - if (ncol_p_) + if (note_column_) { - typeset_grob (ncol_p_); - ncol_p_ =0; + typeset_grob (note_column_); + note_column_ =0; } } diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 9189ee71eb..09bb7c4b33 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -45,10 +45,12 @@ Score_engraver::make_columns () command_column_l_->set_grob_property ("breakable", SCM_BOOL_T); - Grob_info i1 (command_column_l_, 0), i2 (musical_column_l_,0); - + Grob_info i1 (command_column_l_, SCM_EOL); i1.origin_trans_l_ = this; + + Grob_info i2 (musical_column_l_, SCM_EOL); i2.origin_trans_l_ = this; + announce_grob (i1); announce_grob (i2); } @@ -190,14 +192,14 @@ Score_engraver::typeset_all () } else { - if (!elem_p->parent_l (X_AXIS)) + if (!elem_p->get_parent (X_AXIS)) { bool br = to_boolean (elem_p->get_grob_property ("breakable")); Axis_group_interface::add_element (br ? command_column_l_ : musical_column_l_, elem_p); } } - if (!elem_p->parent_l (Y_AXIS)) + if (!elem_p->get_parent (Y_AXIS)) Axis_group_interface::add_element (scoreline_l_, elem_p); } elem_p_arr_.clear (); diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index b6b53162cf..14b665acab 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -1,5 +1,5 @@ /* - g-script-column-engraver.cc -- implement Script_column_engraver + script-column-engraver.cc -- implement Script_column_engraver source file of the GNU LilyPond music typesetter @@ -72,8 +72,6 @@ Script_column_engraver::create_grobs () if (!scol_p_ && script_l_arr_.size () > 1) { scol_p_ = new Item (get_property ("ScriptColumn")); - - announce_grob (scol_p_, 0); } @@ -83,6 +81,7 @@ Script_column_engraver::create_grobs () Script_column::add_staff_sided (scol_p_, script_l_arr_[i]); script_l_arr_.clear (); } + } ENTER_DESCRIPTION(Script_column_engraver, diff --git a/lily/script-column.cc b/lily/script-column.cc index 68e21514a7..e5ecb87960 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -18,7 +18,7 @@ Script_column::add_staff_sided (Grob *me, Item *i) if (!gh_number_p (p)) return; - Pointer_group_interface::add_element (me, "scripts",i); + Pointer_group_interface::add_element (me, ly_symbol2scm ("scripts"),i); me->add_dependency (i); } diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 90e448e100..31a9b82f48 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -132,12 +132,12 @@ Script_engraver::acknowledge_grob (Grob_info inf) { Grob *e = script_p_arr_[i]; - if (!e->parent_l (X_AXIS)) + if (!e->get_parent (X_AXIS)) { e->set_parent (inf.grob_l_, X_AXIS); } if (Side_position_interface::get_axis (e) == X_AXIS - && !e->parent_l (Y_AXIS)) + && !e->get_parent (Y_AXIS)) { e->set_parent (inf.grob_l_, Y_AXIS); e->add_dependency (inf.grob_l_); // ?? diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 66935cbd4a..52d25ec489 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -131,7 +131,7 @@ Separating_group_spanner::set_spacing_rods (SCM smob) void Separating_group_spanner::add_spacing_unit (Grob* me ,Item*i) { - Pointer_group_interface::add_element (me, "elements",i); + Pointer_group_interface::add_element (me, ly_symbol2scm ("elements"), i); me->add_dependency (i); } diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index d36a852911..fc4a8c290f 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -13,13 +13,19 @@ #include "paper-def.hh" #include "engraver.hh" #include "axis-group-interface.hh" +#include "note-spacing.hh" class Separating_line_group_engraver : public Engraver { protected: Item * break_malt_p_; Item * musical_malt_p_; + Item * last_musical_malt_p_; + Grob * last_note_spacing_; + Grob * current_note_spacing_; + Grob * staff_spacing_; + Spanner * sep_span_p_; virtual void acknowledge_grob (Grob_info); @@ -32,6 +38,10 @@ public: Separating_line_group_engraver::Separating_line_group_engraver () { + last_note_spacing_ = 0; + current_note_spacing_ = 0; + staff_spacing_ =0; + sep_span_p_ = 0; break_malt_p_ = 0; musical_malt_p_ =0; @@ -60,11 +70,16 @@ Separating_line_group_engraver::acknowledge_grob (Grob_info i) Item * it = dynamic_cast (i.grob_l_); if (!it) return; - if (it->parent_l (X_AXIS) - && it->parent_l (X_AXIS)->has_extent_callback_b - (Axis_group_interface::group_extent_callback_proc, X_AXIS)) + if (it->get_parent (X_AXIS) + && it->get_parent (X_AXIS) + ->has_extent_callback_b(Axis_group_interface::group_extent_callback_proc, X_AXIS)) return; + if (Note_spacing::has_interface (it)) + { + current_note_spacing_ = it; + return ; + } bool ib =Item::breakable_b (it); Item *&p_ref_ (ib ? break_malt_p_ @@ -72,13 +87,24 @@ Separating_line_group_engraver::acknowledge_grob (Grob_info i) if (!p_ref_) { - p_ref_ = new Item - (get_property ("SeparationItem")); - + p_ref_ = new Item (get_property ("SeparationItem")); + if (ib) p_ref_->set_grob_property ("breakable", SCM_BOOL_T); announce_grob (p_ref_, 0); + + if (p_ref_ == break_malt_p_) + { + staff_spacing_ = new Item (get_property ("StaffSpacing")); + staff_spacing_->set_grob_property ("left-item", break_malt_p_->self_scm ()); + announce_grob (staff_spacing_, 0); + + if (last_note_spacing_) + last_note_spacing_->set_grob_property ("right-item", + break_malt_p_->self_scm ()); + } } + Separation_item::add_item (p_ref_,it); } @@ -88,17 +114,29 @@ Separating_line_group_engraver::stop_translation_timestep () if (break_malt_p_) { Separating_group_spanner::add_spacing_unit (sep_span_p_, break_malt_p_); - typeset_grob (break_malt_p_); + break_malt_p_ =0; } + if (staff_spacing_) + { + if (musical_malt_p_) + staff_spacing_->set_grob_property ("right-item", musical_malt_p_->self_scm()); + + typeset_grob (staff_spacing_); + staff_spacing_ = 0; + } + if (musical_malt_p_) { Separating_group_spanner::add_spacing_unit (sep_span_p_, musical_malt_p_); typeset_grob (musical_malt_p_); } + last_note_spacing_ = current_note_spacing_ ; + current_note_spacing_ =0 ; + musical_malt_p_ =0; } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 2c48a34771..534d209182 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -23,7 +23,7 @@ void Separation_item::add_item (Grob*s,Item* i) { assert (i); - Pointer_group_interface::add_element (s,"elements",i); + Pointer_group_interface::add_element (s, ly_symbol2scm ("elements"),i); s->add_dependency (i); } diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 00cf117a5f..a006af5a69 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -19,7 +19,7 @@ void Side_position_interface::add_support (Grob*me, Grob*e) { - Pointer_group_interface::add_element (me, "side-support-elements",e); + Pointer_group_interface::add_element (me, ly_symbol2scm ("side-support-elements"), e); } @@ -67,7 +67,7 @@ Side_position_interface::aligned_on_support_extents (SCM element_smob, SCM axis) SCM Side_position_interface::general_side_position (Grob * me, Axis a, bool use_extents) { - Grob *common = me->parent_l (a); + Grob *common = me->get_parent (a); /* As this is only used as a callback, this is called only once. We @@ -108,7 +108,7 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte Direction dir = Side_position_interface::get_direction (me); - Real off = me->parent_l (a)->relative_coordinate (common, a); + Real off = me->get_parent (a)->relative_coordinate (common, a); SCM minimum = me->remove_grob_property ("minimum-space"); Real total_off = dim.linear_combination (dir) + off; @@ -147,6 +147,8 @@ Side_position_interface::aligned_on_support_refpoints (SCM smob, SCM axis) /** callback that centers the element on itself + + Requires that self-alignment-{X,Y} be set. */ MAKE_SCHEME_CALLBACK (Side_position_interface,aligned_on_self,2); SCM @@ -177,7 +179,7 @@ Side_position_interface::aligned_on_self (SCM element_smob, SCM axis) { return gh_double2scm (- unsmob_grob (align)->relative_coordinate (me, a)); } - return gh_double2scm (0.0); + return gh_double2scm (0.0); } @@ -265,7 +267,7 @@ Side_position_interface::centered_on_parent (SCM element_smob, SCM axis) { Grob *me = unsmob_grob (element_smob); Axis a = (Axis) gh_scm2int (axis); - Grob *him = me->parent_l (a); + Grob *him = me->get_parent (a); return gh_double2scm (him->extent (him,a).center ()); } @@ -275,7 +277,7 @@ void Side_position_interface::add_staff_support (Grob*me) { Grob* st = Staff_symbol_referencer::staff_symbol_l (me); - if (st) + if (st && get_axis (me) == Y_AXIS) { add_support (me,st); } diff --git a/lily/slur.cc b/lily/slur.cc index e0f4836d04..479e11f665 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -48,7 +48,7 @@ Slur::add_column (Grob*me, Grob*n) warning (_ ("Putting slur over rest. Ignoring.")); else { - Pointer_group_interface::add_element (me, "note-columns",n); + Pointer_group_interface::add_element (me, ly_symbol2scm ("note-columns"), n); me->add_dependency (n); } diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index be821b012b..ebba459d17 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -13,6 +13,9 @@ #include "spacing-spanner.hh" #include "engraver.hh" #include "pqueue.hh" +#include "note-spacing.hh" +#include "staff-spacing.hh" +#include "group-interface.hh" struct Rhythmic_tuple { @@ -92,10 +95,15 @@ Spacing_engraver::finalize () void Spacing_engraver::acknowledge_grob (Grob_info i) { + if (Note_spacing::has_interface (i.grob_l_) || Staff_spacing::has_interface (i.grob_l_)) + { + Pointer_group_interface::add_element (spacing_p_, ly_symbol2scm ("wishes"), i.grob_l_); + } + if (to_boolean (i.grob_l_->get_grob_property ("non-rhythmic"))) return; - if (Rhythmic_req * r = dynamic_cast (i.req_l_)) + if (Rhythmic_req * r = dynamic_cast (i.music_cause ())) { Rhythmic_tuple t (i, now_mom () + r->length_mom ()); now_durations_.push (t); @@ -109,7 +117,7 @@ Spacing_engraver::stop_translation_timestep () shortest_playing.set_infinite (1); for (int i=0; i < playing_durations_.size (); i++) { - Moment m = (playing_durations_[i].info_.req_l_)->length_mom (); + Moment m = (playing_durations_[i].info_.music_cause ())->length_mom (); if (m.to_bool ()) { shortest_playing = shortest_playing length_mom (); + Moment m = now_durations_[i].info_.music_cause ()->length_mom (); if (m.to_bool ()) starter = starter get_grob_property ("stems"); gh_pair_p (s); s = ly_cdr (s)) - Group_interface::add_thing (span_arpeggio_, "stems", ly_car (s)); + Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("stems"), ly_car (s)); for (SCM s = arpeggios_[i]->get_grob_property ("side-support-elements"); gh_pair_p (s); s = ly_cdr (s)) - Group_interface::add_thing (span_arpeggio_, "side-support-elements", ly_car (s)); + Group_interface::add_thing (span_arpeggio_, ly_symbol2scm ("side-support-elements"), ly_car (s)); /* we can't kill the children, since we don't want to the diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 0e5d6e2f7b..bf39b2d3ac 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -20,7 +20,7 @@ void Span_bar::add_bar (Grob*me, Grob*b) { - Pointer_group_interface::add_element (me,"elements", b); + Pointer_group_interface::add_element (me, ly_symbol2scm ("elements"), b); me->add_dependency (b); } diff --git a/lily/spanner.cc b/lily/spanner.cc index 6f5504a556..3579abefca 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -36,7 +36,7 @@ Spanner::do_break_processing () */ for (int a = X_AXIS; a < NO_AXES; a ++) { - if (Spanner* parent = dynamic_cast (parent_l ((Axis)a))) + if (Spanner* parent = dynamic_cast (get_parent ((Axis)a))) { if (!parent->spanned_rank_iv ().contains_b (this->spanned_rank_iv ())) { @@ -190,7 +190,7 @@ Spanner::set_bound (Direction d, Grob*s) */ if (dynamic_cast (i)) { - Pointer_group_interface::add_element (i, "bounded-by-me",this); + Pointer_group_interface::add_element (i, ly_symbol2scm ("bounded-by-me"), this); } } diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc new file mode 100644 index 0000000000..771760ca52 --- /dev/null +++ b/lily/staff-spacing.cc @@ -0,0 +1,17 @@ +/* +staff-spacing.cc -- implement + +source file of the GNU LilyPond music typesetter + +(c) 2001 Han-Wen Nienhuys + + */ + +#include "staff-spacing.hh" +#include "grob.hh" + +bool +Staff_spacing::has_interface (Grob* g) +{ + return g && g->has_interface (ly_symbol2scm ("staff-spacing-interface")); +} diff --git a/lily/stanza-number-engraver.cc b/lily/stanza-number-engraver.cc index ae47a7d189..833241cb53 100644 --- a/lily/stanza-number-engraver.cc +++ b/lily/stanza-number-engraver.cc @@ -45,7 +45,7 @@ Stanza_number_engraver::process_music () // TODO - if (gh_string_p (s)) + if (gh_string_p (s) || gh_pair_p (s)) /* if (i.grob_l_->has_interface (symbol ("lyric-syllable-interface"))) diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 083a25a483..5ab49f9227 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -105,12 +105,12 @@ Stem_engraver::acknowledge_grob (Grob_info i) gh_int2scm (tremolo_flags)); } } - announce_grob (stem_p_, i.req_l_); + announce_grob (stem_p_, i.music_cause ()); } if (Stem::flag_i (stem_p_) != duration_log) { - i.req_l_->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::flag_i (stem_p_))); + i.music_cause ()->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::flag_i (stem_p_))); } Stem::add_head (stem_p_,h); diff --git a/lily/stem.cc b/lily/stem.cc index b8dec893c0..90949fc766 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -8,6 +8,7 @@ TODO: This is way too hairy */ + #include // m_pi #include "lookup.hh" @@ -227,7 +228,7 @@ Stem::add_head (Grob*me, Grob *n) if (Note_head::has_interface (n)) { - Pointer_group_interface::add_element (me, "heads",n); + Pointer_group_interface::add_element (me, ly_symbol2scm ("heads"), n); } else { @@ -344,7 +345,7 @@ Stem::get_default_stem_end_position (Grob*me) which should be a dot-column. */ if (dir * (st + flagy - dp) < 0.5) - Side_position_interface::add_support (dots->parent_l (X_AXIS), me); + Side_position_interface::add_support (dots->get_parent (X_AXIS), me); /* previous approach was to lengthen the stem. This is not @@ -389,10 +390,11 @@ Stem::position_noteheads (Grob*me) Grob *hed = support_head (me); - Real w = hed->extent (hed, X_AXIS)[dir]; + Real w = Note_head::head_extent (hed,X_AXIS)[dir]; for (int i=0; i < heads.size (); i++) { - heads[i]->translate_axis (w - heads[i]->extent (heads[i], X_AXIS)[dir], X_AXIS); + heads[i]->translate_axis (w - Note_head::head_extent (heads[i],X_AXIS)[dir], + X_AXIS); } bool parity= true; // todo: make me settable. @@ -632,7 +634,7 @@ Stem::off_callback (SCM element_smob, SCM) Real r=0; if (Grob * f = first_head (me)) { - Interval head_wid = f->extent (f,X_AXIS); + Interval head_wid = Note_head::head_extent(f, X_AXIS); Real attach = Note_head::stem_attachment_coordinate(f, X_AXIS); diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index 5f7828b127..1cda41fe53 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -39,7 +39,7 @@ System_start_delimiter_engraver::acknowledge_grob (Grob_info inf) don't add as Axis_group_interface::add_element (delim_,), because that would set the parent as well */ - Pointer_group_interface::add_element (delim_, "elements", inf.grob_l_); + Pointer_group_interface::add_element (delim_, ly_symbol2scm ("elements"), inf.grob_l_); } else if (System_start_delimiter::has_interface (inf.grob_l_)) { diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 5db60e1750..c6e668e4cc 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -59,10 +59,10 @@ Text_engraver::acknowledge_grob (Grob_info inf) ugh. */ if (Side_position_interface::get_axis (t) == X_AXIS - && !t->parent_l (Y_AXIS)) + && !t->get_parent (Y_AXIS)) t->set_parent (inf.grob_l_, Y_AXIS); else if (Side_position_interface::get_axis (t) == Y_AXIS - && !t->parent_l (X_AXIS)) + && !t->get_parent (X_AXIS)) t->set_parent (inf.grob_l_, X_AXIS); } } diff --git a/lily/tfm-reader.cc b/lily/tfm-reader.cc index 42a51b8446..7f816afc2a 100644 --- a/lily/tfm-reader.cc +++ b/lily/tfm-reader.cc @@ -222,7 +222,7 @@ Tex_font_metric_reader::read_char () #define GET_CHAR_DIMEN(d) \ if (d##_index != 0) \ { \ - input_.seek_ch_C (header_.##d##_pos + d##_index*4); \ + input_.seek_ch_C (header_. d##_pos + d##_index*4); \ tfm_char.d##_fix_ = input_.get_U32 (); \ tfm_char.d##_ = fix_to_real (tfm_char.d##_fix_) \ * info_.design_size; \ diff --git a/lily/third-try.cc b/lily/third-try.cc new file mode 100644 index 0000000000..15a2cbf748 --- /dev/null +++ b/lily/third-try.cc @@ -0,0 +1,15 @@ +/* + spacing-spanner.cc -- implement Spacing_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1999--2001 Han-Wen Nienhuys + + */ + +class Third_spacing_spanner +{ +public: + void find_loose_columns () {} + +}; diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 4f9536427b..50844a3b1b 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -44,7 +44,7 @@ Tie_column::add_tie (Grob*me,Grob *s) dynamic_cast (me)->set_bound (RIGHT, Tie::head (s,RIGHT)); } - Pointer_group_interface::add_element (me, "ties",s); + Pointer_group_interface::add_element (me, ly_symbol2scm ("ties"), s); s->add_dependency (me); } diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 251f5f1f9c..227761a82d 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -98,7 +98,7 @@ Tie_engraver::acknowledge_grob (Grob_info i) { if (Rhythmic_head::has_interface (i.grob_l_)) { - Note_req * m = dynamic_cast (i.req_l_); + Note_req * m = dynamic_cast (i.music_cause ()); if (!m) return; now_heads_.push (Grob_pitch_tuple (i.grob_l_, m, now_mom () + m->length_mom ())); diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index f343ffaadb..53460fae9c 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -93,7 +93,7 @@ Tie_performer::acknowledge_audio_element (Audio_element_info i) { if (Audio_note *nh = dynamic_cast (i.elem_l_)) { - Note_req * m = dynamic_cast (i.req_l_); + Note_req * m = dynamic_cast (i.req_l_); if (!m) return; now_notes_.push (CNote_melodic_tuple (nh, m, now_mom ()+ m->length_mom ())); diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index bac89f1d25..cf26511ffe 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -292,7 +292,7 @@ Tuplet_bracket::get_default_dir (Grob*me) void Tuplet_bracket::add_column (Grob*me, Item*n) { - Pointer_group_interface::add_element (me, "columns",n); + Pointer_group_interface::add_element (me, ly_symbol2scm ("columns"), n); me->add_dependency (n); add_bound_item (dynamic_cast (me), n); diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 65eb757387..cb4df699ce 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -53,7 +53,7 @@ Vertical_align_engraver::qualifies_b (Grob_info i) const int sz = i.origin_trans_l_arr ((Translator*)this).size () ; return sz > 1 && Axis_group_interface::has_interface (i.grob_l_) - && !i.grob_l_->parent_l (Y_AXIS) && Axis_group_interface::axis_b (i.grob_l_, Y_AXIS); + && !i.grob_l_->get_parent (Y_AXIS) && Axis_group_interface::axis_b (i.grob_l_, Y_AXIS); } void diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 5771f502cb..d558d1ee04 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -117,7 +117,7 @@ Volta_spanner::brew_molecule (SCM smob) void Volta_spanner::add_bar (Grob *me, Item* b) { - Pointer_group_interface::add_element (me, "bars",b); + Pointer_group_interface::add_element (me, ly_symbol2scm ("bars"), b); Side_position_interface::add_support (me,b); add_bound_item (dynamic_cast (me), b); } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index c70ccf51f9..104d8ab6ea 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -142,7 +142,8 @@ VoiceContext = \translator { %} \consists "Dynamic_engraver" - \consists "Text_engraver" + \consists "Fingering_engraver" +% \consists "Text_engraver" \consists "Script_engraver" \consists "Script_column_engraver" diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index e614e84fe3..5cf9f286fa 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.5.23 -Entered-date: 29NOV01 +Version: 1.5.24 +Entered-date: 01DEC01 Description: @BLURB@ Keywords: music notation typesetting midi fonts engraving Author: hanwen@cs.uu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 1000k lilypond-1.5.23.tar.gz + 1000k lilypond-1.5.24.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.5.23.tar.gz + 1000k lilypond-1.5.24.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.mandrake.spec b/make/out/lilypond.mandrake.spec index bf2fd2f6e5..6053f4d2c2 100644 --- a/make/out/lilypond.mandrake.spec +++ b/make/out/lilypond.mandrake.spec @@ -1,5 +1,5 @@ %define name lilypond -%define version 1.5.23 +%define version 1.5.24 %define release 1mdk Name: %{name} diff --git a/make/out/lilypond.redhat.spec b/make/out/lilypond.redhat.spec index 4140712f8a..07da5dde40 100644 --- a/make/out/lilypond.redhat.spec +++ b/make/out/lilypond.redhat.spec @@ -1,11 +1,11 @@ %define info yes Name: lilypond -Version: 1.5.23 +Version: 1.5.24 Release: 1 License: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.23.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.24.tar.gz Summary: Create and print music notation URL: http://www.lilypond.org/ BuildRoot: /tmp/lilypond-install diff --git a/make/out/lilypond.suse.spec b/make/out/lilypond.suse.spec index 6acea87cbb..5bf5530c94 100644 --- a/make/out/lilypond.suse.spec +++ b/make/out/lilypond.suse.spec @@ -14,11 +14,11 @@ Distribution: SuSE Linux 7.0 (i386) Name: lilypond -Version: 1.5.23 +Version: 1.5.24 Release: 2 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.23.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.24.tar.gz # music notation software for.. ? Summary: A program for printing sheet music. URL: http://www.lilypond.org/ diff --git a/scm/basic-properties.scm b/scm/basic-properties.scm index 7f02a51e5d..e3c781c1bc 100644 --- a/scm/basic-properties.scm +++ b/scm/basic-properties.scm @@ -27,6 +27,7 @@ '((":|:" . (":|" . "|:")) ("||:" . ("||" . "|:")) ("|" . ("|" . "")) + ("||:" . ("||" . "|:")) ("|s" . (nil . "|")) ("|:" . ("|" . "|:")) ("|." . ("|." . nil)) diff --git a/scm/beam.scm b/scm/beam.scm index f7afad28fc..b0feb6008f 100644 --- a/scm/beam.scm +++ b/scm/beam.scm @@ -95,6 +95,8 @@ (define (beam-dir-majority count total) (dir-compare (car count) (cdr count))) +(beam-dir-majority '(0 . 0) '(0 . 0)) + (define (beam-dir-mean count total) (dir-compare (car total) (cdr total))) diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 5e09ffe9ad..fd68506d0d 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -233,8 +233,9 @@ (molecule-callback . ,Text_item::brew_molecule) (X-offset-callbacks . (,Side_position_interface::centered_on_parent ,Side_position_interface::aligned_on_self)) (padding . 0.6) - (direction . -1) +; (direction . -1) (self-alignment-X . 0) + (self-alignment-Y . 0) (font-family . number) (font-relative-size . -3) (font-shape . upright) @@ -566,7 +567,21 @@ (break-align-symbol . Clef_item) (visibility-lambda . ,begin-of-line-visible) (font-family . roman) - (meta . ,(grob-description break-aligned-interface text-interface font-interface)) + (meta . ,(grob-description break-aligned-interface text-interface font-interface)) + )) + + (StaffSpacing . ( + (breakable . #t) + (X-extent-callback . #f) + (Y-extent-callback . #f) + + (meta . ,(grob-description staff-spacing-interface)) + )) + (NoteSpacing . ( + (X-extent-callback . #f) + (Y-extent-callback . #f) + + (meta . ,(grob-description note-spacing-interface)) )) (StaffSymbol . ( diff --git a/scm/interface-description.scm b/scm/interface-description.scm index 42129c4b39..9050f64050 100644 --- a/scm/interface-description.scm +++ b/scm/interface-description.scm @@ -87,6 +87,17 @@ ) ) +(lily-interface + 'staff-spacing-interface + "" + '( + )) + +(lily-interface + 'note-spacing-interface + "" + '( + )) (lily-interface 'clef-interface diff --git a/scm/lily.scm b/scm/lily.scm index 0fd88bb740..0025dacb7c 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -63,7 +63,7 @@ (define (sign x) (if (= x 0) - 1 + 0 (if (< x 0) -1 1))) (define (write-me n x) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 52a9a4a5e3..98127c076f 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -10,19 +10,8 @@ (define (unfold-repeats music) " -[Rune Zedeler] - -Han-Wen Nienhuys wrote: - -> It shouldn't be hard to write a Scheme function to replace all repeats -> with unfold repeats. -[...] -> Left to the reader as an exercise. - -With thanks to Han-Wen: - - -" +This function replaces all repeats with unfold repeats. It was +written by Rune Zedeler. " (let* ((es (ly-get-mus-property music 'elements)) (e (ly-get-mus-property music 'element)) (body (ly-get-mus-property music 'body)) @@ -59,3 +48,34 @@ With thanks to Han-Wen: music)) +(define (pitchify-scripts music) + "Copy the pitch fields of the Note_requests into Text_script_requests, to aid +Fingering_engraver." + (define (find-note musics) + (filter-list (lambda (m) (equal? (ly-music-name m) "Note_req")) musics) + ) + (define (find-scripts musics) + (filter-list (lambda (m) (equal? (ly-music-name m) "Text_script_req")) musics)) + + (let* ( + (e (ly-get-mus-property music 'element)) + (es (ly-get-mus-property music 'elements)) + (notes (find-note es)) + (pitch (if (pair? notes) (ly-get-mus-property (car notes) 'pitch) #f)) + ) + + (if pitch + (map (lambda (x) (ly-set-mus-property x 'pitch pitch)) (find-scripts es)) + ) + + (if (pair? es) + (ly-set-mus-property + music 'elements + (map pitchify-scripts es))) + + (if (music? e) + (ly-set-mus-property + music 'element + (pitchify-scripts e))) + + music)) diff --git a/scm/sketch.scm b/scm/sketch.scm index 30ec4a4ce0..80c76752e3 100644 --- a/scm/sketch.scm +++ b/scm/sketch.scm @@ -19,7 +19,6 @@ ;; elif symbol == 'char': ;; out.write ('moveto( %f %f); char(%d)' % (x,y,rest)) - ;; (define (dispatch x y expr) ;; (let ((keyword (car expr))) ;; (cond @@ -30,16 +29,10 @@ ;; )) -;; guile < 1.4 compatibility for eval -(if (or (equal? (minor-version) "4") - (equal? (minor-version) "3.4")) - (define (ly-eval e m) - (eval-in-module e m)) - (define (ly-eval e m) - (eval e m))) -(define-module (scm sketch)) -(debug-enable 'backtrace) +(define-module (scm sketch) ) +; :export (sketch-output-expression) +; :no-backtrace (define this-module (current-module)) @@ -47,7 +40,8 @@ (display (dispatch expr) port)) (use-modules - (guile)) + (guile) + (guile-user)) (use-modules (ice-9 format)) diff --git a/stepmake/bin/add-html-footer.py b/stepmake/bin/add-html-footer.py index 744c6ac509..fe15316b41 100644 --- a/stepmake/bin/add-html-footer.py +++ b/stepmake/bin/add-html-footer.py @@ -40,7 +40,7 @@ of @PACKAGE_NAME@ built = r"""

-This page was built from @PACKAGE_NAME@-@PACKAGE_VERSION@ by
+This page was built from @PACKAGE_NAME@-@PACKAGE_VERSION@ (@BRANCH@) by

@GCOS@ <@MAILADDRESS@>, @LOCALTIME@.
""" @@ -218,6 +218,7 @@ def do_file (f): else: s = s + footer + #URUGRGOUSNGUOUNRIU index = index_url top = top_url @@ -231,6 +232,12 @@ def do_file (f): # index = "./index.html" # top = "./" + + versiontup = string.split(package_version, '.') + branch_str = 'stable-branch' + if string.atoi ( versiontup[1]) % 2: + branch_str = 'development-branch' + s = re.sub ('@INDEX@', index, s) s = re.sub ('@TOP@', top, s) s = re.sub ('@PACKAGE_NAME@', package_name, s) @@ -239,7 +246,8 @@ def do_file (f): s = re.sub ('@GCOS@', gcos, s) s = re.sub ('@LOCALTIME@', localtime, s) s = re.sub ('@MAILADDRESS@', mail_address, s) - + s = re.sub ('@BRANCH@', branch_str, s) + m = re.match ('.*?', s, re.DOTALL) while m: at_var = m.group (1)