From 40c8e12b8afa8e9c7e44cf6ea3b724295884091b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 30 Jun 2000 12:49:35 +0200 Subject: [PATCH] release: 1.3.67 =========== * Use callbacks for augmentation dot positioning. * Removed types Note_head and Rest * Cleanup of slur.cc: use common reference points in a sane manner. 1.3 --- CHANGES | 14 ++- VERSION | 2 +- lily/auto-beam-engraver.cc | 2 +- lily/beam-engraver.cc | 8 +- lily/breathing-sign-engraver.cc | 20 +++- lily/breathing-sign.cc | 2 +- lily/chord-tremolo-engraver.cc | 6 +- lily/clef-engraver.cc | 4 +- lily/collision.cc | 6 +- lily/dot-column.cc | 53 +++++++---- lily/dots.cc | 23 +++-- lily/dynamic-engraver.cc | 2 +- lily/grace-position-engraver.cc | 8 +- lily/include/breathing-sign-engraver.hh | 34 ------- lily/include/dot-column.hh | 10 +- lily/include/dots.hh | 2 +- lily/include/multi-measure-rest.hh | 1 - lily/include/note-column.hh | 2 +- lily/include/note-head.hh | 17 +--- lily/include/note-heads-engraver.hh | 32 ------- lily/include/rest-engraver.hh | 30 ------ lily/include/rest.hh | 11 +-- lily/include/rhythmic-head.hh | 2 +- lily/include/slur.hh | 9 +- lily/include/staff-symbol-referencer.hh | 4 - lily/include/stem.hh | 4 +- lily/include/tie.hh | 12 +-- lily/include/tuplet-spanner.hh | 4 +- lily/include/volta-spanner.hh | 2 +- lily/line-number-engraver.cc | 6 +- lily/local-key-engraver.cc | 6 +- lily/local-key-item.cc | 2 +- lily/multi-measure-rest.cc | 28 +----- lily/note-column.cc | 2 +- lily/note-head.cc | 46 ++------- lily/note-heads-engraver.cc | 39 ++++++-- lily/piano-pedal-engraver.cc | 4 +- lily/pitch-squash-engraver.cc | 6 +- lily/rest-collision.cc | 3 +- lily/rest-engraver.cc | 27 +++++- lily/rest.cc | 32 +++---- lily/rhythmic-column-engraver.cc | 2 +- lily/rhythmic-head.cc | 18 +--- lily/score-element.cc | 36 ++++++- lily/slur.cc | 121 ++++++++++-------------- lily/staff-symbol-referencer.cc | 7 +- lily/stem-engraver.cc | 2 +- lily/stem.cc | 29 +++--- lily/text-engraver.cc | 13 ++- lily/text-item.cc | 2 +- lily/tie-column.cc | 2 +- lily/tie-engraver.cc | 10 +- lily/tie.cc | 16 ++-- lily/tuplet-spanner.cc | 16 +--- lily/volta-spanner.cc | 14 --- ly/engraver.ly | 9 +- make/out/lilypond.lsm | 8 +- make/out/lilypond.spec | 4 +- scm/slur.scm | 66 ++++++------- 59 files changed, 378 insertions(+), 524 deletions(-) delete mode 100644 lily/include/breathing-sign-engraver.hh delete mode 100644 lily/include/note-heads-engraver.hh delete mode 100644 lily/include/rest-engraver.hh diff --git a/CHANGES b/CHANGES index 8fa5208be2..f14c1d313c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,16 @@ -1.3.65.mb1 -========== +1.3.66.hwn1 +=========== + +* Use callbacks for augmentation dot positioning. -* Corrected text sizes in paper*.ly +* Removed types Note_head and Rest + +* Cleanup of slur.cc: use common reference points in a sane manner. + +1.3.66 +====== +* Corrected text sizes in paper*.ly (Mats Bengtsson) 1.3.65.uu1 ========== diff --git a/VERSION b/VERSION index 4e0c3d5167..7f7efbb39e 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=66 +PATCH_LEVEL=67 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 7e939e7c8e..1d88248b40 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -314,7 +314,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) { end_beam (); } - else if (Rest* rest_l = dynamic_cast (info.elem_l_)) + else if (to_boolean (info.elem_l_->get_elt_property ("rest-interface"))) { end_beam (); } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index c037c00923..61fbd4997e 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -183,16 +183,16 @@ Beam_engraver::acknowledge_element (Score_element_info info) { if (beam_p_) { - if (Rest* r = dynamic_cast (info.elem_l_)) + if (to_boolean (info.elem_l_->get_elt_property("rest-interface"))) { - r->add_offset_callback (Beam::rest_collision_callback, Y_AXIS); + info.elem_l_->add_offset_callback (Beam::rest_collision_callback, Y_AXIS); } - else if (Stem* stem_l = dynamic_cast (info.elem_l_)) + else if (to_boolean (info.elem_l_->get_elt_property ("stem-interface"))) { + Stem *stem_l = dynamic_cast (info.elem_l_); if (stem_l->beam_l ()) return; - bool stem_grace = stem_l->get_elt_property ("grace") == SCM_BOOL_T; SCM wg =get_property ("weAreGraceContext"); diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc index f72e5b2b97..151fbbff79 100644 --- a/lily/breathing-sign-engraver.cc +++ b/lily/breathing-sign-engraver.cc @@ -14,14 +14,30 @@ TODO: */ #include "staff-symbol-referencer.hh" -#include "breathing-sign-engraver.hh" #include "breathing-sign.hh" #include "musical-request.hh" #include "command-request.hh" #include "engraver-group-engraver.hh" -#include "note-head.hh" #include "local-key-item.hh" +#include "engraver.hh" +#include "command-request.hh" + +class Breathing_sign_engraver : public Engraver { +public: + Breathing_sign_engraver(); + VIRTUAL_COPY_CONS(Translator); + +protected: + virtual bool do_try_music (Music *req_l); + virtual void do_process_music(); + + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +private: + Breathing_sign_req * breathing_sign_req_l_; + Breathing_sign * breathing_sign_p_; +}; Breathing_sign_engraver::Breathing_sign_engraver() { diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index c8a7a0c1a2..cc743c5a28 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -49,7 +49,7 @@ GLUE_SCORE_ELEMENT(Breathing_sign,after_line_breaking); SCM Breathing_sign::member_after_line_breaking () { - Real space = staff_symbol_referencer (this).staff_space(); + Real space = Staff_symbol_referencer_interface (this).staff_space(); Direction d = Directional_element_interface (this). get (); if (!d) { diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 5ab38f6f85..3445d1277e 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -11,7 +11,7 @@ #include "beam.hh" #include "repeated-music.hh" #include "stem.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "engraver-group-engraver.hh" #include "musical-request.hh" #include "warn.hh" @@ -171,9 +171,9 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info info) ::warning (s); } } - if (Note_head *nh = dynamic_cast (info.elem_l_)) + if (to_boolean (info.elem_l_->get_elt_property ("note-head-interface"))) { - nh->set_elt_property ("duration-log", gh_int2scm (intlog2 (note_head_i_))); + info.elem_l_->set_elt_property ("duration-log", gh_int2scm (intlog2 (note_head_i_))); } } } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 616e4c55f6..def1a62622 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -16,7 +16,7 @@ #include "debug.hh" #include "command-request.hh" #include "timing-translator.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "key-item.hh" #include "local-key-item.hh" #include "array.hh" @@ -133,7 +133,7 @@ Clef_engraver::acknowledge_element (Score_element_info info) Item * it_l =dynamic_cast (info.elem_l_); if (it_l) { - if (dynamic_cast(it_l) + if (to_boolean (it_l->get_elt_property("note-head-interface")) || dynamic_cast (it_l)) { Staff_symbol_referencer_interface si (it_l); diff --git a/lily/collision.cc b/lily/collision.cc index 01cb443dd5..9cedc34479 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -8,7 +8,7 @@ #include "debug.hh" #include "collision.hh" #include "note-column.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "paper-def.hh" #include "axis-group-interface.hh" #include "item.hh" @@ -164,8 +164,8 @@ Collision::automatic_shift (Score_element *me) /* TODO. */ - Note_head * nu_l= cu_l->first_head(); - Note_head * nd_l = cd_l->first_head(); + Rhythmic_head * nu_l= cu_l->first_head(); + Rhythmic_head * nd_l = cd_l->first_head(); int downpos = Note_column::head_positions_interval (cd_l)[BIGGER]; int uppos = Note_column::head_positions_interval (cu_l)[SMALLER]; diff --git a/lily/dot-column.cc b/lily/dot-column.cc index ce660a24a2..a725998bcf 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -16,16 +16,6 @@ #include "axis-group-interface.hh" -// todo: dots and elements duplicate each other. -void -Dot_column::add_dots (Item *d) -{ - Pointer_group_interface gi (this, "dots"); - gi.add_element (d); - - add_dependency (d); - Axis_group_interface (this).add_element (d); -} void Dot_column::add_head (Rhythmic_head *r) @@ -34,12 +24,20 @@ Dot_column::add_head (Rhythmic_head *r) return ; Side_position_interface (this).add_support (r); - add_dots (r->dots_l ()); + Item * d = r->dots_l (); + if (d) + { + Pointer_group_interface gi (this, "dots"); + gi.add_element (d); + + d->add_offset_callback (force_shift_callback , Y_AXIS); + Axis_group_interface (this).add_element (d); + } } int -Dot_column::compare (Item * const &d1, Item * const &d2) +Dot_column::compare (Score_element * const &d1, Score_element * const &d2) { Staff_symbol_referencer_interface s1(d1); Staff_symbol_referencer_interface s2(d2); @@ -51,8 +49,7 @@ Dot_column::compare (Item * const &d1, Item * const &d2) Dot_column::Dot_column (SCM s) : Item (s) { - Pointer_group_interface gi (this, "dots"); - gi.set_interface (); + this->set_elt_pointer ("dots", SCM_EOL); Directional_element_interface (this).set (RIGHT); Axis_group_interface (this).set_interface (); @@ -75,11 +72,27 @@ Dot_column::Dot_column (SCM s) Should be smarter. */ -GLUE_SCORE_ELEMENT(Dot_column,after_line_breaking); + +Real +Dot_column::force_shift_callback (Score_element const * dot, Axis a) +{ + assert (a == Y_AXIS); + Score_element * me = dot->parent_l (X_AXIS); + SCM dots = me->get_elt_pointer ("dots"); + do_shifts (dots); + return 0.0; +} + SCM -Dot_column::member_after_line_breaking () +Dot_column::do_shifts (SCM l) { - Link_array dots = Pointer_group_interface__extract_elements (this, (Item*)0 , "dots"); + Link_array dots; + while (gh_pair_p (l)) + { + dots.push (unsmob_element (gh_car (l))); + l = gh_cdr (l); + } + dots.sort (Dot_column::compare); if (dots.size () < 2) @@ -103,8 +116,7 @@ Dot_column::member_after_line_breaking () } if (!conflicts) - return SCM_UNDEFINED; - + return SCM_UNDEFINED; int middle = s.center (); /* @@ -116,7 +128,8 @@ Dot_column::member_after_line_breaking () for (int i=0; i < dots.size (); pos += 2, i++) { - staff_symbol_referencer (dots[i]).set_position(pos); + Score_element * d = dots[i]; + Staff_symbol_referencer_interface (d).set_position(pos); } return SCM_UNDEFINED; diff --git a/lily/dots.cc b/lily/dots.cc index ccd29ae3b6..6a037d9f80 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -14,30 +14,29 @@ #include "staff-symbol-referencer.hh" #include "directional-element-interface.hh" -MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Dots,after_line_breaking); -SCM -Dots::after_line_breaking (SCM smob) +Real +Dots::quantised_position_callback (Score_element const* me, Axis a) { - Item * p = dynamic_cast (unsmob_element (smob)); - - SCM d= p->get_elt_property ("dot-count"); + assert (a == Y_AXIS); + + SCM d= me->get_elt_property ("dot-count"); if (gh_number_p (d) && gh_scm2int (d)) { - if (!Directional_element_interface (p).get ()) - Directional_element_interface (p).set (UP); + if (!Directional_element_interface (me).get ()) + Directional_element_interface (me).set (UP); - Staff_symbol_referencer_interface si (p); + Staff_symbol_referencer_interface si (me); int pos = int (si.position_f ()); if (!(pos % 2)) - si.set_position (pos + Directional_element_interface (p).get ()); + return si.staff_space () / 2.0 * Directional_element_interface (me).get (); } - return SCM_UNDEFINED; + return 0.0; } -MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Dots,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Dots,brew_molecule); SCM Dots::brew_molecule (SCM d) { diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 739f03f7eb..8224b1f6f6 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -19,7 +19,7 @@ #include "side-position-interface.hh" #include "engraver.hh" #include "stem.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "group-interface.hh" #include "directional-element-interface.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/grace-position-engraver.cc b/lily/grace-position-engraver.cc index bbfa5392de..bdf58af7e8 100644 --- a/lily/grace-position-engraver.cc +++ b/lily/grace-position-engraver.cc @@ -9,7 +9,7 @@ #include "engraver.hh" #include "grace-align-item.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "local-key-item.hh" #include "paper-column.hh" #include "dimension-cache.hh" @@ -46,10 +46,10 @@ Grace_position_engraver::acknowledge_element (Score_element_info i) { align_l_ = g; } - else if (Note_head * n = dynamic_cast (i.elem_l_)) + else if (to_boolean (i.elem_l_->get_elt_property ("note-head-interface"))) { - if (!to_boolean (n->get_elt_property ("grace"))) - support_.push (n); + if (!to_boolean (i.elem_l_->get_elt_property ("grace"))) + support_.push (dynamic_cast (i.elem_l_)); } else if (Local_key_item*it = dynamic_cast(i.elem_l_)) { diff --git a/lily/include/breathing-sign-engraver.hh b/lily/include/breathing-sign-engraver.hh deleted file mode 100644 index ef0fa899fa..0000000000 --- a/lily/include/breathing-sign-engraver.hh +++ /dev/null @@ -1,34 +0,0 @@ -/* - breathing-sign-engraver.hh -- declare Breathing_Sign_engraver - - Copyright (C) 1999 Michael Krause - - written for the GNU LilyPond music typesetter - -*/ - -#ifndef BREATHING_SIGN_ENGRAVER_HH -#define BREATHING_SIGN_ENGRAVER_HH - -#include "engraver.hh" -#include "command-request.hh" -#include "breathing-sign.hh" - -class Breathing_sign_engraver : public Engraver { -public: - Breathing_sign_engraver(); - VIRTUAL_COPY_CONS(Translator); - -protected: - virtual bool do_try_music (Music *req_l); - virtual void do_process_music(); - - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); - -private: - Breathing_sign_req * breathing_sign_req_l_; - Breathing_sign * breathing_sign_p_; -}; - -#endif // BREATHING_SIGN_ENGRAVER_HH diff --git a/lily/include/dot-column.hh b/lily/include/dot-column.hh index 0a71a1466d..e812875e99 100644 --- a/lily/include/dot-column.hh +++ b/lily/include/dot-column.hh @@ -18,15 +18,13 @@ */ class Dot_column : public Item { - static int compare (Item * const&,Item * const&); - void add_dots (Item*); + static int compare (Score_element * const&,Score_element * const&); public: VIRTUAL_COPY_CONS (Score_element); void add_head (Rhythmic_head*); Dot_column (SCM); - - - SCM member_after_line_breaking (); - static SCM after_line_breaking (SCM); + + static Real force_shift_callback (Score_element const* , Axis); + static SCM do_shifts (SCM dotlist); }; #endif // DOT_COLUMN_HH diff --git a/lily/include/dots.hh b/lily/include/dots.hh index 3333cd26b7..21be4f7747 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -27,7 +27,7 @@ class Dots // interface { public: - static SCM after_line_breaking (SCM); + static Real quantised_position_callback(Score_element const*, Axis); static SCM brew_molecule (SCM); }; diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index 50ab957bb3..6a9b31be68 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -26,7 +26,6 @@ public: SCM member_brew_molecule () const; VIRTUAL_COPY_CONS (Score_element); - virtual void do_add_processing (); SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); virtual Array get_rods () const; diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index dc6d665f77..ddd691232d 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -34,7 +34,7 @@ public: static Slice head_positions_interval(Score_element* me) ; static Direction static_dir (Score_element*); void translate_rests(int dy); - Note_head * first_head ()const; + Rhythmic_head * first_head ()const; Interval rest_dim ()const ; Note_column (SCM); void set_stem (Score_element*); diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 272ed3da95..b945d3a28a 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -7,7 +7,8 @@ #ifndef NOTEHEAD_HH #define NOTEHEAD_HH -#include "rhythmic-head.hh" +#include "lily-guile.hh" +#include "molecule.hh" /** ball at the end of the stem. Takes care of: @@ -19,19 +20,11 @@ */ -class Note_head : public Rhythmic_head +class Note_head { public: - static int compare (Note_head * const &a, Note_head *const &b) ; - static SCM brew_molecule (SCM); - - - Molecule ledger_line (Interval) const; - Note_head (SCM); - - SCM member_before_line_breaking (); - static SCM before_line_breaking (SCM); - SCM member_brew_molecule() const; + static SCM brew_molecule (SCM); + static Molecule ledger_line (Interval, Score_element*) ; }; #endif // NOTEHEAD_HH diff --git a/lily/include/note-heads-engraver.hh b/lily/include/note-heads-engraver.hh deleted file mode 100644 index bbe8e0254f..0000000000 --- a/lily/include/note-heads-engraver.hh +++ /dev/null @@ -1,32 +0,0 @@ -/* - head-engraver.hh -- part of GNU LilyPond - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef HEADSGRAV_HH -#define HEADSGRAV_HH -#include "engraver.hh" -#include "pqueue.hh" - -/** - make balls and rests - */ -class Note_heads_engraver : public Engraver { - Link_array note_p_arr_; - Link_array dot_p_arr_; - Link_array note_req_l_arr_; - Moment note_end_mom_; -public: - VIRTUAL_COPY_CONS(Translator); - Note_heads_engraver(); - -protected: - virtual bool do_try_music (Music *req_l) ; - virtual void do_process_music(); - virtual void do_pre_move_processing(); -}; - - -#endif // HEADSGRAV_HH diff --git a/lily/include/rest-engraver.hh b/lily/include/rest-engraver.hh deleted file mode 100644 index af5715269d..0000000000 --- a/lily/include/rest-engraver.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - rest-engraver.hh -- declare Engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef REST_GRAV_HH -#define REST_GRAV_HH - -#include "engraver.hh" - -class Rest_engraver : public Engraver -{ - Rest_req *rest_req_l_; - Item * dot_p_; - Rest * rest_p_; -protected: - virtual bool do_try_music (Music *); - virtual void do_pre_move_processing (); - virtual void do_post_move_processing (); - virtual void do_process_music (); -public: - - VIRTUAL_COPY_CONS(Translator); - Rest_engraver (); -}; -#endif // REST_GRAV_HH diff --git a/lily/include/rest.hh b/lily/include/rest.hh index db36065f0c..dc3706005b 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -10,7 +10,7 @@ #ifndef REST_HH #define REST_HH -#include "rhythmic-head.hh" +#include "lily-guile.hh" /** A pause. @@ -19,15 +19,10 @@ style -- string specifying glyph style */ -class Rest : public Rhythmic_head +class Rest { public: - SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); - SCM member_brew_molecule () const; - - static SCM brew_molecule (SCM); - -Rest (SCM s); + static SCM brew_molecule (SCM); }; #endif // REST_HH diff --git a/lily/include/rhythmic-head.hh b/lily/include/rhythmic-head.hh index 33e7bb279b..cb00554714 100644 --- a/lily/include/rhythmic-head.hh +++ b/lily/include/rhythmic-head.hh @@ -30,7 +30,7 @@ public: VIRTUAL_COPY_CONS(Rhythmic_head); int balltype_i () const; - void add_dots (Item *); + void set_dots (Item *); Stem * stem_l () const; Item * dots_l () const; int dot_count () const; diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 3176d4b6bb..e37761e8a5 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -23,21 +23,20 @@ public: static SCM brew_molecule (SCM); SCM member_brew_molecule () const; - virtual Array get_encompass_offset_arr () const; + Array get_encompass_offset_arr () const; Bezier get_curve () const; - virtual Direction get_default_dir () const; + Direction get_default_dir () const; SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); - virtual void do_add_processing (); Array get_rods () const; - Offset get_attachment (Direction dir) const; + Offset get_attachment (Direction dir, Score_element**common) const; private: void de_uglyfy (Slur_bezier_bow* bb, Real default_height); void set_extremities (); void set_control_points (); - Offset encompass_offset (Note_column const* )const; + Offset encompass_offset (Score_element *col,Score_element**common)const; }; #endif // SLUR_HH diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 20311c8abb..9734cf17af 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -40,9 +40,5 @@ public: }; int compare_position (Score_element *const&,Score_element *const&); - - -Staff_symbol_referencer_interface staff_symbol_referencer (Score_element const*); - #endif /* STAFF_SYMBOL_REFERENCER_HH */ diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 24e0630c76..ed0f619d0f 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -57,8 +57,8 @@ public: our beam, for aligning abbrev flags */ Beam* beam_l () const; - Note_head * first_head () const; - Drul_array extremal_heads () const; + Rhythmic_head * first_head () const; + Drul_array extremal_heads () const; Score_element * support_head () const; Stem (SCM); diff --git a/lily/include/tie.hh b/lily/include/tie.hh index bf6f386fc4..92a2b24719 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -23,16 +23,12 @@ public: void set_head (Direction, Item*head_l); VIRTUAL_COPY_CONS(Score_element); - Note_head* head (Direction) const; + Rhythmic_head* head (Direction) const; Real position_f () const; - static SCM brew_molecule (SCM); - - - virtual Direction get_default_dir() const; - - + static SCM brew_molecule (SCM); + Direction get_default_dir() const; SCM member_brew_molecule () const; - virtual Array get_encompass_offset_arr () const; + Array get_encompass_offset_arr () const; Bezier get_curve () const; /* diff --git a/lily/include/tuplet-spanner.hh b/lily/include/tuplet-spanner.hh index 42019434b7..90496b424e 100644 --- a/lily/include/tuplet-spanner.hh +++ b/lily/include/tuplet-spanner.hh @@ -34,8 +34,8 @@ public: SCM member_brew_molecule () const; VIRTUAL_COPY_CONS(Score_element); - virtual void do_add_processing (); - virtual Direction get_default_dir () const; + + Direction get_default_dir () const; }; #endif // Tuplet_spanner_HH diff --git a/lily/include/volta-spanner.hh b/lily/include/volta-spanner.hh index ede918a767..ba28f37e6a 100644 --- a/lily/include/volta-spanner.hh +++ b/lily/include/volta-spanner.hh @@ -23,7 +23,7 @@ public: SCM member_brew_molecule () const; VIRTUAL_COPY_CONS (Score_element); - virtual void do_add_processing (); + SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); }; diff --git a/lily/line-number-engraver.cc b/lily/line-number-engraver.cc index 2c235080e3..dc08a787a9 100644 --- a/lily/line-number-engraver.cc +++ b/lily/line-number-engraver.cc @@ -10,7 +10,7 @@ #include "engraver.hh" #include "item.hh" #include "side-position-interface.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "stem.hh" /** @@ -49,12 +49,12 @@ Line_number_engraver::process_acknowledged () void Line_number_engraver::acknowledge_element (Score_element_info inf) { - if (dynamic_cast (inf.elem_l_)) + if (to_boolean (inf.elem_l_->get_elt_property ("note-head-interface"))) { interesting_.push (inf); support_.push (inf.elem_l_); } - if (dynamic_cast (inf.elem_l_)) + else if (to_boolean (inf.elem_l_->get_elt_property ("stem-interface"))) { support_.push (inf.elem_l_); } diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 55dd16c0b4..9fcde99872 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -9,7 +9,7 @@ #include "local-key-item.hh" #include "key-item.hh" #include "tie.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "timing-translator.hh" #include "engraver-group-engraver.hh" #include "grace-align-item.hh" @@ -100,7 +100,7 @@ Local_key_engraver::process_acknowledged () key_item_p_ = new Local_key_item (get_property ("basicLocalKeyProperties")); Side_position_interface (key_item_p_).set_axis (X_AXIS); Side_position_interface (key_item_p_).set_direction (LEFT); - staff_symbol_referencer(key_item_p_).set_interface (); + Staff_symbol_referencer_interface (key_item_p_).set_interface (); announce_element (Score_element_info (key_item_p_, 0)); } @@ -193,7 +193,7 @@ Local_key_engraver::acknowledge_element (Score_element_info info) grace_align_l_ = gai; } Note_req * note_l = dynamic_cast (info.req_l_); - Note_head * note_head = dynamic_cast (info.elem_l_); + Rhythmic_head * note_head = dynamic_cast (info.elem_l_); if (he_gr != selfgr) return; diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 0c1ec92137..2dd0071095 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -11,7 +11,7 @@ #include "lookup.hh" #include "paper-def.hh" #include "musical-request.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "misc.hh" void diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 27dfeebf5c..97d1401c17 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -38,7 +38,7 @@ SCM Multi_measure_rest::member_brew_molecule () const { Real staff_space - = staff_symbol_referencer (this).staff_space (); + = Staff_symbol_referencer_interface (this).staff_space (); Interval sp_iv; Direction d = LEFT; @@ -140,32 +140,6 @@ Multi_measure_rest::member_brew_molecule () const UGH. JUNKME elt prop "columns" isn't really needed. */ -void -Multi_measure_rest::do_add_processing () -{ -#if 0 - if (gh_pair_p (get_elt_pointer ("columns"))) - { - Link_array column_arr (Pointer_group_interface__extract_elements (this, (Item*)0, "columns")); - - set_bound (LEFT, column_arr[0 >? column_arr.size () - 2]); - set_bound (RIGHT, column_arr.top ()); - } -#endif - // set columns to SCM_EOL? -} - -GLUE_SCORE_ELEMENT(Multi_measure_rest,after_line_breaking); -SCM -Multi_measure_rest::member_after_line_breaking () -{ - if (!gh_pair_p (get_elt_pointer ("columns"))) - { - suicide (); - } - - return SCM_UNDEFINED; -} diff --git a/lily/note-column.cc b/lily/note-column.cc index 613a9bae82..2d20c48a19 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -142,7 +142,7 @@ Note_column::rest_dim () const return r->extent (Y_AXIS); } -Note_head* +Rhythmic_head* Note_column::first_head () const { Stem * st = stem_l (); diff --git a/lily/note-head.cc b/lily/note-head.cc index 5c4e1b6905..c072d2f461 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -22,10 +22,10 @@ build a ledger line for small pieces. */ Molecule -Note_head::ledger_line (Interval xwid) const +Note_head::ledger_line (Interval xwid, Score_element *me) { Drul_array endings; - endings[LEFT] = lookup_l()->afm_find ("noteheads-ledgerending"); + endings[LEFT] = me->lookup_l()->afm_find ("noteheads-ledgerending"); Molecule *e = &endings[LEFT]; endings[RIGHT] = *e; @@ -52,34 +52,15 @@ Note_head::ledger_line (Interval xwid) const } -GLUE_SCORE_ELEMENT(Note_head,before_line_breaking); -SCM -Note_head::member_before_line_breaking () -{ - // 8 ball looks the same as 4 ball: - - if (balltype_i () > 2) - set_elt_property ("duration-log", gh_int2scm (2)); - - if (Item *d = dots_l ()) - { // move into Rhythmic_head? - Staff_symbol_referencer_interface si (d); - Staff_symbol_referencer_interface me (this); - - si.set_position(int (me.position_f ())); - } - - return SCM_UNDEFINED; -} - -GLUE_SCORE_ELEMENT(Note_head,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Note_head,brew_molecule); SCM -Note_head::member_brew_molecule () const +Note_head::brew_molecule (SCM smob) { - Staff_symbol_referencer_interface si (this); + Score_element *me = unsmob_element (smob); + Staff_symbol_referencer_interface si (me); Real inter_f = si.staff_space ()/2; int sz = si.line_count ()-1; @@ -88,15 +69,15 @@ Note_head::member_brew_molecule () const ? 0 : (abs((int)p) - sz) /2; - SCM style = get_elt_property ("style"); + SCM style = me->get_elt_property ("style"); if (style == SCM_UNDEFINED) { style = ly_symbol2scm("default"); } - Molecule out = lookup_l()->afm_find (String ("noteheads-") + + Molecule out = me->lookup_l()->afm_find (String ("noteheads-") + ly_scm2string (scm_eval (gh_list (ly_symbol2scm("find-notehead-symbol"), - gh_int2scm(balltype_i ()), + me->get_elt_property ("duration-log"), ly_quote_scm(style), SCM_UNDEFINED)))); @@ -106,7 +87,7 @@ Note_head::member_brew_molecule () const Interval hd = out.extent (X_AXIS); Real hw = hd.length ()/4; Molecule ledger (ledger_line (Interval (hd[LEFT] - hw, - hd[RIGHT] + hw))); + hd[RIGHT] + hw), me)); ledger.set_empty (true); @@ -122,10 +103,3 @@ Note_head::member_brew_molecule () const } return out.create_scheme(); } - - -Note_head::Note_head (SCM s) - : Rhythmic_head (s) -{ - -} diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index c12f28df11..fa72a59e2f 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -4,13 +4,38 @@ (c) 1997--2000 Han-Wen Nienhuys */ -#include "note-head.hh" -#include "note-heads-engraver.hh" +#include "rhythmic-head.hh" +#include "engraver.hh" #include "paper-def.hh" #include "musical-request.hh" #include "dots.hh" #include "dot-column.hh" #include "staff-symbol-referencer.hh" +#include "engraver.hh" +#include "pqueue.hh" + +/** + make balls and rests + */ +class Note_heads_engraver : public Engraver +{ + Link_array note_p_arr_; + Link_array dot_p_arr_; + Link_array note_req_l_arr_; + Moment note_end_mom_; +public: + VIRTUAL_COPY_CONS(Translator); + Note_heads_engraver(); + +protected: + virtual bool do_try_music (Music *req_l) ; + virtual void do_process_music(); + virtual void do_pre_move_processing(); +}; + + + + Note_heads_engraver::Note_heads_engraver() { @@ -60,7 +85,7 @@ Note_heads_engraver::do_process_music() for (int i=0; i < note_req_l_arr_.size (); i++) { - Note_head *note_p = new Note_head (get_property ("basicNoteHeadProperties")); + Rhythmic_head *note_p = new Rhythmic_head (get_property ("basicNoteHeadProperties")); Staff_symbol_referencer_interface si (note_p); si.set_interface (); @@ -73,17 +98,19 @@ Note_heads_engraver::do_process_music() if (note_req_l->duration_.dots_i_) { - Item * d = new Item (get_property ("basicDotsProperties")); + Item * d = new Item (get_property ("basicDotsProperties")); Staff_symbol_referencer_interface sd (d); sd.set_interface (); - note_p->add_dots (d); + note_p->set_dots (d); if (note_req_l->duration_.dots_i_ != gh_scm2int (d->get_elt_property ("dot-count"))) d->set_elt_property ("dot-count", gh_int2scm (note_req_l->duration_.dots_i_)); - + + d->set_parent (note_p, Y_AXIS); + d->add_offset_callback (Dots::quantised_position_callback, Y_AXIS); announce_element (Score_element_info (d,0)); dot_p_arr_.push (d); } diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 8f43379ba5..2058358a9e 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -12,7 +12,7 @@ #include "item.hh" #include "lookup.hh" #include "lily-guile.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "stem.hh" #include "side-position-interface.hh" #include "staff-symbol-referencer.hh" @@ -111,7 +111,7 @@ Piano_pedal_engraver::acknowledge_element (Score_element_info info) { if (p->item_p_) { - if (Note_head* n = dynamic_cast (info.elem_l_)) + if (Rhythmic_head* n = dynamic_cast (info.elem_l_)) { Side_position_interface st (p->item_p_); st.add_support (n); diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index 21774fb3af..fbe88a3300 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -9,14 +9,14 @@ #include "staff-symbol-referencer.hh" #include "pitch-squash-engraver.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" void Pitch_squash_engraver::acknowledge_element (Score_element_info i) { - if (Note_head *nh = dynamic_cast (i.elem_l_)) + if (to_boolean (i.elem_l_->get_elt_property ("note-head-interface"))) { - Staff_symbol_referencer_interface (nh).set_position(0); + Staff_symbol_referencer_interface (i.elem_l_).set_position(0); } } diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 69f1ff0eed..2a38b27d2b 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -5,13 +5,14 @@ (c) 1997--2000 Han-Wen Nienhuys */ + #include // ceil. #include "debug.hh" #include "rest-collision.hh" #include "note-column.hh" #include "stem.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "paper-def.hh" #include "rest.hh" #include "group-interface.hh" diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index 96f34bfe96..ccc80a3f82 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -6,10 +6,27 @@ (c) 1997--2000 Han-Wen Nienhuys */ #include "staff-symbol-referencer.hh" -#include "rest-engraver.hh" #include "musical-request.hh" #include "dots.hh" -#include "rest.hh" +#include "rhythmic-head.hh" +#include "engraver.hh" + +class Rest_engraver : public Engraver +{ + Rest_req *rest_req_l_; + Item * dot_p_; + Rhythmic_head * rest_p_; +protected: + virtual bool do_try_music (Music *); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + virtual void do_process_music (); +public: + + VIRTUAL_COPY_CONS(Translator); + Rest_engraver (); +}; + /* Should merge with Note_head_engraver @@ -47,7 +64,7 @@ Rest_engraver::do_process_music () { if (rest_req_l_ && !rest_p_) { - rest_p_ = new Rest (get_property ("basicRestProperties")); + rest_p_ = new Rhythmic_head (get_property ("basicRestProperties")); Staff_symbol_referencer_interface si (rest_p_); si.set_interface (); @@ -61,7 +78,9 @@ Rest_engraver::do_process_music () Staff_symbol_referencer_interface si (dot_p_); si.set_interface (); - rest_p_->add_dots (dot_p_); + rest_p_->set_dots (dot_p_); + dot_p_->set_parent (rest_p_, Y_AXIS); + dot_p_->add_offset_callback (Dots::quantised_position_callback, Y_AXIS); dot_p_->set_elt_property ("dot-count", gh_int2scm (rest_req_l_->duration_.dots_i_)); announce_element (Score_element_info (dot_p_,0)); diff --git a/lily/rest.cc b/lily/rest.cc index f76968aaa0..a8264b0ef6 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -15,23 +15,23 @@ #include "staff-symbol-referencer.hh" // -> offset callback -GLUE_SCORE_ELEMENT(Rest,after_line_breaking); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Rest,after_line_breaking); SCM -Rest::member_after_line_breaking () +Rest::after_line_breaking (SCM smob) { - if (balltype_i () == 0) + Score_element *me = unsmob_element (smob); + int bt = gh_scm2int (me->get_elt_property ("duration-log")); + if (bt == 0) { - Staff_symbol_referencer_interface si (this); - si.set_position (si.position_f () + 2); + Staff_symbol_referencer_interface si (me); + me->translate_axis (si.staff_space() , Y_AXIS); } - Item * d = dots_l (); - if (d && balltype_i () > 4) // UGH. + + Score_element * d = unsmob_element (me->get_elt_pointer ("dot")); + if (d && bt > 4) // UGH. { - /* - UGH. - */ - staff_symbol_referencer (d) - .set_position ((balltype_i () == 7) ? 4 : 3); + d->set_elt_property ("staff-position", + gh_int2scm ((bt == 7) ? 4 : 3)); } return SCM_UNDEFINED; @@ -39,7 +39,6 @@ Rest::member_after_line_breaking () MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Rest,brew_molecule) - SCM Rest::brew_molecule (SCM smob) { @@ -69,10 +68,3 @@ Rest::brew_molecule (SCM smob) return sc-> lookup_l ()->afm_find (idx).create_scheme(); } - - -Rest::Rest (SCM s) - : Rhythmic_head (s) -{ -} - diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 06a67569cc..dba6143faa 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -9,7 +9,7 @@ #include "dimension-cache.hh" #include "slur.hh" #include "engraver.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "stem.hh" #include "note-column.hh" #include "dot-column.hh" diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index 76a2d698a0..b443e3d612 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -46,27 +46,11 @@ Rhythmic_head::dot_count () const return dots_l () ? gh_scm2int (dots_l ()->get_elt_property ("dot-count")) : 0; } - -GLUE_SCORE_ELEMENT(Rhythmic_head,after_line_breaking); -SCM -Rhythmic_head::member_after_line_breaking () -{ - if (Item *d = dots_l ()) - { - Staff_symbol_referencer_interface si (d); - Staff_symbol_referencer_interface me (d); - si.set_position(int (me.position_f ())); - } - - return SCM_UNDEFINED; -} - void -Rhythmic_head::add_dots (Item *dot_l) +Rhythmic_head::set_dots (Item *dot_l) { set_elt_pointer ("dot", dot_l->self_scm_); - dot_l->add_dependency (this); } diff --git a/lily/score-element.cc b/lily/score-element.cc index 0761c5e51e..5e929206f4 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -789,16 +789,42 @@ Score_element::ly_get_elt_property (SCM elt, SCM sym) } +void +Score_element::discretionary_processing() +{ +} + + +SCM +spanner_get_bound (SCM slur, SCM dir) +{ + return dynamic_cast (unsmob_element (slur))->get_bound (to_dir (dir))->self_scm_; +} + +SCM +score_element_get_pointer (SCM se, SCM name) +{ + SCM s = scm_assq (name, unsmob_element (se)->pointer_alist_); + return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); +} + +SCM +score_element_get_property (SCM se, SCM name) +{ + SCM s = scm_assq (name, unsmob_element (se)->property_alist_); + return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); +} + + static void init_functions () { scm_make_gsubr ("ly-get-elt-property", 2, 0, 0, (SCM(*)(...))Score_element::ly_get_elt_property); scm_make_gsubr ("ly-set-elt-property", 3, 0, 0, (SCM(*)(...))Score_element::ly_set_elt_property); + scm_make_gsubr ("ly-get-elt-pointer", 2 , 0, 0, + (SCM(*)(...)) score_element_get_pointer); + scm_make_gsubr ("ly-get-spanner-bound", 2 , 0, 0, + (SCM(*)(...)) spanner_get_bound); } - ADD_SCM_INIT_FUNC(scoreelt, init_functions); -void -Score_element::discretionary_processing() -{ -} diff --git a/lily/slur.cc b/lily/slur.cc index 260e2cecc9..04d44e7ad9 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -102,36 +102,24 @@ Slur::get_default_dir () const return d; } -void -Slur::do_add_processing () -{ -#if 0 - Link_array encompass_arr = - Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns"); - if (encompass_arr.size ()) - { - set_bound (LEFT, encompass_arr[0]); - if (encompass_arr.size () > 1) - set_bound (RIGHT, encompass_arr.top ()); - } -#endif -} Offset -Slur::encompass_offset (Note_column const* col) const +Slur::encompass_offset (Score_element* col, + Score_element **common) const { Offset o; - Stem* stem_l = col->stem_l (); + Score_element* stem_l = unsmob_element (col->get_elt_pointer ("stem")); + Direction dir = Directional_element_interface (this).get (); if (!stem_l) { warning (_ ("Slur over rest?")); - o[X_AXIS] = col->relative_coordinate (0, X_AXIS); - o[Y_AXIS] = col->relative_coordinate (0, Y_AXIS); + o[X_AXIS] = col->relative_coordinate (common[X_AXIS], X_AXIS); + o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); return o; } Direction stem_dir = Directional_element_interface (stem_l).get (); @@ -146,11 +134,11 @@ Slur::encompass_offset (Note_column const* col) const if ((stem_dir == dir) && !stem_l->extent (Y_AXIS).empty_b ()) { - o[Y_AXIS] = stem_l->relative_coordinate (0, Y_AXIS); + o[Y_AXIS] = stem_l->relative_coordinate (common[Y_AXIS], Y_AXIS); // iuhg } else { - o[Y_AXIS] = col->relative_coordinate (0, Y_AXIS); + o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); // ugh } /* @@ -170,39 +158,6 @@ Slur::member_after_line_breaking () return SCM_UNDEFINED; } -SCM -slur_get_bound (SCM slur, SCM dir) -{ - return ((Slur*)unsmob_element (slur))->get_bound (to_dir (dir))->self_scm_; -} - -SCM -score_element_get_pointer (SCM se, SCM name) -{ - SCM s = scm_assq (name, unsmob_element (se)->pointer_alist_); - return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); -} - -SCM -score_element_get_property (SCM se, SCM name) -{ - SCM s = scm_assq (name, unsmob_element (se)->property_alist_); - return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); -} - -void -init_score_elts () -{ - scm_make_gsubr ("get-pointer", 2 , 0, 0, - (SCM(*)(...)) score_element_get_pointer); - scm_make_gsubr ("get-property", 2 , 0, 0, - (SCM(*)(...)) score_element_get_property); - scm_make_gsubr ("get-bound", 2 , 0, 0, - (SCM(*)(...)) slur_get_bound); -} - -ADD_SCM_INIT_FUNC (score_elt, init_score_elts); - void Slur::set_extremities () { @@ -234,7 +189,8 @@ Slur::set_extremities () } Offset -Slur::get_attachment (Direction dir) const +Slur::get_attachment (Direction dir, + Score_element **common) const { SCM s = get_elt_property ("attachment"); SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s); @@ -242,6 +198,8 @@ Slur::get_attachment (Direction dir) const Real ss = Staff_symbol_referencer_interface (this).staff_space (); Real hs = ss / 2.0; Offset o; + + if (Note_column* n = dynamic_cast (get_bound (dir))) { if (Stem* st = dynamic_cast (n->stem_l ())) @@ -282,7 +240,7 @@ Slur::get_attachment (Direction dir) const SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s); if (ly_symbol2string (other_a) != "loose-end") { - o = Offset (0, get_attachment (-dir)[Y_AXIS]); + o = Offset (0, get_attachment (-dir, common)[Y_AXIS]); } } @@ -301,28 +259,48 @@ Slur::get_attachment (Direction dir) const } } - if (str != "loose-end") - o += Offset (0, get_bound (dir)->relative_coordinate (0, Y_AXIS) - - relative_coordinate (0, Y_AXIS)); - + + /* + What if get_bound () is not a note-column? + */ + if (str != "loose-end" + && get_bound (dir)->common_refpoint (common[Y_AXIS], Y_AXIS) == common[Y_AXIS]) + { + o[Y_AXIS] += get_bound (dir)->relative_coordinate (common[Y_AXIS], Y_AXIS) + - relative_coordinate (common[Y_AXIS], Y_AXIS); + } return o; } Array Slur::get_encompass_offset_arr () const { - Link_array encompass_arr = - Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns"); + SCM eltlist = get_elt_pointer ("note-columns"); + Score_element *common[] = {common_refpoint (eltlist,X_AXIS), + common_refpoint (eltlist,Y_AXIS)}; + + + common[X_AXIS] = common[X_AXIS]->common_refpoint (get_bound (RIGHT), X_AXIS); + common[X_AXIS] = common[X_AXIS]->common_refpoint (get_bound (LEFT), X_AXIS); + + Link_array encompass_arr; + while (gh_pair_p (eltlist)) + { + encompass_arr.push (unsmob_element (gh_car (eltlist))); + eltlist =gh_cdr (eltlist); + } + encompass_arr.reverse (); + Array offset_arr; - Offset origin (relative_coordinate (0, X_AXIS), - relative_coordinate (0, Y_AXIS)); + Offset origin (relative_coordinate (common[X_AXIS], X_AXIS), + relative_coordinate (common[Y_AXIS], Y_AXIS)); int first = 1; int last = encompass_arr.size () - 2; - offset_arr.push (get_attachment (LEFT)); + offset_arr.push (get_attachment (LEFT, common)); /* left is broken edge @@ -331,8 +309,11 @@ Slur::get_encompass_offset_arr () const if (encompass_arr[0] != get_bound (LEFT)) { first--; - offset_arr[0][Y_AXIS] -= encompass_arr[0]->relative_coordinate (0, Y_AXIS) - - relative_coordinate (0, Y_AXIS); + + // ? + offset_arr[0][Y_AXIS] -= + encompass_arr[0]->relative_coordinate (common[Y_AXIS], Y_AXIS) + - relative_coordinate (common[Y_AXIS], Y_AXIS); } /* @@ -345,16 +326,16 @@ Slur::get_encompass_offset_arr () const for (int i = first; i <= last; i++) { - Offset o (encompass_offset (encompass_arr[i])); + Offset o (encompass_offset (encompass_arr[i], common)); offset_arr.push (o - origin); } - offset_arr.push (Offset (spanner_length (), 0) + get_attachment (RIGHT)); + offset_arr.push (Offset (spanner_length (), 0) + get_attachment (RIGHT,common)); if (encompass_arr[0] != get_bound (LEFT)) { - offset_arr.top ()[Y_AXIS] -= encompass_arr.top ()->relative_coordinate (0, Y_AXIS) - - relative_coordinate (0, Y_AXIS); + offset_arr.top ()[Y_AXIS] -= encompass_arr.top ()->relative_coordinate (common[Y_AXIS], Y_AXIS) + - relative_coordinate (common[Y_AXIS], Y_AXIS); } return offset_arr; diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index ba6d15a7d8..ca3c938ed8 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -99,7 +99,7 @@ Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis ) Real off =0.0; if (gh_number_p (pos)) { - Real space = staff_symbol_referencer (sc).staff_space (); + Real space = Staff_symbol_referencer_interface (sc).staff_space (); off = gh_scm2double (pos) * space/2.0; } @@ -145,11 +145,6 @@ Staff_symbol_referencer_interface::set_position (Real p) elt_l_->add_offset_callback (callback, Y_AXIS); } -Staff_symbol_referencer_interface -staff_symbol_referencer (Score_element const*e) -{ - return e; // gee, I'm so smart! -} int compare_position (Score_element *const &a, Score_element * const &b) diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 18c6669187..0deb53ab44 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -7,7 +7,7 @@ */ #include "staff-symbol-referencer.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "stem.hh" #include "musical-request.hh" #include "misc.hh" diff --git a/lily/stem.cc b/lily/stem.cc index e8fe8b4647..694be6fde2 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -15,7 +15,7 @@ #include "stem.hh" #include "debug.hh" #include "paper-def.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "lookup.hh" #include "molecule.hh" #include "paper-column.hh" @@ -61,10 +61,10 @@ Stem::head_positions () const } - Drul_array e (extremal_heads ()); + Drul_array e (extremal_heads ()); - return Interval (staff_symbol_referencer (e[DOWN]).position_f (), - staff_symbol_referencer( e[UP]).position_f ()); + return Interval (Staff_symbol_referencer_interface (e[DOWN]).position_f (), + Staff_symbol_referencer_interface ( e[UP]).position_f ()); } @@ -159,7 +159,7 @@ Stem::heads_i ()const /* The note head which forms one end of the stem. */ -Note_head* +Rhythmic_head* Stem::first_head () const { return extremal_heads ()[-get_direction ()]; @@ -168,7 +168,7 @@ Stem::first_head () const /* START is part where stem reaches `last' head. */ -Drul_array +Drul_array Stem::extremal_heads () const { const int inf = 1000000; @@ -176,12 +176,12 @@ Stem::extremal_heads () const extpos[DOWN] = inf; extpos[UP] = -inf; - Drul_array exthead; + Drul_array exthead; exthead[LEFT] = exthead[RIGHT] =0; for (SCM s = get_elt_pointer ("heads"); gh_pair_p (s); s = gh_cdr (s)) { - Note_head * n = dynamic_cast (unsmob_element (gh_car (s))); + Rhythmic_head * n = dynamic_cast (unsmob_element (gh_car (s))); Staff_symbol_referencer_interface si (n); int p = int(si.position_f ()); @@ -205,12 +205,9 @@ Stem::add_head (Rhythmic_head *n) n->set_elt_pointer ("stem", this->self_scm_); n->add_dependency (this); - if (Note_head *nh = dynamic_cast (n)) + if (to_boolean (n->get_elt_property ("note-head-interface"))) { - Pointer_group_interface gi (this); - gi.name_ = "heads"; - - gi.add_element (n); + Pointer_group_interface (this, "heads").add_element (n); } else { @@ -232,7 +229,7 @@ Stem::invisible_b () const /* UGH. Who determines balltype for stem? */ - Note_head * nh = dynamic_cast (support_head ()); + Rhythmic_head * nh = dynamic_cast (support_head ()); return !(heads_i () && nh->balltype_i () >= 1); } @@ -476,7 +473,7 @@ Stem::member_brew_molecule () const Interval stem_y(y1,y2); stem_y.unite (Interval (y2,y1)); - Real dy = staff_symbol_referencer (this).staff_space ()/2.0; + Real dy = Staff_symbol_referencer_interface (this).staff_space ()/2.0; Real head_wid = 0; if (support_head ()) head_wid = support_head ()->extent (X_AXIS).length (); @@ -506,7 +503,7 @@ Stem::off_callback (Score_element const* se, Axis) Stem *st = dynamic_cast ((Score_element*)se); Real r=0; - if (Note_head * f = st->first_head ()) + if (Rhythmic_head * f = st->first_head ()) { Interval head_wid(0, f->extent (X_AXIS).length ()); diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 3611f59dcc..7e2a394326 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -12,7 +12,7 @@ #include "side-position-interface.hh" #include "item.hh" #include "musical-request.hh" -#include "note-head.hh" + #include "stem.hh" #include "staff-symbol.hh" @@ -24,7 +24,6 @@ class Text_engraver : public Engraver Link_array reqs_; Link_array texts_; public: - VIRTUAL_COPY_CONS(Translator); protected: virtual bool do_try_music (Music* m); @@ -48,20 +47,20 @@ Text_engraver::do_try_music (Music *m) void -Text_engraver::acknowledge_element (Score_element_info i) +Text_engraver::acknowledge_element (Score_element_info inf) { - if (Note_head *n = dynamic_cast (i.elem_l_)) + if (to_boolean (inf.elem_l_->get_elt_property ("note-head-interface"))) { for (int i=0; i < texts_.size (); i++) { Side_position_interface st (texts_[i]); - st.add_support (n); + st.add_support (inf.elem_l_); if (st.get_axis( ) == X_AXIS && !texts_[i]->parent_l (Y_AXIS)) - texts_[i]->set_parent (n, Y_AXIS); + texts_[i]->set_parent (inf.elem_l_, Y_AXIS); } } - if (Stem *n = dynamic_cast (i.elem_l_)) + if (Stem *n = dynamic_cast (inf.elem_l_)) { for (int i=0; i < texts_.size (); i++) { diff --git a/lily/text-item.cc b/lily/text-item.cc index 777706f0bf..84a006243d 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -39,7 +39,7 @@ Text_item::brew_molecule (SCM sm) Molecule m; m.set_empty (false); mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)* - staff_symbol_referencer (s).staff_space ()); + Staff_symbol_referencer_interface (s).staff_space ()); } return mol.create_scheme (); } diff --git a/lily/tie-column.cc b/lily/tie-column.cc index a1910eeabc..63e3d2a465 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -11,7 +11,7 @@ #include "group-interface.hh" #include "tie.hh" #include "directional-element-interface.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" Tie_column::Tie_column (SCM s) : Spanner (s) diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 6d07edd453..020779e482 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -9,7 +9,7 @@ #include "tie-engraver.hh" #include "command-request.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "musical-request.hh" #include "tie.hh" #include "translator-group.hh" @@ -19,10 +19,10 @@ struct CHead_melodic_tuple { Melodic_req *req_l_ ; - Note_head *head_l_; + Rhythmic_head *head_l_; Moment end_; CHead_melodic_tuple (); - CHead_melodic_tuple (Note_head*, Melodic_req*, Moment); + CHead_melodic_tuple (Rhythmic_head*, Melodic_req*, Moment); static int pitch_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &); static int time_compare (CHead_melodic_tuple const &, CHead_melodic_tuple const &); }; @@ -100,7 +100,7 @@ Tie_engraver::set_melisma (bool m) void Tie_engraver::acknowledge_element (Score_element_info i) { - if (Note_head *nh = dynamic_cast (i.elem_l_)) + if (Rhythmic_head *nh = dynamic_cast (i.elem_l_)) { Note_req * m = dynamic_cast (i.req_l_); if (!m) @@ -250,7 +250,7 @@ CHead_melodic_tuple::CHead_melodic_tuple () end_ = 0; } -CHead_melodic_tuple::CHead_melodic_tuple (Note_head *h, Melodic_req*m, Moment mom) +CHead_melodic_tuple::CHead_melodic_tuple (Rhythmic_head *h, Melodic_req*m, Moment mom) { head_l_ = h; req_l_ = m; diff --git a/lily/tie.cc b/lily/tie.cc index 02dd922b2d..e777a74fba 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -10,7 +10,7 @@ #include "lookup.hh" #include "paper-def.hh" #include "tie.hh" -#include "note-head.hh" +#include "rhythmic-head.hh" #include "bezier.hh" #include "paper-column.hh" #include "debug.hh" @@ -39,21 +39,21 @@ Tie::Tie(SCM s) } -Note_head* +Rhythmic_head* Tie::head (Direction d) const { SCM c = get_elt_pointer ("heads"); c = index_cell (c, d); - return dynamic_cast (unsmob_element (c)); + return dynamic_cast (unsmob_element (c)); } Real Tie::position_f () const { return head (LEFT) - ? staff_symbol_referencer (head (LEFT)).position_f () - : staff_symbol_referencer (head (RIGHT)).position_f () ; + ? Staff_symbol_referencer_interface (head (LEFT)).position_f () + : Staff_symbol_referencer_interface (head (RIGHT)).position_f () ; } @@ -84,7 +84,7 @@ Tie::do_add_processing() warning (_ ("lonely tie")); Direction d = LEFT; - Drul_array new_head_drul; + Drul_array new_head_drul; new_head_drul[LEFT] = head(LEFT); new_head_drul[RIGHT] = head(RIGHT); do { @@ -110,7 +110,7 @@ Tie::member_after_line_breaking () if (!Directional_element_interface (this).get ()) Directional_element_interface (this).set (get_default_dir ()); - Real staff_space = staff_symbol_referencer (this).staff_space (); + Real staff_space = Staff_symbol_referencer_interface (this).staff_space (); Real half_space = staff_space / 2; Real x_gap_f = paper_l ()->get_var ("tie_x_gap"); Real y_gap_f = paper_l ()->get_var ("tie_y_gap"); @@ -220,7 +220,7 @@ Tie::get_curve () const Direction d (Directional_element_interface (this).get ()); Bezier_bow b (get_encompass_offset_arr (), d); - Real staff_space = staff_symbol_referencer (this).staff_space (); + Real staff_space = Staff_symbol_referencer_interface (this).staff_space (); Real h_inf = paper_l ()->get_var ("tie_height_limit_factor") * staff_space; Real r_0 = paper_l ()->get_var ("tie_ratio"); diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 0f9badfc34..3acb6c68f3 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -114,21 +114,7 @@ Tuplet_spanner::member_brew_molecule () const } return mol.create_scheme(); } - -void -Tuplet_spanner::do_add_processing () -{ -#if 0 - if (gh_pair_p (get_elt_pointer ("columns"))) - { - Link_array column_arr= - Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns"); - - set_bound (LEFT, column_arr[0]); - set_bound (RIGHT, column_arr.top ()); - } -#endif -} + diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index bf7eb05c05..6e99afdb84 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -93,21 +93,7 @@ Volta_spanner::member_brew_molecule () const mol.translate_axis (left, X_AXIS); return mol.create_scheme(); } - -void -Volta_spanner::do_add_processing () -{ -#if 0 - Link_array bar_arr - = Pointer_group_interface__extract_elements (this, (Bar*)0, "bars"); - if (bar_arr.size ()) - { - set_bound (LEFT, bar_arr[0]); - set_bound (RIGHT, bar_arr.top ()); - } -#endif -} GLUE_SCORE_ELEMENT(Volta_spanner,after_line_breaking); SCM diff --git a/ly/engraver.ly b/ly/engraver.ly index 2fff02a9f8..cb548ddced 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -461,11 +461,10 @@ ScoreContext = \translator { (molecule-callback . ,Crescendo::brew_molecule) ) basicDotColumnProperties = #`( - (after-line-breaking-callback . ,Dot_column::after_line_breaking) + (dot-column-interface . #t) ) basicDotsProperties = #`( (molecule-callback . ,Dots::brew_molecule) - (after-line-breaking-callback . ,Dots::after_line_breaking) (dot-count . 1) (dots-interface . #t) ) @@ -525,7 +524,7 @@ ScoreContext = \translator { basicMultiMeasureRestProperties = #`( (molecule-callback . ,Multi_measure_rest::brew_molecule) (staff-position . 0) - (after-line-breaking-callback . ,Multi_measure_rest::after_line_breaking) + ) basicNoteColumnProperties = #`( (axes 0 1) @@ -533,8 +532,6 @@ ScoreContext = \translator { basicNoteHeadProperties = #`( (note-head-interface . #t) (molecule-callback . ,Note_head::brew_molecule) - (before-line-breaking-callback . ,Note_head::before_line_breaking) - (after-line-breaking-callback . ,Rhythmic_head::after_line_breaking) ) basicNoteNameProperties = #`( (molecule-callback . ,Text_item::brew_molecule) @@ -557,7 +554,6 @@ ScoreContext = \translator { basicRestProperties = #`( (rest-interface . #t) (molecule-callback . ,Rest::brew_molecule) - (after-line-breaking-callback . ,Rhythmic_head::after_line_breaking) (minimum-beam-collision-distance . 1.5) ) @@ -611,6 +607,7 @@ ScoreContext = \translator { basicStemProperties = #`( (before-line-breaking-callback . ,Stem::before_line_breaking) (molecule-callback . ,Stem::brew_molecule) + (stem-interface . #t) ) staffSymbolBasicProperties = #`( (molecule-callback . ,Staff_symbol::brew_molecule) diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 4bb845b7e0..00ee1d42b0 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.66 -Entered-date: 29JUN00 +Version: 1.3.67 +Entered-date: 30JUN00 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.66.tar.gz + 1000k lilypond-1.3.67.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.66.tar.gz + 1000k lilypond-1.3.67.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 107f9ff031..0f23a1b61b 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.66 +Version: 1.3.67 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.66.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.67.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # Icon: lilypond-icon.gif diff --git a/scm/slur.scm b/scm/slur.scm index 58a1b2b99f..540ce7ac7f 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -1,12 +1,12 @@ (define (attached-to-stem slur dir) - (let* ((note-columns (get-pointer slur 'note-columns)) + (let* ((note-columns (ly-get-elt-pointer slur 'note-columns)) (col (if (= dir 1) (car note-columns) (car (reverse note-columns)))) - (stem (get-pointer col 'stem))) + (stem (ly-get-elt-pointer col 'stem))) (and - (eq? col (get-bound slur dir)) + (eq? col (ly-get-spanner-bound slur dir)) stem - (get-pointer stem 'heads)))) + (ly-get-elt-pointer stem 'heads)))) ;; Slur-extremity-rules is a list of rules. Each rule is a pair @@ -25,38 +25,38 @@ (define slur-extremity-rules (list - (cons (lambda (slur dir) - ;; urg, code dup - (let* ((note-columns (get-pointer slur 'note-columns)) - (col (if (= dir 1) (car note-columns) (car (reverse note-columns)))) - (stem (get-pointer col 'stem))) - (and stem - (not (= (get-property slur 'direction) - (get-property stem 'direction)))))) 'head) + (cons (lambda (slur dir) + ;; urg, code dup + (let* ((note-columns (ly-get-elt-pointer slur 'note-columns)) + (col (if (= dir 1) (car note-columns) (car (reverse note-columns)))) + (stem (ly-get-elt-pointer col 'stem))) + (and stem + (not (= (ly-get-elt-property slur 'direction) + (ly-get-elt-property stem 'direction)))))) 'head) - (cons (lambda (slur dir) - ;; if attached-to-stem - (and (attached-to-stem slur dir) - ;; and got beam - ;; urg, code dup - (let* ((note-columns (get-pointer slur 'note-columns)) - (col (if (= dir 1) (car note-columns) (car (reverse note-columns)))) - (stem (get-pointer col 'stem))) - (and stem - (get-pointer stem 'beam) - ;; and beam on same side as slur - (let ((beaming (get-property stem 'beaming))) - (if (pair? beaming) - (<= 1 - (if (= dir -1) (car beaming) (cdr beaming))) - #f)))))) - 'stem) + (cons (lambda (slur dir) + ;; if attached-to-stem + (and (attached-to-stem slur dir) + ;; and got beam + ;; urg, code dup + (let* ((note-columns (ly-get-elt-pointer slur 'note-columns)) + (col (if (= dir 1) (car note-columns) (car (reverse note-columns)))) + (stem (ly-get-elt-pointer col 'stem))) + (and stem + (ly-get-elt-pointer stem 'beam) + ;; and beam on same side as slur + (let ((beaming (ly-get-elt-property stem 'beaming))) + (if (pair? beaming) + (<= 1 + (if (= dir -1) (car beaming) (cdr beaming))) + #f)))))) + 'stem) - (cons (lambda (slur dir) (not (attached-to-stem slur dir))) 'loose-end) + (cons (lambda (slur dir) (not (attached-to-stem slur dir))) 'loose-end) - ;; default case, attach to head - (cons (lambda (x y) #t) 'head) - )) + ;; default case, attach to head + (cons (lambda (x y) #t) 'head) + )) ;; This list defines the offsets for each type of attachment. -- 2.39.2