From fa891b75e895f16fc3871531e244abe78f9d93ff Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 14 Mar 2000 15:16:52 +0100 Subject: [PATCH] patch::: 1.3.32.hwn2 1.3.32.hwn2 =========== * Cleanups for Dynamic_engraver and Dynamic_line_spanner. * Warn if last column in score is musical. Helps catch programming errors. * Spanner::spanned_drul_ now is private. --- Zorg dat de dynamic-line-spanner als typeset_element () wordt aangeroepen verschillende linker en rechter spanpunten heeft. Je mag hiervoor *nooit* de laatste musical_column uit de score gebruiken (want de laatste moet altijd breakable, dus non-musical, zijn.) Het gaat fout met crescendo die over space-noten heen zijn gezet. Zie ook bug-voorbeeld in input/bugs/b.ly. Ik heb nog geprobeerd robuustheids fix te maken in spanner.cc als spanpunten wel gelijk zijn, maar kreeg niet werkend, en gdb snapt multiple inheritance ook niet. Verder heb ik wat ? vervangen door /* uitleg */. Misschien kan jij er weer iets bij typen. Generated by hanwen@cs.uu.nl, From = lilypond-1.3.32.hwn1, To = lilypond-1.3.32.hwn2 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.32.hwn2.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure --- CHANGES | 16 ++++- VERSION | 2 +- input/bugs/b.fly | 4 ++ lily/audio-item.cc | 2 +- lily/axis-group-engraver.cc | 4 +- lily/beam.cc | 8 +-- lily/crescendo.cc | 2 +- lily/dynamic-engraver.cc | 95 ++++++++++---------------- lily/extender-engraver.cc | 4 +- lily/extender-spanner.cc | 6 +- lily/hyphen-engraver.cc | 4 +- lily/hyphen-spanner.cc | 6 +- lily/include/atom.hh | 17 ----- lily/include/axis-align-item.hh | 6 +- lily/include/axis-align-spanner.hh | 6 +- lily/include/axis-group-element.hh | 4 +- lily/include/axis-group-item.hh | 4 +- lily/include/axis-group-spanner.hh | 6 +- lily/include/line-of-score.hh | 2 +- lily/include/spanner.hh | 7 +- lily/include/super-element.hh | 5 +- lily/line-group-group-engraver.cc | 4 +- lily/line-of-score.cc | 4 +- lily/multi-measure-rest.cc | 14 ++-- lily/paper-score.cc | 5 ++ lily/score-engraver.cc | 19 ++++-- lily/separating-line-group-engraver.cc | 4 +- lily/slur.cc | 58 +++------------- lily/spacing-engraver.cc | 4 +- lily/spanner.cc | 77 ++++++++++++++------- lily/staff-symbol-engraver.cc | 4 +- lily/staff-symbol-referencer.cc | 15 +++- lily/staff-symbol.cc | 6 +- lily/tie-column.cc | 4 +- lily/tie.cc | 7 +- lily/tuplet-spanner.cc | 8 +-- lily/vertical-align-engraver.cc | 4 +- lily/volta-spanner.cc | 4 +- 38 files changed, 227 insertions(+), 224 deletions(-) create mode 100644 input/bugs/b.fly diff --git a/CHANGES b/CHANGES index 82ae10ab04..f659443b62 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,18 @@ -1.3.32.jcn3 +--- ../lilypond-1.3.32.hwn1/CHANGES Tue Mar 14 12:47:50 2000 +++ b/CHANGES Tue Mar 14 15:16:52 2000 +@@ -1,3 +1,12 @@ +1.3.32.hwn2 +=========== + +* Cleanups for Dynamic_engraver and Dynamic_line_spanner. + +* Warn if last column in score is musical. Helps catch programming errors. + +* Spanner::spanned_drul_ now is private. + + 1.3.32.jcn2 + =========== + 1.3.32.jcn3 =========== * Embedded newlines in text items are now allowed. This helps avoiding diff --git a/VERSION b/VERSION index 340fa5797e..4f01f008b7 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=32 -MY_PATCH_LEVEL=jcn3 +MY_PATCH_LEVEL=hwn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/b.fly b/input/bugs/b.fly new file mode 100644 index 0000000000..0b3c3a38d8 --- /dev/null +++ b/input/bugs/b.fly @@ -0,0 +1,4 @@ + +\time 3/2; < a1. + { s1 \> s4 \! s4\ppp} > + diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 410222f0e5..60b15abb5c 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -78,7 +78,7 @@ Audio_tie::set_note (Direction d, Audio_note* note_l) { assert (!note_l_drul_[d]); note_l_drul_[d] = note_l; - //set_bounds (d, head_l); + //set_bound (d, head_l); // add_dependency (head_l); } diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 9ae9db6438..e4182d8f5a 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -20,7 +20,7 @@ Axis_group_engraver::do_creation_processing () { staffline_p_ = get_spanner_p (); staffline_p_->set_axes (Y_AXIS, Y_AXIS); - staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ()); + staffline_p_->set_bound(LEFT,get_staff_info().command_pcol_l ()); announce_element (Score_element_info (staffline_p_, 0)); } @@ -32,7 +32,7 @@ Axis_group_engraver::get_spanner_p () const void Axis_group_engraver::do_removal_processing () { - staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ()); + staffline_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ()); typeset_element (staffline_p_); staffline_p_ = 0; } diff --git a/lily/beam.cc b/lily/beam.cc index e104c10ec8..4b87534347 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -50,10 +50,10 @@ Beam::add_stem (Stem*s) assert (!s->beam_l ()); s->set_elt_property ("beam", self_scm_); - if (!spanned_drul_[LEFT]) - set_bounds (LEFT,s); + if (!get_bound (LEFT)) + set_bound (LEFT,s); else - set_bounds (RIGHT,s); + set_bound (RIGHT,s); } int @@ -742,7 +742,7 @@ Beam::do_brew_molecule () const mol.add_molecule (sb); } mol.translate_axis (x0 - - spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS), X_AXIS); + - get_bound (LEFT)->relative_coordinate (0, X_AXIS), X_AXIS); return mol; } diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 36bdcbdbec..ffe11eaefb 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -72,7 +72,7 @@ Crescendo::do_brew_molecule () const Direction d = LEFT; do { - Paper_column* s = dynamic_cast(spanned_drul_[d]); // UGH + Paper_column* s = dynamic_cast(get_bound (d)); // UGH broken[d] = (!s->musical_b ()); } while (flip (&d) != LEFT); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 38362df351..b729de9c65 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -28,11 +28,9 @@ class Dynamic_line_spanner : public Spanner { public: Dynamic_line_spanner (); - - void add_column (Note_column*); + VIRTUAL_COPY_CONS(Score_element); + void add_column (Item*); Direction get_default_dir () const; -protected: - virtual void do_post_processing (); }; Dynamic_line_spanner::Dynamic_line_spanner () @@ -42,11 +40,12 @@ Dynamic_line_spanner::Dynamic_line_spanner () } void -Dynamic_line_spanner::add_column (Note_column* n) +Dynamic_line_spanner::add_column (Item* n) { - if (!spanned_drul_[LEFT]) - set_bounds (LEFT, n); - set_bounds (RIGHT, n); + if (!get_bound (LEFT)) + set_bound (LEFT, n); + else + set_bound (RIGHT, n); add_dependency (n); } @@ -57,48 +56,6 @@ Dynamic_line_spanner::get_default_dir () const return DOWN; } -void -Dynamic_line_spanner::do_post_processing () -{ - Spanner::do_post_processing (); - Direction dir = directional_element (this).get (); - if (!dir) - dir = get_default_dir (); - - /* - Hier is ook vast iets voor? - */ - Staff_symbol_referencer_interface si (this); - Real above_staff = si.line_count () + 2; - -#if 0 - // Aargh, nu snap ik waarom ik het niet snap - // zie Staff_symbol_referencer_interface::set_position - - if (si.position_f () * dir < above_staff) - si.set_position (above_staff * (int)dir); - - SCM s = get_elt_property ("padding"); - if (gh_number_p (s)) - { - si.set_position (si.position_f () + gh_scm2double (s) * (int) dir); - } -#else - Real dy = 0; - Real pos = si.position_f () * dir; - if (pos * dir < above_staff) - dy = above_staff; - - SCM s = get_elt_property ("padding"); - if (gh_number_p (s)) - dy += gh_scm2double (s); - - Real half_space = si.staff_space () / 2; - translate_axis (dy*half_space*dir, Y_AXIS); -#endif - -} - /** print text & hairpin dynamics. */ @@ -162,6 +119,12 @@ Dynamic_engraver::do_post_move_processing () text_req_l_ = 0; span_req_l_drul_[START] = 0; span_req_l_drul_[STOP] = 0; + + /* ugr; we must attach the Dynamic_line_spanner to something + to be sure that the linebreaker will not be confused + */ + // if (line_spanner_) + // line_spanner_->add_column (LEFT, get_staff_info ().command_pcol_l ()); } bool @@ -229,8 +192,8 @@ Dynamic_engraver::do_process_requests () else { assert (!finished_cresc_p_); - cresc_p_->set_bounds(RIGHT, get_staff_info ().musical_pcol_l ()); - cresc_p_->add_dependency (get_staff_info ().musical_pcol_l ()); + cresc_p_->set_bound(RIGHT, get_staff_info ().musical_pcol_l ()); + // cresc_p_->add_dependency (get_staff_info ().musical_pcol_l ()); finished_cresc_p_ = cresc_p_; cresc_p_ = 0; span_start_req_l_ = 0; @@ -272,11 +235,21 @@ Dynamic_engraver::do_process_requests () + "Spanner", SCM_UNDEFINED); } - cresc_p_->set_bounds(LEFT, get_staff_info ().musical_pcol_l ()); - cresc_p_->set_bounds(RIGHT, get_staff_info ().musical_pcol_l ()); - cresc_p_->add_dependency (get_staff_info ().musical_pcol_l ()); + cresc_p_->set_bound(LEFT, get_staff_info ().musical_pcol_l ()); + - // arrragh, brr, urg: we know how wide text is, no? + // cresc_p_->add_dependency (get_staff_info ().musical_pcol_l ()); + + /* + We know how wide the text is, if we can be sure that the + text already has relevant pointers into the paperdef, + and it has its font-size property set. + + Since font-size may be set by a context higher up, we + can not be sure of the size. + */ + + if (text_p_) { index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"), @@ -288,7 +261,7 @@ Dynamic_engraver::do_process_requests () assert (line_spanner_); cresc_p_->set_parent (line_spanner_, Y_AXIS); - cresc_p_->add_dependency (line_spanner_); + // cresc_p_->add_dependency (line_spanner_); announce_element (Score_element_info (cresc_p_, span_req_l_drul_[START])); } } @@ -300,6 +273,7 @@ Dynamic_engraver::do_pre_move_processing () typeset_all (); } + void Dynamic_engraver::do_removal_processing () { @@ -323,7 +297,6 @@ Dynamic_engraver::typeset_all () { if (finished_cresc_p_) { - //finished_cresc_p_->set_bounds (RIGHT, get_staff_info ().musical_pcol_l ()); typeset_element (finished_cresc_p_); finished_cresc_p_ =0; } @@ -338,10 +311,12 @@ Dynamic_engraver::typeset_all () TODO: This should be optionised: * break when group of dynamic requests ends * break now - * continue through piece - */ + * continue through piece */ if (line_spanner_ && last_request_mom_ < now_mom ()) { + + side_position (line_spanner_).add_staff_support (); + typeset_element (line_spanner_); line_spanner_ = 0; } diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index 32e6f01f38..9cab9a6db5 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -31,7 +31,7 @@ Extender_engraver::acknowledge_element (Score_element_info i) { current_lyric_l_ = t; if (extender_spanner_p_ - && !extender_spanner_p_->spanned_drul_[RIGHT] + && !extender_spanner_p_->get_bound (RIGHT) ) { extender_spanner_p_->set_textitem (RIGHT, t); @@ -60,7 +60,7 @@ Extender_engraver::do_removal_processing () if (extender_spanner_p_) { req_l_->warning (_ ("unterminated extender")); - extender_spanner_p_->set_bounds(RIGHT, get_staff_info ().command_pcol_l ()); + extender_spanner_p_->set_bound(RIGHT, get_staff_info ().command_pcol_l ()); } } diff --git a/lily/extender-spanner.cc b/lily/extender-spanner.cc index ff02c16d92..a590aa1a24 100644 --- a/lily/extender-spanner.cc +++ b/lily/extender-spanner.cc @@ -58,8 +58,8 @@ Extender_spanner::do_post_processing () Direction d = LEFT; do { - Item* t = spanned_drul_[d] - ? spanned_drul_[d] : spanned_drul_[(Direction)-d]; + Item* t = get_bound (d) + ? get_bound (d) : get_bound ((Direction)-d); if (d == LEFT) dx_f_drul_[d] += t->extent (X_AXIS).length (); else @@ -72,7 +72,7 @@ Extender_spanner::do_post_processing () void Extender_spanner::set_textitem (Direction d, Item* textitem_l) { - set_bounds (d, textitem_l); + set_bound (d, textitem_l); add_dependency (textitem_l); } diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index 1b73e01499..b259f29670 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -29,7 +29,7 @@ Hyphen_engraver::acknowledge_element (Score_element_info i) { current_lyric_l_ = t; if (hyphen_spanner_p_ - && !hyphen_spanner_p_->spanned_drul_[RIGHT] + && !hyphen_spanner_p_->get_bound (RIGHT) ) { hyphen_spanner_p_->set_textitem (RIGHT, t); @@ -58,7 +58,7 @@ Hyphen_engraver::do_removal_processing () if (hyphen_spanner_p_) { req_l_->warning (_ ("unterminated hyphen")); - hyphen_spanner_p_->set_bounds(RIGHT, get_staff_info ().command_pcol_l ()); + hyphen_spanner_p_->set_bound(RIGHT, get_staff_info ().command_pcol_l ()); } } diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index 65470ea81c..3fd4f63bc9 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -65,8 +65,8 @@ Hyphen_spanner::do_post_processing () Direction d = LEFT; do { - Item* t = spanned_drul_[d] - ? spanned_drul_[d] : spanned_drul_[(Direction)-d]; + Item* t = get_bound (d) + ? get_bound (d) : get_bound ((Direction)-d); if (d == LEFT) dx_f_drul_[d] += t->extent (X_AXIS).length (); else @@ -79,7 +79,7 @@ Hyphen_spanner::do_post_processing () void Hyphen_spanner::set_textitem (Direction d, Item* textitem_l) { - set_bounds (d, textitem_l); + set_bound (d, textitem_l); add_dependency (textitem_l); } diff --git a/lily/include/atom.hh b/lily/include/atom.hh index 576dc45e1a..e69de29bb2 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -1,17 +0,0 @@ -/* - atom.hh -- declare Atom - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - -#ifndef ATOM_HH -#define ATOM_HH - -#include "lily-proto.hh" - -#include "lily-guile.hh" - - -#endif diff --git a/lily/include/axis-align-item.hh b/lily/include/axis-align-item.hh index b6a0ab5231..bcea4e18d9 100644 --- a/lily/include/axis-align-item.hh +++ b/lily/include/axis-align-item.hh @@ -13,8 +13,10 @@ #include "align-element.hh" #include "axis-group-item.hh" -class Axis_align_item : public virtual Align_element, - public virtual Axis_group_item +/* + UGH. FIXME: multiple inheritance. + */ +class Axis_align_item : public virtual Align_element, public virtual Axis_group_item { public: Axis_align_item (); diff --git a/lily/include/axis-align-spanner.hh b/lily/include/axis-align-spanner.hh index 9fdb72194d..0352968aee 100644 --- a/lily/include/axis-align-spanner.hh +++ b/lily/include/axis-align-spanner.hh @@ -14,8 +14,10 @@ #include "align-element.hh" #include "axis-group-spanner.hh" -class Axis_align_spanner : public virtual Align_element, - public virtual Axis_group_spanner +/* + FIXME: multiple inheritance + */ +class Axis_align_spanner : public virtual Align_element, public virtual Axis_group_spanner { public: VIRTUAL_COPY_CONS(Score_element); diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh index 969fd7b736..83acd188b1 100644 --- a/lily/include/axis-group-element.hh +++ b/lily/include/axis-group-element.hh @@ -16,7 +16,9 @@ /** Treat a group of elements a unity in either or both axis sense . This is a wrapper around Axis_group_administration - */ + + FIXME: remove this class, and make interface of it, so we can remove multiple inheritance. +*/ class Axis_group_element : public virtual Score_element { /// modify fields of E for removal. diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index 06561d0301..0f88cc78bb 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -16,9 +16,7 @@ /** A grouping item. Its special support is in do_breakable_col_processing(). */ - -class Axis_group_item : public virtual Axis_group_element, - public virtual Item +class Axis_group_item : public virtual Axis_group_element, 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 a88d9c3dad..d421973f50 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -13,8 +13,10 @@ #include "spanner.hh" #include "axis-group-element.hh" -/** An element which groups a line in a certain direction. The most - useful example of this is the Vertical_group_spanner */ +/** + An element which groups a line in a certain direction. The most + useful example of this is the Vertical_group_spanner +*/ class Axis_group_spanner : public virtual Axis_group_element, public virtual Spanner diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 1c65a78ebc..994a50b20d 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -11,7 +11,7 @@ #include "axis-group-spanner.hh" #include "super-element.hh" -/// the columns of a score that form one line. +/// the columns of a score that form one line. FIXME: multiple inheritance class Line_of_score : public Axis_group_spanner, public Super_element { public: diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 7736ed8610..130604b863 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -35,11 +35,12 @@ class Axis_group_spanner; */ class Spanner : public virtual Score_element { -public: Drul_array spanned_drul_; - Link_array broken_into_l_arr_; - void set_bounds (Direction d, Item*); +public: + Link_array broken_into_l_arr_; + void set_bound (Direction d, Item*); + Item *get_bound (Direction d) const; Spanner (); Spanner (Spanner const &); diff --git a/lily/include/super-element.hh b/lily/include/super-element.hh index c27d1bd963..cdc121c06e 100644 --- a/lily/include/super-element.hh +++ b/lily/include/super-element.hh @@ -19,8 +19,9 @@ dependency graph, and calls the appropriate Score_element::do_XXX_processing function on each Score_element it encounters. - - */ + + FIXME: remove this class, to eliminate multiple inheritance. Merge + with Line_of_score ? */ class Super_element : public virtual Score_element { public: void space_processing (); diff --git a/lily/line-group-group-engraver.cc b/lily/line-group-group-engraver.cc index f30e40959f..a0f8d10dbc 100644 --- a/lily/line-group-group-engraver.cc +++ b/lily/line-group-group-engraver.cc @@ -34,7 +34,7 @@ Line_group_engraver_group::do_removal_processing() { Engraver_group_engraver::do_removal_processing (); - staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ()); + staffline_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ()); Engraver_group_engraver::typeset_element (staffline_p_); staffline_p_ = 0; } @@ -43,7 +43,7 @@ void Line_group_engraver_group::do_creation_processing() { create_line_spanner (); - staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ()); + staffline_p_->set_bound(LEFT,get_staff_info().command_pcol_l ()); Engraver::announce_element (Score_element_info (staffline_p_,0)); } diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 69d7f36339..cde8965e03 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -48,8 +48,8 @@ Line_of_score::break_into_pieces (Array const &breaking) line_l->rank_i_ = i; Link_array c (breaking[i].cols_); pscore_l_->typeset_element (line_l); - line_l->set_bounds(LEFT,c[0]); - line_l->set_bounds(RIGHT,c.top ()); + line_l->set_bound(LEFT,c[0]); + line_l->set_bound(RIGHT,c.top ()); for (int j=0; j < c.size(); j++) { c[j]->translate_axis (breaking[i].config_[j],X_AXIS); diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index cba889d3f7..81ba1f26da 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -40,7 +40,7 @@ Multi_measure_rest::do_brew_molecule () const Direction d = LEFT; do { - Item * col = spanned_drul_[d]->column_l (); + Item * col = get_bound (d)->column_l (); Interval coldim = col->extent (X_AXIS) + col->relative_coordinate (0, X_AXIS); @@ -51,7 +51,7 @@ Multi_measure_rest::do_brew_molecule () const Molecule mol; Real x_off = 0.0; - Real rx = spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS); + Real rx = get_bound (LEFT)->relative_coordinate (0, X_AXIS); /* we gotta stay clear of sp_iv, so move a bit to the right if needed. @@ -143,8 +143,8 @@ Multi_measure_rest::do_add_processing () { Link_array column_arr (Group_interface__extract_elements (this, (Item*)0, "columns")); - set_bounds (LEFT, column_arr[0 >? column_arr.size () - 2]); - set_bounds (RIGHT, column_arr.top ()); + set_bound (LEFT, column_arr[0 >? column_arr.size () - 2]); + set_bound (RIGHT, column_arr.top ()); } // set columns to SCM_EOL? @@ -175,14 +175,14 @@ Multi_measure_rest::get_rods () const { Array a; - if (!(spanned_drul_[LEFT] && spanned_drul_[RIGHT])) + if (!(get_bound (LEFT) && get_bound (RIGHT))) { programming_error ("Multi_measure_rest::get_rods (): I am not spanned!"); return a; } - Item * l = spanned_drul_[LEFT]->column_l (); - Item * r = spanned_drul_[RIGHT]->column_l (); + Item * l = get_bound (LEFT)->column_l (); + Item * r = get_bound (RIGHT)->column_l (); Item * lb = l->find_broken_piece (RIGHT); Item * rb = r->find_broken_piece (LEFT); diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 6bd6e33e05..b062978633 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -225,6 +225,11 @@ Paper_score::fixup_refpoints () { Score_element * se = unsmob_element (e); se->fixup_refpoint (); + + if (!dynamic_cast (se) && !se->parent_l (Y_AXIS)) + { + programming_error ("No parent!"); + } } } } diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index ed74043951..09c7ffd47f 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -53,7 +53,7 @@ Score_engraver::do_creation_processing () { scoreline_l_ = pscore_p_->line_l_; - scoreline_l_->set_bounds(LEFT, command_column_l_); + scoreline_l_->set_bound(LEFT, command_column_l_); command_column_l_->set_elt_property ("breakable", SCM_BOOL_T); @@ -65,10 +65,15 @@ void Score_engraver::do_removal_processing() { Engraver_group_engraver::do_removal_processing(); - scoreline_l_->set_bounds(RIGHT,command_column_l_); + scoreline_l_->set_bound(RIGHT,command_column_l_); command_column_l_->set_elt_property ("breakable", SCM_BOOL_T); + typeset_all (); + + + if (musical_column_l_->linked_b ()) + programming_error ("Last column in score should be non-musical"); set_columns (0,0); } @@ -128,9 +133,9 @@ Score_engraver::typeset_all() */ Direction d = LEFT; do { - if (!s->spanned_drul_[d]) + if (!s->get_bound (d)) { - s->set_bounds(d, command_column_l_); + s->set_bound(d, command_column_l_); ::warning (_f ("unbound spanner `%s'", classname(s))); } } while (flip(&d) != LEFT); @@ -189,7 +194,11 @@ Score_engraver::set_columns (Paper_column *new_command_l, We're forgetting about this column. Dump it, and make SCM forget it. - (UGH.) */ + FIXME: we should have another way of not putting this + column into the spacing problem. Maybe we shouldn't + even prevent this. + + */ scm_unprotect_object ((*current[i])->self_scm_); *current[i] =0; } diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 9cd56f58b6..7d99122fd5 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -25,13 +25,13 @@ Separating_line_group_engraver::do_creation_processing () { sep_span_p_ = new Separating_group_spanner; announce_element (Score_element_info (sep_span_p_, 0)); - sep_span_p_->set_bounds (LEFT, get_staff_info ().command_pcol_l ()); + sep_span_p_->set_bound (LEFT, get_staff_info ().command_pcol_l ()); } void Separating_line_group_engraver::do_removal_processing () { - sep_span_p_->set_bounds (RIGHT, get_staff_info ().command_pcol_l ()); + sep_span_p_->set_bound (RIGHT, get_staff_info ().command_pcol_l ()); typeset_element (sep_span_p_); sep_span_p_ =0; } diff --git a/lily/slur.cc b/lily/slur.cc index 916cc54e25..774a5dc132 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -302,9 +302,9 @@ Slur::do_add_processing () if (encompass_arr.size ()) { - set_bounds (LEFT, encompass_arr[0]); + set_bound (LEFT, encompass_arr[0]); if (encompass_arr.size () > 1) - set_bounds (RIGHT, encompass_arr.top ()); + set_bound (RIGHT, encompass_arr.top ()); } } @@ -411,7 +411,7 @@ Slur::set_extremities () dx_f_drul_[d] = 0; dy_f_drul_[d] = 0; - if ((note_column_drul[d] == spanned_drul_[d]) + if ((note_column_drul[d] == get_bound (d)) && note_column_drul[d]->first_head () && (note_column_drul[d]->stem_l ())) { @@ -425,7 +425,7 @@ Slur::set_extremities () && !((my_dir == stem_l->get_direction ()) && stem_l->beam_l () && (stem_l->beam_count (-d) >= 1))) { - dx_f_drul_[d] = spanned_drul_[d]->extent (X_AXIS).length () / 2; + dx_f_drul_[d] = get_bound (d)->extent (X_AXIS).length () / 2; dx_f_drul_[d] -= d * x_gap_f; if (stem_l->get_direction () != my_dir) @@ -445,7 +445,7 @@ Slur::set_extremities () else { dx_f_drul_[d] = stem_l->hpos_f () - - spanned_drul_[d]->relative_coordinate (0, X_AXIS); + - get_bound (d)->relative_coordinate (0, X_AXIS); /* side attached to beamed stem */ @@ -503,7 +503,7 @@ Slur::set_extremities () if (fix_broken_b) { - Direction d = (encompass_arr.top () != spanned_drul_[RIGHT]) ? + Direction d = (encompass_arr.top () != get_bound (RIGHT)) ? RIGHT : LEFT; dy_f_drul_[d] = info_drul[d][Y_AXIS]; if (!interstaff_b) @@ -569,7 +569,7 @@ Slur::get_encompass_offset_arr () const int cross_count = cross_staff_count (); bool cross_b = cross_count && cross_count < encompass_arr.size (); - if (encompass_arr[0] != spanned_drul_[LEFT]) + if (encompass_arr[0] != get_bound (LEFT)) { first--; Real is = calc_interstaff_dist (encompass_arr[0], this); @@ -580,7 +580,7 @@ Slur::get_encompass_offset_arr () const /* right is broken edge */ - if (encompass_arr.top () != spanned_drul_[RIGHT]) + if (encompass_arr.top () != get_bound (RIGHT)) { last++; } @@ -603,7 +603,9 @@ Slur::get_rods () const { Array a; Rod r; - r.item_l_drul_ = spanned_drul_; + r.item_l_drul_[LEFT] = get_bound (LEFT); + r.item_l_drul_[RIGHT] = get_bound (RIGHT); + r.distance_f_ = paper_l ()->get_var ("slur_x_minimum"); a.push (r); @@ -612,31 +614,6 @@ Slur::get_rods () const -#if 0 -SCM -ugly_scm (Bezier b) -{ - b.translate (-b.control_[0]); - Real alpha = b.control_[3].arg (); - - b.rotate ( -alpha); - if (b.control_[1][Y_AXIS] < 0) - { - b.control_[1][Y_AXIS] *= -1; - b.control_[2][Y_AXIS] *= -1; - } - - Real len = b.control_[3][X_AXIS]; - Real indent = 10 *b.control_[1][X_AXIS] / len ; - Real ht = 10 *b.control_[1][Y_AXIS] / len ; - - SCM res = scm_eval (scm_listify (ly_symbol2scm ("slur-ugly"), gh_double2scm (indent), gh_double2scm (ht), SCM_UNDEFINED )); - - return res; -} -#endif - - /* Ugh should have dash-length + dash-period */ @@ -653,19 +630,6 @@ Slur::do_brew_molecule () const else a = lookup_l ()->slur (one, directional_element (this).get () * thick, thick); -#if 0 - SCM u = ugly_scm (one); - if (gh_pair_p (u)) - { - Molecule mark = lookup_l ()-> text ( "roman", - to_str (gh_scm2double (gh_car (u)), "%0.2f") + "," + - to_str(gh_scm2double (gh_cdr (u)), "%0.2f"), - paper_l ()); - - mark.translate_axis (20 , Y_AXIS); - a.add_molecule (mark); - } -#endif return a; } diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 7f3ac132fc..5caefdf72e 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -35,7 +35,7 @@ void Spacing_engraver::do_creation_processing () { spacing_p_ =new Spacing_spanner; - spacing_p_->set_bounds (LEFT, get_staff_info ().command_pcol_l ()); + spacing_p_->set_bound (LEFT, get_staff_info ().command_pcol_l ()); announce_element (Score_element_info (spacing_p_, 0)); } @@ -44,7 +44,7 @@ Spacing_engraver::do_removal_processing () { Paper_column * p = get_staff_info ().command_pcol_l (); - spacing_p_->set_bounds (RIGHT, p); + spacing_p_->set_bound (RIGHT, p); typeset_element (spacing_p_); spacing_p_ =0; } diff --git a/lily/spanner.cc b/lily/spanner.cc index 7d0ca15fdd..2bc8b98ab4 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -32,38 +32,58 @@ Spanner::do_break_processing() if (left == right) { warning (_ ("Left spanpoint is right spanpoint")); - return; - } - - Link_array break_points = pscore_l_->broken_col_range (left,right); - - break_points.insert (left,0); - break_points.push (right); - for (int i=1; i < break_points.size(); i++) - { - Drul_array bounds; - bounds[LEFT] = break_points[i-1]; - bounds[RIGHT] = break_points[i]; + /* + FIXME: this is broken. + */ + /* + If we have a spanner spanning one column, we must break it + anyway because it might provide a parent for another item. */ Direction d = LEFT; do { - Item *&pc_l = bounds[d] ; - if (!pc_l->line_l()) - pc_l = pc_l->find_broken_piece(- d); - - assert (pc_l); + Item* bound = left->find_broken_piece (d); + Spanner * span_p = dynamic_cast( clone ()); + span_p->set_bound (LEFT, bound); + span_p->set_bound (RIGHT, bound); + + assert (span_p->line_l ()); + pscore_l_->typeset_element (span_p); + broken_into_l_arr_.push (span_p); } while ((flip(&d))!= LEFT); + } + else + { + Link_array break_points = pscore_l_->broken_col_range (left,right); - Spanner *span_p = dynamic_cast(clone ()); - span_p->set_bounds(LEFT,bounds[LEFT]); - span_p->set_bounds(RIGHT,bounds[RIGHT]); + break_points.insert (left,0); + break_points.push (right); + + for (int i=1; i < break_points.size(); i++) + { + Drul_array bounds; + bounds[LEFT] = break_points[i-1]; + bounds[RIGHT] = break_points[i]; + Direction d = LEFT; + do + { + Item *&pc_l = bounds[d] ; + if (!pc_l->line_l()) + pc_l = pc_l->find_broken_piece(- d); + + assert (pc_l); + } + while ((flip(&d))!= LEFT); + + Spanner *span_p = dynamic_cast(clone ()); + span_p->set_bound(LEFT,bounds[LEFT]); + span_p->set_bound(RIGHT,bounds[RIGHT]); - pscore_l_->typeset_element (span_p); - broken_into_l_arr_.push (span_p); + pscore_l_->typeset_element (span_p); + broken_into_l_arr_.push (span_p); + } } - broken_into_l_arr_.sort (Spanner::compare); } @@ -74,13 +94,20 @@ Spanner::set_my_columns() do { if (!spanned_drul_[i]->line_l()) - set_bounds(i,spanned_drul_[i]->find_broken_piece((Direction) -i)); + set_bound(i,spanned_drul_[i]->find_broken_piece((Direction) -i)); } while (flip(&i) != LEFT); } + +Item* +Spanner::get_bound (Direction d) const +{ + return spanned_drul_ [d]; +} + void -Spanner::set_bounds(Direction d, Item*i) +Spanner::set_bound(Direction d, Item*i) { spanned_drul_[d] =i; if (i) diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index a84f393a52..4bed0bf752 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -47,7 +47,7 @@ void Staff_symbol_engraver::do_creation_processing() { span_p_ = new Staff_symbol; - span_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ()); + span_p_->set_bound(LEFT,get_staff_info().command_pcol_l ()); announce_element (Score_element_info (span_p_, 0)); } @@ -62,7 +62,7 @@ Staff_symbol_engraver::do_removal_processing() if (gh_number_p (n)) span_p_->set_elt_property ("line-count", n); - span_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ()); + span_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ()); typeset_element (span_p_); span_p_ =0; } diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 0557fce059..00172d1985 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -108,7 +108,19 @@ Staff_symbol_referencer_interface::callback (Dimension_cache const * c) } /* - Huh? -- jcn + + This sets the position relative to the center of the staff symbol. + + The function is hairy, because it can be callled in two situations: + + 1. There is no staff yet; we must set staff-position + + 2. There is a staff, and perhaps someone even applied a + translate_axis (). Then we must compensate for the translation + + In either case, we set a callback to be sure that our new position + will be extracted from staff-position + */ void Staff_symbol_referencer_interface::set_position (Real p) @@ -117,7 +129,6 @@ Staff_symbol_referencer_interface::set_position (Real p) if (st && elt_l_->common_refpoint(st, Y_AXIS)) { Real oldpos = position_f (); - // Aargh! elt_l_->set_elt_property ("staff-position", gh_double2scm (p - oldpos)); } else diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc index 21123e75d9..4419d8dc12 100644 --- a/lily/staff-symbol.cc +++ b/lily/staff-symbol.cc @@ -19,12 +19,12 @@ Molecule Staff_symbol::do_brew_molecule() const { Score_element * common - = spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS); + = get_bound (LEFT)->common_refpoint (get_bound (RIGHT), X_AXIS); Real width = // right_shift - left_shift - + spanned_drul_[RIGHT]->relative_coordinate (common , X_AXIS) - - spanned_drul_[LEFT]->relative_coordinate (common, X_AXIS) + + get_bound (RIGHT)->relative_coordinate (common , X_AXIS) + - get_bound (LEFT)->relative_coordinate (common, X_AXIS) ; Real t = paper_l ()->get_var ("stafflinethickness"); diff --git a/lily/tie-column.cc b/lily/tie-column.cc index f23d218d93..eba1c4d8f0 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -27,8 +27,8 @@ Tie_column::add_tie (Tie *s) Group_interface g (this, "ties"); if (!g.count ()) { - set_bounds (LEFT, s->head (LEFT)); - set_bounds (RIGHT, s->head (RIGHT)); + set_bound (LEFT, s->head (LEFT)); + set_bound (RIGHT, s->head (RIGHT)); } group (this, "ties").add_element (s); diff --git a/lily/tie.cc b/lily/tie.cc index 87de462d73..e98bb1eea9 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -26,7 +26,7 @@ Tie::set_head (Direction d, Item * head_l) assert (!head (d)); index_set_cell (get_elt_property ("heads"), d, head_l->self_scm_); - set_bounds (d, head_l); + set_bound (d, head_l); add_dependency (head_l); } @@ -179,7 +179,10 @@ Tie::get_rods () const { Array a; Rod r; - r.item_l_drul_ = spanned_drul_; + + r.item_l_drul_ [LEFT]=get_bound (LEFT); + r.item_l_drul_ [RIGHT]=get_bound (RIGHT); + r.distance_f_ = paper_l ()->get_var ("tie_x_minimum"); a.push (r); return a; diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 5447595709..dd55332caa 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -116,8 +116,8 @@ Tuplet_spanner::do_add_processing () Link_array column_arr= Group_interface__extract_elements (this, (Note_column*)0, "columns"); - set_bounds (LEFT, column_arr[0]); - set_bounds (RIGHT, column_arr.top ()); + set_bound (LEFT, column_arr[0]); + set_bound (RIGHT, column_arr.top ()); } } @@ -223,8 +223,8 @@ calc_position_and_height (&offset,&dy); Score_element *b = unsmob_element (gh_car (bs)); Beam * beam_l = dynamic_cast (b); if (!broken_b () - && spanned_drul_[LEFT]->column_l () == beam_l->spanned_drul_[LEFT]->column_l () - && spanned_drul_[RIGHT]->column_l () == beam_l->spanned_drul_[RIGHT]->column_l ()) + && get_bound (LEFT)->column_l () == beam_l->get_bound (LEFT)->column_l () + && get_bound (RIGHT)->column_l () == beam_l->get_bound (RIGHT)->column_l ()) set_elt_property ("parallel-beam", SCM_BOOL_T); } } diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 464e7e3df2..001d79f494 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -25,7 +25,7 @@ Vertical_align_engraver::do_creation_processing() valign_p_->set_axis (Y_AXIS); valign_p_->set_elt_property ("stacking-dir", gh_int2scm (DOWN)); - valign_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ()); + valign_p_->set_bound(LEFT,get_staff_info().command_pcol_l ()); announce_element (Score_element_info (valign_p_ , 0)); } @@ -44,7 +44,7 @@ Vertical_align_engraver::do_removal_processing() valign_p_->threshold_interval_[SMALLER] = gh_scm2double (dist); } - valign_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ()); + valign_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ()); typeset_element (valign_p_); valign_p_ =0; } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 9f5427a244..a446d7cd12 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -114,8 +114,8 @@ Volta_spanner::do_add_processing () if (bar_arr.size ()) { - set_bounds (LEFT, bar_arr[0]); - set_bounds (RIGHT, bar_arr.top ()); + set_bound (LEFT, bar_arr[0]); + set_bound (RIGHT, bar_arr.top ()); } } -- 2.39.2