From: Han-Wen Nienhuys Date: Wed, 2 Feb 2000 16:32:01 +0000 (+0100) Subject: release: 1.3.22 X-Git-Tag: release/1.3.22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=28b274e6d311e56087794a973e82ebd1185f923e;p=lilypond.git release: 1.3.22 ========== * Getopt bugfix: don't assert on certain errors. * ly2dvi: Remove unnecessary space for the page headers. * Bugfix convert-mudela 1.3.21.h --- diff --git a/CHANGES b/CHANGES index b1c73c7276..7fd2dfd03f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,34 @@ +1.3.21.mb1 +========== +* Getopt bugfix: don't assert on certain errors. + +* ly2dvi: Remove unnecessary space for the page headers. + +* Bugfix convert-mudela + +1.3.21.hwn1 +=========== + +* Bugfix in lilypond-mode.el: eval-buffering now uses file name and +not buffer name. + +* Scrapped tupletVisibility property. Now use tupletNumberVisibility, +tupletBracketVisibility, with Scheme value #t, #f or 'if-no-beam. +\property tupletInvisible will stop all tuplet spanner creation. + +* Don't go berserk if tuplet spanner is on only one column. + +* Use SCMs & Smobs for Molecules & atoms. This uses less +scm_(un)protect_object () calls, so the output stage should be faster. + +* Added \property tupletSpannerDuration, to make multiple tuplet signs +with one \times. + +* Some programming Errors in spacing are now caught. Lily does not +hang when encountering degenerate springs. + +* Allow beams to start and end over rests + 1.3.19.hwn2 =========== * Fix disappearing clefs when clefs are not printed with a barline. diff --git a/Documentation/user/properties.itely b/Documentation/user/properties.itely index e4f98b1284..41db30bb48 100644 --- a/Documentation/user/properties.itely +++ b/Documentation/user/properties.itely @@ -330,14 +330,35 @@ c4^"foo" \emptyText c4^"foo" c4 @code{\down} to force them below the staff, @code{\up} to force them above, or @code{\free} to let LilyPond decide. - @item @code{tupletVisibility}@indexcode{tupletVisibility} @propertytype{number} - [deprecate this, FIXME] - Determines whether tuplets of notes are labeled. Setting - to 0 shows nothing; setting to 1 shows a number; - setting to 2 shows a number and a bracket if there is no - beam; setting to 3 shows a number, and if there is no beam - it adds a bracket; setting to 4 shows both a number and a - bracket unconditionally. + @item @code{tupletBracketVisibility}@indexcode{tupletBracketVisibility} @propertytype{boolean} or @propertytype{symbol} + @item @code{tupletNumberVisibility}@indexcode{tupletNumberVisibility} @propertytype{boolean} or @propertytype{symbol} + + These properties the visibility of the tuplet bracket and its +number respectively. Setting it to false will prevent printing of the +associated element. Setting the property to 'if-no-beam will make it +print only if there is no beam associated with this tuplet bracket. + +[fixme examples] + + @item @code{tupletInvisible}@indexcode{tupletInvisible} @propertytype{boolean} + + If set to true, tuplet bracket creation is switched off +entirely. This has the same effect as setting both +@code{tupletNumberVisibility} and @code{tupletBracketVisibility} to +@code{#f}, but as this does not even create elements, this setting +uses less memory and time. + + +@item @code{tupletSpannerDuration} @indexcode{tupletSpannerDuration} +@propertytype{moment} + +Normally a tuplet bracket is as wide as the +@code{\times} expression that gave rise to it. By setting this +property, you can make brackets last shorter. Example + +@mudela[verbatim,fragment] +\context Voice \times 2/3 { \property Voice.tupletSpannerDuration = #(make-moment 1 4) [c8 c c] [c c c] } +@end mudela @end table diff --git a/TODO b/TODO index 421ec74ddc..57b88fb58d 100644 --- a/TODO +++ b/TODO @@ -12,7 +12,12 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. . * use hash tabs iso. alist_ for elt property? . * fix tremolos. . * internationalize GUILE msgs. +gg . * unbroken marks. +. * write smobifying howto. +. * tuplet spanner dir +. * \property autoBeamOverRest (boolean). Don't stop for rests when autobeaming. +? . * put property test files in refman. . * fix slurdotted! . * alignment within @itemize diff --git a/VERSION b/VERSION index 5c90fcb688..c12766d66b 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=21 +PATCH_LEVEL=22 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc index f78e18a8c7..3f34b5b455 100644 --- a/flower/getopt-long.cc +++ b/flower/getopt-long.cc @@ -157,6 +157,7 @@ Getopt_long::report (Errorcod c) case E_ILLEGALARG: str += _f ("invalid argument `%s' to option `%s'", optional_argument_ch_C_, found_option_l_->str ()); + break; default: assert (false); } diff --git a/input/test/staff-size.ly b/input/test/staff-size.ly index 37046fc5f0..43a7e19095 100644 --- a/input/test/staff-size.ly +++ b/input/test/staff-size.ly @@ -1,6 +1,6 @@ \score { \notes \relative c' < \context Voice { - \property Staff.staffLineLeading = 4 + \property Staff.staffSpace = #10 \property Staff.fontSize = #-1 \property Voice.fontSize = #-1 diff --git a/input/test/tuplet-spanner-duration.ly b/input/test/tuplet-spanner-duration.ly new file mode 100644 index 0000000000..92f58c1a5e --- /dev/null +++ b/input/test/tuplet-spanner-duration.ly @@ -0,0 +1,12 @@ + +\score +{ +\context Voice \notes \relative c'' { +\time 2/4; +\times 2/3 { c8 c c c c c } +\property Voice . tupletSpannerDuration = #(make-moment 1 4) +\times 2/3 { c8 c c c c c } + +} + +} diff --git a/lily/align-element.cc b/lily/align-element.cc index 3ca9684461..db954498bf 100644 --- a/lily/align-element.cc +++ b/lily/align-element.cc @@ -34,7 +34,7 @@ Align_element::do_side_processing () Link_array elems; Link_array all_elts (elem_l_arr ()); - for (int i=0; i < elem_l_arr ().size(); i++) + for (int i=0; i < all_elts.size(); i++) { Interval y = all_elts[i]->extent(axis ()) + all_elts[i]->relative_coordinate (this, axis ()); if (!y.empty_b()) diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index f83c2747ac..a5e3c57bb8 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -15,7 +15,7 @@ #include "directional-element-interface.hh" /** - catch notes, and put them in a row. + Catch notes, and put them in a row. Used for aligning grace notes. */ class Align_note_column_engraver: public Engraver { diff --git a/lily/atom.cc b/lily/atom.cc index eccf3b9843..f6eda93aa5 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -6,6 +6,9 @@ (c) 1997--2000 Han-Wen Nienhuys */ +#include +#include "ly-smobs.icc" + #include "atom.hh" #include "interval.hh" #include "string.hh" @@ -19,7 +22,18 @@ Atom::Atom(SCM s) { - func_ = s; + SCM onstack = s; // protection. + func_ = scm_protect_object (s); + self_scm_ = SCM_EOL; + smobify_self (); +} + +SCM +Atom::mark_smob (SCM s) +{ + Atom* a = SMOB_TO_TYPE(Atom, s); + assert (s == a->self_scm_); + return a->func_; } void @@ -34,5 +48,33 @@ Atom::fontify (Font_metric * met) func_ = gh_list (ly_symbol2scm ("string-append"), font_switch , f, SCM_UNDEFINED); +} + +void +Atom::do_smobify_self () +{ +} +Atom::Atom (Atom const &s) +{ + off_ = s.off_; + func_ = s.func_; + self_scm_= SCM_EOL; + smobify_self (); } +int +Atom::print_smob (SCM s, SCM p, scm_print_state*) +{ + Atom * a = unsmob_atom (s); + + scm_puts ("#off_.str ()); + scm_puts ((char *)str.ch_C(), p); + scm_display (a->func_, p); + scm_puts ("> ",p); + return 1; +} + +IMPLEMENT_UNSMOB(Atom, atom) +IMPLEMENT_SMOBS(Atom) + diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index ac12b47e5b..63037e1a7f 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -180,13 +180,18 @@ Beam_engraver::acknowledge_element (Score_element_info info) { rhythmic_req->warning (_ ("Stem doesn't fit in beam")); prev_start_req_->warning (_ ("Beam was started here")); - return; + /* + don't return, since + + [r4 c8] can just as well be modern notation. + */ } stem_l->set_elt_property ("duration-log", gh_int2scm (rhythmic_req->duration_.durlog_i_)); Moment stem_location = now_mom () - beam_start_mom_ + beam_start_location_; - beam_info_p_->add_stem (stem_location, rhythmic_req->duration_.durlog_i_ - 2); + beam_info_p_->add_stem (stem_location, + (rhythmic_req->duration_.durlog_i_ - 2) >? 1); beam_p_->add_stem (stem_l); } } diff --git a/lily/beam.cc b/lily/beam.cc index e3d816526d..6dc4bb25c4 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -85,7 +85,7 @@ Beam::do_pre_processing () if (visible_stem_count () < 2) { warning (_ ("beam has less than two stems")); - set_elt_property ("transparent", SCM_BOOL_T); + // set_elt_property ("transparent", SCM_BOOL_T); } if (!directional_element (this).get ()) @@ -269,15 +269,17 @@ Beam::do_post_processing () /* first, calculate y, dy */ Real y, dy; calc_position_and_height (&y, &dy); - if (suspect_slope_b (y, dy)) - dy = 0; + if (visible_stem_count ()) + { + if (suspect_slope_b (y, dy)) + dy = 0; - Real damped_dy = calc_slope_damping_f (dy); - Real quantised_dy = quantise_dy_f (damped_dy); + Real damped_dy = calc_slope_damping_f (dy); + Real quantised_dy = quantise_dy_f (damped_dy); - y += (dy - quantised_dy) / 2; - dy = quantised_dy; - + y += (dy - quantised_dy) / 2; + dy = quantised_dy; + } /* until here, we used only stem_info, which acts as if dir=up */ @@ -368,6 +370,7 @@ Beam::calc_position_and_height (Real* y, Real* dy) const bool Beam::suspect_slope_b (Real y, Real dy) const { + /* first, calculate y, dy */ /* steep slope running against lengthened stem is suspect */ @@ -602,7 +605,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const Real bdy = interbeam_f; Real stemdx = staffline_f; - Real dx = last_visible_stem ()->hpos_f () - first_visible_stem ()->hpos_f (); + Real dx = visible_stem_count () ? + last_visible_stem ()->hpos_f () - first_visible_stem ()->hpos_f () + : 0.0; Real dy = get_real ("height"); Real dydx = dy && dx ? dy/dx : 0; @@ -710,9 +715,19 @@ Beam::do_brew_molecule_p () const Molecule *mol_p = new Molecule; if (!stem_count ()) return mol_p; + Real x0,dx; + if (visible_stem_count ()) + { + x0 = first_visible_stem ()->hpos_f (); + dx = last_visible_stem ()->hpos_f () - x0; + } + else + { + x0 = stem (0)->hpos_f (); + dx = stem_top ()->hpos_f () - x0; + } + - Real x0 = first_visible_stem ()->hpos_f (); - Real dx = last_visible_stem ()->hpos_f () - x0; Real dy = get_real ("height"); Real dydx = dy && dx ? dy/dx : 0; Real y = get_real ("y-position"); @@ -802,9 +817,6 @@ Beam::first_visible_stem () const if (!s->invisible_b ()) return s; } - - assert (0); - return 0; } @@ -817,8 +829,5 @@ Beam::last_visible_stem () const if (!s->invisible_b ()) return s; } - - assert (0); - // sigh return 0; } diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index c2c190fcac..376a71dd25 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -5,7 +5,9 @@ (c) 1997--2000 Han-Wen Nienhuys */ +#include +#include "warn.hh" #include "dimension-cache.hh" #include "lily-guile.hh" #include "break-align-item.hh" @@ -106,10 +108,20 @@ Break_align_item::do_pre_processing() Axis_align_item::do_pre_processing(); - Real pre_space = elems[0]->extent (X_AXIS)[LEFT] - + elems[0]->relative_coordinate (column_l (), X_AXIS); - Real spring_len = elems.top ()->extent (X_AXIS)[RIGHT] - + elems.top ()->relative_coordinate (column_l (), X_AXIS); + Real pre_space = elems[0]->relative_coordinate (column_l (), X_AXIS); + + Real xl = elems[0]->extent (X_AXIS)[LEFT]; + if (!isinf (xl)) + pre_space += xl; + else + programming_error ("Infinity reached. "); + + Real xr = elems.top ()->extent (X_AXIS)[RIGHT]; + Real spring_len = elems.top ()->relative_coordinate (column_l (), X_AXIS); + if (!isinf (xr)) + spring_len += xr; + else + programming_error ("Infinity reached."); Real stretch_distance =0.; diff --git a/lily/crescendo.cc b/lily/crescendo.cc index ef32c1e7c9..02b31c40c4 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -78,19 +78,19 @@ Crescendo * me = (Crescendo*)this; Real thick = paper_l ()->get_var ("crescendo_thickness"); const char* hairpin = (gd < 0)? "decrescendo" : "crescendo"; - Atom at (gh_list (ly_symbol2scm (hairpin), + Molecule * m + = new Molecule; + m->dim_.x () = Interval (0, width); + m->dim_.y () = Interval (-2*height, 2*height); + + Atom *a = new Atom(gh_list (ly_symbol2scm (hairpin), gh_double2scm (thick), gh_double2scm (width), gh_double2scm (height), gh_double2scm (continued ? height/2 : 0.0), SCM_UNDEFINED)); - Molecule * m - = new Molecule; - - m->dim_.x () = Interval (0, width); - m->dim_.y () = Interval (-2*height, 2*height); - m->add_atom (&at); - + + m->add_atom (a->self_scm_); m->translate_axis (extra_left, X_AXIS); return m; } diff --git a/lily/font-metric.cc b/lily/font-metric.cc index b420332d14..c872d5b8d9 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -10,6 +10,7 @@ #include #include +#include "ly-smobs.icc" #include "font-metric.hh" Box @@ -124,11 +125,4 @@ Font_metric::print_smob (SCM s, SCM port, scm_print_state * ) return 1; } -Font_metric * -unsmob_metrics( SCM s) -{ - if (SMOB_IS_TYPE_B(Font_metric, s)) - return SMOB_TO_TYPE(Font_metric, s); - else - return 0; -} +IMPLEMENT_UNSMOB(Font_metric, metrics); diff --git a/lily/include/atom.hh b/lily/include/atom.hh index 931d43f64b..877cdd999e 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -14,20 +14,30 @@ #include "box.hh" #include "lily-proto.hh" #include "lily-guile.hh" +#include "smobs.hh" +/** + Atoms should only be created on the heap, ie. with + "new Atom" + */ class Atom { Offset off_; + friend class Molecule; friend class Paper_outputter; public: Atom (SCM s); + Atom (Atom const&); + + DECLARE_SMOBS; /* SCM expression that (when evaluated) gives a TeX string representing a musical notation symbol. */ - Protected_scm func_; + SCM func_; void fontify (Font_metric*); }; +Atom* unsmob_atom (SCM); #endif diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index 3ee8d6db51..97da61e6d0 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -10,6 +10,17 @@ #ifndef LY_SMOBS_ICC #define LY_SMOBS_ICC +#define IMPLEMENT_UNSMOB(CL, name) \ +CL * \ +unsmob_ ## name ( SCM s) \ +{ \ + if (SMOB_IS_TYPE_B(CL, s)) \ + return SMOB_TO_TYPE(CL, s); \ + else \ + return 0; \ +} + + #define IMPLEMENT_SMOBS(CL)\ long CL::smob_tag_;\ static scm_smobfuns CL ## _funs = { \ diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index d33a100cdf..f5e94ef60a 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -13,6 +13,7 @@ #include "axes.hh" #include "direction.hh" #include "cons.hh" +#include "protected-scm.hh" //#define ATOM_SMOB @@ -27,12 +28,8 @@ */ class Molecule { -#ifdef ATOM_SMOB - SCM atom_list_; -#else - // Protected_scm atom_list_; // change to List? - Cons *atom_list_; -#endif + Protected_scm atom_list_; + friend class Paper_outputter; public: @@ -44,9 +41,12 @@ public: /** Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */ void set_empty (bool); - void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding); - void add_atom (Atom const *a); + + /** + Add an atom. The molecule assumes responsibility for cleaning. + */ + void add_atom (SCM as); void add_molecule (Molecule const &m); void translate (Offset); @@ -67,8 +67,9 @@ public: Interval extent (Axis) const; Molecule (const Molecule&s); - void print() const; + void operator=(const Molecule&); bool empty_b() const; + void print ()const; }; #endif diff --git a/lily/include/multi-measure-rest-engraver.hh b/lily/include/multi-measure-rest-engraver.hh index c976d681f8..951112c3ef 100644 --- a/lily/include/multi-measure-rest-engraver.hh +++ b/lily/include/multi-measure-rest-engraver.hh @@ -6,34 +6,3 @@ (c) 1998--2000 Jan Nieuwenhuizen */ -#ifndef MULTI_MEASURE_REST_ENGRAVER_HH -#define MULTI_MEASURE_REST_ENGRAVER_HH - -#include "engraver.hh" -#include "moment.hh" - -/** - */ -class Multi_measure_rest_engraver : public Engraver -{ -public: - VIRTUAL_COPY_CONS(Translator); - - Multi_measure_rest_engraver (); - -protected: - virtual void acknowledge_element (Score_element_info i); - virtual void do_process_requests (); - virtual bool do_try_music (Music*); - virtual void do_pre_move_processing (); - virtual void do_post_move_processing (); - -private: - Drul_array rest_moments_; - - int start_measure_i_; - Rhythmic_req* multi_measure_req_l_; - Multi_measure_rest* mmrest_p_; - Multi_measure_rest* lastrest_p_; -}; -#endif // MULTI_MEASURE_REST_ENGRAVER_HH diff --git a/lily/include/simple-spacer.hh b/lily/include/simple-spacer.hh index 712349d878..e0c9840924 100644 --- a/lily/include/simple-spacer.hh +++ b/lily/include/simple-spacer.hh @@ -25,6 +25,7 @@ struct Spring_description Real length (Real force) const; Spring_description (); Real energy_f (Real) const; + bool sane_b () const; }; /** diff --git a/lily/include/tuplet-engraver.hh b/lily/include/tuplet-engraver.hh index 7b50fb86ec..64539a0f78 100644 --- a/lily/include/tuplet-engraver.hh +++ b/lily/include/tuplet-engraver.hh @@ -10,28 +10,3 @@ #ifndef AUTO_PLET_ENGRAVER_HH #define AUTO_PLET_ENGRAVER_HH -#include "engraver.hh" - -class Tuplet_engraver : public Engraver -{ - void typeset_all (); -public: - VIRTUAL_COPY_CONS(Translator); - - -protected: - Link_array time_scaled_music_arr_; - Array stop_moments_; - Link_array started_span_p_arr_; - - - virtual void do_removal_processing (); - virtual void acknowledge_element (Score_element_info); - virtual bool do_try_music (Music*r); - virtual void do_process_requests (); - virtual void do_post_move_processing (); -}; - - - -#endif /* AUTO_PLET_ENGRAVER_HH */ diff --git a/lily/lookup.cc b/lily/lookup.cc index 6f97d92b6d..afcd03b804 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -98,13 +98,13 @@ Lookup::afm_find (String s, bool warn) const return m; } - Atom at (gh_list (ly_symbol2scm ("char"), + Atom* at = new Atom (gh_list (ly_symbol2scm ("char"), gh_int2scm (cm->code), SCM_UNDEFINED)); - at.fontify (afm_l_); + at->fontify (afm_l_); m.dim_ = afm_bbox_to_box (cm->charBBox); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -210,16 +210,18 @@ Lookup::beam (Real slope, Real width, Real thick) const Molecule m; - Atom at + m.dim_[X_AXIS] = Interval (0, width); + m.dim_[Y_AXIS] = Interval (min_y, max_y); + + + Atom *at = new Atom (gh_list (ly_symbol2scm ("beam"), gh_double2scm (width), gh_double2scm (slope), gh_double2scm (thick), SCM_UNDEFINED)); - m.dim_[X_AXIS] = Interval (0, width); - m.dim_[Y_AXIS] = Interval (min_y, max_y); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -237,13 +239,13 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash) const l = gh_cons (ly_offset2scm (b.control_[i]), l); } - Atom at (gh_list (ly_symbol2scm ("dashed-slur"), + Atom *at = new Atom(gh_list (ly_symbol2scm ("dashed-slur"), gh_double2scm (thick), gh_double2scm (dash), ly_quote_scm (l), SCM_UNDEFINED)); Molecule m; - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -284,7 +286,7 @@ Lookup::filledbox (Box b ) const { Molecule m; - Atom at (gh_list (ly_symbol2scm ("filledbox"), + Atom* at = new Atom(gh_list (ly_symbol2scm ("filledbox"), gh_double2scm (-b[X_AXIS][LEFT]), gh_double2scm (b[X_AXIS][RIGHT]), gh_double2scm (-b[Y_AXIS][DOWN]), @@ -292,7 +294,7 @@ Lookup::filledbox (Box b ) const SCM_UNDEFINED)); m.dim_ = b; - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -390,12 +392,12 @@ Lookup::text (String style, String text, Paper_def *paper_l) const m.dim_ = metric_l->text_dimension (text); - Atom at (gh_list (ly_symbol2scm ("text"), + Atom *at = new Atom (gh_list (ly_symbol2scm ("text"), ly_str02scm (text.ch_C()), SCM_UNDEFINED)); - at.fontify (metric_l); + at->fontify (metric_l); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -438,13 +440,13 @@ Lookup::staff_brace (Real y, int staff_size) const String nm = String ("feta-braces" + to_str (staff_size)); SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED); - Atom at (e); + Atom *at = new Atom (e); - at.fontify (all_fonts_global_p->find_font (nm)); + at->fontify (all_fonts_global_p->find_font (nm)); m.dim_[Y_AXIS] = Interval (-y/2,y/2); m.dim_[X_AXIS] = Interval (0,0); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -456,7 +458,7 @@ Lookup::tuplet_bracket (Real dy , Real dx, Real thick, Real gap, { Molecule m; - Atom at (gh_list(ly_symbol2scm ("tuplet"), + Atom *at = new Atom (gh_list(ly_symbol2scm ("tuplet"), gh_double2scm (height), gh_double2scm (gap), gh_double2scm (dx), @@ -464,7 +466,7 @@ Lookup::tuplet_bracket (Real dy , Real dx, Real thick, Real gap, gh_double2scm (thick), gh_int2scm (dir), SCM_UNDEFINED)); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -499,7 +501,7 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick) const } - Atom at (gh_list (ly_symbol2scm ("bezier-sandwich"), + Atom *at = new Atom (gh_list (ly_symbol2scm ("bezier-sandwich"), ly_quote_scm (list), gh_double2scm (linethick), SCM_UNDEFINED)); @@ -507,7 +509,7 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick) const Molecule m; m.dim_[X_AXIS] = curve.extent (X_AXIS); m.dim_[Y_AXIS] = curve.extent (Y_AXIS); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } @@ -515,7 +517,7 @@ Molecule Lookup::staff_bracket (Real height, Paper_def* paper_l) const { Molecule m; - Atom at ( gh_list (ly_symbol2scm ("bracket"), + Atom *at = new Atom ( gh_list (ly_symbol2scm ("bracket"), gh_double2scm (paper_l->get_var("bracket_arch_angle")), gh_double2scm (paper_l->get_var("bracket_arch_width")), gh_double2scm (paper_l->get_var("bracket_arch_height")), @@ -525,7 +527,7 @@ Lookup::staff_bracket (Real height, Paper_def* paper_l) const gh_double2scm (paper_l->get_var("bracket_thick")), SCM_UNDEFINED)); - m.add_atom (&at); + m.add_atom (at->self_scm_); m.dim_[Y_AXIS] = Interval (-height/2,height/2); m.dim_[X_AXIS] = Interval (0,4 PT); @@ -538,7 +540,7 @@ Lookup::volta (Real h, Real w, Real thick, bool vert_start, bool vert_end) const { Molecule m; - Atom at (gh_list (ly_symbol2scm ("volta"), + Atom *at = new Atom(gh_list (ly_symbol2scm ("volta"), gh_double2scm (h), gh_double2scm (w), gh_double2scm (thick), @@ -549,7 +551,7 @@ Lookup::volta (Real h, Real w, Real thick, bool vert_start, bool vert_end) const m.dim_[Y_AXIS] = Interval (- h/2, h/2); m.dim_[X_AXIS] = Interval (0, w); - m.add_atom (&at); + m.add_atom (at->self_scm_); return m; } diff --git a/lily/molecule.cc b/lily/molecule.cc index 2243f8517e..45fa78b7ec 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -5,32 +5,15 @@ (c) 1997--2000 Han-Wen Nienhuys */ +#include #include "interval.hh" #include "string.hh" #include "molecule.hh" #include "atom.hh" #include "debug.hh" - #include "killing-cons.tcc" -#ifdef ATOM_SMOB -#define MOL_EOL SCM_EOL -#define NEXT_CELL(a) gh_cdr(a) -#define CELLTYPE SCM -#define UNBOX_ATOM(a) Atom::atom_l (a) -#define BOX_ATOM(a) a->make_smob () -#define NEWCELL(a,b) gh_cons (a,b) -#define UNBOX_PTR(a) gh_car (a) -#else -#define MOL_EOL 0 -#define NEXT_CELL(a) ptr->next_ -#define CELLTYPE Cons* -#define UNBOX_ATOM(a) a -#define UNBOX_PTR(a) a->car_ -#define BOX_ATOM(a) a -#define NEWCELL(a,b) new Killing_cons(a,b) -#endif Box Molecule::extent() const @@ -47,9 +30,15 @@ Molecule::extent(Axis a) const void Molecule::translate (Offset o) { - for (CELLTYPE ptr = atom_list_; ptr != MOL_EOL; ptr = NEXT_CELL(ptr)) + if (isinf (o.length ())) + { + programming_error ("Translating infinitely. Ignore."); + return; + } + + for (SCM ptr = gh_cdr (atom_list_); ptr != SCM_EOL; ptr = gh_cdr(ptr)) { - UNBOX_ATOM(UNBOX_PTR(ptr))->off_ += o; + unsmob_atom (gh_car (ptr))->off_ += o; } if (!empty_b ()) dim_.translate (o); @@ -58,8 +47,15 @@ Molecule::translate (Offset o) void Molecule::translate_axis (Real x,Axis a) { - for (CELLTYPE ptr = atom_list_; ptr != MOL_EOL; ptr = NEXT_CELL(ptr)) - UNBOX_ATOM (UNBOX_PTR(ptr))->off_[a] += x; + if (isinf (x)) + { + programming_error ("Translating infinitely. Ignore."); + return; + } + for (SCM ptr = gh_cdr (atom_list_); ptr != SCM_EOL; ptr = gh_cdr(ptr)) + { + unsmob_atom (gh_car (ptr))->off_[a] += x; + } if (!dim_[a].empty_b ()) dim_[a] += x; @@ -68,30 +64,30 @@ Molecule::translate_axis (Real x,Axis a) void Molecule::add_molecule (Molecule const &m) { - for (CELLTYPE ptr = m.atom_list_; ptr != MOL_EOL; ptr = NEXT_CELL(ptr)) - add_atom(UNBOX_ATOM (UNBOX_PTR(ptr))); - + for (SCM ptr = gh_cdr (m.atom_list_); ptr != SCM_EOL; ptr = gh_cdr(ptr)) + { + Atom *a = new Atom (*unsmob_atom (gh_car (ptr))); + add_atom (a->self_scm_); + } dim_.unite (m.dim_); } void -Molecule::add_atom (Atom const *al) +Molecule::add_atom (SCM atomsmob) { - Atom *a = new Atom(*al); + gh_set_cdr_x (atom_list_, + gh_cons (atomsmob, gh_cdr (atom_list_))); - atom_list_ = NEWCELL(BOX_ATOM(a), atom_list_); + scm_unprotect_object (atomsmob); } void Molecule::operator=(Molecule const & src) { - if (&src == this) return; - -#ifndef ATOM_SMOB - delete atom_list_; -#endif + if (&src == this) + return; - atom_list_ = MOL_EOL; + atom_list_ = gh_cons (SCM_EOL,SCM_EOL); dim_= src.dim_; add_molecule (src); } @@ -111,31 +107,26 @@ Molecule::set_empty (bool e) } } +void +Molecule::print () const +{ +#ifndef NPRINT + for (SCM ptr = gh_cdr (atom_list_); ptr != SCM_EOL; ptr = gh_cdr(ptr)) + gh_display (gh_car (ptr)); +#endif +} + Molecule::Molecule (Molecule const &s) { - atom_list_ = MOL_EOL; + atom_list_ = gh_cons (SCM_EOL, SCM_EOL); set_empty (true); add_molecule (s); } Molecule::~Molecule () { -#ifndef ATOM_SMOB - delete atom_list_; -#endif } -void -Molecule::print() const -{ -#ifndef NPRINT - if (! flower_dstream) - return; - DEBUG_OUT << "dim:"; - for (Axis i=X_AXIS; i < NO_AXES; incr (i)) - DEBUG_OUT << axis_name_str (i) << " = " << dim_[i].str (); -#endif -} void Molecule::align_to (Axis a, Direction d) @@ -155,7 +146,7 @@ Molecule::Molecule () { dim_[X_AXIS].set_empty (); dim_[Y_AXIS].set_empty (); - atom_list_ = MOL_EOL; + atom_list_ = gh_cons (SCM_EOL, SCM_EOL); } @@ -177,5 +168,5 @@ Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding) bool Molecule::empty_b () const { - return atom_list_ == MOL_EOL; + return gh_cdr (atom_list_) == SCM_EOL; } diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 6bb488a547..7ac5c3791f 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -8,13 +8,38 @@ #include "proto.hh" #include "musical-request.hh" #include "multi-measure-rest.hh" -#include "multi-measure-rest-engraver.hh" #include "paper-column.hh" #include "engraver-group-engraver.hh" #include "timing-translator.hh" #include "bar.hh" #include "staff-symbol-referencer.hh" +#include "engraver.hh" +#include "moment.hh" +/** + */ +class Multi_measure_rest_engraver : public Engraver +{ +public: + VIRTUAL_COPY_CONS(Translator); + + Multi_measure_rest_engraver (); + +protected: + virtual void acknowledge_element (Score_element_info i); + virtual void do_process_requests (); + virtual bool do_try_music (Music*); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + +private: + Drul_array rest_moments_; + + int start_measure_i_; + Rhythmic_req* multi_measure_req_l_; + Multi_measure_rest* mmrest_p_; + Multi_measure_rest* lastrest_p_; +}; ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver); @@ -81,7 +106,10 @@ Multi_measure_rest_engraver::do_process_requests () Staff_symbol_referencer_interface si (mmrest_p_); si.set_interface (); - + + /* + UGH. JUNKME + */ if(dynamic_cast (multi_measure_req_l_)) mmrest_p_->set_elt_property ("alt-symbol", ly_str02scm ("scripts-repeatsign")); diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index e25dffbbc6..ea462cee20 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -27,9 +27,6 @@ Multi_measure_rest::Multi_measure_rest () } - - - /* [TODO] 17 * variable-sized multi-measure rest symbol: |====| ?? diff --git a/lily/note-column.cc b/lily/note-column.cc index 00fb47af38..8dca8fc061 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -153,7 +153,7 @@ Note_column::do_post_processing () return; Beam * b = stem_l ()->beam_l (); - if (!b || !b->stem_count ()) + if (!b || !b->visible_stem_count ()) return; /* ugh. Should be done by beam. @@ -171,6 +171,7 @@ Note_column::do_post_processing () if (gh_number_p (s)) beam_y = gh_scm2double (s); + Real x0 = b->first_visible_stem ()->hpos_f (); Real dx = b->last_visible_stem ()->hpos_f () - x0; Real dydx = beam_dy && dx ? beam_dy/dx : 0; diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index f1df4c15fe..7c14708d7f 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -9,6 +9,7 @@ #include #include +#include #include "dimensions.hh" #include "dictionary-iter.hh" @@ -78,9 +79,9 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) output_comment (nm); } - for (Cons *ptr = m->atom_list_; ptr; ptr = ptr->next_) + for (SCM ptr = gh_cdr (m->atom_list_); ptr != SCM_EOL; ptr = gh_cdr (ptr)) { - Atom * i = ptr->car_; + Atom * i = unsmob_atom (gh_car (ptr)); Offset a_off = i->off_; a_off += o; @@ -88,18 +89,19 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) if (!i->func_) continue; - if (a_off.length () > 100 CM) + Axis a = X_AXIS; + while (a < NO_AXES) { - programming_error ("improbable offset for object"); - Axis a =X_AXIS; - while (a < NO_AXES) + if (abs(a_off[a]) > 30 CM + || isinf (a_off[a]) || isnan (a_off[a])) { - if (abs(a_off[a]) > 30 CM) - a_off[a] = 30 CM; - incr (a); + programming_error ("Improbable offset for object: setting to zero"); + a_off[a] = 0.0; } + incr (a); } - + + SCM box_scm = gh_list (ly_symbol2scm ("placebox"), gh_double2scm (a_off[X_AXIS]), diff --git a/lily/score-element.cc b/lily/score-element.cc index 6569b790a1..7bbf22594d 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -491,48 +491,7 @@ Score_element::find_broken_piece (Line_of_score*) const return 0; } -SCM -Score_element::mark_smob (SCM ses) -{ - void * mp = (void*) gh_cdr(ses); - Score_element * s = (Score_element*) mp; - - if (s->self_scm_ != ses) - { - programming_error ("SMOB marking gone awry"); - return SCM_EOL; - } - return s->element_property_alist_; -} - - -int -Score_element::print_smob (SCM s, SCM port, scm_print_state *) -{ - Score_element *sc = (Score_element *) gh_cdr (s); - - scm_puts ("#name (), port); - - // scm_puts (" properties = ", port); - // scm_display (sc->element_property_alist_, port); - scm_puts (" >", port); - return 1; -} - -void -Score_element::do_smobify_self () -{ - scm_unprotect_object (element_property_alist_); // ugh -} -#include "ly-smobs.icc" -IMPLEMENT_SMOBS(Score_element); -SCM -Score_element::equal_p (SCM a, SCM b) -{ - return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F; -} void Score_element::translate_axis (Real y, Axis a) @@ -573,15 +532,6 @@ Score_element::extent (Axis a) const return d->get_dim (); } -Score_element* -unsmob_element (SCM s) -{ - if (SMOB_IS_TYPE_B (Score_element, s)) - return SMOB_TO_TYPE(Score_element,s); - else - return 0; -} - Score_element* Score_element::parent_l (Axis a) const @@ -648,3 +598,52 @@ Score_element::fixup_refpoint () } } } + + + +/**************************************************** + SMOB funcs + ****************************************************/ + + +#include "ly-smobs.icc" + +IMPLEMENT_SMOBS(Score_element); +IMPLEMENT_UNSMOB(Score_element, element); +SCM +Score_element::mark_smob (SCM ses) +{ + Score_element * s = SMOB_TO_TYPE (Score_element, ses); + if (s->self_scm_ != ses) + { + programming_error ("SMOB marking gone awry"); + return SCM_EOL; + } + return s->element_property_alist_; +} + +int +Score_element::print_smob (SCM s, SCM port, scm_print_state *) +{ + Score_element *sc = (Score_element *) gh_cdr (s); + + scm_puts ("#name (), port); + + // scm_puts (" properties = ", port); + // scm_display (sc->element_property_alist_, port); + scm_puts (" >", port); + return 1; +} + +void +Score_element::do_smobify_self () +{ + scm_unprotect_object (element_property_alist_); // ugh +} + +SCM +Score_element::equal_p (SCM a, SCM b) +{ + return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F; +} diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index a053d9f6f8..4910fd27de 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -12,6 +12,7 @@ */ +#include #include "simple-spacer.hh" #include "paper-column.hh" @@ -32,13 +33,20 @@ Simple_spacer::Simple_spacer () void Simple_spacer::add_rod (int l, int r, Real dist) { + if (isinf (dist) || isnan (dist)) + { + programming_error ("Weird minimum distance. Ignoring"); + return; + } + + Real c = range_stiffness (l,r); Real d = range_ideal_len (l,r); Real block_stretch = dist - d; Real block_force = c * block_stretch; force_f_ = force_f_ >? block_force; - + for (int i=l; i < r; i++) springs_[i].block_force_f_ = block_force >? springs_[i].block_force_f_ ; @@ -184,6 +192,13 @@ Simple_spacer::add_columns (Link_array cols) desc.hooke_f_ = 1.0; desc.ideal_f_ = default_space_f_; } + + if (!desc.sane_b ()) + { + programming_error ("Insane spring."); + continue; + } + desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0 springs_.push (desc); } @@ -240,6 +255,13 @@ Spring_description::energy_f (Real force) const return e; } +bool +Spring_description::sane_b () const +{ + return (hooke_f_ > 0) && ! isinf (ideal_f_) && !isnan (ideal_f_); +} + + Real Simple_spacer::energy_f () const { diff --git a/lily/spanner.cc b/lily/spanner.cc index 77d35356b6..7d0ca15fdd 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -5,6 +5,7 @@ (c) 1996, 1997--2000 Han-Wen Nienhuys */ +#include #include "dimension-cache.hh" #include "debug.hh" @@ -187,7 +188,10 @@ Spanner::do_space_processing () Array ss (get_springs ()); for (int i=0; i < ss.size (); i++) { - ss[i].add_to_cols (); + if (isinf (ss[i].distance_f_)) + programming_error ("weird spring"); + else + ss[i].add_to_cols (); } } diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index 479ed456d4..8f93df70e1 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -93,7 +93,7 @@ Timing_translator::do_pre_move_processing() /* allbars == ! skipbars */ SCM sb = get_property ("skipBars", 0); - bool allbars = !(gh_boolean_p (sb)&&gh_scm2bool (sb)); + bool allbars = !to_boolean (sb); // urg: multi bar rests: should always process whole of first bar? SCM tim = get_property ("timing", 0); diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index 478ad40abd..39dbc7b12b 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -1,5 +1,5 @@ /* - auto-plet-engraver.cc -- implement Auto_plet_engraver + plet-engraver.cc -- implement Tuplet_engraver source file of the GNU LilyPond music typesetter @@ -7,13 +7,36 @@ */ -#include "tuplet-engraver.hh" + #include "command-request.hh" #include "tuplet-spanner.hh" #include "note-column.hh" #include "time-scaled-music.hh" #include "beam.hh" #include "music-list.hh" +#include "engraver.hh" + +class Tuplet_engraver : public Engraver +{ +public: + VIRTUAL_COPY_CONS(Translator); + +protected: + Link_array time_scaled_music_arr_; + /// when does the scaled music stop? Array order is synced with time_scaled_music_arr_ + Array stop_moments_; + /// when does the current spanner stop? Array order is synced with time_scaled_music_arr_ + Array span_stop_moments_; + + /// The spanners. Array order is synced with time_scaled_music_arr_ + Link_array started_span_p_arr_; + + virtual void do_removal_processing (); + virtual void acknowledge_element (Score_element_info); + virtual bool do_try_music (Music*r); + virtual void do_process_requests (); + virtual void do_post_move_processing (); +}; bool Tuplet_engraver::do_try_music (Music *r) @@ -24,7 +47,14 @@ Tuplet_engraver::do_try_music (Music *r) if (!dynamic_cast (el)) { time_scaled_music_arr_.push (c); - stop_moments_.push (now_mom () + c->length_mom ()); + Moment m = now_mom () + c->length_mom (); + stop_moments_.push (m); + + SCM s = get_property ("tupletSpannerDuration",0); + if (SMOB_IS_TYPE_B(Moment, s)) + m = m = started_span_p_arr_.size ()) + started_span_p_arr_.push (glep); + else + started_span_p_arr_[i] = glep; + glep->set_elt_property ("text", ly_str02scm (to_str (time_scaled_music_arr_[i]->den_i_).ch_C())); - glep->set_elt_property("tuplet-visibility", - gh_int2scm (visibility)); - if (dir != 0) - glep->set_elt_property("dir-forced", gh_int2scm (dir)); announce_element (Score_element_info (glep, time_scaled_music_arr_ [i])); } } @@ -71,12 +98,14 @@ Tuplet_engraver::acknowledge_element (Score_element_info i) if (Note_column *nc = dynamic_cast (i.elem_l_)) { for (int j =0; j add_column (nc); + if (started_span_p_arr_[j]) + started_span_p_arr_[j]->add_column (nc); } else if (Beam *b = dynamic_cast (i.elem_l_)) { for (int j = 0; j < started_span_p_arr_.size (); j++) - started_span_p_arr_[j]->add_beam (b); + if (started_span_p_arr_[j]) + started_span_p_arr_[j]->add_beam (b); } } @@ -84,13 +113,31 @@ void Tuplet_engraver::do_post_move_processing () { Moment now = now_mom (); + + Moment tsd; + SCM s = get_property ("tupletSpannerDuration",0); + if (SMOB_IS_TYPE_B(Moment, s)) + tsd = *SMOB_TO_TYPE(Moment,s); + for (int i= started_span_p_arr_.size (); i--; ) { + if (now >= span_stop_moments_[i]) + { + if (started_span_p_arr_[i]) + { + typeset_element (started_span_p_arr_[i]); + started_span_p_arr_[i] =0; + } + + if (tsd) + span_stop_moments_[i] += tsd; + } + if (now >= stop_moments_[i]) { - typeset_element (started_span_p_arr_[i]); started_span_p_arr_.del (i); stop_moments_.del(i); + span_stop_moments_.del (i); time_scaled_music_arr_.del(i); } } @@ -101,7 +148,8 @@ Tuplet_engraver::do_removal_processing () { for (int i=0; i < started_span_p_arr_.size (); i++) { - typeset_element (started_span_p_arr_[i]); + if (started_span_p_arr_[i]) + typeset_element (started_span_p_arr_[i]); } } diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 348db3f890..8e5e8d376d 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -40,25 +40,22 @@ Tuplet_spanner::do_brew_molecule_p () const bool par_beam = to_boolean (get_elt_property ("parallel-beam")); bool bracket_visibility = !par_beam; bool number_visibility = true; - SCM visibility_sym =get_elt_property ("tuplet-visibility"); - if (gh_number_p (visibility_sym)) + + SCM bracket = get_elt_property ("tuplet-bracket-visibility"); + if (gh_boolean_p (bracket)) { - /* - ARG. Fixme. - */ - - /* Property values: - 0 show nothing - 1 show number - 2 show (number and bracket)-if-no-beam - 3 show number, and bracket-if-no-beam - 4 show number, and bracket - */ - int value = gh_scm2int ((visibility_sym)); - bracket_visibility = (value == 4 || (value > 1 && !par_beam)); - number_visibility = (value > 2 || value == 1 || - (value == 2 && !par_beam)); + bracket_visibility = gh_scm2bool (bracket); + } + else if (bracket == ly_symbol2scm ("if-no-beam")) + bracket_visibility = !par_beam; + + SCM numb = get_elt_property ("tuplet-number-visibility"); + if (gh_boolean_p (numb)) + { + number_visibility = gh_scm2bool (numb); } + else if (bracket == ly_symbol2scm ("if-no-beam")) + number_visibility = !par_beam; if (gh_pair_p (get_elt_property ("columns"))) { @@ -73,9 +70,8 @@ Tuplet_spanner::do_brew_molecule_p () const Direction dir = directional_element (this).get (); Real dy = gh_scm2double (get_elt_property ("delta-y")); SCM number = get_elt_property ("text"); - if (gh_string_p (number)) + if (gh_string_p (number) && number_visibility) { - Molecule num (lookup_l ()->text ("italic", ly_scm2string (number), paper_l ())); @@ -124,7 +120,7 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const Link_array column_arr= Group_interface__extract_elements (this, (Note_column*)0, "columns"); - + Direction d = directional_element (this).get (); *dy = column_arr.top ()->extent (Y_AXIS) [d] - column_arr[0]->extent (Y_AXIS) [d]; @@ -133,11 +129,14 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const Real x0 = column_arr[0]->hpos_f (); Real x1 = column_arr.top ()->hpos_f (); + + Real factor = column_arr.size () > 1 ? 1/(x1 - x0) : 1.0; + for (int i = 0; i < column_arr.size (); i++) { Real notey = column_arr[i]->extent (Y_AXIS)[d]; Real x = column_arr[i]->hpos_f () - x0; - Real tuplety = *dy * x / (x1 -x0); + Real tuplety = *dy * x * factor; if (notey * d > (*offset + tuplety) * d) *offset = notey - tuplety; @@ -188,6 +187,8 @@ Tuplet_spanner::do_post_processing () Direction Tuplet_spanner::get_default_dir () const { + assert (false); + Direction d = UP; SCM dir_sym =get_elt_property ("dir-forced"); if (gh_number_p (dir_sym)) diff --git a/lilypond-mode.el b/lilypond-mode.el index a6c7d67787..8a4c7ccf6f 100644 --- a/lilypond-mode.el +++ b/lilypond-mode.el @@ -169,10 +169,10 @@ "Run LilyPond on buffer." (interactive) (let ((buffer (buffer-name))) - (if buffer-file-name + (if (buffer-file-name) (progn (lily-save-buffer) - (lily-compile-file lily-command lily-parameters buffer)) + (lily-compile-file lily-command lily-parameters (buffer-file-name))) (progn (error "Buffer %s is not associated with a file" buffer) (lily-eval-region (min-point) (max-point)))))) diff --git a/ly/auto-beam-settings.ly b/ly/auto-beam-settings.ly index 50044c786e..1f6c21307f 100644 --- a/ly/auto-beam-settings.ly +++ b/ly/auto-beam-settings.ly @@ -35,57 +35,54 @@ autoBeamSettings = (list %} - - - - - - - - - time3_2beamAutoEnd = #(make-moment 1 2) %time3_2beamAutoEnd_16 = #(make-moment 1 4) time3_2beamAutoEnd_16 = #(make-moment 1 4) -time3_2beamAutoEnd_32 = #(begin (make-moment 1 8)) +time3_2beamAutoEnd_32 = #(make-moment 1 8) -time3_4beamAutoBegin_8 = #(begin (make-moment 1 4)) -time3_4beamAutoEnd = #(begin (make-moment 3 4)) -time3_4beamAutoBegin_16 = #(begin (make-moment 1 16)) -time3_4beamAutoEnd_16 = #(begin (make-moment 1 4)) -%time3_4beamAutoBegin_32 = #(begin (make-moment 1 8)) -time3_4beamAutoEnd_32 = #(begin (make-moment 1 8)) +time3_4beamAutoBegin_8 = #(make-moment 1 4) +time3_4beamAutoEnd = #(make-moment 3 4) +time3_4beamAutoBegin_16 = #(make-moment 1 16) +time3_4beamAutoEnd_16 = #(make-moment 1 4) +%time3_4beamAutoBegin_32 = #(make-moment 1 8) +time3_4beamAutoEnd_32 = #(make-moment 1 8) -time3_8beamAutoBegin = #(begin (make-moment 1 8)) -time3_8beamAutoEnd = #(begin (make-moment 3 8)) +time3_8beamAutoBegin = #(make-moment 1 8) +time3_8beamAutoEnd = #(make-moment 3 8) % in common time: % end beams each 1/2 note % end beams with 32th notes each 1/8 note % end beams with 1/8 triplets each 1/4 note -time4_4beamAutoEnd = #(begin (make-moment 1 2)) -time4_4beamAutoEnd_12 = #(begin (make-moment 1 4)) -time4_4beamAutoEnd_16 = #(begin (make-moment 1 4)) -time4_4beamAutoEnd_32 = #(begin (make-moment 1 8)) +time4_4beamAutoEnd = #(make-moment 1 2) +time4_4beamAutoEnd_12 = #(make-moment 1 4) +time4_4beamAutoEnd_16 = #(make-moment 1 4) +time4_4beamAutoEnd_32 = #(make-moment 1 8) + +time2_4beamAutoEnd = #(make-moment 1 4) +time2_4beamAutoEnd_12 = #(make-moment 1 4) +time2_4beamAutoEnd_16 = #(make-moment 1 4) +time2_4beamAutoEnd_32 = #(make-moment 1 8) + -time4_8beamAutoEnd = #(begin (make-moment 1 4)) -time4_8beamAutoEnd_16 = #(begin (make-moment 1 4)) -time4_8beamAutoEnd_32 = #(begin (make-moment 1 8)) +time4_8beamAutoEnd = #(make-moment 1 4) +time4_8beamAutoEnd_16 = #(make-moment 1 4) +time4_8beamAutoEnd_32 = #(make-moment 1 8) -time4_16beamAutoEnd = #(begin (make-moment 1 8)) +time4_16beamAutoEnd = #(make-moment 1 8) -time6_8beamAutoEnd = #(begin (make-moment 3 8)) -time6_8beamAutoEnd_16 = #(begin (make-moment 3 8)) -time6_8beamAutoEnd_32 = #(begin (make-moment 1 8)) +time6_8beamAutoEnd = #(make-moment 3 8) +time6_8beamAutoEnd_16 = #(make-moment 3 8) +time6_8beamAutoEnd_32 = #(make-moment 1 8) -time9_8beamAutoEnd = #(begin (make-moment 3 8)) -time9_8beamAutoEnd_16 = #(begin (make-moment 3 8)) -time9_8beamAutoEnd_32 = #(begin (make-moment 1 8)) +time9_8beamAutoEnd = #(make-moment 3 8) +time9_8beamAutoEnd_16 = #(make-moment 3 8) +time9_8beamAutoEnd_32 = #(make-moment 1 8) -time12_8beamAutoEnd = #(begin (make-moment 3 8)) -time12_8beamAutoEnd_16 = #(begin (make-moment 3 8)) -time12_8beamAutoEnd_32 = #(begin (make-moment 1 8)) +time12_8beamAutoEnd = #(make-moment 3 8) +time12_8beamAutoEnd_16 = #(make-moment 3 8) +time12_8beamAutoEnd_32 = #(make-moment 1 8) diff --git a/ly/property.ly b/ly/property.ly index 4a28d27368..d416d2edd9 100644 --- a/ly/property.ly +++ b/ly/property.ly @@ -117,7 +117,7 @@ endincipit = \notes{ \nobreak \bar ""; } -autoBeamOff = \property Voice.noAutoBeaming = #t +autoBeamOff = \property Voice.noAutoBeaming = ##t autoBeamOn = \property Voice.noAutoBeaming = ##f diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index fad40f07db..e71c5d7eb5 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.21 -Entered-date: 21JAN00 +Version: 1.3.22 +Entered-date: 02FEB00 Description: 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.3.21.tar.gz + 1000k lilypond-1.3.22.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.21.tar.gz + 1000k lilypond-1.3.22.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 46e30bc200..c0a9a76337 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.21 +Version: 1.3.22 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.21.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.22.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # get Packager from (undocumented?) ~/.rpmmacros! diff --git a/scm/generic-property.scm b/scm/generic-property.scm index fcf6fcbfb6..6be4443944 100644 --- a/scm/generic-property.scm +++ b/scm/generic-property.scm @@ -127,11 +127,23 @@ (list (list 'timeSignatureStyle string? 'style)))) +(define (symbol-or-boolean? s) + (or (boolean? s) (symbol? s))) + +(define generic-tuplet-spanner-properties + (cons "Tuplet_spanner" + (list + (list 'tupletNumberVisibility symbol-or-boolean? 'tuplet-number-visibility) + (list 'tupletBracketVisibility symbol-or-boolean? 'tuplet-bracket-visibility) + )) +) + (define generic-voice-properties (list generic-stem-properties generic-breathing-sign-properties generic-tie-properties + generic-tuplet-spanner-properties generic-rest-properties generic-slur-properties generic-beam-properties diff --git a/scripts/convert-mudela.py b/scripts/convert-mudela.py index 5d91080465..ede540b40b 100644 --- a/scripts/convert-mudela.py +++ b/scripts/convert-mudela.py @@ -407,10 +407,12 @@ if 1: if 1: def conv (str): - return re.sub ('staffLineLeading' - 'staffSpace', - str) - conversions.append ((1,3,18), conv, "staffLineLeading -> staffSpace") + str = re.sub ('staffLineLeading', + 'staffSpace', + str) + return str + + conversions.append ((1,3,18), conv, 'staffLineLeading -> staffSpace') ############################ diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index b309317ff1..e8d5a36e69 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -257,7 +257,7 @@ class TeXOutput: %%\\addtolength{\\topmargin}{-1cm} %%\\setlength{\\textwidth}{%s} %%\\setlength{\\textheight}{%s} -\\geometry{width=%spt, left=%spt, height=%spt, top=%spt} +\\geometry{width=%spt, left=%spt, height=%spt, top=%spt, nohead} \\input lilyponddefs \\input titledefs %s