From: Jan Nieuwenhuizen Date: Fri, 8 Jan 1999 17:21:21 +0000 (+0100) Subject: patch::: 1.1.19.jcn2: Re: niew trei X-Git-Tag: release/1.1.20~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=843f36c1b3100c3d21f1be471537b93c4f8eabae;p=lilypond.git patch::: 1.1.19.jcn2: Re: niew trei pl 19.jcn2 - multi-measure-rest is now spanner SkipBars=0 is broken pl 19.jcn1 - hmm, almost centered whole-bar rests -- NOT --- diff --git a/NEWS b/NEWS index ed3b41e22c..a7003e2ef9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +pl 19.jcn2 + - multi-measure-rest is now spanner SkipBars=0 is broken + +pl 19.jcn1 + - hmm, almost centered whole-bar rests -- NOT + pl 18.jcn5 - bf: beamtrend - bf: vv-duet diff --git a/TODO b/TODO index 8fc5b1d577..2b1245e000 100644 --- a/TODO +++ b/TODO @@ -30,6 +30,9 @@ grep for TODO and ugh/ugr/urg * update mi2mu for lilypond 1.1 BUGS: + * collisions/voices \voiceone \voicetwo are broken; see + input/praeludium-fuga-E.ly + mutopia/J.S.Bach/wtk1-fugue2.ly * fix: standchen. @@ -573,7 +576,9 @@ SMALLISH PROJECTS * handle EOF graciously in error messages. - * centered whole rest + * really centered whole rest + + * centered multi-bar-rest * declare notenametab? diff --git a/VERSION b/VERSION index 985f62eacd..80ecd75d52 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=19 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=jcn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/init/engraver.ly b/init/engraver.ly index 11f0884081..6ad41f5600 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -15,6 +15,7 @@ StaffContext=\translator { %} % \type "Hara_kiri_line_group_engraver"; + \consists "Multi_measure_rest_engraver"; \consists "Repeat_engraver"; \consists "Bar_engraver"; \consists "Clef_engraver"; @@ -97,7 +98,7 @@ VoiceContext = \translator { \consists "Stem_engraver"; \consists "Beam_engraver"; \consists "Abbreviation_beam_engraver"; - \consists "Multi_measure_rest_engraver"; +% \consists "Multi_measure_rest_engraver"; % ugh. Order matters here. \consists "Text_engraver"; diff --git a/lily/include/multi-measure-rest-engraver.hh b/lily/include/multi-measure-rest-engraver.hh index 4b54fa417c..b9d47c9158 100644 --- a/lily/include/multi-measure-rest-engraver.hh +++ b/lily/include/multi-measure-rest-engraver.hh @@ -22,18 +22,21 @@ public: 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: - Moment rest_req_stop_mom_; - Moment rest_item_creation_mom_; - Moment req_start_mom_; + Moment rest_stop_mom_; +// Moment rest_item_creation_mom_; + Moment rest_start_mom_; int start_measure_i_; Multi_measure_rest_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/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index 8be84d3002..ed9c9769fd 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -10,19 +10,25 @@ #ifndef MULTI_MEASURE_REST_HH #define MULTI_MEASURE_REST_HH -#include "item.hh" +#include "spanner.hh" -class Multi_measure_rest : public Item +class Multi_measure_rest : public Spanner { public: Multi_measure_rest (); int measures_i_; + void add_column (Bar*); - + Link_array column_arr_; protected: - virtual void do_print () const; virtual Molecule *do_brew_molecule_p () const; + VIRTUAL_COPY_CONS (Score_element); + + virtual void do_add_processing (); + virtual void do_post_processing (); + virtual void do_print () const; + virtual void do_substitute_dependency (Score_element*,Score_element*); }; #endif /* MULTI_MEASURE_REST_HH */ diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index dc3f53961a..736712abdf 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -42,7 +42,7 @@ public: Moment when() { return when_; } - Score_column (Moment when, bool musical_b = false); + Score_column (Moment when, bool musical_b=false); void add_duration (Moment); void preprocess(); bool musical_b() { return musical_b_; } diff --git a/lily/include/volta-spanner.hh b/lily/include/volta-spanner.hh index 92dc770812..cf8c1b32d5 100644 --- a/lily/include/volta-spanner.hh +++ b/lily/include/volta-spanner.hh @@ -9,11 +9,11 @@ #include "text-def.hh" #include "pointer.hh" -#include "directional-spanner.hh" +#include "spanner.hh" /** Volta bracket with number */ -class Volta_spanner : public Directional_spanner +class Volta_spanner : public Spanner { public: Volta_spanner (); @@ -29,7 +29,7 @@ public: protected: virtual Molecule* do_brew_molecule_p () const; - VIRTUAL_COPY_CONS(Score_element); + VIRTUAL_COPY_CONS (Score_element); virtual void do_add_processing (); virtual void do_post_processing (); diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 4bfa5be725..f1df3cf2e3 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -11,7 +11,12 @@ #include "multi-measure-rest-engraver.hh" #include "score-column.hh" #include "time-description.hh" -#include "p-score.hh" +//#include "paper-score.hh" +//#include "p-score.hh" +//#include "paper-def.hh" +//#include "main.hh" +//#include "global-translator.hh" +#include "bar.hh" ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver); @@ -19,11 +24,24 @@ ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver); Multi_measure_rest_engraver::Multi_measure_rest_engraver () { start_measure_i_ = 0; - rest_item_creation_mom_ = rest_req_stop_mom_ =0; + rest_stop_mom_ =0; + // rest_item_creation_mom_ = 0; multi_measure_req_l_ = 0; mmrest_p_ = 0; } +void +Multi_measure_rest_engraver::acknowledge_element (Score_element_info i) +{ + if (Bar *c = dynamic_cast (i.elem_l_)) + { + if (mmrest_p_) + mmrest_p_->add_column (c); + if (lastrest_p_) + lastrest_p_->add_column (c); + } +} + bool Multi_measure_rest_engraver::do_try_music (Music* req_l) { @@ -31,13 +49,13 @@ Multi_measure_rest_engraver::do_try_music (Music* req_l) { if (multi_measure_req_l_) if (!multi_measure_req_l_->equal_b (mr) - || req_start_mom_ != now_moment ()) + || rest_start_mom_ != now_moment ()) return false; multi_measure_req_l_ = mr; - req_start_mom_ = now_moment (); + rest_start_mom_ = now_moment (); - rest_req_stop_mom_ = req_start_mom_ + multi_measure_req_l_->duration_.length (); + rest_stop_mom_ = rest_start_mom_ + multi_measure_req_l_->duration_.length (); return true; } return false; @@ -50,15 +68,7 @@ Multi_measure_rest_engraver::do_process_requests () { Time_description const *time = get_staff_info().time_C_; mmrest_p_ = new Multi_measure_rest; - rest_item_creation_mom_ = time->when_mom (); - - rest_item_creation_mom_ += time->whole_per_measure_ / Moment (2); -#if 0 - // core dump because of missing column? - mmrest_p_->pscore_l_->add_column (new Score_column (rest_item_creation_mom_)); - mmrest_p_->pscore_l_->add_column (new Score_column (rest_item_creation_mom_, true)); -#endif - + // rest_item_creation_mom_ = time->when_mom (); announce_element (Score_element_info (mmrest_p_, multi_measure_req_l_)); start_measure_i_ = time->bars_i_; } @@ -68,10 +78,18 @@ void Multi_measure_rest_engraver::do_pre_move_processing () { Moment now (now_moment ()); - if (mmrest_p_ && rest_item_creation_mom_ == now) + //urg lily dumps core if i want to let her print all (SkipBars=0) rests... +#if 0 + if (mmrest_p_ && (now >= rest_start_mom_) && (mmrest_p_->column_arr_.size () >= 2)) { typeset_element (mmrest_p_); } +#endif + if (lastrest_p_) + { + typeset_element (lastrest_p_); + lastrest_p_ = 0; + } } void @@ -79,12 +97,24 @@ Multi_measure_rest_engraver::do_post_move_processing () { Time_description const *time = get_staff_info().time_C_; Moment now (now_moment ()); - if (rest_req_stop_mom_ <= now) - multi_measure_req_l_ = 0; - if (mmrest_p_ && (!time->whole_in_measure_ || !multi_measure_req_l_)) + /* + when our time's up, calculate the number of bars rest and + make way for new request + however, linger around a bit to catch this last column when + its announced + */ + if (mmrest_p_ && (now >= rest_stop_mom_)) //&& (!time->whole_in_measure_)) { - assert (rest_item_creation_mom_ < now); + lastrest_p_ = mmrest_p_; + lastrest_p_->measures_i_ = time->bars_i_ - start_measure_i_; + //urg lily dumps core if i want to let her print all (SkipBars=0) rests... +#if 0 + if (lastrest_p_->column_arr_.size () >= 2) + lastrest_p_ = 0; +#endif + multi_measure_req_l_ = 0; mmrest_p_ = 0; } } + diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 6bb3a5a6e4..77a49ca7bb 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -3,13 +3,15 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Jan Nieuwenhuizen + (c) 1998, 1999 Jan Nieuwenhuizen */ #include "multi-measure-rest.hh" #include "debug.hh" #include "paper-def.hh" +#include "p-col.hh" // urg +#include "bar.hh" #include "lookup.hh" #include "rest.hh" #include "script.hh" @@ -33,20 +35,26 @@ Molecule* Multi_measure_rest::do_brew_molecule_p () const { /* - [TODO] 3 - * make real multi-measure rest symbol: |---| - * make two,four,eight-measure-rest symbols + [TODO] 17 + * variable-sized multi-measure rest symbol: |====| ?? + * build 3, 5, 6, 7, 8 symbols (how far, property?) + from whole, brevis and longa rests */ + Molecule* mol_p = new Molecule; + if (!column_arr_.size ()) + return mol_p; + Atom s; if (measures_i_ == 1 || measures_i_ == 2 || measures_i_ == 4) { s = (lookup_l ()->rest (- intlog2(measures_i_), 0)); + s.translate_axis (-s.extent ()[X_AXIS].length () / 2, X_AXIS); } else { s = (lookup_l ()->rest (-4, 0)); } - Molecule* mol_p = new Molecule ( Atom (s)); + mol_p->add_atom (s); Real interline_f = paper ()->interline_f (); if (measures_i_ == 1) { @@ -67,3 +75,34 @@ Multi_measure_rest::do_brew_molecule_p () const return mol_p; } +void +Multi_measure_rest::do_add_processing () +{ + if (column_arr_.size ()) + { + set_bounds (LEFT, column_arr_[0 >? column_arr_.size () - 2]); + set_bounds (RIGHT, column_arr_[column_arr_.size () - 1]); + } +} + +void +Multi_measure_rest::do_post_processing () +{ + if (column_arr_.size ()) + translate_axis (extent (X_AXIS).length () / 2, X_AXIS); +} + +void +Multi_measure_rest::do_substitute_dependency (Score_element* o, Score_element* n) +{ + if (Bar* c = dynamic_cast (o)) + column_arr_.substitute (c, dynamic_cast (n)); +} + +void +Multi_measure_rest::add_column (Bar* c) +{ + column_arr_.push (c); + add_dependency (c); +} + diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 783e36399b..e1ab3ab2fb 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -16,7 +16,6 @@ #include "score-column.hh" #include "command-request.hh" #include "paper-def.hh" -#include "p-score.hh" diff --git a/lily/stem-info.cc b/lily/stem-info.cc index 20f16ea05c..42374eb12b 100644 --- a/lily/stem-info.cc +++ b/lily/stem-info.cc @@ -93,7 +93,7 @@ Stem_info::Stem_info (Stem const *s) if (((int)s->chord_start_f ()) && (s->dir_ != s->get_default_dir ())) { idealy_f_ -= shorten_f; - miny_f_ = miny_f_ add_moment_to_process (time_.next_bar_moment ()); } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index a5b6f629a0..7513146388 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -20,14 +20,8 @@ #include "stem.hh" #include "text-def.hh" -/* - Hmm, should probably make generic Bracket_spanner, - or and derive Plet and volta spanner from that. - */ - Volta_spanner::Volta_spanner () { - dir_ = UP; last_b_ = false; number_p_.set_p (new Text_def); number_p_->align_dir_ = LEFT; @@ -40,38 +34,38 @@ Volta_spanner::do_brew_molecule_p () const { Molecule* mol_p = new Molecule; - if (column_arr_.size ()) - { - Real internote_f = paper ()->internote_f (); - Real dx = internote_f; - Real w = extent (X_AXIS).length () - 2 * dx; - Atom volta (lookup_l ()->volta (w, last_b_)); - Real h = volta.dim_.y ().length (); - Atom num (number_p_->get_atom (paper (), LEFT)); - Atom dot (dot_p_->get_atom (paper (), LEFT)); - Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_] > - column_arr_[0]->extent (Y_AXIS) [dir_]; - dy += 2 * h; + if (!column_arr_.size ()) + return mol_p; - /* - UGH. Must use extent ()[dir_] - */ - for (int i = 0; i < note_column_arr_.size (); i++) - dy = dy >? note_column_arr_[i]->extent (Y_AXIS).max (); - dy -= h; + Real internote_f = paper ()->internote_f (); + Real dx = internote_f; + Real w = extent (X_AXIS).length () - 2 * dx; + Atom volta (lookup_l ()->volta (w, last_b_)); + Real h = volta.dim_.y ().length (); + Atom num (number_p_->get_atom (paper (), LEFT)); + Atom dot (dot_p_->get_atom (paper (), LEFT)); + Real dy = column_arr_.top ()->extent (Y_AXIS) [UP] > + column_arr_[0]->extent (Y_AXIS) [UP]; + dy += 2 * h; - Real gap = num.dim_.x ().length () / 2; - Offset off (num.dim_.x ().length () + gap, - (h - num.dim_.y ().length ()) / internote_f - gap); - num.translate (off); - Real dotheight = dot.dim_.y ().length () / 7; - off -= Offset (0, dotheight); - dot.translate (off); - mol_p->add_atom (volta); - mol_p->add_atom (num); - mol_p->add_atom (dot); - mol_p->translate (Offset (dx, dy)); - } + /* + UGH. Must use extent ()[dir_] + */ + for (int i = 0; i < note_column_arr_.size (); i++) + dy = dy >? note_column_arr_[i]->extent (Y_AXIS).max (); + dy -= h; + + Real gap = num.dim_.x ().length () / 2; + Offset off (num.dim_.x ().length () + gap, + (h - num.dim_.y ().length ()) / internote_f - gap); + num.translate (off); + Real dotheight = dot.dim_.y ().length () / 7; + off -= Offset (0, dotheight); + dot.translate (off); + mol_p->add_atom (volta); + mol_p->add_atom (num); + mol_p->add_atom (dot); + mol_p->translate (Offset (dx, dy)); return mol_p; } @@ -91,8 +85,8 @@ Volta_spanner::do_add_processing () void Volta_spanner::do_post_processing () { - if (column_arr_.size()) - translate_axis (column_arr_[0]->extent (Y_AXIS)[dir_], Y_AXIS); + if (column_arr_.size()) + translate_axis (column_arr_[0]->extent (Y_AXIS)[UP], Y_AXIS); } void diff --git a/mutopia/J.S.Bach/wtk1-fugue2.ly b/mutopia/J.S.Bach/wtk1-fugue2.ly index 9aeb030879..7d2239f968 100644 --- a/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -77,8 +77,8 @@ dux = \notes \relative c''{ comes = \notes \relative c'' { \voiceone - r1 | - r1 | + R1 | + R1 | r8 [g'16 fis] [g8 c,] [es g16 fis] [g8 a] | [d,8 g16 fis] [g8 a] [c,16 d] es4 [d16 c] | %%5 @@ -120,13 +120,13 @@ comes = \notes \relative c'' { bassdux = \notes \relative c' { \clef bass; - r1 | - r | - r | - r | + R1 | + R | + R | + R | %%5 - r | - r1 | + R | + R1 | r8 [c16 b] [c8 g] [as c16 b] [c8 d] | [g, c16 b] [c8 d] [f,16 g] as4 [g16 f] | [es c' b a] [g f es d] [c d es d] [c bes! as! g] |