From: fred Date: Tue, 26 Mar 2002 23:24:04 +0000 (+0000) Subject: lilypond-1.3.67 X-Git-Tag: release/1.5.59~1517 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c0235018f3048461617175b35ee607fdd7ba533f;p=lilypond.git lilypond-1.3.67 --- 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/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/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/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/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/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/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/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