From: Jan Nieuwenhuizen Date: Fri, 12 Sep 1997 11:25:41 +0000 (+0200) Subject: patch::: 0.1.13.jcn2: abbrev pats X-Git-Tag: release/0.1.14~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ecbaaf79efe3393c133dbfa976f6fd7deacecd9a;p=lilypond.git patch::: 0.1.13.jcn2: abbrev pats pl 13.jcn2 - gaps on abbrev-beams - bf: stem-info - bf: last abbrev - bf: stem: do_width - bf: removed rest-column.hh --- diff --git a/NEWS b/NEWS index 3fa6da35ec..739797cd39 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +pl 13.jcn2 + - gaps on abbrev-beams + - bf: stem-info + - bf: last abbrev + - bf: stem: do_width + - bf: removed rest-column.hh pl 13 - big Rest/notehead rewrite: diff --git a/VERSION b/VERSION index ca27f3dfd2..1ac534dd99 100644 --- a/VERSION +++ b/VERSION @@ -3,4 +3,4 @@ TOPLEVEL_MINOR_VERSION = 1 TOPLEVEL_PATCH_LEVEL = 13 # use to send patches, always empty for released version: -TOPLEVEL_MY_PATCH_LEVEL = .jcn1 +TOPLEVEL_MY_PATCH_LEVEL = .jcn2 diff --git a/input/abbrev.ly b/input/abbrev.ly index b25a386f03..4c91009e0e 100644 --- a/input/abbrev.ly +++ b/input/abbrev.ly @@ -20,19 +20,22 @@ EndMudelaHeader 'a1 'a1:32 'c4:8 c' 'c4:16 c' - [ 'c8:16 'c 'c 'c ] [ a a a a ] - [ 'c 'f 'b e ] - [ 'c16:32 'c 'c 'c ] [ a16:32 a a a ] +% [ 'c8:16 'c 'c 'c ] [ a a a a ] +% [ 'c 'f 'b e ] +% [ 'c16:32 'c 'c 'c ] [ a16:32 a a a ] %% % there's still some hairy beam bugfixing todo %% [ c'8:16 g d 'a ] %% [ c'16:32 g d 'a ] %% [ 'c8:32 'f 'b e ] - [:16 c4 e] + [:32 c16 e] + [:32 c16 e] + [:16 c8 e] [:16 e4 g] [:16 e2 g] [:16 e1 g] } \paper{ + gourlay_maxmeasures =5.; } % oeps \midi{ } diff --git a/input/wtk1-fugue1.ly b/input/wtk1-fugue1.ly index d1c21d8aeb..53764efbd0 100644 --- a/input/wtk1-fugue1.ly +++ b/input/wtk1-fugue1.ly @@ -47,12 +47,12 @@ tenor = \stemboth [c'. d'32 c'] [b8 e'] [a d'] ~ [d'16 e' d' c'] | [b8 g' cis' d'] [e' cis' d' e' ] | - \stemdown a8 r8 r e [fis g] \stemboth[a. b32 a] | + \stemdown a8 r8 r e [fis g] \stemboth [a. b32 a] | %% 20 - [g8 c' fis b] ~ [b16 c' b a] \stemdown [g fis e d] \stemboth| + [g8 c' fis b] ~ [b16 c' b a] \stemdown [g fis e d] \stemboth | e4 \stemdown d ~ [d16 a g f!] [e g f! a] | g4 ~ [g16 a bes8] c'4 [d'8 g] | - \stembothg4. f8 ~ [f e] d4 | + \stemboth g4. f8 ~ [f e] d4 | \stemdown e8 a4 g8 ~ [g8 f g a] | %% 25 [bes8. c'32 b] [a8 d'] [g c'] ~ [c'16 d' c' bes] | diff --git a/lily/abbreviation-beam-engraver.cc b/lily/abbreviation-beam-engraver.cc index 89952d24fa..59c70b28b7 100644 --- a/lily/abbreviation-beam-engraver.cc +++ b/lily/abbreviation-beam-engraver.cc @@ -79,7 +79,6 @@ Abbreviation_beam_engraver::do_removal_processing () } } - void Abbreviation_beam_engraver::acknowledge_element (Score_elem_info i) { @@ -94,5 +93,9 @@ Abbreviation_beam_engraver::acknowledge_element (Score_elem_info i) s->beams_left_i_ = s->flag_i_; else s->beams_right_i_ = s->flag_i_; + + if (s->type_i () != 1) // no abbrev gaps on half note + s->beam_gap_i_ = s->flag_i_ - ((s->type_i () >? 2) - 2); + abeam_p_->add (s); } diff --git a/lily/beam.cc b/lily/beam.cc index 02dde804a0..a696c646ce 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -18,6 +18,7 @@ #include "proto.hh" #include "dimen.hh" #include "beam.hh" +#include "abbreviation-beam.hh" #include "misc.hh" #include "debug.hh" #include "symbol.hh" @@ -46,9 +47,9 @@ Beam::add (Stem*s) s->beam_l_ = this; if (!spanned_drul_[LEFT]) - set_bounds(LEFT,s); + set_bounds (LEFT,s); else - set_bounds(RIGHT,s); + set_bounds (RIGHT,s); } Molecule* @@ -302,7 +303,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const { int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ; int lwholebeams= here->beams_left_i_ beams_right_i_ ; - Real w = (here->hpos_f() - prev->hpos_f ())/4; + Real w = (here->hpos_f () - prev->hpos_f ())/4; Symbol dummy; Atom a (dummy); if (lhalfs) // generates warnings if not @@ -323,12 +324,28 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const Real w = next->hpos_f() - here->hpos_f (); Atom a = paper()->lookup_l ()->beam (sl, w + stemdx); - + int j = 0; + Real gap_f = 0; + if (here->beam_gap_i_) + { + int nogap = rwholebeams - here->beam_gap_i_; + for (; j < nogap; j++) + { + Atom b (a); + b.translate (-dir_ * dy * j, Y_AXIS); + rightbeams.add (b); + } + // TODO: notehead widths differ for different types + gap_f = paper()->note_width () / 2; + w -= 2 * gap_f; + a = paper()->lookup_l ()->beam (sl, w + stemdx); + } + for (; j < rwholebeams; j++) { Atom b (a); - b.translate (-dir_ * dy * j, Y_AXIS); + b.translate (Offset (gap_f, -dir_ * dy * j)); rightbeams.add (b); } diff --git a/lily/include/beam.hh b/lily/include/beam.hh index c1b1b971b9..5d605937c1 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -33,7 +33,7 @@ public: SCORE_ELEM_CLONE(Beam); protected: - Interval do_width() const; + virtual Interval do_width() const; Offset center() const; void set_default_dir(); virtual void do_pre_processing(); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index a492a3d4d8..9787323350 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -33,7 +33,6 @@ class Stem : public Item { Real stem_bottom_f_, stem_top_f_; - /// needed for determining direction/length int staff_size_i_; @@ -55,6 +54,9 @@ public: /// abbrev flag? + count int abbrev_flag_i_; + /// how many abbrev beam don't reach stem? + int beam_gap_i_; + /// flagtype? 4 none, 8 8th flag, 0 = beam. int flag_i_; @@ -79,7 +81,9 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Real hpos_f() const; - + + int type_i () const; + void do_print() const; void set_stemend (Real); Direction get_default_dir(); diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index d03e29ffec..7cbcd86bc3 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -216,7 +216,7 @@ Chord * My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p) { Chord*v = new Request_chord; - v->set_spot (here_input()); + v->set_spot (here_input ()); v->add (rq); @@ -227,8 +227,14 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p) assert (!duration_p->plet_b ()); duration_p->set_plet (1, 2); } + if (default_abbrev_type_i_) + { + Abbreviation_req* a = new Abbreviation_req; + a->type_i_ = default_abbrev_type_i_; + v->add (a); + } rq->set_duration (*duration_p); - rq->set_spot (here_input()); + rq->set_spot (here_input ()); delete duration_p ; return v; } diff --git a/lily/rest-collision-grav.cc b/lily/rest-collision-grav.cc index 7a41c7ab45..4aa0607aca 100644 --- a/lily/rest-collision-grav.cc +++ b/lily/rest-collision-grav.cc @@ -10,7 +10,6 @@ #include "rest-collision.hh" #include "rest-collision-grav.hh" #include "collision.hh" -#include "rest-column.hh" #include "note-column.hh" diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 54392d5585..cf4a898831 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -8,7 +8,6 @@ #include "debug.hh" #include "rest-collision.hh" -#include "rest-column.hh" #include "note-column.hh" #include "stem.hh" #include "note-head.hh" diff --git a/lily/stem-info.cc b/lily/stem-info.cc index 5e446b665e..a3287ce55c 100644 --- a/lily/stem-info.cc +++ b/lily/stem-info.cc @@ -25,7 +25,7 @@ Stem_info::Stem_info (Stem const *s) { x = s->hpos_f(); dir_ = s->dir_; - beams_i_ = intlog2(s->flag_i_) - 2; + beams_i_ = 0 >? (abs (s->flag_i_) - 2); /* [todo] diff --git a/lily/stem.cc b/lily/stem.cc index 0cd5486d0f..875db21405 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -38,6 +38,7 @@ Stem::Stem () staff_size_i_ = 8; stem_xoffset_f_ =0; + beam_gap_i_ = 0; } int @@ -98,6 +99,12 @@ Stem::set_stemend (Real se) stem_bottom_f_ = (dir_ < 0) ? se : min_head_i (); } +int +Stem::type_i () const +{ + return head_l_arr_[0]->balltype_i_; +} + void Stem::add (Note_head *n) { @@ -196,10 +203,12 @@ Stem::set_default_extents () set_default_stemlen (); set_stemend ((dir_< 0) ? - max_head_i ()-stem_length_f (): min_head_i () +stem_length_f ()); - if (dir_ > 0){ - stem_xoffset_f_ = paper ()->note_width ()-paper ()->rule_thickness (); - } + max_head_i ()-stem_length_f (): min_head_i () + stem_length_f ()); + // ugh, a whole ball is wider + if (head_l_arr_[0]->balltype_i_ <= 0) + stem_xoffset_f_ = paper ()->note_width () / 2; + else if (dir_ > 0) + stem_xoffset_f_ = paper ()->note_width () - paper ()->rule_thickness (); else stem_xoffset_f_ = 0; } @@ -248,58 +257,67 @@ Stem::do_pre_processing () flag_i_ = dir_ * abs (flag_i_); transparent_b_ = invisible_b (); empty_b_ = invisible_b (); + } Interval Stem::do_width () const { - if (beam_l_ || abs (flag_i_) <= 4) - return Interval (0,0); // TODO! - Paper_def*p= paper (); - Interval r (p->lookup_l ()->flag (flag_i_).dim.x ()); - r+= stem_xoffset_f_; + Interval r (0, 0); + if (abbrev_flag_i_) + { + r = abbrev_mol ().extent ().x (); + } + else if (beam_l_ || abs (flag_i_) <= 4) + ; // TODO! + else + { + Paper_def*p= paper (); + r = p->lookup_l ()->flag (flag_i_).dim.x (); + r+= stem_xoffset_f_; + } return r; } - - Molecule - Stem::abbrev_mol () const - { - Real dy = paper ()->interbeam_f (); - Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length (); - Real beamdy = paper ()->interline_f () / 2; - - int beams_i = 0; - Real slope = paper ()->internote_f () / 4; - - if (beam_l_) { - // huh? - slope = 2 * beam_l_->slope; - // ugh, rather calc from Abbreviation_req - beams_i = beams_right_i_ >? beams_left_i_; - } - paper ()->lookup_l ()->beam (slope, 20 PT); - Molecule beams; - Atom a (paper ()->lookup_l ()->beam (slope, w)); - a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope))); - // ugh - if (!beams_i) - a.translate (dy + beamdy - dir_ * dy, Y_AXIS); - else - a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS); - - for (int i = 0; i < abbrev_flag_i_; i++) - { - Atom b (a); - b.translate (-dir_ * dy * (beams_i + i), Y_AXIS); - beams.add (b); - } - - return beams; - } +Molecule +Stem::abbrev_mol () const +{ + Real dy = paper ()->interbeam_f (); + Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length (); + Real beamdy = paper ()->interline_f () / 2; + + int beams_i = 0; + Real slope = paper ()->internote_f () / 4; + + if (beam_l_) { + // huh? + slope = 2 * beam_l_->slope; + // ugh, rather calc from Abbreviation_req + beams_i = beams_right_i_ >? beams_left_i_; + } + paper ()->lookup_l ()->beam (slope, 20 PT); + + Molecule beams; + Atom a (paper ()->lookup_l ()->beam (slope, w)); + a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope))); + // ugh + if (!beams_i) + a.translate (dy + beamdy - dir_ * dy, Y_AXIS); + else + a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS); + + for (int i = 0; i < abbrev_flag_i_; i++) + { + Atom b (a); + b.translate (-dir_ * dy * (beams_i + i), Y_AXIS); + beams.add (b); + } + + return beams; +} Molecule* Stem::brew_molecule_p () const