From: Han-Wen Nienhuys Date: Thu, 17 Jun 1999 09:34:46 +0000 (+0200) Subject: release: 1.1.48 X-Git-Tag: release/1.1.48 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=refs%2Ftags%2Frelease%2F1.1.48;p=lilypond.git release: 1.1.48 --- diff --git a/Documentation/tex/lilypond-regtest.doc b/Documentation/tex/lilypond-regtest.doc index 20a8336e71..6fcd8b45a0 100644 --- a/Documentation/tex/lilypond-regtest.doc +++ b/Documentation/tex/lilypond-regtest.doc @@ -29,6 +29,15 @@ are not expanded when you set Score.SkipBars \mudelafile{multi-measure-rest.ly} +\section{Stems} + +Stem tremolos (official naming?) or rolls are tremolo signs that look +like beam segments crossing stems. If the stem is in a beam, the +tremolo must be parallel to the beam. If the stem is invisible +(eg. on a whole note), the tremolo must be centered on the note. + +\mudelafile{stem-tremolo.ly} + \section{Beams, slurs and other spanners} diff --git a/NEWS b/NEWS index a44a11ac86..1b90a27d70 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +pl 47.jcn1 + - bf: interstaff slurs (urg: more segfaults in scm_gc_mark ()) + +pl 45.hwn3 + - Abbreviation -> Stem_tremolo. + - bf: Stem_tremolo in Beam. + - bf: Stem_tremolo over whole note. + - spacing before clefs. + - Spacing_spanner is now on by default + - junked most of Spring_spacer + - Tunable space after barline. + +********* pl 46.mb2 - Reintroduced the tupletVisibility property. Same values as the old version (pletvisibility), see the Reference Manual. diff --git a/TODO b/TODO index d68cafc830..ee05f34ea8 100644 --- a/TODO +++ b/TODO @@ -63,9 +63,8 @@ I understand your point. It should be changed. . * fix MIDI . * \shape 1st dim skipped? . * turn slope-damping on/off -. * tremolo stuff +. * tremolo stuff: tremolo over whole note. . * We need feta-din*.mf files for more sizes than 10. -. * feta-accordeon has some 'strange turning paths' on 300dpi . * fix dynamics decently, ie. use kerning & ligatures. . * dots & rest collisions? . * mudela-book.py @@ -147,7 +146,6 @@ specify the third. Should there be? . * make wide_spanner_engraver (line_group_spanner, staff_symbol) . * remove Interval dim_ from Dimension_cache and rename the struct. . * do scaled fonts generally -. * Spacing. . * The Lilypond accidental symbols are available through the TeX macros, \textflat, \textsharp and \textnatural defined in the init file lilyponddefs.tex. All the symbols are defined in the files fetaXX.tex @@ -193,7 +191,6 @@ compilation. . * add new glyphs to font.ly . * formatting of input stuff. . * \notes{ a \< b \cr } vs \notes{ a \< b \! } -. * space after bars? . * 'hinterfleisch' before bar (e.g. wtk1-fugue2)? . * Summary of minor spelling irregularities: . * capitalization/use of underscores in property names diff --git a/VERSION b/VERSION index 1ed063fa0a..b8326958da 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 -PATCH_LEVEL=47 +PATCH_LEVEL=48 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/flower/include/unionfind.hh b/flower/include/unionfind.hh index 9f360be400..b83a673a5d 100644 --- a/flower/include/unionfind.hh +++ b/flower/include/unionfind.hh @@ -13,15 +13,14 @@ */ struct Union_find { - void connect (int i, int j); - int find (int i); - bool equiv (int i, int j) { return find (i) == find (j); } - Union_find (int sz); + void connect (int i, int j); + int find (int i); + bool equiv (int i, int j) { return find (i) == find (j); } + Union_find (int sz); -private: /** This array provides the representing point for each node in the graph. - */ + */ Array classes_; }; #endif diff --git a/input/test/abbrev.ly b/input/test/abbrev.ly deleted file mode 100644 index 33b050ea55..0000000000 --- a/input/test/abbrev.ly +++ /dev/null @@ -1,30 +0,0 @@ - -\version "1.0.20"; -\score{ - \notes \transpose c'''{ - \stemup -% \stemdown - % default abbreviations - c4 c4: c4:32 c4: c4 c2. - a,1 - a,1:32 - c,4:8 c': c,4:16 c': - [ c,8:16 c, c, c, ] [ a a a a ] - [ c, f, b, e ] - [ c,16:32 c, c, c, ] [ a16:32 a a a ] -% % there's still some hairy beam bugfixing todo - [ c'8:16 g d a, ] - [ c,8:32 f, b, e ] -% [ c'16:32 g d a, ] - [:32 c16 e] - [:32 c16 e] - [:16 c8 e] - [:16 e4 g] - [:16 e2 g] - [:16 e1 g] - - } - \paper{ - castingalgorithm = \Wordwrap; - } -} diff --git a/input/test/beam-tremolo.ly b/input/test/beam-tremolo.ly new file mode 100644 index 0000000000..f60c9c7e0e --- /dev/null +++ b/input/test/beam-tremolo.ly @@ -0,0 +1,8 @@ + + % broken. + [:32 c16 e] + [:32 c16 e] + [:16 c8 e] + [:16 e4 g] + [:16 e2 g] + [:16 e1 g] diff --git a/input/test/noteheadstyle.ly b/input/test/noteheadstyle.ly index 7cdf9d88f1..852d062afe 100644 --- a/input/test/noteheadstyle.ly +++ b/input/test/noteheadstyle.ly @@ -9,10 +9,10 @@ c4 c2 c8 c16 c16 c1 \property Voice.noteHeadStyle = "harmonic" c4 c2 c8 c16 c16 c1 - \context ThreadedVoice < + \context Voice < \context Thread = TA { \property Thread.noteHeadStyle = "cross" - \property ThreadedVoice.verticalDirection = \up c16} + \property Voice.verticalDirection = \up c16} \context Thread = TB { \property Thread.noteHeadStyle = "" a16 } @@ -23,21 +23,7 @@ c4 c2 c8 c16 c16 c1 } \paper { - \translator { - \VoiceContext - \remove Note_heads_engraver; - \accepts Thread; - \name ThreadedVoice; - } - \translator { - \StaffContext - \accepts ThreadedVoice; - } - \translator { - \type Engraver_group_engraver; - \consists Note_heads_engraver; - \name Thread; - } + } } \version "1.0.20"; diff --git a/input/test/stem-tremolo.ly b/input/test/stem-tremolo.ly new file mode 100644 index 0000000000..7804771d86 --- /dev/null +++ b/input/test/stem-tremolo.ly @@ -0,0 +1,26 @@ + +\version "1.0.20"; +\score{ + \notes \transpose c'''{ + \stemup +% \stemdown + % default abbreviations + c4 c4: c4:32 c4: c4 c2. + a,1 + a,1:32 + c,4:8 c': c,4:16 c': + [ c,8:16 c, c, c, ] + [ a a a a ] + [ c, f, b, e ] + [ c,16:32 c, c, c, ] [ a16:32 a a a ] +% % there's still some hairy beam bugfixing todo + [ c'8:16 g d a, ] + [ c,8:32 f, b, e ] + [ c'16:32 g d a, ] + + + } + \paper{ + castingalgorithm = \Wordwrap; + } +} diff --git a/lily/abbrev.cc b/lily/abbrev.cc deleted file mode 100644 index dd17851d1e..0000000000 --- a/lily/abbrev.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - abbrev.cc -- implement Abbreviation - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys - - */ - -#include "abbrev.hh" -#include "debug.hh" -#include "beam.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "stem.hh" -#include "offset.hh" - -Abbreviation::Abbreviation () -{ - stem_l_ = 0; - abbrev_flags_i_ = 1; -} - -void -Abbreviation::do_print () const -{ - DOUT << "abbrev_flags_i_ " << abbrev_flags_i_; -} - -Molecule* -Abbreviation::do_brew_molecule_p () const -{ - Beam * b = stem_l_->beam_l_; - int mult =0; - if (b) - { - Stem_info i = b->get_stem_info (stem_l_); - mult = i.mult_i_; - } - - Real interbeam_f = paper_l ()->interbeam_f (mult); - Real w = 1.5 * lookup_l ()->notehead (2, "").dim_[X_AXIS].length (); - Real space = stem_l_->staff_line_leading_f (); - Real internote_f = space/2; - - Real beam_f = paper_l ()->beam_thickness_f (); - - int beams_i = 0; - Real slope_f = internote_f / 4 / internote_f; // HUH? - - if (stem_l_ && stem_l_->beam_l_) { - slope_f = stem_l_->beam_l_->slope_f_; - // ugh, rather calc from Abbreviation_req - beams_i = stem_l_->beams_i_drul_[RIGHT] >? stem_l_->beams_i_drul_[LEFT]; - } - Real sl = slope_f * internote_f; - - Molecule a (lookup_l ()->beam (sl, w, beam_f)); - a.translate (Offset (-w/2, w / 2 * slope_f)); - - Molecule *beams= new Molecule; - for (int i = 0; i < abbrev_flags_i_; i++) - { - Molecule b (a); - b.translate_axis (interbeam_f * i, Y_AXIS); - beams->add_molecule (b); - } - beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS); - - if (stem_l_) - { - if (stem_l_->beam_l_) - { - beams->translate (Offset(stem_l_->hpos_f () - hpos_f (), - stem_l_->stem_end_f () * internote_f - - stem_l_->beam_l_->dir_ * beams_i * interbeam_f)); - } - else - { - /* - Beams should intersect one beamthickness below staff end - */ - Real dy = - beams->extent ()[Y_AXIS].length () / 2 * stem_l_->dir_; - dy /= internote_f; - dy += stem_l_->stem_end_f (); - dy *= internote_f; -// urg: can't: stem should be stetched first -// dy -= paper_l ()->beam_thickness_f () * stem_l_->dir_; - beams->translate (Offset(stem_l_->hpos_f () - hpos_f (), dy)); - } - - /* - there used to be half a page of code that was long commented out. - Removed in 1.1.35 - */ - } - - return beams; -} - -void -Abbreviation::do_substitute_element_pointer (Score_element*o, Score_element*n) -{ - if (stem_l_ == o) - stem_l_ = dynamic_cast (n); -} - - -void -Abbreviation::set_stem (Stem *s) -{ - stem_l_ = s; - add_dependency (s); -} diff --git a/lily/align-element.cc b/lily/align-element.cc index 56011a3fe1..a92f7502b3 100644 --- a/lily/align-element.cc +++ b/lily/align-element.cc @@ -94,18 +94,28 @@ Align_element::do_side_processing () Interval y = elem_l_arr_[i]->extent(axis ()); if (!y.empty_b()) { - dims.push (y); + Score_element *e =dynamic_cast(elem_l_arr_[i]); - SCM extra_dims = e->get_elt_property (extra_space_scm_sym); + // todo: fucks up if item both in Halign & Valign. + SCM min_dims = e->remove_elt_property (minimum_space_scm_sym); + if (min_dims != SCM_BOOL_F) + { + min_dims = SCM_CDR (min_dims); + y.unite (Interval (gh_scm2double (SCM_CAR (min_dims)), + gh_scm2double (SCM_CDR (min_dims)))); + } + + SCM extra_dims = e->remove_elt_property (extra_space_scm_sym); if (extra_dims != SCM_BOOL_F) { extra_dims = SCM_CDR (extra_dims); - dims.top ()[LEFT] -= gh_scm2double (SCM_CAR (extra_dims)); - dims.top ()[RIGHT] += gh_scm2double (SCM_CDR (extra_dims)); + y[LEFT] += gh_scm2double (SCM_CAR (extra_dims)); + y[RIGHT] += gh_scm2double (SCM_CDR (extra_dims)); } elems.push (e); + dims.push (y); } } diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 4e383675d7..07cd63aa6c 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -22,7 +22,6 @@ ADD_THIS_TRANSLATOR (Auto_beam_engraver); Auto_beam_engraver::Auto_beam_engraver () { stem_l_arr_p_ = 0; - //shortest_mom_ = 1; shortest_mom_ = Moment (1, 8); finished_beam_p_ = 0; finished_grouping_p_ = 0; @@ -156,7 +155,6 @@ Auto_beam_engraver::consider_end_and_begin () void Auto_beam_engraver::begin_beam () { - // DOUT << String ("starting autobeam at: ") + now_mom ().str () + "\n"; assert (!stem_l_arr_p_); stem_l_arr_p_ = new Array; assert (!grouping_p_); @@ -198,7 +196,6 @@ Auto_beam_engraver::end_beam () delete stem_l_arr_p_; stem_l_arr_p_ = 0; grouping_p_ = 0; - //shortest_mom_ = 1; shortest_mom_ = Moment (1, 8); } } @@ -310,8 +307,6 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) } grouping_p_->add_child (start, rhythmic_req->length_mom ()); - //stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_; - stem_l_arr_p_->push (stem_l); Moment now = now_mom (); last_add_mom_ = now; @@ -331,7 +326,6 @@ Auto_beam_engraver::junk_beam () stem_l_arr_p_ = 0; delete grouping_p_; grouping_p_ = 0; - //shortest_mom_ = 1; shortest_mom_ = Moment (1, 8); } diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index e8e314a567..bd8e723ea3 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -11,6 +11,16 @@ #include "dimensions.hh" #include "p-score.hh" #include "paper-def.hh" +#include "p-col.hh" + + +/* + Handle spacing for prefatory matter. + + + + TODO: rewrite this. It is kludgy +*/ void Break_align_item::do_pre_processing() @@ -18,7 +28,7 @@ Break_align_item::do_pre_processing() align_dir_ = break_status_dir(); flip (&align_dir_); sort_elements (); - + Real interline= paper_l ()->get_realvar (interline_scm_sym); Link_array elems; for (int i=0; i < elem_l_arr_.size(); i++) @@ -29,50 +39,96 @@ Break_align_item::do_pre_processing() } - if (elems.size ()) - { - Score_element *current_elt =elems[0]; - SCM current_origin = current_elt->get_elt_property (origin_scm_sym); + + if (!elems.size ()) + return; - if (current_origin != SCM_BOOL_F) - current_origin = SCM_CDR (current_origin); + SCM symbol_list = SCM_EOL; + Array dists; + SCM current_origin = gh_str02scm (""); + for (int i=0; i <= elems.size (); i++) + { + Score_element *next_elt = i < elems.size () + ? elems[i] + : 0 ; - for (int i=1; i < elems.size (); i++) + SCM next_origin; + + if (next_elt) { - Score_element *next_elt = elems[i]; - SCM next_origin = next_elt->get_elt_property (origin_scm_sym); - if (next_origin != SCM_BOOL_F) - { - next_origin = SCM_CDR(next_origin); - SCM extra_space = scm_eval (scm_listify (ly_symbol ("break-align-spacer"), - current_origin, - next_origin, - SCM_UNDEFINED)); - - - Real spc = gh_scm2double (extra_space); - spc *= paper_l ()->get_realvar (interline_scm_sym); - - current_elt->set_elt_property (extra_space_scm_sym, - scm_cons (gh_double2scm (0.0), - gh_double2scm (spc))); - - } - current_elt = next_elt; - current_origin = next_origin; + next_origin = next_elt->get_elt_property (origin_scm_sym); + next_origin = + (next_origin == SCM_BOOL_F) + ? gh_str02scm ("") + : SCM_CDR (next_origin); } + else + next_origin = gh_str02scm ("begin-of-note"); + + SCM extra_space + = scm_eval (scm_listify (ly_symbol ("break-align-spacer"), + current_origin, next_origin, SCM_UNDEFINED)); + SCM symbol = SCM_CAR (extra_space); + Real spc = gh_scm2double (SCM_CADR(extra_space)); + spc *= interline; + + dists.push(spc); + symbol_list = gh_cons (symbol, symbol_list); + current_origin = next_origin; + } + + // skip the first sym. + symbol_list = SCM_CDR (scm_reverse (symbol_list)); + for (int i=0; i set_elt_property (SCM_CAR (symbol_list), + scm_cons (gh_double2scm (0), + gh_double2scm (dists[i+1]))); + + symbol_list = SCM_CDR (symbol_list); } + + + // urg + SCM first_pair = elems[0]->get_elt_property (minimum_space_scm_sym); + if (first_pair == SCM_BOOL_F) + first_pair = gh_cons (gh_double2scm (0.0), gh_double2scm (0.0)); + else + first_pair = SCM_CDR (first_pair); + + scm_set_car_x (first_pair, gh_double2scm (-dists[0])); + elems[0]->set_elt_property (minimum_space_scm_sym, first_pair); + + + Axis_align_item::do_pre_processing(); -} + Real pre_space = elems[0]->extent (X_AXIS)[LEFT]; + Real spring_len = elems.top ()->extent (X_AXIS)[RIGHT]; + if (SCM_CAR (symbol_list) == extra_space_scm_sym) + { + spring_len += dists.top (); + } + else if (SCM_CAR (symbol_list) == minimum_space_scm_sym) + { + spring_len = spring_len >? dists.top (); + } + + + /* + Hint the spacing engine how much space to put in. + */ + column_l ()->set_elt_property (extra_space_scm_sym, + scm_cons (gh_double2scm (pre_space), + gh_double2scm (spring_len))); +} Break_align_item::Break_align_item () { stacking_dir_ = RIGHT; - threshold_interval_[SMALLER] = 1.5 PT; set_axis (X_AXIS); } @@ -111,12 +167,5 @@ Break_align_item::add_breakable_item (Item *it) center_l_ = hg; } - /* - hg->set_elt_property (ly_symbol("origin"), - scm_cons (gh_str02scm (it->name()), - hg->get_elt_property (ly_symbol ("origin")))); - */ hg->add_element (it); - - } diff --git a/lily/include/abbrev.hh b/lily/include/abbrev.hh deleted file mode 100644 index 960956548a..0000000000 --- a/lily/include/abbrev.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* - abbrev.hh -- declare Abbreviation - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys - - */ - -#ifndef ABBREV_HH -#define ABBREV_HH - -#include "item.hh" -class Abbreviation : public Item { - Stem * stem_l_; -protected: - virtual void do_print () const; - virtual Molecule *do_brew_molecule_p () const; - virtual void do_substitute_element_pointer (Score_element*, Score_element*); -public: - int abbrev_flags_i_; - Abbreviation (); - void set_stem (Stem *); -}; - -#endif /* ABBREV_HH */ - diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 3647c56a26..76a1095bed 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -11,11 +11,11 @@ #include "proto.hh" struct Absolute_dynamic_req; -struct Abbreviation; +struct Stem_tremolo; struct Abbreviation_beam; struct Abbreviation_beam_req; struct Abbreviation_beam_engraver; -struct Abbreviation_req; +struct Tremolo_req; struct Adobe_font_metric; struct Adobe_font_char_metric; struct All_font_metrics; diff --git a/lily/include/ly-symbols.hh b/lily/include/ly-symbols.hh index fafa503ad9..3c35d42e95 100644 --- a/lily/include/ly-symbols.hh +++ b/lily/include/ly-symbols.hh @@ -39,6 +39,7 @@ DECLARE_LY_SYMBOL(interbeam); DECLARE_LY_SYMBOL(interbeam4); DECLARE_LY_SYMBOL(interline); DECLARE_LY_SYMBOL(linewidth); +DECLARE_LY_SYMBOL(minimum_space); DECLARE_LY_SYMBOL(molecule); DECLARE_LY_SYMBOL(notewidth); DECLARE_LY_SYMBOL(non_default); @@ -63,5 +64,6 @@ DECLARE_LY_SYMBOL(volta); DECLARE_LY_SYMBOL(volta_thick); + #endif /* LY_SYMBOLS_HH */ diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 16aee2493e..1ac291c871 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -37,9 +37,9 @@ public: }; -struct Abbreviation_req : public Request { - VIRTUAL_COPY_CONS (Abbreviation_req); - Abbreviation_req (); +struct Tremolo_req : public Request { + VIRTUAL_COPY_CONS (Music); + Tremolo_req (); int type_i_; virtual void do_print () const; }; diff --git a/lily/include/spring-spacer.hh b/lily/include/spring-spacer.hh index 3b89b247e1..19b973edce 100644 --- a/lily/include/spring-spacer.hh +++ b/lily/include/spring-spacer.hh @@ -65,7 +65,7 @@ class Spring_spacer : public Line_spacer { /// make the energy function void make_matrices (Matrix &quad, Vector &lin,Real&) const; - void get_ruling_durations(Array&); + /// generate the LP constraints void make_constraints (Mixed_qp& lp) const; @@ -75,7 +75,7 @@ class Spring_spacer : public Line_spacer { void position_loose_cols (Vector &) const; bool try_initial_solution_and_tell (Vector&)const; Vector try_initial_solution() const; - void calc_idealspacing(); + void set_fixed_cols (Mixed_qp&) const; Score_column* scol_l (int); @@ -89,7 +89,6 @@ public: virtual void solve (Column_x_positions*) const; virtual void lower_bound_solution (Column_x_positions*) const; virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0); - virtual Vector default_solution() const; virtual bool check_constraints (Vector v) const; diff --git a/lily/include/stem-engraver.hh b/lily/include/stem-engraver.hh index ff8a96b08d..1971d53754 100644 --- a/lily/include/stem-engraver.hh +++ b/lily/include/stem-engraver.hh @@ -19,9 +19,9 @@ class Stem_engraver : public Engraver { int default_abbrev_i_; Stem *stem_p_; - Abbreviation *abbrev_p_; + Stem_tremolo *abbrev_p_; Rhythmic_req *rhythmic_req_l_; - Abbreviation_req* abbrev_req_l_; + Tremolo_req* abbrev_req_l_; protected: virtual void do_creation_processing (); virtual void acknowledge_element (Score_element_info); diff --git a/lily/include/stem-tremolo.hh b/lily/include/stem-tremolo.hh new file mode 100644 index 0000000000..617f2ed604 --- /dev/null +++ b/lily/include/stem-tremolo.hh @@ -0,0 +1,31 @@ +/* + stem-tremolo.hh -- declare Abbreviation + + source file of the GNU LilyPond music typesetter + + (c) 1997--1999 Han-Wen Nienhuys + + */ + +#ifndef ABBREV_HH +#define ABBREV_HH + +#include "item.hh" + + +class Stem_tremolo : public Item { + Stem * stem_l_; +protected: + virtual void do_print () const; + virtual Molecule *do_brew_molecule_p () const; + virtual void do_substitute_element_pointer (Score_element*, Score_element*); + virtual Interval do_width () const; + virtual void do_pre_processing (); +public: + int abbrev_flags_i_; + Stem_tremolo (); + void set_stem (Stem *); +}; + +#endif /* ABBREV_HH */ + diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 46d5908d47..2f00874ff2 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -125,7 +125,7 @@ SCM ly_warning (SCM str) { assert (gh_string_p (str)); - warning ("scheme: " + ly_scm2string (str)); + warning ("lily-guile: " + ly_scm2string (str)); return SCM_BOOL_T; } diff --git a/lily/musical-request.cc b/lily/musical-request.cc index cb81818d3d..2716822b03 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -20,13 +20,13 @@ Span_req::do_print () const #endif } -Abbreviation_req::Abbreviation_req () +Tremolo_req::Tremolo_req () { type_i_ = 0; } void -Abbreviation_req::do_print () const +Tremolo_req::do_print () const { #ifndef NPRINT DOUT << "type " << type_i_ << '\n'; diff --git a/lily/parser.yy b/lily/parser.yy index 66e5b059b2..edf2ee9557 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1076,7 +1076,7 @@ verbose_request: $$ = sp_p; } | abbrev_type { - Abbreviation_req* a = new Abbreviation_req; + Tremolo_req* a = new Tremolo_req; a->set_spot (THIS->here_input ()); a->type_i_ = $1; $$ = a; diff --git a/lily/slur.cc b/lily/slur.cc index 5d04e5fae8..580974a888 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -316,28 +316,34 @@ Slur::get_encompass_offset_arr () const int first = 1; int last = encompass_arr_.size () - 1; + + Array notes; + notes.push (Offset (0,0)); + // prebreak if (broken_edge_b (RIGHT)) last++; - + else + { + Encompass_info info (encompass_arr_.top (), dir_, this); + d[Y_AXIS] += info.interstaff_f_; + } + // postbreak if (broken_edge_b (LEFT)) first--; + else + { + Encompass_info info (encompass_arr_[0], dir_, this); + notes[0][Y_AXIS] += info.interstaff_f_; + } - Array notes; - notes.push (Offset (0,0)); - - Real dy =0.0; - for (int i = 0; i < last; i++) + for (int i = first; i < last; i++) { Encompass_info info (encompass_arr_[i], dir_, this); - if (i >= first) - notes.push (info.o_ - left); - else - dy = info.interstaff_f_; + notes.push (info.o_ - left); } - notes[0][Y_AXIS] += dy; notes.push (d); return notes; diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 0f639a3abe..4979c7b5a3 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -35,6 +35,20 @@ Spacing_spanner::scol (int i)const /* cut 'n paste from spring-spacer.cc + + generate springs between columns. + + + TODO + + * Spacing should take optical effects into account + + The algorithm is partly taken from : + + John S. Gourlay. ``Spacing a Line of Music,'' Technical Report + OSU-CISRC-10/87-TR35, Department of Computer and Information + Science, The Ohio State University, 1987. + */ Array Spacing_spanner::do_measure (int col1, int col2) const @@ -57,9 +71,89 @@ Spacing_spanner::do_measure (int col1, int col2) const Array meas_springs; + /* + UGR GUR URG. duplicate code for spacing generation. + */ for (int i= col1; i < col2; i++) { - if (!scol (i)->musical_b() && i+1 < col_count()) + SCM hint = scol (i)->get_elt_property (extra_space_scm_sym); + if (hint != SCM_BOOL_F) + { + hint = SCM_CDR (hint); + + Spring s; + s.item_l_drul_[LEFT] = scol (i); + s.item_l_drul_[RIGHT] = scol (i+1); + Real unbroken_dist = gh_scm2double (SCM_CDR(hint)); + + s.distance_f_ = unbroken_dist; + s.strength_f_ = 2.0; + + + meas_springs.push (s); + + + Item * l = scol(i)->find_prebroken_piece (RIGHT); + Item * r = scol(i+1)->find_prebroken_piece (LEFT); + if (l) + { + Spring s; + s.item_l_drul_[LEFT] = l; + s.item_l_drul_[RIGHT] = scol (i+1); + hint = l->get_elt_property (extra_space_scm_sym); + + if (hint == SCM_BOOL_F) + { + programming_error ("No postbreak breakable spacing hint set."); + s.distance_f_= unbroken_dist; + } + else + s.distance_f_ = gh_scm2double (SCM_CDDR(hint)); + + /* + space around barlines should not stretch very much. + */ + s.strength_f_ = 2.0; + meas_springs.push (s); + } + + if (r) + { + Spring s; + s.item_l_drul_[LEFT] = scol (i); + s.item_l_drul_[RIGHT] = r; + s.distance_f_ = unbroken_dist; + + /* + space around barlines should not stretch very much. + */ + s.strength_f_ = 2.0; + meas_springs.push (s); + } + + if (l&&r) + { + Spring s; + s.item_l_drul_[LEFT] = l; + s.item_l_drul_[RIGHT] = r; + + hint = l->get_elt_property (extra_space_scm_sym); + if (hint == SCM_BOOL_F) + { + programming_error ("No postbreak breakable spacing hint set."); + s.distance_f_= unbroken_dist; + } + else + s.distance_f_ = gh_scm2double (SCM_CDDR(hint)); + + /* + space around barlines should not stretch very much. + */ + s.strength_f_ = 2.0; + meas_springs.push (s); + } + } + else if (!scol (i)->musical_b() && i+1 < col_count()) { Real symbol_distance = scol (i)->extent (X_AXIS)[RIGHT] ; Real durational_distance = 0; diff --git a/lily/spring-spacer.cc b/lily/spring-spacer.cc index 8ef04b7f07..df25b4ee33 100644 --- a/lily/spring-spacer.cc +++ b/lily/spring-spacer.cc @@ -393,26 +393,22 @@ Spring_spacer::add_column (Paper_column *col, bool fixed, Real fixpos) r_rod.other_idx_ = this_rank; cols_[left_idx].rods_[RIGHT].push (r_rod); } -#if 1 - if (experimental_features_global_b) - { - for (int i=0; i < col->spring_arr_drul_[LEFT].size (); i++) - { - Column_spring &cr = col->spring_arr_drul_[LEFT][i]; - int idx = cr.other_l_->rank_i () - cols_[0].pcol_l_->rank_i (); - if (idx < 0) - continue; - if (cols_[idx].pcol_l_ != cr.other_l_) + for (int i=0; i < col->spring_arr_drul_[LEFT].size (); i++) + { + Column_spring &cr = col->spring_arr_drul_[LEFT][i]; + int idx = cr.other_l_->rank_i () - cols_[0].pcol_l_->rank_i (); + if (idx < 0) + continue; + + if (cols_[idx].pcol_l_ != cr.other_l_) continue; - - - connect (idx, this_rank, cr.distance_f_, - cr.strength_f_ / cr.distance_f_); - } + + + connect (idx, this_rank, cr.distance_f_, + cr.strength_f_ / cr.distance_f_); } -#endif - + cols_.push (c); } @@ -429,6 +425,7 @@ Spring_spacer::error_pcol_l_arr() const } return retval; } + /* Ugh. Should junk this. */ @@ -500,8 +497,6 @@ Spring_spacer::connect (int i, int j, Real d, Real h) void Spring_spacer::prepare() { - if (!experimental_features_global_b) - calc_idealspacing(); handle_loose_cols(); print(); } @@ -514,231 +509,3 @@ Spring_spacer::constructor() -/** - get the shortest_playing running note at a time. */ -void -Spring_spacer::get_ruling_durations(Array &context_shortest_arr) -{ - for (int i=0; i < cols_.size(); i++) - { - scol_l (i)->preprocess(); - scol_l (i)->print (); - } - int start_context_i=0; - Moment context_shortest; - context_shortest.set_infinite (1); - context_shortest_arr.set_size(cols_.size()); - - for (int i=0; i < cols_.size(); i++) - { - Score_column * sc = scol_l(i); - - if (sc->breakable_b () || sc->break_status_dir ()) - { - for (int ji=i; ji >= start_context_i; ji--) - context_shortest_arr[ji] = context_shortest; - start_context_i = i; - context_shortest.set_infinite (1); - } - else if (sc->musical_b ()) - context_shortest = context_shortest shortest_starter_mom_; - } - -#ifndef NPRINT - DOUT << "context shortest :[ "; - for (int i=0; i < context_shortest_arr.size(); i++) - { - DOUT << context_shortest_arr[i] << ", "; - } - DOUT << "]\n"; -#endif -} - -/* - TODO: take out the refs to width - - */ -/** - generate springs between columns. - - TODO: This needs rethinking....... - - * Spacing should take optical effects into account - - * Should be decentralised - - The algorithm is taken from : - - John S. Gourlay. ``Spacing a Line of Music,'' Technical Report - OSU-CISRC-10/87-TR35, Department of Computer and Information - Science, The Ohio State University, 1987. - - */ -void -Spring_spacer::calc_idealspacing() -{ - Array context_shortest_arr; - get_ruling_durations(context_shortest_arr); - - Real interline_f = paper_l ()->get_realvar (interline_scm_sym); - - Array ideal_arr; - Array hooke_arr; - for (int i=0; i < cols_.size() - 1; i++){ - ideal_arr.push (-1.0); - hooke_arr.push (1.0); - } - - /* - First do all non-musical columns - */ - for (int i=0; i < cols_.size(); i++) - { - if (!scol_l (i)->musical_b() && i+1 < cols_.size()) - { - Real symbol_distance =cols_[i].width_[RIGHT] + 2 PT; - Real durational_distance = 0; - Moment delta_t = scol_l (i+1)->when_mom () - scol_l (i)->when_mom () ; - - /* - ugh should use shortest_playing distance - */ - if (delta_t) - { - Real k= paper_l()->arithmetic_constant (context_shortest_arr[i]); - durational_distance = paper_l()->length_mom_to_dist (delta_t,k); - } - symbol_distance += -cols_[i+1].width_[LEFT]; - - - ideal_arr[i] = symbol_distance >? durational_distance; - hooke_arr[i] = 1; //2.0; - } - } - - /* - Then musicals - */ - for (int i=0; i < cols_.size(); i++) - { - if (scol_l (i)->musical_b()) - { - Moment shortest_playing_len = scol_l(i)->shortest_playing_mom_; - Moment context_shortest = context_shortest_arr[i]; - if (! shortest_playing_len) - { - warning (_f ("can't find a ruling note at %s", - scol_l (i)->when_mom ().str ())); - shortest_playing_len = 1; - } - if (! context_shortest) - { - warning (_f ("no minimum in measure at %s", - scol_l (i)->when_mom ().str ())); - context_shortest = 1; - } - Moment delta_t = scol_l (i+1)->when_mom () - scol_l (i)->when_mom (); - Real k= paper_l()->arithmetic_constant(context_shortest); - Real dist = paper_l()->length_mom_to_dist (shortest_playing_len, k); - dist *= (double)(delta_t / shortest_playing_len); - - /* - According to [Ross] and [Wanske], and from what i've seen: - - * whitespace at the begin of the bar should be fixed at - (about) one interline. - - [Ross]: - when spacing gets real tight, a smaller fixed value may be - used, so that there are two discrete amounts of whitespace - possible at the begin of a bar; but this is not implemented - right now. - - * whitespace at the end of the bar is the normal amount of - "hinterfleish" that would have been used, had there been - yet another note in the bar. - - [Ross]: - some editors argue that the bar line should not take any - space, not to hinder the flow of music spaced around a bar - line. - - [Ross] and [Wanske] do not suggest this, however. Further, - it introduces some spacing problems and I think that it is ugly - too. - - [jcn] - */ - - /* - first musical column of bar - */ - if (i && !scol_l (i - 1)->musical_b ()) - { - // one interline minimum at start of bar - - // cols_[i].width_[RIGHT] += interline_f; - cols_[i].width_[RIGHT] = cols_[i].width_[RIGHT] >? interline_f; - - // should adjust dist too? - ideal_arr[i-1] = ideal_arr[i-1] >? (2 * interline_f); - } - - /* - last musical column of bar - */ - if (i + 1 < cols_.size () && !scol_l(i+1)->musical_b ()) - { - // two interline minimum ok for last column? - dist = dist >? 2 * interline_f; - - // set minimum rod - /* - urg: simply *adding* an interline leaves big gaps at - end of measure in star-spangled-banner (after lyrics - at eom). - - cols_[i].width_[RIGHT] += interline_f; // before - - having a minimum of one interline solves this problem - in most (but not all??) cases. - - for music without lyrics (esp. when set very tightly), - adding an interline looks good: probably because this - hides a bug that allows the last note's "hinterfleish" - to be removed (e.g., see wtk1-fugue2: that's ugly now). - -- jcn - */ - - cols_[i].width_[RIGHT] = cols_[i].width_[RIGHT] >? 2 * interline_f; - } - - // ugh, do we need this? - if (i < cols_.size () - 1 && !scol_l (i + 1)->musical_b ()) - { - Real minimum = -cols_[i + 1].width_[LEFT] + cols_[i].width_[RIGHT] - + interline_f / 2; - dist = dist >? minimum; - } - ideal_arr[i] = dist; - } - } - - /* - shorter distances should stretch less. - - (and how bout - - hooke[i] = 2 * max_ideal_space - ideal[i] - - ?) - */ - for (int i=0; i < ideal_arr.size(); i++) - hooke_arr[i] = 1/ideal_arr[i]; - - for (int i=0; i < ideal_arr.size(); i++) - { - assert (ideal_arr[i] >=0 && hooke_arr[i] >=0); - connect (i, i+1, ideal_arr[i], hooke_arr[i]); - } -} diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index aa3aab9628..1a2284783e 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -12,7 +12,7 @@ #include "musical-request.hh" #include "duration-convert.hh" #include "misc.hh" -#include "abbrev.hh" +#include "stem-tremolo.hh" #include "staff-info.hh" #include "translator-group.hh" @@ -61,7 +61,7 @@ Stem_engraver::acknowledge_element(Score_element_info i) if (t) { - abbrev_p_ = new Abbreviation; + abbrev_p_ = new Stem_tremolo; announce_element (Score_element_info (abbrev_p_, abbrev_req_l_)); abbrev_p_->abbrev_flags_i_ =intlog2 (t) - (duration_log>? 2); } @@ -75,7 +75,7 @@ Stem_engraver::acknowledge_element(Score_element_info i) { r->warning (_f("Adding note head to incompatible stem (type = %d)", 1 << stem_p_->flag_i_)); } - + stem_p_->add_head (h); } } @@ -123,7 +123,7 @@ Stem_engraver::do_pre_move_processing() bool Stem_engraver::do_try_music (Music* r) { - if (Abbreviation_req* a = dynamic_cast (r)) + if (Tremolo_req* a = dynamic_cast (r)) { abbrev_req_l_ = a; return true; diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc new file mode 100644 index 0000000000..6a0e947362 --- /dev/null +++ b/lily/stem-tremolo.cc @@ -0,0 +1,135 @@ +/* + abbrev.cc -- implement Stem_tremolo + + source file of the GNU LilyPond music typesetter + + (c) 1997--1999 Han-Wen Nienhuys + + */ + +#include "stem-tremolo.hh" +#include "debug.hh" +#include "beam.hh" +#include "paper-def.hh" +#include "lookup.hh" +#include "stem.hh" +#include "offset.hh" + +Stem_tremolo::Stem_tremolo () +{ + stem_l_ = 0; + abbrev_flags_i_ = 1; +} + +void +Stem_tremolo::do_print () const +{ + DOUT << "abbrev_flags_i_ " << abbrev_flags_i_; +} + +Interval +Stem_tremolo::do_width () const +{ + Real space = stem_l_->staff_line_leading_f (); + return Interval (-space, space); +} + +void +Stem_tremolo::do_pre_processing () +{ +} + +Molecule* +Stem_tremolo::do_brew_molecule_p () const +{ + int mult =0; + if (Beam * b = stem_l_->beam_l_) + { + Stem_info i = b->get_stem_info (stem_l_); + mult = i.mult_i_; + } + + Real interbeam_f = paper_l ()->interbeam_f (mult); + Real w = 1.5 * lookup_l ()->notehead (2, "").dim_[X_AXIS].length (); + Real space = stem_l_->staff_line_leading_f (); + Real internote_f = space/2; + + Real beam_f = paper_l ()->beam_thickness_f (); + + int beams_i = 0; + Real slope_f = internote_f / 4 / internote_f; // HUH? + + if (stem_l_ && stem_l_->beam_l_) { + slope_f = stem_l_->beam_l_->slope_f_; + // ugh, rather calc from Stem_tremolo_req + beams_i = stem_l_->beams_i_drul_[RIGHT] >? stem_l_->beams_i_drul_[LEFT]; + } + Real sl = slope_f * internote_f; + + Molecule a (lookup_l ()->beam (sl, w, beam_f)); + a.translate (Offset (-w/2, w / 2 * slope_f)); + + Molecule *beams= new Molecule; + for (int i = 0; i < abbrev_flags_i_; i++) + { + Molecule b (a); + b.translate_axis (interbeam_f * i, Y_AXIS); + beams->add_molecule (b); + } + beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS); + + if (stem_l_) + { + if (stem_l_->beam_l_) + { + beams->translate (Offset(stem_l_->hpos_f () - hpos_f (), + stem_l_->stem_end_f () * internote_f - + stem_l_->beam_l_->dir_ * beams_i * interbeam_f)); + } + else + { + /* + Beams should intersect one beamthickness below staff end + */ + Real dy = - beams->extent ()[Y_AXIS].length () / 2 * stem_l_->dir_; + + /* + uhg. Should use relative coords and placement + */ + Real whole_note_correction = (stem_l_ && stem_l_->invisible_b( )) + ? -stem_l_->get_dir () * stem_l_->note_delta_f ()/2 + : 0.0; + + /* + UGH. Internote fudging. + */ + dy /= internote_f; + dy += stem_l_->stem_end_f (); + dy *= internote_f; + beams->translate (Offset(stem_l_->hpos_f () - hpos_f ()+ + whole_note_correction, dy)); + } + + /* + there used to be half a page of code that was long commented out. + Removed in 1.1.35 + */ + } + + return beams; +} + +void +Stem_tremolo::do_substitute_element_pointer (Score_element*o, Score_element*n) +{ + if (stem_l_ == o) + stem_l_ = dynamic_cast (n); +} + + +void +Stem_tremolo::set_stem (Stem *s) +{ + stem_l_ = s; + add_dependency (s); +} diff --git a/make/out/lelievijver.lsm b/make/out/lelievijver.lsm index a4bcc81feb..0a7d845f6f 100644 --- a/make/out/lelievijver.lsm +++ b/make/out/lelievijver.lsm @@ -1,15 +1,15 @@ Begin3 Titel: LilyPond -Versie: 1.1.47 -Inschrijf datum: 09JUN99 +Versie: 1.1.48 +Inschrijf datum: 17JUN99 Beschrijving: @FLAPTEKST@ Trefwoorden: muziek typezetten midi notatie Auteur: hanwen@stack.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Onderhouden door: hanwen@cs.ruu.nl (Han-Wen Nienhuys) Voornaamste plek: sunsite.unc.edu /pub/Linux/apps - 770k lilypond-1.1.47.tar.gz + 770k lilypond-1.1.48.tar.gz Oorspronkelijke plek: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 770k lilypond-1.1.47.tar.gz + 770k lilypond-1.1.48.tar.gz Copi-eer voorwaarden: GPL End diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index d67fbc0822..f4dc825184 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 1.1.47 -Entered-date: 09JUN99 +Version: 1.1.48 +Entered-date: 17JUN99 Description: LilyPond is the GNU Project music typesetter. This program can print beautiful sheet music from a music definition file. It can also play @@ -14,8 +14,8 @@ Author: hanwen@cs.ruu.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 - 770k lilypond-1.1.47.tar.gz + 770k lilypond-1.1.48.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 770k lilypond-1.1.47.tar.gz + 770k lilypond-1.1.48.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index b47a80facf..24649e39a4 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.1.47 +Version: 1.1.48 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.47.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.48.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys diff --git a/scm/lily.scm b/scm/lily.scm index 70c06dc82e..d5f9845de1 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -82,33 +82,46 @@ ;; Spacing constants for prefatory matter. ;; -;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134 +;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147 ;; ;; + (define space-alist '( - (("Clef_item" "Key_item") . 2.5) - (("Key_item" "Time_signature") . 2.5) - (("Clef_item" "Time_signature") . 2.75) - (("Staff_bar" "Clef_item") . 1.0) - (("Clef_item" "Staff_bar") . 3.7) - (("Time_signature" "Staff_bar") . 2.0) - (("Key_item" "Staff_bar") . 2.5) - (("Span_bar" "Clef_item") . 1.0) - (("Clef_item" "Span_bar") . 3.7) - (("Time_signature" "Span_bar") . 2.0) - (("Key_item" "Span_bar") . 2.5) - (("Staff_bar" "Time_signature") . 1.0) + (("" "Clef_item") . (minimum_space 1.0)) + (("" "Staff_bar") . (minimum_space 0.0)) + (("" "Clef_item") . (minimum_space 1.0)) + (("" "Key_item") . (minimum_space 0.5)) + (("" "Span_bar") . (extra_space 0.0)) + (("" "Time_signature") . (extra_space 0.0)) + (("" "begin-of-note") . (minimum_space 1.5)) + (("Clef_item" "Key_item") . (minimum_space 3.5)) + (("Key_item" "Time_signature") . (extra_space 2.0)) + (("Clef_item" "Time_signature") . (minimum_space 3.5)) + (("Staff_bar" "Clef_item") . (minimum_space 1.0)) + (("Clef_item" "Staff_bar") . (minimum_space 3.7)) + (("Time_signature" "Staff_bar") . (minimum_space 2.0)) + (("Key_item" "Staff_bar") . (extra_space 1.0)) + (("Span_bar" "Clef_item") . (extra_space 1.0)) + (("Clef_item" "Span_bar") . (minimum_space 3.7)) + (("Time_signature" "Span_bar") . (minimum_space 2.0)) + (("Key_item" "Span_bar") . (minimum_space 2.5)) + (("Staff_bar" "Time_signature") . (minimum_space 1.0)) + (("Time_signature" "begin-of-note") . (extra_space 1.0)) ; Huh? see twinkle.ly + (("Key_item" "begin-of-note") . (extra_space 3.0)) + (("Staff_bar" "begin-of-note") . (extra_space 1.0)) + (("Clef_item" "begin-of-note") . (minimum_space 5.0)) ) +) + - ) (define (break-align-spacer this next) (let ((entry (assoc `(,this ,next) space-alist))) (if entry (cdr entry) - (begin (ly-warn (string-append "Unknown spacing pair " this ", " next)) - 0.0)))) + (begin (ly-warn (string-append "Unknown spacing pair `" this "', `" next "'")) + '(minimum_space 0.0)))))