From 163503e56aa0c03d41d37fd083bdb96a6a473a11 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 14 Dec 1999 01:19:34 +0100 Subject: [PATCH] release: 1.3.11 --- CHANGES | 9 + Documentation/programmer/regression-test.tely | 4 +- Documentation/user/refman.itely | 7 +- TODO | 4 +- VERSION | 4 +- input/bugs/c.ly | 24 --- input/bugs/cr.ly | 2 - lily/align-element.cc | 5 +- lily/axis-group-element.cc | 37 +--- lily/axis-group-engraver.cc | 2 +- lily/axis-group-item.cc | 41 ----- lily/axis-group-spanner.cc | 166 ------------------ lily/bar-script-engraver.cc | 2 +- lily/beam-engraver.cc | 3 +- lily/beam.cc | 50 +++--- lily/bow.cc | 2 +- lily/breathing-sign-engraver.cc | 3 + lily/breathing-sign.cc | 7 +- lily/chord-tremolo-engraver.cc | 12 +- lily/clef-engraver.cc | 12 +- lily/clef-item.cc | 4 +- lily/collision.cc | 2 +- lily/dimension-cache.cc | 17 +- lily/directional-spanner.cc | 10 +- lily/dot-column.cc | 22 ++- lily/dots.cc | 6 +- lily/dynamic-engraver.cc | 2 +- lily/file-results.cc | 0 lily/grace-position-engraver.cc | 5 +- lily/group-interface.cc | 7 +- lily/include/axis-group-element.hh | 20 --- lily/include/axis-group-item.hh | 5 +- lily/include/axis-group-spanner.hh | 3 - lily/include/breathing-sign.hh | 2 - lily/include/chord-tremolo.hh | 28 --- lily/include/clef-item.hh | 5 +- lily/include/dots.hh | 5 +- lily/include/glob.hh | 0 lily/include/graphical-element.hh | 27 --- lily/include/group-interface.hh | 2 +- lily/include/key-item.hh | 5 +- lily/include/local-key-item.hh | 5 +- lily/include/multi-measure-rest.hh | 5 +- lily/include/new-beaming.hh | 0 lily/include/new-repeated-music.hh | 0 lily/include/note-head.hh | 5 +- lily/include/parseconstruct.hh | 0 lily/include/rest.hh | 3 - lily/include/rhythmic-head.hh | 12 +- lily/include/score-element.hh | 8 +- ...aff-side.hh => side-position-interface.hh} | 16 +- lily/include/spanner.hh | 1 - lily/include/staff-bar.hh | 5 +- lily/include/staff-sym-engraver.hh | 32 ---- lily/include/staff-symbol-referencer.hh | 11 +- lily/include/staff-symbol.hh | 2 + lily/include/stem-staff-side.hh | 42 ----- lily/include/stem.hh | 22 +-- lily/include/symbols.hh | 0 lily/key-engraver.cc | 4 + lily/key-item.cc | 5 +- lily/line-of-score.cc | 7 - lily/local-key-engraver.cc | 4 + lily/local-key-item.cc | 4 +- lily/multi-measure-rest-engraver.cc | 5 + lily/multi-measure-rest.cc | 12 +- lily/note-column.cc | 19 +- lily/note-head-side.cc | 2 +- lily/note-head.cc | 44 ++--- lily/note-heads-engraver.cc | 15 +- lily/paper-score.cc | 11 ++ lily/pitch-squash-engraver.cc | 3 +- lily/rest-engraver.cc | 14 +- lily/rest.cc | 39 ++-- lily/rhythmic-head.cc | 29 ++- lily/score-element.cc | 67 +++---- lily/script-column-engraver.cc | 4 +- lily/script-column.cc | 2 +- lily/script-engraver.cc | 5 +- lily/script.cc | 2 +- ...aff-side.cc => side-position-interface.cc} | 31 ++-- lily/spanner.cc | 23 +-- lily/specialty-engraver.cc | 35 ---- lily/staff-bar.cc | 12 +- lily/staff-margin-engraver.cc | 2 +- ...m-engraver.cc => staff-symbol-engraver.cc} | 29 ++- lily/staff-symbol-referencer.cc | 83 ++++++--- lily/{staff-sym.cc => staff-symbol.cc} | 5 + lily/stem-engraver.cc | 12 +- lily/stem-info.cc | 0 lily/stem-staff-side.cc | 0 lily/stem-tremolo.cc | 7 +- lily/stem.cc | 75 ++++---- lily/text-engraver.cc | 2 +- lily/tie.cc | 28 +-- lily/vertical-align-engraver.cc | 7 - make/out/lilypond.lsm | 8 +- make/out/lilypond.spec | 4 +- 98 files changed, 511 insertions(+), 891 deletions(-) delete mode 100644 input/bugs/c.ly delete mode 100644 input/bugs/cr.ly delete mode 100644 lily/axis-group-item.cc delete mode 100644 lily/axis-group-spanner.cc delete mode 100644 lily/file-results.cc delete mode 100644 lily/include/chord-tremolo.hh delete mode 100644 lily/include/glob.hh delete mode 100644 lily/include/graphical-element.hh delete mode 100644 lily/include/new-beaming.hh delete mode 100644 lily/include/new-repeated-music.hh delete mode 100644 lily/include/parseconstruct.hh rename lily/include/{staff-side.hh => side-position-interface.hh} (73%) delete mode 100644 lily/include/staff-sym-engraver.hh delete mode 100644 lily/include/stem-staff-side.hh delete mode 100644 lily/include/symbols.hh rename lily/{staff-side.cc => side-position-interface.cc} (88%) delete mode 100644 lily/specialty-engraver.cc rename lily/{staff-sym-engraver.cc => staff-symbol-engraver.cc} (75%) rename lily/{staff-sym.cc => staff-symbol.cc} (95%) delete mode 100644 lily/stem-info.cc delete mode 100644 lily/stem-staff-side.cc diff --git a/CHANGES b/CHANGES index 972c92ac2d..db957bac39 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ + +pl 10.uu1 + - various small bfs + - bf: alignment reversed + - Staff_symbol_referencer -> Staff_symbol_referencer_interface + - bf: staccato pos + - Knee fixes (thanks, Jan) + pl 10.jcn2 - fixes for invisible beamed stems - removed steminfo from properties, don't cache Stem_info @@ -6,6 +14,7 @@ pl 10.jcn1 - steminfo to properties - dropped internote dim for stem-beams +********** pl 9.hwn1 - abstracting Staff_symbol_referencer to an interface. - quantised_position for staccato dots. diff --git a/Documentation/programmer/regression-test.tely b/Documentation/programmer/regression-test.tely index 2496262883..de989ac512 100644 --- a/Documentation/programmer/regression-test.tely +++ b/Documentation/programmer/regression-test.tely @@ -67,7 +67,7 @@ like beam segments crossing stems. If the stem is in a beam, the tremolo must be parallel to the beam. If the stem is invisible (eg. on a whole note), the tremolo must be centered on the note. -@mudelafile{stem-tremolo.ly} +@c @mu delafile{stem-tremolo.ly} Chord tremolos look like beams, but are a kind of repeat symbol. To avoid confusion, chord tremolo beams do not reach the stems, but @@ -75,7 +75,7 @@ leave a gap. Chord tremolo beams on half notes are not ambiguous, as half notes cannot appear in a regular beam, and should reach the stems. -@mudelafile{chord-tremolo.sly} +@c miudelafile{chord-tremolo.sly} Beams, stems and noteheads often have communication troubles, since the two systems for y dimensions (1 unit = staffspace, 1 unit = 1 diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 08b7db490f..4a5a95c7a2 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -1020,14 +1020,15 @@ construction will produce odd effects. To create tremolo beams on a single note, simply attach `@code{:}@var{length}' to the note itself (see also section XREF-tremolo [FIXME]). -@mudela[fragment,verbatim,center] +@ignore +@mu dela[fragment,verbatim,center] [:16 e'1 g'] [:8 e'4 f'] @end mudela -@mudela[fragment,verbatim,center] +@mud ela[fragment,verbatim,center] c'4:32 [:16 c'8 d'8] @end mudela - +@end ignore @cindex --@@@code{-}@code{-} diff --git a/TODO b/TODO index 48be8ed92c..5bf1c889c4 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,8 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. .* TODO . * use hash tabs iso. alist_ for elt property? . * agressive type-checking for SCM stuff. +. * use "staff-space" and "half-space" iso interline, + staff_line_leading () etc. . * TODO^2: . * make a TODO.texi, like http://www.gnu.org/software/guile/ideas.html @@ -24,8 +26,6 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. ctor_dict["Score_element"]->create_func (); . * acc at tied note after linebreak. . * fix font-naming and selecting -. * fix naming: \interline Context.staffLineLeading, staff_line_leading (), -staff_position staff_space . * chord tonic: placement of accidental C#, Cb (from scm and C++) . * note head on stem err msg in dutch. . * why need to run -C mf twice? diff --git a/VERSION b/VERSION index 130506112a..b5129961d5 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=10 -MY_PATCH_LEVEL=jcn2 +PATCH_LEVEL=11 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/c.ly b/input/bugs/c.ly deleted file mode 100644 index 0f605aa829..0000000000 --- a/input/bugs/c.ly +++ /dev/null @@ -1,24 +0,0 @@ -% core dumps - -global = \notes { - \key a \minor; - \time 6/4; -} - -\score{ - \notes \context PianoStaff < - \global - \context Staff=up { c } - %\context Staff=down { \autochange Staff c } -% \context Staff=down { c } - > - \paper { - \translator{ - \StaffContext - - % other core dump when this is removed? -% \remove "Time_signature_engraver"; - } - } -} - diff --git a/input/bugs/cr.ly b/input/bugs/cr.ly deleted file mode 100644 index 6392a695c0..0000000000 --- a/input/bugs/cr.ly +++ /dev/null @@ -1,2 +0,0 @@ - -\score { \notes { c1 \< \break \! c1 }} diff --git a/lily/align-element.cc b/lily/align-element.cc index 4134d8e3e2..5f4080015c 100644 --- a/lily/align-element.cc +++ b/lily/align-element.cc @@ -97,12 +97,13 @@ Align_element::do_side_processing () if (center_f) translate_axis ( - center_f, axis ()); - dim_cache_[axis ()]->invalidate (); + + // dim_cache_[axis ()]->invalidate (); + } Align_element::Align_element() { - ordered_b_ = true; threshold_interval_ = Interval (0, Interval::infinity ()); stacking_dir_ = DOWN; align_dir_ = CENTER; diff --git a/lily/axis-group-element.cc b/lily/axis-group-element.cc index 5992ea4614..081b42a22f 100644 --- a/lily/axis-group-element.cc +++ b/lily/axis-group-element.cc @@ -6,9 +6,9 @@ (c) 1997--1999 Han-Wen Nienhuys */ -#include "axis-group-element.hh" #include "axis-group-element.hh" #include "dimension-cache.hh" +#include "group-interface.hh" Link_array Axis_group_element::get_extra_dependencies() const @@ -20,17 +20,8 @@ Axis_group_element::get_extra_dependencies() const Link_array Axis_group_element::elem_l_arr () const { - /* - ugh. I know - */ - Link_array r; - for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) - { - SCM e=gh_car (s); - r.push (unsmob_element (e)); - } - - return r; + return + Group_interface__extract_elements (this, (Score_element*)0, "elements"); } Link_array @@ -96,15 +87,6 @@ Axis_group_element::extent_callback (Dimension_cache const *c) } -/* - UGH. - */ -void -Axis_group_element::add_extra_element (Score_element *e) -{ - add_element (e); -} - void Axis_group_element::add_element (Score_element *e) @@ -117,16 +99,7 @@ Axis_group_element::add_element (Score_element *e) if (!e->parent_l (axes_[i])) e->set_parent (this, axes_[i]); } - set_elt_property ("elements", - gh_cons (e->self_scm_, - get_elt_property ("elements"))); - - assert (e->parent_l(Y_AXIS) == this || e->parent_l (X_AXIS) == this); + Group_interface gi (this); + gi.add_element (e); } - - - - - - diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 85d21f0f8c..22cfb5fdf3 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -55,7 +55,7 @@ Axis_group_engraver::process_acknowledged () && ! dynamic_cast (elts_[i]->parent_l (Y_AXIS))) { - staffline_p_->add_extra_element (elts_[i]); + staffline_p_->add_element (elts_[i]); } } elts_.clear (); diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc deleted file mode 100644 index fdbcf9cf29..0000000000 --- a/lily/axis-group-item.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - axis-item.cc -- implement Axis_group_item - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys -*/ -#include "axis-group-item.hh" -#include "paper-column.hh" - - - -void -Axis_group_item::do_breakable_col_processing() -{ -#if 0 - if (!breakable_b ()) // ugh should merge with Item code - return; - - OK(); - copy_breakable_items(); - - - Link_array elems = elem_l_arr (); - for (int i=0; i < elems.size(); i++) - { - Item* it_l = dynamic_cast (elems[i]); - Direction j=LEFT; - do - { - Axis_group_item * my_brok - = dynamic_cast (find_broken_piece(j)); - Item *new_l = it_l->find_broken_piece (j); - my_brok->add_element (new_l); - } - while (flip(&j)!=LEFT); - } -#endif - Item::do_breakable_col_processing(); -} - diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc deleted file mode 100644 index 7af3118a11..0000000000 --- a/lily/axis-group-spanner.cc +++ /dev/null @@ -1,166 +0,0 @@ -/* - axis-group-spanner.cc -- implement Axis_group_spanner - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys -*/ - -#include "axis-group-spanner.hh" -#include "debug.hh" -#include "item.hh" -#include "paper-column.hh" - -/** Do stuff if we're not broken. In this case the last and first - columns usually are pre- and postbreak respectively, - so the items from these columns need adjusting. - */ -void -Axis_group_spanner::do_break_processing_if_unbroken() -{ -#if 0 - Link_array elems = elem_l_arr (); - Line_of_score *my_line = line_l(); - for (int i=0; i < elems.size(); i++) - { - if (!elems[i]->line_l()) - { - Item * item_l = dynamic_cast (elems[i]); - if (item_l - && item_l->breakable_b () - && item_l->break_status_dir() == 0) - { - // last two checks are paranoia - Score_element * broken_item_l = - item_l->find_broken_piece (my_line); - add_element (broken_item_l); - } - - Spanner *spanner_l = dynamic_cast (elems[i]); - if (spanner_l) - { - Score_element *broken_spanner_l = - spanner_l->find_broken_piece (my_line); - add_element (broken_spanner_l); - } - remove_element (elems[i]); - } - - } -#endif -} - -void -Axis_group_spanner::do_break_processing() -{ - Spanner::do_break_processing (); - - bool breaking_self_b = ! Spanner::line_l(); - if (!breaking_self_b) - { - do_break_processing_if_unbroken(); - Spanner::do_break_processing(); - return; - } - -#if 0 - break_into_pieces (); - Link_array loose_elems = elem_l_arr (); - - Array axeses; - - for (int i=0; i < loose_elems.size (); i++) - { - Score_element* elt = loose_elems[i]; - /* - with which axes do we have to meddle? - */ - int j =0; - int as [2]; - for (int a = X_AXIS; a < NO_AXES; ++a) - if (elt->parent_l (Axis (a)) == this) - as[j++] = a; - if (j == 1) - as[j++] = as[0]; - - axeses.push (as[0]); - axeses.push (as[1]); - } - - remove_all(); - - for (int i=0; i < loose_elems.size(); i++) - { - Score_element * elt = loose_elems[i]; - Line_of_score *elt_line = elt->line_l(); - - Axis a1= (Axis)axeses[2*i]; // ugh. - Axis a2= (Axis)axeses[2*i+1]; // ugh. - if (! elt_line) - { - /* this piece doesn't know where it belongs. - Find out if it was broken, and use the broken remains - */ - - - Item *it = dynamic_cast (elt) ; - if (Spanner * sp =dynamic_cast (elt)) - { - for (int j =0; j < sp->broken_into_l_arr_.size(); j++) - { - Line_of_score *l = sp->broken_into_l_arr_[j]->line_l (); - - Axis_group_spanner * my_broken_l - = dynamic_cast(find_broken_piece (l)); - - Score_element * broken_span_l - = sp->find_broken_piece (l); - - if (broken_span_l) - my_broken_l->add_element (broken_span_l, a1, a2); - } - } - else if (it && it->broken_original_b ()) - { - // broken items - Direction j=LEFT; - do - { - Item * broken_item = it->find_broken_piece (j); - Line_of_score * item_line_l = broken_item->line_l() ; - if (! item_line_l) - continue; - - Axis_group_spanner * v - = dynamic_cast(find_broken_piece (item_line_l)); - if (v) - v->add_element (broken_item, a1, a2); - else - { - broken_item->set_elt_property ("transparent", SCM_BOOL_T); - broken_item->set_empty (X_AXIS); // UGH. - broken_item->set_empty (Y_AXIS); - } - - } - while (flip(&j) != LEFT); - } - } - else - { - /* this piece *does* know where it belongs. - Put it in appropriate piece of this spanner - */ - Axis_group_spanner * my_broken_l - = dynamic_cast (find_broken_piece (elt->line_l())); - my_broken_l->add_element (elt, a1, a2); - } - } - - Spanner::do_break_processing(); -#endif -} - - - - diff --git a/lily/bar-script-engraver.cc b/lily/bar-script-engraver.cc index 1e82d91657..f4fa06452c 100644 --- a/lily/bar-script-engraver.cc +++ b/lily/bar-script-engraver.cc @@ -10,7 +10,7 @@ #include "bar-script-engraver.hh" #include "bar.hh" #include "clef-item.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "text-item.hh" #include "lily-guile.hh" #include "paper-column.hh" diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 1d1a70addf..1fa729cc51 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -183,7 +183,8 @@ Beam_engraver::acknowledge_element (Score_element_info info) return; } - stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_; + stem_l->set_elt_property ("duration-log", + gh_int2scm (rhythmic_req->duration_.durlog_i_)); Moment stem_location = now_mom () - beam_start_mom_ + beam_start_location_; beam_info_p_->add_stem (stem_location, rhythmic_req->duration_.durlog_i_ - 2); beam_p_->add_stem (stem_l); diff --git a/lily/beam.cc b/lily/beam.cc index 146a47218d..8b25aeb5d5 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -30,6 +30,7 @@ #include "paper-def.hh" #include "lookup.hh" #include "group-interface.hh" +#include "staff-symbol-referencer.hh" #include "cross-staff.hh" Beam::Beam () @@ -266,14 +267,7 @@ Beam::do_post_processing () } -#if 0 -Interval -Beam::do_width () const -{ - return Interval (stem (0)->hpos_f (), - stems_.top ()->hpos_f ()); -} -#endif + Direction Beam::get_default_dir () const @@ -350,7 +344,7 @@ Beam::set_direction (Direction d) Stem *s = stem (i); s->set_elt_property ("beam-dir", gh_int2scm (d)); - SCM force = s->remove_elt_property ("dir-forced"); + SCM force = s->get_elt_property ("dir-forced"); // remove_prop? if (force == SCM_UNDEFINED) s->set_direction ( d); } @@ -372,7 +366,7 @@ Beam::solve_slope () Stem* s = stem (i); if (s->invisible_b ()) continue; - l.input.push (Offset (s->hpos_f () - x0, s->get_info ().idealy_f_)); + l.input.push (Offset (s->hpos_f () - x0, s->calc_stem_info ().idealy_f_)); } l.minimise (slope_f_, left_y_); } @@ -397,16 +391,21 @@ Beam::check_stemlengths_f (bool set_b) if (s->invisible_b ()) continue; Real y = (s->hpos_f () - x0) * slope_f_ + left_y_; - Stem_info info = s->get_info (); + Stem_info info = s->calc_stem_info (); // correct for knee if (get_direction () != s->get_direction ()) { y -= get_direction () * (beam_f / 2 + (multiplicity_i_ - 1) * interbeam_f); + + + Staff_symbol_referencer_interface s1 (s); + Staff_symbol_referencer_interface s2 (stem_top ()); + if (!i - && s->staff_symbol_l () != stem_top ()->staff_symbol_l ()) - y += get_direction () * (multiplicity_i_ - (s->flag_i_ - 2) >? 0) + && s1.staff_symbol_l () != s2.staff_symbol_l ()) + y += get_direction () * (multiplicity_i_ - (s->flag_i () - 2) >? 0) * interbeam_f; } @@ -486,10 +485,10 @@ Beam::calculate_slope () { if (!stem_count ()) slope_f_ = left_y_ = 0; - else if (first_visible_stem ()->get_info ().idealy_f_ == last_visible_stem ()->get_info ().idealy_f_) + else if (first_visible_stem ()->calc_stem_info ().idealy_f_ == last_visible_stem ()->calc_stem_info ().idealy_f_) { slope_f_ = 0; - left_y_ = first_visible_stem ()->get_info ().idealy_f_; + left_y_ = first_visible_stem ()->calc_stem_info ().idealy_f_; left_y_ *= get_direction (); } else @@ -504,9 +503,9 @@ Beam::calculate_slope () Real lengthened = paper_l ()->get_var ("beam_lengthened"); Real steep = paper_l ()->get_var ("beam_steep_slope"); - if (((left_y_ - first_visible_stem ()->get_info ().idealy_f_ > lengthened) + if (((left_y_ - first_visible_stem ()->calc_stem_info ().idealy_f_ > lengthened) && (slope_f_ > steep)) - || ((left_y_ + slope_f_ * dx_f - last_visible_stem ()->get_info ().idealy_f_ > lengthened) + || ((left_y_ + slope_f_ * dx_f - last_visible_stem ()->calc_stem_info ().idealy_f_ > lengthened) && (slope_f_ < -steep))) { slope_f_ = 0; @@ -552,7 +551,9 @@ Beam::quantise_dy () if (q == ly_symbol2scm ("none")) return; - Real interline_f = stem (0)->staff_line_leading_f (); + Staff_symbol_referencer_interface st (this); + Real interline_f = st.staff_line_leading_f (); + Real staffline_f = paper_l ()->get_var ("stafflinethickness"); Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));; @@ -601,7 +602,8 @@ Beam::quantise_left_y (bool extend_b) hang straddle sit inter hang */ - Real space = stem (0)->staff_line_leading_f (); + Staff_symbol_referencer_interface sinf (this); + Real space = sinf.staff_line_leading_f (); Real staffline_f = paper_l ()->get_var ("stafflinethickness"); Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));; @@ -709,16 +711,6 @@ Beam::do_add_processing () } while ((flip (&d)) != LEFT); } -#if 0 - /* - Why? - */ - if (stem_count ()) - { - stem (0)->beams_i_drul_[LEFT] =0; - stem (stem_count () -1)->beams_i_drul_[RIGHT] =0; - } -#endif } diff --git a/lily/bow.cc b/lily/bow.cc index ca967f0ee3..5d44313d04 100644 --- a/lily/bow.cc +++ b/lily/bow.cc @@ -6,8 +6,8 @@ (c) 1997--1999 Han-Wen Nienhuys Jan Nieuwenhuizen */ -#include "dimension-cache.hh" +#include "dimension-cache.hh" #include "bow.hh" #include "debug.hh" #include "paper-def.hh" diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc index df9c9a70bd..669a606353 100644 --- a/lily/breathing-sign-engraver.cc +++ b/lily/breathing-sign-engraver.cc @@ -13,6 +13,7 @@ TODO: */ +#include "staff-symbol-referencer.hh" #include "breathing-sign-engraver.hh" #include "breathing-sign.hh" #include "musical-request.hh" @@ -44,6 +45,8 @@ Breathing_sign_engraver::do_process_requests() { if(breathing_sign_req_l_) { breathing_sign_p_ = new Breathing_sign; + Staff_symbol_referencer_interface st (breathing_sign_p_); + st.set_interface (); announce_element (Score_element_info (breathing_sign_p_, breathing_sign_req_l_)); } diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index 3578e06210..bf1f8dea96 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -8,6 +8,7 @@ TODO: --> see breathing-sign-engraver.cc */ +#include "staff-symbol-referencer.hh" #include "breathing-sign.hh" #include "string.hh" @@ -30,7 +31,9 @@ Breathing_sign::Breathing_sign () Molecule* Breathing_sign::do_brew_molecule_p () const { - Real dl = staff_line_leading_f(); + Staff_symbol_referencer_interface si (this); + + Real dl = si.staff_line_leading_f(); Interval i1(0, dl / 6), i2(-dl / 2, dl / 2); Box b(i1, i2); @@ -42,7 +45,7 @@ Breathing_sign::do_brew_molecule_p () const void Breathing_sign::do_post_processing() { - Real dl = staff_line_leading_f(); + Real dl = Staff_symbol_referencer_interface (this).staff_line_leading_f(); translate_axis(2.0 * dl * get_direction (), Y_AXIS); } diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 427e0d76e6..c705ea05a3 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -137,25 +137,25 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info i) if (Stem* s = dynamic_cast (i.elem_l_)) { int type_i = prev_start_req_->type_i_; - s->flag_i_ = intlog2 (type_i) - 2; + s->set_elt_property ("duration-log", gh_int2scm (intlog2 (type_i) - 2)); - s->beams_i_drul_[LEFT] = s->flag_i_; - s->beams_i_drul_[RIGHT] = s->flag_i_; + s->beams_i_drul_[LEFT] = s->flag_i (); + s->beams_i_drul_[RIGHT] = s->flag_i (); - abeam_p_->multiplicity_i_ = s->flag_i_; + abeam_p_->multiplicity_i_ = s->flag_i (); /* abbrev gaps on all but half note */ #if 0 if (s->type_i () != 1) { - int gap_i =s->flag_i_ - ((s->type_i () >? 2) - 2); + int gap_i =s->flag_i () - ((s->type_i () >? 2) - 2); s->set_elt_property ("beam-gap", gh_int2scm(gap_i)); } #else if (s->type_i () != 1) { - int gap_i =s->flag_i_ - ((s->type_i () >? 2) - 2); + int gap_i =s->flag_i () - ((s->type_i () >? 2) - 2); abeam_p_->set_elt_property ("beam-gap", gh_int2scm(gap_i)); } #endif diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 2ec5e9c569..226e7adaa4 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -13,6 +13,7 @@ */ #include +#include "staff-symbol-referencer.hh" #include "bar.hh" #include "clef-engraver.hh" #include "clef-item.hh" @@ -126,7 +127,8 @@ Clef_engraver::acknowledge_element (Score_element_info info) { if (Note_head * h = dynamic_cast(it_l)) { - h->set_position (int (h->position_f ()) + c0_position_i_); + Staff_symbol_referencer_interface si (h); + si.set_position (int (si.position_f ()) + c0_position_i_); } else if (Local_key_item *i = dynamic_cast (it_l)) { @@ -178,11 +180,15 @@ Clef_engraver::create_clef() Clef_item *c= new Clef_item; c->set_elt_property ("break-aligned", SCM_BOOL_T); announce_element (Score_element_info (c, clef_req_l_)); + + Staff_symbol_referencer_interface si(c); + si.set_interface (); + clef_p_ = c; } - + Staff_symbol_referencer_interface si(clef_p_); clef_p_->symbol_ = clef_type_str_; - clef_p_->set_position(clef_position_i_); + si.set_position (clef_position_i_); if (octave_dir_) { clef_p_->set_elt_property ("octave-dir", gh_int2scm (octave_dir_)); diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 838d06a808..c98c188f7c 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -15,12 +15,11 @@ #include "text-item.hh" #include "paper-score.hh" #include "dimension-cache.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" void Clef_item::do_pre_processing() { - Staff_symbol_referencer::do_pre_processing(); SCM style_sym =get_elt_property ("style"); String style; if (style_sym != SCM_UNDEFINED) @@ -43,7 +42,6 @@ Clef_item::Clef_item() set_elt_property ("breakable", SCM_BOOL_T); symbol_ = "treble"; - set_position(-2); } void diff --git a/lily/collision.cc b/lily/collision.cc index f1691792c6..1ee27e6c37 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -155,7 +155,7 @@ Collision::automatic_shift () bool merge = downpos == uppos - && nu_l->balltype_i_ == nd_l->balltype_i_ + && nu_l->balltype_i () == nd_l->balltype_i () && nu_l->dots_i () == nd_l->dots_i (); /* diff --git a/lily/dimension-cache.cc b/lily/dimension-cache.cc index aacf58aadc..ce851df2bd 100644 --- a/lily/dimension-cache.cc +++ b/lily/dimension-cache.cc @@ -46,8 +46,8 @@ Dimension_cache::init() void Dimension_cache::invalidate () { - off_valid_b_ =false; - valid_b_ = false; + /* off_valid_b_ =false; + valid_b_ = false;*/ } @@ -99,16 +99,13 @@ Dimension_cache::axis () const Real Dimension_cache::get_offset () const { - if (!off_valid_b_) + Dimension_cache *me = (Dimension_cache*) this; + while (off_callbacks_.size ()) { - Dimension_cache *d = (Dimension_cache*) this; - - d->basic_offset_ =0.0; - d->off_valid_b_ = true; - for (int i=0; i < off_callbacks_.size (); i++) - d->basic_offset_ += (*off_callbacks_[i]) (d); + Offset_cache_callback c = me->off_callbacks_[0]; + me->off_callbacks_.del (0); + me->basic_offset_ += (*c) (me); } - return basic_offset_ + extra_offset_; } diff --git a/lily/directional-spanner.cc b/lily/directional-spanner.cc index eb6b471fc6..41751d77a2 100644 --- a/lily/directional-spanner.cc +++ b/lily/directional-spanner.cc @@ -14,12 +14,4 @@ Directional_spanner::do_pre_processing() set_direction (get_default_dir()); } -#if 0 -Offset -Directional_spanner::center () const -{ - Real w= extent (X_AXIS).length (); - Offset o (w/2, 0); - return o; -} -#endif + diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 730228eeec..d085bf4011 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -10,6 +10,7 @@ #include "dot-column.hh" #include "rhythmic-head.hh" #include "group-interface.hh" +#include "staff-symbol-referencer.hh" void Dot_column::add_dots (Dots *d) @@ -35,7 +36,11 @@ Dot_column::add_head (Rhythmic_head *r) int Dot_column::compare (Dots * const &d1, Dots * const &d2) { - return int (d1->position_f () - d2->position_f ()); + Staff_symbol_referencer_interface s1(d1); + Staff_symbol_referencer_interface s2(d2); + + + return int (s1.position_f () - s2.position_f ()); } @@ -78,12 +83,15 @@ Dot_column::do_post_processing () int conflicts = 0; for (int i=0; i < dots.size (); i++) { + Real p = Staff_symbol_referencer_interface (dots[i]).position_f (); for (int j=0; j < taken_posns.size (); j++) - if (taken_posns[j] == (int) dots[i]->position_f ()) - conflicts++; - taken_posns.push ((int)dots[i]->position_f ()); - s.unite (Slice ((int)dots[i]->position_f (), - (int)dots[i]->position_f ())); + { + if (taken_posns[j] == (int) p) + conflicts++; + } + taken_posns.push ((int)p); + s.unite (Slice ((int)p, + (int)p)); } if (!conflicts) @@ -99,6 +107,6 @@ Dot_column::do_post_processing () for (int i=0; i set_position(pos); + staff_symbol_referencer_interface (dots[i]).set_position(pos); } } diff --git a/lily/dots.cc b/lily/dots.cc index 6fc996328c..92d564478e 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -10,6 +10,7 @@ #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" +#include "staff-symbol-referencer.hh" Dots::Dots () { @@ -30,9 +31,10 @@ Dots::do_post_processing () if (!get_direction ()) set_direction (UP); - int p = int (position_f ()); + Staff_symbol_referencer_interface si (this); + int p = si.position_f (); if (!(p % 2)) - set_position (p + get_direction ()); + si.set_position (p + get_direction ()); } } Molecule* diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index d112945de1..f117c9c49d 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -14,7 +14,7 @@ #include "staff-symbol.hh" #include "note-column.hh" #include "text-item.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "engraver.hh" #include "stem.hh" #include "note-head.hh" diff --git a/lily/file-results.cc b/lily/file-results.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/grace-position-engraver.cc b/lily/grace-position-engraver.cc index 172f26968f..03be73a2d2 100644 --- a/lily/grace-position-engraver.cc +++ b/lily/grace-position-engraver.cc @@ -87,11 +87,12 @@ Grace_position_engraver::do_pre_move_processing () return; warning (_("Unattached grace notes. Attaching to last musical column.")); - Axis_group_element * ae = dynamic_cast (elt); /* if (ae) ae->remove_element (align_l_); else if (elt)*/ - align_l_->set_parent (0, X_AXIS); + + + align_l_->set_parent (0, X_AXIS); last_musical_col_l_->add_element (align_l_); } diff --git a/lily/group-interface.cc b/lily/group-interface.cc index e9b79eeb19..b8388670ef 100644 --- a/lily/group-interface.cc +++ b/lily/group-interface.cc @@ -22,7 +22,7 @@ Group_interface::Group_interface (Score_element const *e, String s) name_ = s; } bool -Group_interface::supports_interface_b () +Group_interface::has_interface_b () { SCM el = elt_l_->get_elt_property (name_); @@ -33,6 +33,9 @@ Group_interface::supports_interface_b () void Group_interface::add_element (Score_element*p) { + p->used_b_ = true; + elt_l_->used_b_ = true; + elt_l_->set_elt_property (name_, gh_cons (p->self_scm_, elt_l_->get_elt_property (name_))); } @@ -46,7 +49,7 @@ Group_interface::count () void Group_interface::set_interface () { - if (!supports_interface_b ()) + if (!has_interface_b ()) { elt_l_->set_elt_property (name_, SCM_EOL); } diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh index 270bcdb03e..3b1264d5fc 100644 --- a/lily/include/axis-group-element.hh +++ b/lily/include/axis-group-element.hh @@ -21,37 +21,17 @@ class Axis_group_element : public virtual Score_element { /// modify fields of E for removal. void do_remove (Score_element*e); - void purge_extra (); - - protected: virtual Link_array get_extra_dependencies() const; virtual Link_array elem_l_arr() const; static Interval extent_callback (Dimension_cache const*); - - - Interval extra_extent (Axis a) const; public: - // keep array in order. - bool ordered_b_; Axis axes_[2]; - Interval my_extent (Axis) const; - - - - bool contains_b (Score_element const *) const; void add_element (Score_element*); - /** - add an element that only influences size, but does not have X/Y parent - relationship with THIS. - */ - void add_extra_element (Score_element*); - - Axis_group_element (); void set_axes (Axis,Axis); diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index 8f59c298a2..3f75d905e7 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -18,9 +18,8 @@ */ class Axis_group_item : public virtual Axis_group_element, - public virtual Item { -protected: - virtual void do_breakable_col_processing(); + public virtual Item +{ public: VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index f81b7354c7..9d7e0c8382 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -19,9 +19,6 @@ class Axis_group_spanner : public virtual Axis_group_element, public virtual Spanner { - void do_break_processing_if_unbroken(); -protected: - virtual void do_break_processing(); public: VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/breathing-sign.hh b/lily/include/breathing-sign.hh index 0378d62078..ffc2f3d7eb 100644 --- a/lily/include/breathing-sign.hh +++ b/lily/include/breathing-sign.hh @@ -11,12 +11,10 @@ #define BREATHING_SIGN_HH #include "item.hh" -#include "staff-symbol-referencer.hh" #include "parray.hh" #include "directional-element.hh" class Breathing_sign : public Item, - public Staff_symbol_referencer, public Directional_element { public: diff --git a/lily/include/chord-tremolo.hh b/lily/include/chord-tremolo.hh deleted file mode 100644 index 67c67c76fe..0000000000 --- a/lily/include/chord-tremolo.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - chord-tremolo-engraver.hh -- declare Chord_tremolo_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys - Jan Nieuwenhuizen -*/ - -#ifndef Chord_tremolo_HH -#define Chord_tremolo_HH - -#include "beam.hh" - -/** a beam connects multiple stems Beam adjusts the stems its owns to - make sure that they reach the beam and that point in the correct - direction */ -class Chord_tremolo : public Beam { -public: - VIRTUAL_COPY_CONS(Score_element); - -protected: - virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const; -}; - -#error -#endif // Chord_tremolo_HH - diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index 11362d72fa..e35b20c9c0 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -10,7 +10,7 @@ #include "direction.hh" #include "pointer.hh" -#include "staff-symbol-referencer.hh" + /** Set a clef in a staff. @@ -23,7 +23,8 @@ change: is this a change clef (smaller size)? */ -class Clef_item : public Item, public Staff_symbol_referencer { +class Clef_item : public Item +{ protected: virtual void do_pre_processing(); virtual Molecule* do_brew_molecule_p() const; diff --git a/lily/include/dots.hh b/lily/include/dots.hh index 05aeec680d..8225860aa9 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -11,14 +11,15 @@ #define DOTS_HH #include "item.hh" -#include "staff-symbol-referencer.hh" + #include "directional-element.hh" /** The dots to go with a notehead/rest. A separate class, since they are a party in collision resolution. */ -class Dots : public Item, public Staff_symbol_referencer, +class Dots : + public Item, public Directional_element { protected: diff --git a/lily/include/glob.hh b/lily/include/glob.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh deleted file mode 100644 index eab17f40b7..0000000000 --- a/lily/include/graphical-element.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* - graphical-element.hh -- declare Graphical_element - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys -*/ - - -#ifndef GRAPHICAL_ELEMENT_HH -#define GRAPHICAL_ELEMENT_HH - -#include "offset.hh" -#include "lily-proto.hh" -#include "interval.hh" -#include "virtual-methods.hh" -#error - - -/** The 2d geometric aspects of a score-element. - */ -class Graphical_element -{ -}; - -#endif // GRAPHICAL_ELEMENT_HH - diff --git a/lily/include/group-interface.hh b/lily/include/group-interface.hh index 289ba913ba..fc832a5426 100644 --- a/lily/include/group-interface.hh +++ b/lily/include/group-interface.hh @@ -23,7 +23,7 @@ public: Group_interface (Score_element const*); Group_interface (Score_element const*, String); int count (); - bool supports_interface_b (); + bool has_interface_b (); void set_interface (); void add_element (Score_element*); }; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 82f72cb871..ac80432208 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -9,10 +9,11 @@ #include "item.hh" #include "array.hh" -#include "staff-symbol-referencer.hh" + /// An item which places accidentals at the start of the line -class Key_item :public Item, public Staff_symbol_referencer { +class Key_item :public Item +{ Array pitch_arr_; Array acc_arr_; Array old_pitch_arr_; diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index e10468474a..25a1a2d3dd 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -9,7 +9,7 @@ #include "item.hh" #include "array.hh" #include "musical-pitch.hh" -#include "staff-symbol-referencer.hh" + #include "note-head-side.hh" struct Local_key_cautionary_tuple @@ -40,7 +40,8 @@ struct Local_key_cautionary_tuple */ -class Local_key_item : public Note_head_side, public Staff_symbol_referencer { +class Local_key_item : public Note_head_side +{ Array accidental_arr_; Molecule accidental (int,bool,bool) const; diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index 23cea928fd..1d5fc2bcce 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -11,9 +11,9 @@ #define MULTI_MEASURE_REST_HH #include "spanner.hh" -#include "staff-symbol-referencer.hh" -class Multi_measure_rest : public Spanner, public Staff_symbol_referencer + +class Multi_measure_rest : public Spanner { public: Multi_measure_rest (); @@ -26,7 +26,6 @@ protected: virtual void do_add_processing (); virtual void do_post_processing (); - virtual void do_print () const; virtual Array get_rods () const; }; diff --git a/lily/include/new-beaming.hh b/lily/include/new-beaming.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/new-repeated-music.hh b/lily/include/new-repeated-music.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 308ff1c1eb..bbc051d239 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -15,15 +15,14 @@ */ -class Note_head : public Rhythmic_head { +class Note_head : public Rhythmic_head +{ public: - Note_head (); void flip_around_stem (Direction); static int compare (Note_head * const &a, Note_head *const &b) ; protected: Molecule make_molecule () const; - static Interval dim_callback (Dimension_cache const*); virtual void do_pre_processing(); diff --git a/lily/include/parseconstruct.hh b/lily/include/parseconstruct.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 8614789684..591c9eb81b 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -14,10 +14,7 @@ class Rest : public Rhythmic_head { -public: - protected: - virtual void do_add_processing (); virtual void do_post_processing (); virtual Molecule * do_brew_molecule_p () const; }; diff --git a/lily/include/rhythmic-head.hh b/lily/include/rhythmic-head.hh index 58063bd501..9013c0eb42 100644 --- a/lily/include/rhythmic-head.hh +++ b/lily/include/rhythmic-head.hh @@ -11,25 +11,19 @@ #define RHYTHMIC_HEAD_HH #include "item.hh" -#include "staff-symbol-referencer.hh" -class Rhythmic_head : public Item, public Staff_symbol_referencer + +class Rhythmic_head : public Item { - Dots * dots_l_; - Stem * stem_l_; public: - - int balltype_i_; + int balltype_i () const; void add_dots (Dots *); - Rhythmic_head (); Stem * stem_l ()const; Dots * dots_l ()const; int dots_i ()const; protected: virtual void do_post_processing (); - - virtual void do_print () const; }; #endif // RHYTHMIC_HEAD_HH diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index c799408ee8..ba75990681 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -43,7 +43,6 @@ class Score_element { */ SCM element_property_alist_; - Link_array dependency_arr_; /** The lookup, determined by the font size. Cache this value. */ @@ -106,7 +105,7 @@ public: static SCM handle_broken_smobs (SCM, SCM criterion); void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)()); - + virtual void do_break_processing (); virtual Score_element *find_broken_piece (Line_of_score*) const; protected: @@ -115,9 +114,6 @@ protected: be handled by GUILE gc. */ virtual ~Score_element (); - Score_element* dependency (int) const; - int dependency_size () const; - virtual void output_processing (); static Interval molecule_extent (Dimension_cache const*); @@ -137,8 +133,6 @@ protected: /// do calculations after determining horizontal spacing virtual void do_post_processing (); - virtual void do_break_processing (); - virtual Link_array get_extra_dependencies () const; static Interval dim_cache_callback (Dimension_cache const*); diff --git a/lily/include/staff-side.hh b/lily/include/side-position-interface.hh similarity index 73% rename from lily/include/staff-side.hh rename to lily/include/side-position-interface.hh index 42c1e00289..55a15f308a 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/side-position-interface.hh @@ -1,5 +1,5 @@ /* - staff-side.hh -- declare Staff_side_{element,spanner,item} + side-position-interface.hh -- declare Side_position_interface source file of the GNU LilyPond music typesetter @@ -7,20 +7,19 @@ */ -#ifndef STAFF_SIDE_HH -#define STAFF_SIDE_HH - +#ifndef SIDE_POSITION_INTERFACE_HH +#define SIDE_POSITION_INTERFACE_HH #include "spanner.hh" #include "item.hh" -#include "staff-symbol-referencer.hh" + #include "directional-element.hh" struct Side_position_interface { Score_element * elt_l_; public: - Side_position_interface (Score_element*); + Side_position_interface (Score_element const*); static Real side_position (Dimension_cache const *); static Real self_alignment (Dimension_cache const *); static Real aligned_side (Dimension_cache const *); @@ -30,7 +29,7 @@ public: Axis get_axis () const; bool supported_b () const; - bool is_staff_side_b () const; + bool has_interface_b () const; void add_support (Score_element*); Direction get_direction () const; @@ -38,6 +37,5 @@ public: }; - -#endif /* STAFF_SIDE_HH */ +#endif /* SIDE_POSITION_INTERFACE_HH */ diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 08c7f361f3..6ef182fe13 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -63,7 +63,6 @@ protected: friend Axis_group_spanner; // UGH virtual void do_space_processing (); - // void handle_broken_dependents (); virtual void do_break_processing (); Real spanner_length () const; virtual Line_of_score*line_l () const; diff --git a/lily/include/staff-bar.hh b/lily/include/staff-bar.hh index 171ec1ddc0..244f36a849 100644 --- a/lily/include/staff-bar.hh +++ b/lily/include/staff-bar.hh @@ -11,16 +11,15 @@ #define STAFF_BAR_HH #include "bar.hh" -#include "staff-symbol-referencer.hh" + /** A bar that is on a staff. Ugh. Entita non multiplicandum ... */ -class Staff_bar : public Bar, public Staff_symbol_referencer +class Staff_bar : public Bar { public: - virtual void do_pre_processing (); VIRTUAL_COPY_CONS(Score_element); virtual Real get_bar_size () const; }; diff --git a/lily/include/staff-sym-engraver.hh b/lily/include/staff-sym-engraver.hh deleted file mode 100644 index 18d2efceab..0000000000 --- a/lily/include/staff-sym-engraver.hh +++ /dev/null @@ -1,32 +0,0 @@ -/* - staff-sym-engraver.hh -- declare Staff_symbol_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--1999 Han-Wen Nienhuys -*/ - - -#ifndef STAFF_SYMBOL_GRAV_HH -#define STAFF_SYMBOL_GRAV_HH -#include "engraver.hh" -#include "moment.hh" - -/** - Manage the staff symbol. - */ -class Staff_symbol_engraver : public Engraver { - Staff_symbol *span_p_; -public: - VIRTUAL_COPY_CONS(Translator); - Staff_symbol_engraver(); - -protected: - virtual ~Staff_symbol_engraver(); - - virtual void acknowledge_element (Score_element_info); - virtual void do_removal_processing(); - virtual void do_creation_processing(); - -}; -#endif // STAFF_SYMBOL_GRAV_HH diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index e5f6751a75..60e9ac2787 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -17,10 +17,13 @@ lines, leading). */ -class Staff_symbol_referencer : public virtual Score_element +class Staff_symbol_referencer_interface { public: - Staff_symbol_referencer (); + Score_element * elt_l_; + Staff_symbol_referencer_interface (Score_element const*); + void set_interface (); + bool has_interface_b (); void set_position (Real); static Real callback (Dimension_cache const*); @@ -28,11 +31,15 @@ public: Leading are the lead strips between the sticks (lines) of typeface. ie. leading is vertical space. */ + Real staff_line_leading_f () const; Staff_symbol * staff_symbol_l () const; int lines_i () const; Real position_f () const; }; + +Staff_symbol_referencer_interface staff_symbol_referencer_interface (Score_element const*); + #endif /* STAFF_SYMBOL_REFERENCER_HH */ diff --git a/lily/include/staff-symbol.hh b/lily/include/staff-symbol.hh index afe679d65b..89dc0d63cd 100644 --- a/lily/include/staff-symbol.hh +++ b/lily/include/staff-symbol.hh @@ -21,6 +21,8 @@ public: /// this many lines. int no_lines_i_; Real staff_line_leading_f_; + Real staff_line_leading_f (); + Staff_symbol (); int steps_i() const; diff --git a/lily/include/stem-staff-side.hh b/lily/include/stem-staff-side.hh deleted file mode 100644 index 7e649c96ec..0000000000 --- a/lily/include/stem-staff-side.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* - stem-staff-side.hh -- declare Stem_staff_side - - source file of the GNU LilyPond music typesetter - - (c) 1999 Han-Wen Nienhuys - - */ - -#ifndef Stem_STAFF_SIDE_HH -#define Stem_STAFF_SIDE_HH - -#error - -#include "staff-side.hh" -/** - Position self, analogous to Staff_side_item, but use Stem direction - for determining direction. - - Properties: - - padding :: Real - - Padding in staffline leading - - */ -class Stem_staff_side_item : public Staff_side_item -{ - Stem *stem_l_; -public: - Direction relative_dir_; - - void set_stem (Stem*); - Stem_staff_side_item (); -protected: - virtual Direction get_default_direction ()const; - virtual void do_pre_processing (); - virtual void do_post_processing (); -}; - -#endif /* Stem_STAFF_SIDE_HH */ - diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 3f4a19197b..a40484123c 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -6,11 +6,11 @@ #ifndef STEM_HH #define STEM_HH + #include "item.hh" #include "array.hh" #include "moment.hh" #include "molecule.hh" -#include "staff-symbol-referencer.hh" #include "directional-element.hh" #include "stem-info.hh" @@ -41,22 +41,21 @@ */ -// todo: remove baseclass Staff_symbol_referencer, since stem -// can be across a staff. -class Stem : public Item, public Staff_symbol_referencer, +class Stem : public Item, public Directional_element { /**extent of the stem (positions). fractional, since Beam has to adapt them. */ - Drul_array yextent_drul_; + Interval yextent_; public: - - /// log of the duration. Eg. 4 -> 16th note -> 2 flags - int flag_i_; + int flag_i () const; + + Drul_array beams_i_drul_; + /** don't print flag when in beam. @@ -64,20 +63,17 @@ public: */ Beam* beam_l () const; Note_head * first_head () const; - - Drul_array beams_i_drul_; Stem (); /// ensure that this Stem also encompasses the Notehead #n# void add_head (Rhythmic_head*n); - Stem_info get_info () const; Real hpos_f () const; + Stem_info calc_stem_info () const; + Real chord_start_f () const; int type_i () const; - - void do_print() const; void set_stemend (Real); Direction get_default_dir() const; diff --git a/lily/include/symbols.hh b/lily/include/symbols.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index d477f00620..6758de4207 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -14,6 +14,7 @@ #include "local-key-item.hh" #include "bar.hh" #include "timing-translator.hh" +#include "staff-symbol-referencer.hh" Key_engraver::Key_engraver () { @@ -33,6 +34,9 @@ Key_engraver::create_key () if (!item_p_) { item_p_ = new Key_item; + Staff_symbol_referencer_interface st (item_p_); + st.set_interface (); + item_p_->set_elt_property ("break-aligned", SCM_BOOL_T); // ugh item_p_->multi_octave_b_ = key_.multi_octave_b_; diff --git a/lily/key-item.cc b/lily/key-item.cc index 7b7631fe9a..c39f0e4e5c 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -15,6 +15,7 @@ #include "paper-def.hh" #include "lookup.hh" #include "musical-pitch.hh" +#include "staff-symbol-referencer.hh" const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ @@ -97,7 +98,9 @@ Molecule* Key_item::do_brew_molecule_p() const { Molecule*output = new Molecule; - Real inter = staff_line_leading_f ()/2.0; + + Staff_symbol_referencer_interface si (this); + Real inter = si.staff_line_leading_f ()/2.0; int j; if ((break_status_dir () == LEFT || break_status_dir () == CENTER) diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 5fb4931a2a..28d2477f68 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -58,13 +58,6 @@ Line_of_score::break_into_pieces (Array const &breaking) broken_into_l_arr_.push (line_l); } - - for (int i=0; i < broken_into_l_arr_.size (); i++) - { - broken_into_l_arr_[i]->handle_broken_dependencies (); - } - - handle_broken_dependencies (); } void diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index beff1c9148..100bac981d 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -16,6 +16,7 @@ #include "timing-translator.hh" #include "engraver-group-engraver.hh" #include "grace-align-item.hh" +#include "staff-symbol-referencer.hh" Local_key_engraver::Local_key_engraver() { @@ -82,6 +83,9 @@ Local_key_engraver::process_acknowledged () if (!key_item_p_) { key_item_p_ = new Local_key_item; + Staff_symbol_referencer_interface si(key_item_p_); + si.set_interface (); + announce_element (Score_element_info (key_item_p_, 0)); } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index a8823c59c9..72c7104e4a 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -7,6 +7,7 @@ */ #include "local-key-item.hh" #include "molecule.hh" +#include "staff-symbol-referencer.hh" #include "lookup.hh" #include "paper-def.hh" @@ -67,7 +68,8 @@ Molecule* Local_key_item::do_brew_molecule_p() const { Molecule*output = new Molecule; - Real note_distance = staff_line_leading_f ()/2; + Staff_symbol_referencer_interface si (this); + Real note_distance = si.staff_line_leading_f ()/2; Molecule *octave_mol_p = 0; int lastoct = -100; diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 609cf8c720..d6c065ccf2 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -13,6 +13,7 @@ #include "engraver-group-engraver.hh" #include "timing-translator.hh" #include "bar.hh" +#include "staff-symbol-referencer.hh" ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver); @@ -77,6 +78,10 @@ Multi_measure_rest_engraver::do_process_requests () Timing_translator * time = dynamic_cast (tr); mmrest_p_ = new Multi_measure_rest; + Staff_symbol_referencer_interface si (mmrest_p_); + si.set_interface (); + + if(dynamic_cast (multi_measure_req_l_)) mmrest_p_->set_elt_property ("alt-symbol", ly_str02scm ("scripts-repeatsign")); diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index d69333940f..5edec8fc3e 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -18,6 +18,7 @@ #include "misc.hh" #include "group-interface.hh" #include "stem.hh" +#include "staff-symbol-referencer.hh" Multi_measure_rest::Multi_measure_rest () { @@ -25,13 +26,7 @@ Multi_measure_rest::Multi_measure_rest () set_elt_property ("columns", SCM_EOL); } -void -Multi_measure_rest::do_print () const -{ -#ifndef NPRINT - DEBUG_OUT << "measures_i_ " << measures_i_; -#endif -} + @@ -94,7 +89,8 @@ Multi_measure_rest::do_brew_molecule_p () const } mol_p->add_molecule (s); - Real interline_f = staff_line_leading_f (); + Real interline_f + = staff_symbol_referencer_interface (this).staff_line_leading_f (); if (measures_i_ == 1 && rest_symbol) { mol_p->translate_axis (interline_f, Y_AXIS); diff --git a/lily/note-column.cc b/lily/note-column.cc index 21740f4513..439cb08186 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -14,6 +14,7 @@ #include "debug.hh" #include "paper-def.hh" #include "group-interface.hh" +#include "staff-symbol-referencer.hh" bool Note_column::rest_b () const @@ -61,8 +62,9 @@ Note_column::head_positions_interval() const for (; gh_pair_p (h); h = gh_cdr (h)) { Score_element *se = unsmob_element (gh_car (h)); + Staff_symbol_referencer_interface si (se); - int j = int (dynamic_cast (se)->position_f ()); + int j = int (si.position_f ()); iv.unite (Slice (j,j)); } return iv; @@ -114,14 +116,15 @@ Note_column::add_head (Rhythmic_head *h) void Note_column::translate_rests (int dy_i) { - invalidate_cache (Y_AXIS); + // invalidate_cache (Y_AXIS); SCM s = get_elt_property ("rests"); for (; gh_pair_p (s); s = gh_cdr (s)) { - Score_element * se = unsmob_element ( gh_car (s)); - Staff_symbol_referencer *str = dynamic_cast (se); - se->translate_axis (dy_i * str->staff_line_leading_f ()/2.0, Y_AXIS); + Score_element * se = unsmob_element (gh_car (s)); + Staff_symbol_referencer_interface si (se); + + se->translate_axis (dy_i * si.staff_line_leading_f ()/2.0, Y_AXIS); } } @@ -159,9 +162,9 @@ Note_column::do_post_processing () SCM s = get_elt_property ("rests"); Score_element * se = unsmob_element (gh_car (s)); - Staff_symbol_referencer *str = dynamic_cast (se); + Staff_symbol_referencer_interface si (se); - Real staff_space = str->staff_line_leading_f (); + Real staff_space = si.staff_line_leading_f (); Real rest_dim = extent (Y_AXIS)[d]*2.0 /staff_space ; Real minimum_dist @@ -169,7 +172,7 @@ Note_column::do_post_processing () Real dist = minimum_dist + -d * (beamy - rest_dim) >? 0; - int stafflines = str->lines_i (); + int stafflines = si.lines_i (); // move discretely by half spaces. int discrete_dist = int (ceil (dist )); diff --git a/lily/note-head-side.cc b/lily/note-head-side.cc index 1406da12a6..b84b895334 100644 --- a/lily/note-head-side.cc +++ b/lily/note-head-side.cc @@ -7,7 +7,7 @@ */ -#include "staff-side.hh" +#include "side-position-interface.hh" #include "note-head-side.hh" void Note_head_side::add_support (Item*head_l) diff --git a/lily/note-head.cc b/lily/note-head.cc index 17bc7d6b30..4ddaac0848 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -14,6 +14,7 @@ #include "molecule.hh" #include "musical-request.hh" #include "dimension-cache.hh" +#include "staff-symbol-referencer.hh" void Note_head::flip_around_stem (Direction d) @@ -37,8 +38,6 @@ Note_head::Note_head () void Note_head::do_pre_processing () { - Rhythmic_head::do_pre_processing (); - // 8 ball looks the same as 4 ball: String type; SCM style = get_elt_property ("style"); @@ -48,24 +47,27 @@ Note_head::do_pre_processing () } - if (balltype_i_ > 2 || type == "harmonic" || type == "cross") - balltype_i_ = 2; + if (balltype_i () > 2 || type == "harmonic" || type == "cross") + set_elt_property ("duration-log", gh_int2scm (2)); - if (dots_l ()) // move into Rhythmic_head? - dots_l ()->set_position(int (position_f ())); + if (Dots *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 ())); + } } - - int Note_head::compare (Note_head *const &a, Note_head * const &b) { - return sign(a->position_f () - b->position_f ()); -} - + Staff_symbol_referencer_interface s1(a); + Staff_symbol_referencer_interface s2(b); + return sign(s1.position_f () - s2.position_f ()); +} Molecule Note_head::make_molecule () const @@ -78,18 +80,20 @@ Note_head::make_molecule () const } return lookup_l()->afm_find (String ("noteheads-") - + to_str (balltype_i_) + type); + + to_str (balltype_i ()) + type); } Molecule* Note_head::do_brew_molecule_p() const { - Real inter_f = staff_line_leading_f ()/2; - int sz = lines_i ()-1; - - int streepjes_i = abs (position_f ()) < sz + Staff_symbol_referencer_interface si (this); + + Real inter_f = si.staff_line_leading_f ()/2; + int sz = si.lines_i ()-1; + Real p = si.position_f (); + int streepjes_i = abs (p) < sz ? 0 - : (abs((int)position_f ()) - sz) /2; + : (abs((int)p) - sz) /2; Molecule* out = new Molecule (make_molecule ()); @@ -97,7 +101,7 @@ Note_head::do_brew_molecule_p() const if (streepjes_i) { - Direction dir = (Direction)sign (position_f ()); + Direction dir = (Direction)sign (p); Interval hd = out->dim_[X_AXIS]; Real hw = hd.length ()/4; @@ -105,7 +109,7 @@ Note_head::do_brew_molecule_p() const = lookup_l ()->ledger_line (Interval (hd[LEFT] - hw, hd[RIGHT] + hw)); - int parity = abs(int (position_f ())) % 2; + int parity = abs(int (p)) % 2; for (int i=0; i < streepjes_i; i++) { diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index c1bfea9317..ce6c46dcf5 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -10,6 +10,7 @@ #include "musical-request.hh" #include "dots.hh" #include "dot-column.hh" +#include "staff-symbol-referencer.hh" Note_heads_engraver::Note_heads_engraver() { @@ -61,19 +62,29 @@ Note_heads_engraver::do_process_requests() for (int i=0; i < note_req_l_arr_.size (); i++) { Note_head *note_p = new Note_head; + + Staff_symbol_referencer_interface si (note_p); + si.set_interface (); + + Note_req * note_req_l = note_req_l_arr_[i]; - note_p->balltype_i_ = note_req_l->duration_.durlog_i_ set_elt_property ("duration-log", + gh_int2scm (note_req_l->duration_.durlog_i_ duration_.dots_i_) { Dots * d = new Dots; + + Staff_symbol_referencer_interface sd (d); + sd.set_interface (); + note_p->add_dots (d); d->dots_i_ = note_req_l->duration_.dots_i_; announce_element (Score_element_info (d,0)); dot_p_arr_.push (d); } - note_p->set_position(note_req_l->pitch_.steps ()); + si.set_position(note_req_l->pitch_.steps ()); /* TODO: transparent note heads. diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 960dffd675..adb3b1f0ca 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -123,6 +123,17 @@ Paper_score::process () Array breaking = calc_breaking (); line_l_->break_into_pieces (breaking); + for (SCM s = element_smob_list_; gh_pair_p (s); s = gh_cdr (s)) + { + Score_element *sc = unsmob_element (gh_car (s)); + sc->do_break_processing (); + } + for (SCM s = element_smob_list_; gh_pair_p (s); s = gh_cdr (s)) + { + Score_element *sc = unsmob_element (gh_car (s)); + sc->handle_broken_dependencies (); + } + outputter_l_ = new Paper_outputter ; outputter_l_->output_header (); diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index 8218ff66c9..7ed7a8c085 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -6,6 +6,7 @@ (c) 1997--1999 Han-Wen Nienhuys */ +#include "staff-symbol-referencer.hh" #include "pitch-squash-engraver.hh" #include "note-head.hh" @@ -15,7 +16,7 @@ Pitch_squash_engraver::acknowledge_element (Score_element_info i) { if (Note_head *nh = dynamic_cast (i.elem_l_)) { - nh->set_position(0); + Staff_symbol_referencer_interface (nh).set_position(0); } } diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index 93b182591f..368f6fdae2 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -5,7 +5,7 @@ (c) 1997--1999 Han-Wen Nienhuys */ - +#include "staff-symbol-referencer.hh" #include "rest-engraver.hh" #include "musical-request.hh" #include "dots.hh" @@ -47,11 +47,19 @@ Rest_engraver::do_process_requests () if (rest_req_l_ && !rest_p_) { rest_p_ = new Rest; - rest_p_->balltype_i_ = rest_req_l_->duration_.durlog_i_; - + Staff_symbol_referencer_interface si (rest_p_); + si.set_interface (); + + rest_p_->set_elt_property ("duration-log", + gh_int2scm (rest_req_l_->duration_.durlog_i_)); + if (rest_req_l_->duration_.dots_i_) { dot_p_ = new Dots; + + Staff_symbol_referencer_interface si (dot_p_); + si.set_interface (); + rest_p_->add_dots (dot_p_); dot_p_->dots_i_ = 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 10455405f8..5caadb0999 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -13,30 +13,26 @@ #include "dots.hh" #include "axis-group-element.hh" #include "paper-score.hh" +#include "staff-symbol-referencer.hh" -void -Rest::do_add_processing () -{ - if (balltype_i_ == 0) - set_position (position_f () + 2); - - Rhythmic_head::do_add_processing (); -} void Rest::do_post_processing () { - Rhythmic_head::do_post_processing (); - if (dots_l () - && balltype_i_ > 4) // UGH. + if (balltype_i () == 0) + { + Staff_symbol_referencer_interface si (this); + si.set_position (si.position_f () + 2); + } + + Dots * d = dots_l (); + if (d && balltype_i () > 4) // UGH. { /* UGH. */ - if (balltype_i_ == 7) - dots_l ()->set_position (4); - else - dots_l ()->set_position (3); + staff_symbol_referencer_interface (d) + .set_position ((balltype_i () == 7) ? 4 : 3); } } @@ -46,18 +42,21 @@ Rest::do_brew_molecule_p () const { bool ledger_b =false; - if (balltype_i_ == 0 || balltype_i_ == 1) - ledger_b = abs(position_f () - (2* balltype_i_ - 1)) > lines_i (); - + if (balltype_i () == 0 || balltype_i () == 1) + { + Staff_symbol_referencer_interface si(this); + ledger_b = abs(si.position_f () - (2* balltype_i () - 1)) + > si.lines_i (); + } String style; SCM style_sym =get_elt_property ("style"); - if (balltype_i_ >= 2 && style_sym != SCM_UNDEFINED) + if (balltype_i () >= 2 && style_sym != SCM_UNDEFINED) { style = ly_scm2string (style_sym); } - String idx = ("rests-") + to_str (balltype_i_) + (ledger_b ? "o" : "") + style; + String idx = ("rests-") + to_str (balltype_i ()) + (ledger_b ? "o" : "") + style; return new Molecule(lookup_l ()->afm_find (idx)); } diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index 171c93cb7b..9e354bde2f 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -16,6 +16,7 @@ #include "axis-group-element.hh" #include "paper-score.hh" #include "stem.hh" +#include "staff-symbol-referencer.hh" Dots* @@ -25,6 +26,14 @@ Rhythmic_head::dots_l () const return dynamic_cast (unsmob_element (s)); } +int +Rhythmic_head::balltype_i () const +{ + SCM s = get_elt_property ("duration-log"); + + return gh_number_p (s) ? gh_scm2int (s) : 0; +} + Stem* Rhythmic_head::stem_l () const { @@ -41,9 +50,11 @@ Rhythmic_head::dots_i () const void Rhythmic_head::do_post_processing () { - if (dots_l ()) + if (Dots *d = dots_l ()) { - dots_l ()->set_position(int (position_f ())); + Staff_symbol_referencer_interface si (d); + Staff_symbol_referencer_interface me (d); + si.set_position(int (me.position_f ())); } } @@ -55,18 +66,4 @@ Rhythmic_head::add_dots (Dots *dot_l) dot_l->add_dependency (this); } -Rhythmic_head::Rhythmic_head () -{ - balltype_i_ =0; -} - - - -void -Rhythmic_head::do_print () const -{ -#ifndef NPRINT - DEBUG_OUT << "balltype = "<< balltype_i_ << "dots = " << dots_i (); -#endif -} diff --git a/lily/score-element.cc b/lily/score-element.cc index 5e958affaa..918550d158 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -9,6 +9,7 @@ #include +#include "group-interface.hh" #include "misc.hh" #include "paper-score.hh" #include "paper-def.hh" @@ -24,7 +25,7 @@ #include "misc.hh" #include "paper-outputter.hh" #include "dimension-cache.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "item.hh" Score_element::Score_element() @@ -47,6 +48,9 @@ Score_element::Score_element() element_property_alist_ = SCM_EOL; smobify_self (); + + + set_elt_property ("dependencies", SCM_EOL); } SCM ly_deep_copy (SCM); @@ -77,7 +81,7 @@ Score_element::Score_element (Score_element const&s) should protect because smobify_self () might trigger GC. */ element_property_alist_ = scm_protect_object (ly_deep_copy (s.element_property_alist_)); - dependency_arr_ = s.dependency_arr_; + output_p_ =0; status_i_ = s.status_i_; lookup_l_ = s.lookup_l_; @@ -96,17 +100,6 @@ Score_element::~Score_element() delete dim_cache_[Y_AXIS]; } -Score_element* -Score_element::dependency (int i) const -{ - return dependency_arr_ [i]; -} - -int -Score_element::dependency_size () const -{ - return dependency_arr_.size (); -} Real Score_element::get_real (String s) const @@ -184,7 +177,6 @@ Score_element::print() const if (flower_dstream && !flower_dstream->silent_b ("Score_element")) ly_display_scm (element_property_alist_); - DEBUG_OUT << "dependencies: " << dependency_size(); if (original_l_) DEBUG_OUT << "Copy "; do_print(); @@ -196,7 +188,7 @@ Score_element::print() const Paper_def* Score_element::paper_l () const { - return pscore_l_->paper_l_; + return pscore_l_ ? pscore_l_->paper_l_ : 0; } Lookup const * @@ -256,8 +248,11 @@ Score_element::calculate_dependencies (int final, int busy, assert (status_i_!= busy); status_i_= busy; - for (int i=0; i < dependency_arr_.size(); i++) - dependency_arr_[i]->calculate_dependencies (final, busy, funcptr); + Link_array dependency_arr = + Group_interface__extract_elements (this, (Score_element*)0, "dependencies"); + + for (int i=0; i < dependency_arr.size(); i++) + dependency_arr[i]->calculate_dependencies (final, busy, funcptr); Link_array extra (get_extra_dependencies()); for (int i=0; i < extra.size(); i++) @@ -304,7 +299,6 @@ Score_element::output_processing () void Score_element::do_break_processing() { - handle_broken_dependencies(); } void @@ -356,8 +350,8 @@ Score_element::add_dependency (Score_element*e) { if (e) { - dependency_arr_.push (e); - e->used_b_ = true; + Group_interface gi (this, "dependencies"); + gi.add_element (e); } else programming_error ("Null dependency added"); @@ -411,12 +405,17 @@ Score_element::handle_broken_smobs (SCM s, SCM criterion) gh_set_car_x (s, handle_broken_smobs (gh_car (s), criterion)); gh_set_cdr_x (s, handle_broken_smobs (gh_cdr (s), criterion)); - if (gh_car (s) == SCM_UNDEFINED && gh_list_p (gh_cdr(s))) - return gh_cdr (s); + SCM c = gh_cdr(s); + + // gh_list_p () is linear, this is O(1) + bool list = gh_pair_p (c) || c == SCM_EOL; + + if (gh_car (s) == SCM_UNDEFINED && list) + return c; } return s; } - +#if 0 void Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)()) { @@ -431,6 +430,7 @@ Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)()) recurse_into_smobs (gh_cdr (s), meth_ptr); } } +#endif void Score_element::handle_broken_dependencies() @@ -446,27 +446,8 @@ Score_element::handle_broken_dependencies() line ? line->self_scm_ : SCM_UNDEFINED); - recurse_into_smobs (element_property_alist_, - &Score_element::handle_broken_dependencies); - if (!line) return; - - - Link_array new_deps; - - for (int i=0; i < dependency_size(); i++) - { - Score_element * elt = dependency (i); - if (elt->line_l() != line) - { - Score_element * broken = elt->find_broken_piece (line); - elt = broken ; - } - if (elt) - new_deps.push (elt); - } - dependency_arr_ = new_deps; } @@ -608,7 +589,7 @@ unsmob_element (SCM s) void Score_element::invalidate_cache (Axis a) { - dim_cache_[a]->invalidate (); + // dim_cache_[a]->invalidate (); } Score_element* diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index b39e2b0524..793ef46e97 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -9,7 +9,7 @@ #include "engraver.hh" #include "script-column.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "dimension-cache.hh" /** @@ -60,7 +60,7 @@ Script_column_engraver::acknowledge_element( Score_element_info inf) if (!thing) return; - if (Side_position_interface (thing).is_staff_side_b ()) + if (Side_position_interface (thing).has_interface_b ()) { if (!thing->breakable_b () && Side_position_interface (thing).get_axis () == Y_AXIS) { diff --git a/lily/script-column.cc b/lily/script-column.cc index d9da8bc789..18a7fac8b0 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -7,7 +7,7 @@ */ #include "script-column.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "dimension-cache.hh" #include "group-interface.hh" diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index cde149793f..bb38f28339 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -6,7 +6,7 @@ #include "script-engraver.hh" #include "script.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "musical-request.hh" #include "stem.hh" #include "staff-symbol.hh" @@ -50,7 +50,8 @@ Script_engraver::do_process_requests() continue; } Script *p =new Script; - Side_position_interface stafy (p); + Side_position_interface stafy (p); + list = gh_cdr (list); p->set_elt_property ("molecule", diff --git a/lily/script.cc b/lily/script.cc index 430b03acfe..cc5db9d748 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -10,7 +10,7 @@ #include "debug.hh" #include "script.hh" #include "lookup.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "paper-def.hh" #include "dimension-cache.hh" diff --git a/lily/staff-side.cc b/lily/side-position-interface.cc similarity index 88% rename from lily/staff-side.cc rename to lily/side-position-interface.cc index 068ff7b2c2..b458095aa0 100644 --- a/lily/staff-side.cc +++ b/lily/side-position-interface.cc @@ -7,16 +7,17 @@ */ -#include "staff-side.hh" +#include "side-position-interface.hh" #include "staff-symbol.hh" #include "debug.hh" #include "warn.hh" #include "dimensions.hh" #include "dimension-cache.hh" +#include "staff-symbol-referencer.hh" -Side_position_interface::Side_position_interface (Score_element *e) +Side_position_interface::Side_position_interface (Score_element const *e) { - elt_l_ = e; + elt_l_ = (Score_element*)e; } @@ -48,7 +49,7 @@ Side_position_interface::get_direction () const Score_element * e = unsmob_element(other_elt); if (e) { - return relative_dir * Side_position_interface (e).get_direction (); + return (Direction)(relative_dir * Side_position_interface (e).get_direction ()); } return DOWN; @@ -132,7 +133,7 @@ Side_position_interface::self_alignment (Dimension_cache const *c) Real -directed_round (Real f, Direction d ) +directed_round (Real f, Direction d) { if (d < 0) return floor (f); @@ -146,21 +147,21 @@ Side_position_interface::quantised_position (Dimension_cache const *c) Score_element * me = dynamic_cast (c->element_l ()); Side_position_interface s(me); Direction d = s.get_direction (); + Staff_symbol_referencer_interface si (me); - Staff_symbol_referencer *ref = dynamic_cast (me); - if (ref) + if (si.has_interface_b ()) { - Real p = ref->position_f (); - Real rp = directed_round (d, p); + Real p = si.position_f (); + Real rp = directed_round (p, d); - int ip = int (p); - if (!(ip % 2)) + int ip = int (rp); + if ((ip % 2) == 0) { ip += d; rp += d; } - return (rp - p) * ref->staff_line_leading_f (); + return (rp - p) * si.staff_line_leading_f () / 2.0; } return 0.0; } @@ -205,9 +206,7 @@ void Side_position_interface::set_quantised (Axis a) { Dimension_cache * c = elt_l_->dim_cache_[a]; - for (int i=0; i < c->off_callbacks_.size (); i++) - if (c->off_callbacks_[i] == aligned_side) - c->off_callbacks_[i] = side_position ; + c->off_callbacks_.push (quantised_position); } @@ -231,7 +230,7 @@ Side_position_interface::set_direction (Direction d) } bool -Side_position_interface::is_staff_side_b () const +Side_position_interface::has_interface_b () const { return elt_l_->get_elt_property ("side-support") != SCM_UNDEFINED; } diff --git a/lily/spanner.cc b/lily/spanner.cc index dd3d24ead3..5fb0da4792 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -58,8 +58,6 @@ Spanner::break_into_pieces () span_p->set_bounds(RIGHT,bounds[RIGHT]); pscore_l_->typeset_element (span_p); - span_p->handle_broken_dependencies(); - broken_into_l_arr_.push (span_p); } @@ -106,7 +104,6 @@ void Spanner::do_break_processing() { break_into_pieces (); - handle_broken_dependencies(); } Spanner::Spanner () @@ -149,7 +146,7 @@ Score_element* Spanner::find_broken_piece (Line_of_score*l) const { Spanner* me = (Spanner*) this; - break_into_pieces (); + me->break_into_pieces (); int idx = binsearch_link_array (broken_into_l_arr_, (Spanner*)l, Spanner::compare); @@ -217,24 +214,12 @@ Spanner::get_broken_left_end_align () const if(sc != NULL && sc->break_status_dir () == RIGHT) { - // We could possibly return the right edge of the whole Score_column here, - // but we do a full search for the Break_align_item. - /* - In fact that doesn't make a difference, since the Score_column + + We used to do a full search for the Break_align_item. + But that doesn't make a difference, since the Score_column is likely to contain only a Break_align_item. */ -#if 0 - for(SCM s = sc->get_elt_property ("elements"); gh_pair_p (s); - s = gh_cdr (s)) - { - Score_element *e = SMOB_TO_TYPE (Score_element, gh_car (s)); - if(dynamic_cast (e)) - { - return e->extent (X_AXIS) [RIGHT]; - } - } -#endif return sc->extent (X_AXIS)[RIGHT]; } diff --git a/lily/specialty-engraver.cc b/lily/specialty-engraver.cc deleted file mode 100644 index 5f87859db6..0000000000 --- a/lily/specialty-engraver.cc +++ /dev/null @@ -1,35 +0,0 @@ -#if 0 -// not finished yet. -/* - specialty-engraver.cc -- implement Specialty_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1999 Han-Wen Nienhuys - - */ - - -#include "engraver.hh" - -class Specialty_engraver : public Engraver -{ - -public: - VIRTUAL_COPY_CONS(Translator); -protected: - void acknowledge_element (Score_element_info); -}; - - -void -Specialty_engraver::acknowledge_element (Score_element_info ) -{ - /* - We could do groovy stuff, by inserting our own custom (FUNC,FONT) - pairs (Atoms in fact) into acknowledged elements. - - But not yet. This would be cleaner if we had SCM as properties. - */ -} -#endif diff --git a/lily/staff-bar.cc b/lily/staff-bar.cc index 55167bbd32..bf62e781e0 100644 --- a/lily/staff-bar.cc +++ b/lily/staff-bar.cc @@ -8,6 +8,7 @@ */ #include "staff-bar.hh" +#include "staff-symbol-referencer.hh" Real Staff_bar::get_bar_size () const @@ -16,12 +17,9 @@ Staff_bar::get_bar_size () const if (gh_number_p (size)) return gh_scm2double (size); else - return (lines_i () -1) * staff_line_leading_f (); + { + Staff_symbol_referencer_interface si (this); + return (si.lines_i () -1) * si.staff_line_leading_f (); + } } -void -Staff_bar::do_pre_processing () -{ - Bar::do_pre_processing (); - Staff_symbol_referencer::do_pre_processing (); -} diff --git a/lily/staff-margin-engraver.cc b/lily/staff-margin-engraver.cc index dc67ca5cf4..bc52eb857d 100644 --- a/lily/staff-margin-engraver.cc +++ b/lily/staff-margin-engraver.cc @@ -10,7 +10,7 @@ #include "bar.hh" #include "timing-translator.hh" #include "text-item.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" ADD_THIS_TRANSLATOR (Staff_margin_engraver); diff --git a/lily/staff-sym-engraver.cc b/lily/staff-symbol-engraver.cc similarity index 75% rename from lily/staff-sym-engraver.cc rename to lily/staff-symbol-engraver.cc index 369df2928f..9b2575a30f 100644 --- a/lily/staff-sym-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -6,13 +6,32 @@ (c) 1997--1999 Han-Wen Nienhuys */ -#include "staff-sym-engraver.hh" #include "staff-symbol.hh" #include "score.hh" #include "paper-column.hh" -#include "staff-symbol-referencer.hh" #include "paper-def.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" +#include "engraver.hh" +#include "moment.hh" + +/** + Manage the staff symbol. + */ +class Staff_symbol_engraver : public Engraver { + Staff_symbol *span_p_; +public: + VIRTUAL_COPY_CONS(Translator); + Staff_symbol_engraver(); + +protected: + virtual ~Staff_symbol_engraver(); + + virtual void acknowledge_element (Score_element_info); + virtual void do_removal_processing(); + virtual void do_creation_processing(); + +}; + Staff_symbol_engraver::~Staff_symbol_engraver() { @@ -21,7 +40,7 @@ Staff_symbol_engraver::~Staff_symbol_engraver() Staff_symbol_engraver::Staff_symbol_engraver() { - span_p_ = 0; + span_p_ = 0; } void @@ -65,7 +84,7 @@ Staff_symbol_engraver::acknowledge_element (Score_element_info s) if (gh_boolean_p (ss) && gh_scm2bool (ss)) { Side_position_interface si (s.elem_l_); - if (si.is_staff_side_b ()) + if (si.has_interface_b ()) si.add_support (span_p_); } } diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index f2532f0d43..8bd451109a 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -13,56 +13,70 @@ #include "paper-def.hh" #include "dimension-cache.hh" -Staff_symbol_referencer::Staff_symbol_referencer () +Staff_symbol_referencer_interface::Staff_symbol_referencer_interface (Score_element const *sc) { - set_elt_property ("staff-position", gh_double2scm (0.0)); - dim_cache_[Y_AXIS]->off_callbacks_.push (callback); + elt_l_ = (Score_element*)sc; +} + +void +Staff_symbol_referencer_interface::set_interface () +{ + elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0)); + elt_l_->dim_cache_[Y_AXIS]->off_callbacks_.push (callback); +} + + +bool +Staff_symbol_referencer_interface::has_interface_b () +{ + return unsmob_element (elt_l_->get_elt_property ("staff-symbol")) + || gh_number_p (elt_l_->get_elt_property ("staff-position")); } int -Staff_symbol_referencer::lines_i () const +Staff_symbol_referencer_interface::lines_i () const { Staff_symbol *st = staff_symbol_l (); return st ? st->no_lines_i_ : 5; } Staff_symbol* -Staff_symbol_referencer::staff_symbol_l () const +Staff_symbol_referencer_interface::staff_symbol_l () const { - SCM st = get_elt_property ("staff-symbol"); + SCM st = elt_l_->get_elt_property ("staff-symbol"); return dynamic_cast (unsmob_element(st)); } Real -Staff_symbol_referencer::staff_line_leading_f () const +Staff_symbol_referencer_interface::staff_line_leading_f () const { Staff_symbol * st = staff_symbol_l (); if (st) return st->staff_line_leading_f_; - else if (pscore_l_ && paper_l ()) - paper_l ()->get_var ("interline"); + else if (elt_l_->pscore_l_ && elt_l_->paper_l ()) + elt_l_->paper_l ()->get_var ("interline"); return 0.0; } Real -Staff_symbol_referencer::position_f () const +Staff_symbol_referencer_interface::position_f () const { Real p =0.0; - SCM pos = get_elt_property ("staff-position"); + SCM pos = elt_l_->get_elt_property ("staff-position"); if (gh_number_p (pos)) p = gh_scm2double (pos); Staff_symbol * st = staff_symbol_l (); if (st) { - Score_element * c = common_refpoint (st, Y_AXIS); - Real y = relative_coordinate (c, Y_AXIS) + Score_element * c = elt_l_->common_refpoint (st, Y_AXIS); + Real y = elt_l_->relative_coordinate (c, Y_AXIS) - st->relative_coordinate (c, Y_AXIS); - p += 2.0 * y / staff_line_leading_f (); + p += 2.0 * y / st->staff_line_leading_f (); } return p; } @@ -73,15 +87,17 @@ Staff_symbol_referencer::position_f () const should use offset callback! */ Real -Staff_symbol_referencer::callback (Dimension_cache const * c) +Staff_symbol_referencer_interface::callback (Dimension_cache const * c) { Score_element * sc = dynamic_cast (c->element_l ()); - Staff_symbol_referencer * ref = dynamic_cast (sc); + + SCM pos = sc->get_elt_property ("staff-position"); Real off =0.0; if (gh_number_p (pos)) { - off = gh_scm2double (pos) * ref->staff_line_leading_f () /2.0; + Real space = staff_symbol_referencer_interface (sc).staff_line_leading_f (); + off = gh_scm2double (pos) * space/2.0; } sc->set_elt_property ("staff-position", gh_double2scm (0.0)); @@ -90,20 +106,31 @@ Staff_symbol_referencer::callback (Dimension_cache const * c) void -Staff_symbol_referencer::set_position (Real p) +Staff_symbol_referencer_interface::set_position (Real p) { - Real halfspace = staff_line_leading_f ()* 0.5; - - translate_axis (- halfspace * position_f (), Y_AXIS); - Staff_symbol *st = staff_symbol_l (); - if (st) - translate_axis (halfspace * p, Y_AXIS); + Staff_symbol * st = staff_symbol_l (); + if (st && elt_l_->common_refpoint(st, Y_AXIS)) + { + Real oldpos = position_f (); + elt_l_->set_elt_property ("staff-position", gh_double2scm (p - oldpos)); + } else { - // SCM pos = get_elt_property ("staff-position"); - set_elt_property ("staff-position", - gh_double2scm (p)); - // gh_double2scm (p + gh_scm2double (pos))); + elt_l_->set_elt_property ("staff-position", + gh_double2scm (p)); + } + + Array &callbacks (elt_l_->dim_cache_[Y_AXIS]->off_callbacks_); + for (int i=0; i < callbacks.size ();i++) + if (callbacks[i] == callback) + return ; + + callbacks.push (callback); } +Staff_symbol_referencer_interface +staff_symbol_referencer_interface (Score_element const*e) +{ + return e; // gee, I'm so smart! +} diff --git a/lily/staff-sym.cc b/lily/staff-symbol.cc similarity index 95% rename from lily/staff-sym.cc rename to lily/staff-symbol.cc index 2bc87b2321..bd9d63bbcd 100644 --- a/lily/staff-sym.cc +++ b/lily/staff-symbol.cc @@ -72,3 +72,8 @@ Staff_symbol::steps_i() const { return no_lines_i_*2; } +Real +Staff_symbol::staff_line_leading_f () +{ + return staff_line_leading_f_; +} diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index cdb819767c..e6bd43c2bd 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -6,6 +6,7 @@ (c) 1997--1999 Han-Wen Nienhuys */ +#include "staff-symbol-referencer.hh" #include "stem-engraver.hh" #include "note-head.hh" #include "stem.hh" @@ -48,7 +49,10 @@ Stem_engraver::acknowledge_element(Score_element_info i) if (!stem_p_) { stem_p_ = new Stem; - stem_p_->flag_i_ = duration_log; + Staff_symbol_referencer_interface st(stem_p_); + st.set_interface (); + + stem_p_->set_elt_property ("duration-log", gh_int2scm (duration_log)); if (abbrev_req_l_) { @@ -75,9 +79,9 @@ Stem_engraver::acknowledge_element(Score_element_info i) announce_element (Score_element_info (stem_p_, r)); } - if (stem_p_->flag_i_ != duration_log) + if (stem_p_->flag_i () != duration_log) { - r->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << stem_p_->flag_i_)); + r->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << stem_p_->flag_i ())); } stem_p_->add_head (h); @@ -112,7 +116,7 @@ Stem_engraver::do_pre_move_processing() // UGH. Should mark non-forced instead. SCM dir = stem_p_->get_elt_property ("direction"); - if (gh_number_p (dir) && gh_int2scm (dir)) + if (gh_number_p (dir) && to_dir(dir)) { stem_p_->set_elt_property ("dir-forced", SCM_BOOL_T); } diff --git a/lily/stem-info.cc b/lily/stem-info.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/stem-staff-side.cc b/lily/stem-staff-side.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index fc6df56fa8..069ef6259c 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -15,6 +15,8 @@ #include "stem.hh" #include "offset.hh" #include "dimension-cache.hh" +#include "staff-symbol-referencer.hh" + Stem_tremolo::Stem_tremolo () { @@ -40,7 +42,8 @@ Interval Stem_tremolo::dim_callback (Dimension_cache const *c) { Stem_tremolo * s = dynamic_cast (c->element_l ()); - Real space = s->stem_l ()->staff_line_leading_f (); + Real space = Staff_symbol_referencer_interface (s->stem_l ()) + .staff_line_leading_f (); return Interval (-space, space); } @@ -57,7 +60,7 @@ Stem_tremolo::do_brew_molecule_p () const Real interbeam_f = paper_l ()->interbeam_f (mult); Real w = gh_scm2double (get_elt_property ("beam-width")); - Real space = st->staff_line_leading_f (); + Real space = Staff_symbol_referencer_interface (st).staff_line_leading_f (); Real internote_f = space / 2; Real beam_f = gh_scm2double (get_elt_property ("beam-thickness")); diff --git a/lily/stem.cc b/lily/stem.cc index 9f9ab098e9..a6ca3d3df5 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -21,12 +21,11 @@ #include "rest.hh" #include "group-interface.hh" #include "cross-staff.hh" +#include "staff-symbol-referencer.hh" Stem::Stem () { beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = -1; - yextent_drul_[DOWN] = yextent_drul_[UP] = 0; - flag_i_ = 2; } Interval_t @@ -48,43 +47,38 @@ Stem::head_positions () const Interval_t r; for (int i =0; i < head_l_arr.size (); i++) { - int p = (int)head_l_arr[i]->position_f (); + Staff_symbol_referencer_interface si (head_l_arr[i]); + int p = (int)si.position_f (); r[BIGGER] = r[BIGGER] >? p; r[SMALLER] = r[SMALLER] balltype_i_; + return first_head ()->balltype_i (); } Note_head* @@ -137,7 +130,7 @@ Stem::add_head (Rhythmic_head *n) bool Stem::invisible_b () const { - return !(first_head () && first_head()->balltype_i_ >= 1); + return !(first_head () && first_head()->balltype_i () >= 1); } int @@ -160,8 +153,6 @@ Stem::get_default_dir () const return Direction (int(paper_l ()->get_var ("stem_default_neutral_direction"))); } - - void Stem::set_default_stemlen () { @@ -189,10 +180,10 @@ Stem::set_default_stemlen () if (((int)chord_start_f ()) && (get_direction () != get_default_dir ())) length_f -= shorten_f; - - if (flag_i_ >= 5) + + if (flag_i () >= 5) length_f += 2.0; - if (flag_i_ >= 6) + if (flag_i () >= 6) length_f += 1.0; set_stemend ((get_direction () > 0) ? head_positions()[BIGGER] + length_f: @@ -203,6 +194,13 @@ Stem::set_default_stemlen () set_stemend (0); } +int +Stem::flag_i () const +{ + SCM s = get_elt_property ("duration-log"); + return (gh_number_p (s)) ? gh_scm2int (s) : 2; +} + //xxx void Stem::set_default_extents () @@ -232,10 +230,11 @@ Stem::set_noteheads () head_l_arr.top ()->set_elt_property ("extremal", SCM_BOOL_T); int parity=1; - int lastpos = int (beginhead->position_f ()); + int lastpos = int (Staff_symbol_referencer_interface (beginhead).position_f ()); for (int i=1; i < head_l_arr.size (); i ++) { - int dy =abs (lastpos- (int)head_l_arr[i]->position_f ()); + Real p = Staff_symbol_referencer_interface (head_l_arr[i]).position_f (); + int dy =abs (lastpos- (int)p); if (dy <= 1) { @@ -245,14 +244,14 @@ Stem::set_noteheads () } else parity = 1; - lastpos = int (head_l_arr[i]->position_f ()); + lastpos = int (p); } } void Stem::do_pre_processing () { - if (yextent_drul_[DOWN]== yextent_drul_[UP]) + if (yextent_.empty_b ()) set_default_extents (); set_noteheads (); @@ -307,7 +306,7 @@ Stem::flag () const char c = (get_direction () == UP) ? 'u' : 'd'; Molecule m = lookup_l ()->afm_find (String ("flags-") + to_str (c) + - to_str (flag_i_)); + to_str (flag_i ())); if (!style.empty_b ()) m.add_molecule(lookup_l ()->afm_find (String ("flags-") + to_str (c) + style)); return m; @@ -319,7 +318,7 @@ Stem::dim_callback (Dimension_cache const* c) Stem * s = dynamic_cast (c->element_l ()); Interval r (0, 0); - if (s->get_elt_property ("beam") != SCM_UNDEFINED || abs (s->flag_i_) <= 2) + if (s->get_elt_property ("beam") != SCM_UNDEFINED || abs (s->flag_i ()) <= 2) ; // TODO! else { @@ -338,8 +337,9 @@ Molecule* Stem::do_brew_molecule_p () const { Molecule *mol_p =new Molecule; - Drul_array stem_y = yextent_drul_; - Real dy = staff_line_leading_f ()/2.0; + Interval stem_y = yextent_; + Real dy = staff_symbol_referencer_interface (this) + .staff_line_leading_f ()/2.0; Real head_wid = 0; if (first_head ()) @@ -355,7 +355,7 @@ Stem::do_brew_molecule_p () const } if (get_elt_property ("beam") == SCM_UNDEFINED - && abs (flag_i_) > 2) + && abs (flag_i ()) > 2) { Molecule fl = flag (); fl.translate_axis(stem_y[get_direction ()]*dy, Y_AXIS); @@ -403,19 +403,20 @@ Stem::beam_l ()const Stem_info -Stem::get_info () const +Stem::calc_stem_info () const { assert (beam_l ()); SCM bd = get_elt_property ("beam-dir"); - Real internote_f = staff_line_leading_f ()/2; + Real internote_f + = staff_symbol_referencer_interface (this).staff_line_leading_f ()/2; Direction beam_dir; Stem_info info; - if (gh_number_p (bd)) + if (isdir_b (bd)) { - beam_dir = (Direction)gh_scm2int (bd); + beam_dir = to_dir (bd); } else { diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 40646392ed..56f7b3eae1 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -9,7 +9,7 @@ #include "dimension-cache.hh" #include "engraver.hh" -#include "staff-side.hh" +#include "side-position-interface.hh" #include "text-item.hh" #include "musical-request.hh" #include "note-head.hh" diff --git a/lily/tie.cc b/lily/tie.cc index 6959854d0f..f7ea46e801 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -11,10 +11,7 @@ #include "note-head.hh" #include "paper-column.hh" #include "debug.hh" -#include "group-interface.hh" - - - +#include "staff-symbol-referencer.hh" void Tie::set_head (Direction d, Note_head * head_l) @@ -22,7 +19,7 @@ Tie::set_head (Direction d, Note_head * head_l) assert (!head (d)); if (d == LEFT) gh_set_car_x (get_elt_property ("heads"), head_l->self_scm_ ); - else if (d == LEFT) + else if (d == RIGHT) gh_set_cdr_x (get_elt_property ("heads"), head_l->self_scm_ ); set_bounds (d, head_l); @@ -51,8 +48,10 @@ Tie::head (Direction d) const Direction Tie::get_default_dir () const { - int m = int (head (LEFT)->position_f () - + head (RIGHT)->position_f ()) /2; + Real p1 = Staff_symbol_referencer_interface (head (LEFT)).position_f () ; + Real p2 = Staff_symbol_referencer_interface (head (RIGHT)).position_f () ; + + int m = int (p1 + p2); /* If dir is not determined: inverse of stem: down @@ -84,7 +83,14 @@ Tie::do_add_processing() void Tie::do_post_processing() { - assert (head (LEFT) || head (RIGHT)); + if (!head (LEFT) && !head (RIGHT)) + { + programming_error ("Tie without heads."); + set_elt_property ("transparent", SCM_BOOL_T); + set_empty (X_AXIS); + set_empty (Y_AXIS); + return; + } Real interline_f = paper_l ()->get_var ("interline"); Real internote_f = interline_f / 2; @@ -167,8 +173,10 @@ Tie::do_post_processing() for smal slurs */ - Real ypos = head (LEFT) ? head (LEFT)->position_f () - : head (RIGHT)->position_f (); + + Real ypos = head (LEFT) + ? Staff_symbol_referencer_interface (head (LEFT)).position_f () + : Staff_symbol_referencer_interface (head (RIGHT)).position_f () ; Real y_f = internote_f * ypos; int ypos_i = int (ypos); diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 48935c674c..7f047f908e 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -58,15 +58,8 @@ Vertical_align_engraver::do_removal_processing() bool Vertical_align_engraver::qualifies_b (Score_element_info i) const { -#if 0 - Translator * t = i.origin_trans_l_arr_[0]; -#endif int sz = i.origin_trans_l_arr_.size() ; -#if 0 - return (sz == 1 && dynamic_cast (t)) - || (sz == 2 && dynamic_cast (t)); -#endif Axis_group_element * elt = dynamic_cast (i.elem_l_); diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 373b9359dd..777677986c 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.10 -Entered-date: 08DEC99 +Version: 1.3.11 +Entered-date: 14DEC99 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.10.tar.gz + 1000k lilypond-1.3.11.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.10.tar.gz + 1000k lilypond-1.3.11.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 63cc2657f1..0ece23f2da 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.10 +Version: 1.3.11 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.10.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.11.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # get Packager from (undocumented?) ~/.rpmmacros! -- 2.39.5