From 4dbd9a398ea9c3ee7f792880a14287c73ae7140d Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 22:26:16 +0000 Subject: [PATCH] lilypond-1.2.9 --- flower/include/parray.hh | 71 ++++++++++++++++++++ input/bugs/barline.ly | 16 ++--- lily/all-font-metrics.cc | 9 +-- lily/axis-group-item.cc | 4 +- lily/axis-group-spanner.cc | 44 ++++++++++--- lily/break-algorithm.cc | 40 +----------- lily/gdb.cc | 14 ++++ lily/graphical-axis-group.cc | 54 +++++++++------- lily/include/break.hh | 14 ---- lily/include/graphical-axis-group.hh | 6 +- lily/include/item.hh | 4 +- lily/include/line-of-score.hh | 5 +- lily/include/score-element.hh | 29 ++++++++- lily/include/spanner.hh | 15 +---- lily/item.cc | 14 ++-- lily/line-of-score.cc | 22 ++++--- lily/main.cc | 38 +++++------ lily/multi-measure-rest.cc | 4 +- lily/score-element.cc | 68 ++++++++------------ lily/score-engraver.cc | 6 +- lily/separating-group-spanner.cc | 4 +- lily/spacing-spanner.cc | 6 +- lily/spanner.cc | 75 +++++++++++++--------- lily/staff-sym.cc | 23 +++++-- stepmake/stepmake/documentation-rules.make | 1 - stepmake/stepmake/executable-targets.make | 2 +- stepmake/stepmake/executable-vars.make | 2 +- 27 files changed, 347 insertions(+), 243 deletions(-) create mode 100644 lily/gdb.cc diff --git a/flower/include/parray.hh b/flower/include/parray.hh index 3aabb2b06c..8a2efcb6fd 100644 --- a/flower/include/parray.hh +++ b/flower/include/parray.hh @@ -207,5 +207,76 @@ junk_pointer_array (Link_array &a) a.clear (); } + + +/* + lookup with binsearch, return tokencode. +*/ +template +int +binsearch_array (Array const &arr, T t, int (*compare)(T const&,T const&)) +{ + int lo; + int hi; + int cmp; + int result; + lo = 0; + hi = maxkey; + + /* binary search */ + do + { + cmp = (lo + hi) / 2; + + result = compare (t, arr[cmp]); + + if (result < 0) + hi = cmp; + else + lo = cmp; + } + while (hi - lo > 1); + if (!compare (t, arr[lo])) + return lo; + else + return -1; /* not found */ +} + + +template +int +binsearch_link_array (Link_array const &arr, T *t, + int (*compare)(T *const&,T *const&)) +{ + int lo; + int hi; + int cmp; + int result; + lo = 0; + hi = arr.size(); + + if (hi == 0) + return -1; + + /* binary search */ + do + { + cmp = (lo + hi) / 2; + + result = compare (t, arr[cmp]); + + if (result < 0) + hi = cmp; + else + lo = cmp; + } + while (hi - lo > 1); + if (!compare (t, arr[lo])) + return lo; + else + return -1; /* not found */ +} + + #endif // PARRAY_HH diff --git a/input/bugs/barline.ly b/input/bugs/barline.ly index ff14437a05..c9c9699906 100644 --- a/input/bugs/barline.ly +++ b/input/bugs/barline.ly @@ -6,31 +6,23 @@ melody = \notes \relative c' { \partial 8; g8 | - c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | - c4 c8 d [es () d] c4 | d4 es8 d c4. + + \bar "|.";\clef bass; } -text = \lyrics { - The ri -- ver is flo -- wing, flo -- wing and gro -- wing, the - ri -- ver is flo -- wing down to the sea. -} + accompaniment =\chords \sequential { r8 - c2-min f-min 7 d-min es4 c8-min r8 - c2-min f-min 7 g c-min + c2-min f-min 7 } \score { \simultaneous { \context ChordNames \accompaniment - \addlyrics \context Staff { - \property Voice.beamAuto = "0" - \property Staff.automaticMelismas = "1" \melody } - \context LyricVoice \text } \paper { } \midi { } diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 339e74c8d3..0ecfbf4420 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -66,12 +66,13 @@ All_font_metrics::find_font (String name) if (f) return f; - warning (_f("Can't find font `%s', loading default font.", name.ch_C())); + warning (_f ("Can't find font: `%s'", name.ch_C ())); + warning (_ ("Loading default font")); f = find_tfm (default_font_sz_); if (f) return f; - String s = _f("Can't find default font `%s\', giving up.", default_font_sz_); - s += String ("\n") + _f ("(search path: `%s)'", search_path_.str ()); - error (s); + error (_f ("Can't find default font: `%s'", default_font_sz_)); + error (_f ("(search path: `%s'", search_path_.str ())); + error (_ ("Giving up")); } diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc index b43f07e270..5068ecd099 100644 --- a/lily/axis-group-item.cc +++ b/lily/axis-group-item.cc @@ -39,8 +39,8 @@ Axis_group_item::do_breakable_col_processing() do { Axis_group_item * my_brok - = dynamic_cast (find_prebroken_piece(j)); - Item *new_l = it_l->find_prebroken_piece (j); + = 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); diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 71064ac8b4..246fcee710 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -30,15 +30,15 @@ Axis_group_spanner::do_break_processing_if_unbroken() && item_l->break_status_dir() == 0) { // last two checks are paranoia - Item * broken_item_l = - item_l->find_prebroken_piece (my_line); + 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) { - Spanner *broken_spanner_l = + Score_element *broken_spanner_l = spanner_l->find_broken_piece (my_line); add_element (broken_spanner_l); } @@ -62,19 +62,43 @@ Axis_group_spanner::do_break_processing() 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)) { @@ -85,11 +109,11 @@ Axis_group_spanner::do_break_processing() Axis_group_spanner * my_broken_l = dynamic_cast(find_broken_piece (l)); - Spanner * broken_span_l + Score_element * broken_span_l = sp->find_broken_piece (l); - + if (broken_span_l) - my_broken_l->add_element (broken_span_l); + my_broken_l->add_element (broken_span_l, a1, a2); } } else if (it && it->broken_original_b ()) @@ -98,7 +122,7 @@ Axis_group_spanner::do_break_processing() Direction j=LEFT; do { - Item * broken_item = it->find_prebroken_piece (j); + Item * broken_item = it->find_broken_piece (j); Line_of_score * item_line_l = broken_item->line_l() ; if (! item_line_l) continue; @@ -106,7 +130,7 @@ Axis_group_spanner::do_break_processing() Axis_group_spanner * v = dynamic_cast(find_broken_piece (item_line_l)); if (v) - v->add_element (broken_item); + v->add_element (broken_item, a1, a2); else { broken_item->set_elt_property (transparent_scm_sym, SCM_BOOL_T); @@ -124,7 +148,7 @@ Axis_group_spanner::do_break_processing() */ Axis_group_spanner * my_broken_l = dynamic_cast (find_broken_piece (elt->line_l())); - my_broken_l->add_element (elt); + my_broken_l->add_element (elt, a1, a2); } } diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc index 6674d5bcf0..32450301f8 100644 --- a/lily/break-algorithm.cc +++ b/lily/break-algorithm.cc @@ -20,35 +20,7 @@ #include "simple-spacer.hh" -String -Col_stats::str () const -{ - String s; - if (!count_i_) - s = _ ("0 lines"); - else if (count_i_ == 1) - s = _f ("1 line (of %.0f columns)", (Real)cols_i_/count_i_); - else - s = _f ("%d lines (with an average of %.1f columns)", - count_i_, (Real)cols_i_/count_i_); - return s; -} -void -Col_stats::add (Line_of_cols const& line) -{ - count_i_++; - cols_i_ += line.size (); -} - - -Col_stats::Col_stats () -{ - count_i_ =0; - cols_i_ =0; -} - -/* **************************************************************** */ Array @@ -152,7 +124,7 @@ void Break_algorithm::problem_OK () const { if (pscore_l_->col_l_arr_.empty ()) - error (_("score does not have any columns")); + error (_("Score does not have any columns")); OK (); } @@ -164,16 +136,8 @@ Break_algorithm::OK () const Array Break_algorithm::solve () const { - Cpu_timer timer; - Array h= do_solve (); - - if (approx_stats_.count_i_) - *mlog << '\n' << _f ("approximated %s", approx_stats_.str ()) << endl; - if (exact_stats_.count_i_) - *mlog << _f ("calculated %s exactly", exact_stats_.str ()) << endl; - *mlog << _f ("elapsed time %.2f seconds", timer.read ()) << endl; - + return h; } diff --git a/lily/gdb.cc b/lily/gdb.cc new file mode 100644 index 0000000000..0df1e5085a --- /dev/null +++ b/lily/gdb.cc @@ -0,0 +1,14 @@ +#include "item.hh" +#include "spanner.hh" + +// thanks to GDBs wonderful casting abilities, we need these: +Item* +to_item (Graphical_element* g) +{ + return dynamic_cast(g); +} +Spanner* +to_spanner (Graphical_element*g) +{ + return dynamic_cast(g); +} diff --git a/lily/graphical-axis-group.cc b/lily/graphical-axis-group.cc index 02f32e1eb0..1fe7c2b302 100644 --- a/lily/graphical-axis-group.cc +++ b/lily/graphical-axis-group.cc @@ -42,25 +42,35 @@ Graphical_axis_group::extent (Axis axis) const } void -Graphical_axis_group::add_element (Graphical_element*e) +Graphical_axis_group::add_element (Graphical_element*e, Axis a1 , Axis a2) { used_b_ =true; e->used_b_ = true; + + Axis as[2] = { + (a1 == NO_AXES) ? axes_[0] : a1, + (a2 == NO_AXES) ? axes_[1] : a2, + }; + + + for (int i = 0; i < 2; i++) { - Axis a = axes_[i]; - assert (a>=0); - assert (!e->parent_l (a) || this == e->parent_l (a)); - e->set_parent (this, a); + if (e->parent_l (as[i])) + continue; + + e->set_parent (this, as[i]); - e->dim_cache_[a]->dependencies_l_arr_.push (dim_cache_[a]); + e->dim_cache_[as[i]]->dependencies_l_arr_.push (dim_cache_[as[i]]); } - + assert (e->parent_l(Y_AXIS) == this || e->parent_l (X_AXIS) == this); elem_l_arr_.push (e); } - +/** + ugr. duplication of functionality with remove_all () + */ void Graphical_axis_group::remove_element (Graphical_element*e) { @@ -69,13 +79,20 @@ Graphical_axis_group::remove_element (Graphical_element*e) elem_l_arr_.substitute (e,0); else elem_l_arr_.unordered_substitute (e,0); - + + do_remove (e); +} + +void +Graphical_axis_group::do_remove (Graphical_element *e) +{ for (int i=0; i< 2; i++) { Axis a=axes_[i]; - Dimension_cache * d = e->dim_cache_[a]; - d->parent_l_ = 0; - d->dependencies_l_arr_.unordered_substitute (dim_cache_[a], 0); + if (e->parent_l (a) != this) + continue; + e->set_parent (0, a); + e->dim_cache_[a]->dependencies_l_arr_.clear (); } } @@ -83,17 +100,8 @@ void Graphical_axis_group::remove_all () { for (int i=0; i < elem_l_arr_.size(); i++) - { - Graphical_element*e=elem_l_arr_[i]; - for (int i=0; i< 2; i++) - { - Axis a=axes_[i]; - Dimension_cache * d = e->dim_cache_[a]; - d->parent_l_ = 0; - d->dependencies_l_arr_.clear (); - } - - } + do_remove (elem_l_arr_[i]); + elem_l_arr_.clear (); } diff --git a/lily/include/break.hh b/lily/include/break.hh index c6654fa8f0..c3d2f915e3 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -14,18 +14,6 @@ #include "lily-proto.hh" #include "column-x-positions.hh" -/** - Statistics for the number of columns calced. - */ -struct Col_stats -{ - int count_i_; - int cols_i_; - - Col_stats(); - void add (Line_of_cols const&l); - String str() const; -}; /** Class representation of an algorithm which decides where to put the column, and where to break lines. @@ -61,8 +49,6 @@ protected: virtual void do_set_pscore(); public: - Col_stats approx_stats_; - Col_stats exact_stats_; Line_spacer* (*get_line_spacer)(); diff --git a/lily/include/graphical-axis-group.hh b/lily/include/graphical-axis-group.hh index eacf5ff1ad..539f8d95e4 100644 --- a/lily/include/graphical-axis-group.hh +++ b/lily/include/graphical-axis-group.hh @@ -21,6 +21,10 @@ Treat a group of graphical elements as an aggegrate. */ class Graphical_axis_group : public virtual Graphical_element { +private: + + /// modify fields of E for removal. + void do_remove (Graphical_element*e); public: // keep array in order. bool ordered_b_; @@ -35,7 +39,7 @@ public: void remove_all (); bool contains_b (Graphical_element const *) const; - void add_element (Graphical_element*); + void add_element (Graphical_element*, Axis = NO_AXES, Axis = NO_AXES); void remove_element (Graphical_element*); }; diff --git a/lily/include/item.hh b/lily/include/item.hh index ce08eb0b3f..be7d981d66 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -50,8 +50,8 @@ public: Direction break_status_dir () const; - Item * find_prebroken_piece (Direction) const; - Item * find_prebroken_piece (Line_of_score*) const; + Item * find_broken_piece (Direction) const; + Score_element * find_broken_piece (Line_of_score*) const; Item(); Real hpos_f() const; diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index d80ae6b1e2..6d0bfa6634 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -16,14 +16,15 @@ class Line_of_score : public Axis_group_spanner, public Super_element { public: Link_array cols_; - + int rank_i_; + Line_of_score(); /// is #c# contained in #*this#? bool contains_b (Paper_column const *c) const; Line_of_score * set_breaking (Array const&, int j); - + static int compare (Line_of_score* const &,Line_of_score* const &); void output_all (bool last_line); void add_column (Paper_column*); diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 3494e6b11d..af9b484faa 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -105,6 +105,8 @@ public: */ void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr); + + virtual Score_element *find_broken_piece (Line_of_score*) const; protected: Score_element* dependency (int) const; int dependency_size () const; @@ -112,7 +114,8 @@ protected: virtual void output_processing (); virtual Interval do_height () const; virtual Interval do_width () const; - + + /// do printing of derived info. virtual void do_print () const; /// generate the molecule @@ -125,6 +128,9 @@ protected: /// generate rods & springs virtual void do_space_processing (); + /// do postbreak substs on array of pointers. + virtual void do_substitute_arrays (); + virtual void do_breakable_col_processing (); /// do calculations after determining horizontal spacing virtual void do_post_processing (); @@ -141,5 +147,26 @@ protected: }; +template +void +substitute_element_array (Link_array &arr, Line_of_score * to) +{ + Link_array newarr; + for (int i =0; i < arr.size (); i++) + { + T * t = arr[i]; + if (t->line_l () != to) + { + t = dynamic_cast (t->find_broken_piece (to)); + } + + if (t) + newarr.push (t); + } + arr = newarr; +} + + + #endif // STAFFELEM_HH diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 9cca78c8c4..3392804666 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -12,18 +12,6 @@ #include "drul-array.hh" #include "rod.hh" -struct Breaking_information -{ - Line_of_score *line_l_; - Spanner * broken_spanner_l_; - Drul_array bounds_; - Breaking_information () - { - line_l_ =0; - broken_spanner_l_ =0; - bounds_[LEFT] = bounds_[RIGHT] =0; - } -}; class Axis_group_spanner; /** A symbol which is attached between two columns. A spanner is a @@ -57,9 +45,10 @@ public: Spanner (Spanner const &); bool broken_b () const; + static int compare (Spanner * const &,Spanner * const &); virtual Array get_rods () const; virtual Array get_springs () const; - virtual Spanner* find_broken_piece (Line_of_score*) const; + virtual Score_element* find_broken_piece (Line_of_score*) const; protected: void set_my_columns (); VIRTUAL_COPY_CONS(Score_element); diff --git a/lily/item.cc b/lily/item.cc index e6798b5be1..e8ea0357df 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -118,8 +118,9 @@ Item::do_breakable_col_processing() else try_visibility_lambda (); } -Item* -Item::find_prebroken_piece (Line_of_score*l) const + +Score_element* +Item::find_broken_piece (Line_of_score*l) const { if (line_l() == l) return (Item*)(this); @@ -132,7 +133,7 @@ Item::find_prebroken_piece (Line_of_score*l) const } Item* -Item::find_prebroken_piece (Direction d) const +Item::find_broken_piece (Direction d) const { if (!d) return (Item *) (this); // ugh @@ -186,8 +187,8 @@ Item::handle_prebroken_dependents () Direction d = LEFT; do { - Item * broken_self = find_prebroken_piece (d); - Item * broken_parent = parent->find_prebroken_piece (d); + Item * broken_self = find_broken_piece (d); + Item * broken_parent = parent->find_broken_piece (d); broken_self->set_parent (broken_parent, X_AXIS); @@ -199,7 +200,7 @@ Item::handle_prebroken_dependents () Score_element * yparent =dynamic_cast(parent_l (Y_AXIS)); Item *yparenti = dynamic_cast (yparent); Item *broken_yparent = yparenti ? - yparenti->find_prebroken_piece (d) : 0; + yparenti->find_broken_piece (d) : 0; if (!yparent) programming_error ("Vertical refpoint lost!"); @@ -225,3 +226,4 @@ Item::break_status_dir () const else return CENTER; } + diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 441dcd9465..b648ea10c5 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -15,7 +15,7 @@ Line_of_score::Line_of_score() { - set_axes (Y_AXIS,Y_AXIS); + set_axes (Y_AXIS,X_AXIS); } bool @@ -33,7 +33,8 @@ Line_of_score::set_breaking (Array const &breaking, int j) Line_of_score *line_l=0; line_l = dynamic_cast (clone()); - + line_l->rank_i_ = j; + line_l->cols_ = curline; line_l->set_bounds(LEFT,curline[0]); line_l->set_bounds(RIGHT,curline.top()); @@ -41,16 +42,10 @@ Line_of_score::set_breaking (Array const &breaking, int j) for (int i=0; i < curline.size(); i++) { curline[i]->translate_axis (config[i],X_AXIS); - curline[i]->line_l_ = dynamic_cast(line_l); + curline[i]->line_l_ = dynamic_cast (line_l); } - Breaking_information b; - b.bounds_ = line_l->spanned_drul_; - b.broken_spanner_l_ = line_l; - b.line_l_ = line_l; - broken_into_l_arr_.push (line_l); - return line_l; } @@ -58,6 +53,7 @@ void Line_of_score::add_column (Paper_column*p) { cols_.push (p); + add_element (p); } void @@ -88,7 +84,7 @@ Line_of_score::output_all (bool last_line) { Interval i(extent(Y_AXIS)); if (i.empty_b()) - warning ("Huh? Empty Line_of_score?"); + warning (_ ("Huh? Empty Line_of_score?")); else translate_axis (- i[MAX], Y_AXIS); @@ -99,3 +95,9 @@ Line_of_score::output_all (bool last_line) else pscore_l_->outputter_l_->stop_line (); } + +int +Line_of_score::compare (Line_of_score* const &p1,Line_of_score* const &p2) +{ + return p1->rank_i_ - p2->rank_i_; +} diff --git a/lily/main.cc b/lily/main.cc index 149783ac29..f4ad427ab9 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -63,23 +63,26 @@ String distill_inname_str (String name_str, String& ext_r); Internationalisation kludge in two steps: * use _i () to get entry in POT file * call gettext () explicitely for actual "translation" + + Note: these messages all start with lower case (ie, don't + follow regular localisation guidelines). */ Long_option_init theopts[] = { - {_i ("BASENAME"), "output", 'o', _i ("write output to BASENAME[-x].extension")}, - {0, "warranty", 'w', _i ("show warranty and copyright")}, - {0, "help", 'h', _i ("this help")}, - {0, "test", 't', _i ("switch on experimental features")}, {0, "debug", 'd', _i ("enable debugging output")}, - {_i ("FILE"), "init", 'i', _i ("use FILE as init file")}, + {_i ("EXT"), "output-format", 'f', _i ("use output format EXT")}, + {0, "help", 'h', _i ("this help")}, {_i ("DIR"), "include", 'I', _i ("add DIR to search path")}, - {0, "no-paper", 'm', _i ("produce midi output only")}, + {_i ("FILE"), "init", 'i', _i ("use FILE as init file")}, {0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")}, + {0, "no-paper", 'm', _i ("produce MIDI output only")}, + {_i ("BASENAME"), "output", 'o', _i ("write output to BASENAME[-x].extension")}, + {0, "find-old-relative", 'Q', _i ("show all changes in relative syntax")}, + {0, "safe", 's', _i ("inhibit file output naming and exporting")}, {0, "no-timestamps", 'T', _i ("don't timestamp the output")}, - {0, "find-old-relative", 'Q', _i ("show all changes in relative syntax")}, + {0, "test", 't', _i ("switch on experimental features")}, {0, "ignore-version", 'V', _i ("ignore mudela version")}, {0, "version", 'v', _i ("print version number")}, - {_i ("EXT"), "output-format", 'f', _i ("use output format EXT")}, - {0, "safe", 's', _i ("inhibit file output naming and exporting")}, + {0, "warranty", 'w', _i ("show warranty and copyright")}, {0,0,0, 0} }; @@ -88,7 +91,7 @@ usage () { cout << _f ("Usage: %s [OPTION]... [FILE]...", "lilypond"); cout << "\n\n"; - cout << _ ("Typeset music and or play MIDI from FILE."); + cout << _ ("Typeset music and or play MIDI from FILE"); cout << "\n\n"; cout << #include "BLURB.hh" @@ -110,15 +113,14 @@ usage () "STRING_UTILS_INLINED " #endif "\n" - "datadir =" DIR_DATADIR - "\n" - "localedir =" DIR_LOCALEDIR - - "\n\n"; - - cout << _("Report bugs to") << " bug-gnu-music@gnu.org" << endl; + "datadir: `" DIR_DATADIR "'\n" + "localedir: `" DIR_LOCALEDIR "'\n" + "\n"; print_mudela_versions (cout); + cout << endl; + + cout << _f ("Report bugs to %s", "bug-gnu-music@gnu.org") << endl; } void @@ -226,8 +228,6 @@ main_prog (int, char**) /* need to do this first. Engravers use lily.scm contents. */ - extern void ly_init_protection(); - ly_init_protection(); init_lily_guile (); read_lily_scm_file ( "lily.scm"); cout << endl; diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index dc6d8d547a..456c213917 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -153,8 +153,8 @@ Multi_measure_rest::get_rods () const Item * l = spanned_drul_[LEFT]->column_l (); Item * r = spanned_drul_[RIGHT]->column_l (); - Item * lb = l->find_prebroken_piece (RIGHT); - Item * rb = r->find_prebroken_piece (LEFT); + Item * lb = l->find_broken_piece (RIGHT); + Item * rb = r->find_broken_piece (LEFT); Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}}; for (int i=0; i < 4; i++) diff --git a/lily/score-element.cc b/lily/score-element.cc index d8f254175c..9368f95f86 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -282,22 +282,6 @@ Score_element::line_l() const return 0; } -/* - - DEPENDENCIES - - */ - -void -Score_element::remove_dependency (Score_element*e) -{ - int i; - while ((i = dependency_arr_.find_i (e)) >=0 ) - dependency_arr_.unordered_del (i); - - substitute_dependency (e, 0); -} - void Score_element::add_dependency (Score_element*e) { @@ -324,38 +308,27 @@ Score_element::handle_broken_dependencies() if (!line) return; - Link_array remove_us_arr; + do_substitute_arrays (); + + Link_array new_deps; + for (int i=0; i < dependency_size(); i++) { Score_element * elt = dependency (i); if (elt->line_l() != line) { - if (Spanner *sp = dynamic_cast (elt)) - { - Spanner * broken = sp->find_broken_piece (line); - substitute_dependency (sp, broken); - - if (broken) - add_dependency (broken); - } - else if (Item *original = dynamic_cast (elt)) - { - Item * my_item = original->find_prebroken_piece (line); - - substitute_dependency (elt, my_item); - if (my_item) - add_dependency (my_item); - } - remove_us_arr.push (elt); + Score_element * broken = elt->find_broken_piece (line); + substitute_dependency (elt, broken); + elt = broken ; } + if (elt) + new_deps.push (elt); } + dependency_arr_ = new_deps; - remove_us_arr.default_sort(); - remove_us_arr.uniq(); - for (int i=0; i broken_original_b ()) if (Item *me = dynamic_cast (this) ) { - Score_element *new_l = it_l->find_prebroken_piece (me->break_status_dir ()); + Score_element *new_l = it_l->find_broken_piece (me->break_status_dir ()); if (new_l != elt) { new_arr.push (new_l); @@ -397,7 +373,7 @@ Score_element::handle_prebroken_dependencies() Direction d = LEFT; do { old_arr.push (0); - new_arr.push (it_l->find_prebroken_piece (d)); + new_arr.push (it_l->find_broken_piece (d)); } while (flip(&d)!= LEFT); } } @@ -436,3 +412,15 @@ void Score_element::do_print () const { } + +void +Score_element::do_substitute_arrays () +{ +} + + +Score_element* +Score_element::find_broken_piece (Line_of_score*) const +{ + return 0; +} diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 7c7adf3c6c..1c1d39205c 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -55,7 +55,9 @@ void Score_engraver::do_creation_processing () { scoreline_l_ = pscore_p_->line_l_; - scoreline_l_->set_bounds(LEFT,command_column_l_); + + scoreline_l_->set_bounds(LEFT, command_column_l_); + command_column_l_->set_elt_property (breakable_scm_sym, SCM_BOOL_T); Engraver_group_engraver::do_creation_processing(); @@ -146,7 +148,7 @@ Score_engraver::typeset_all() if (!s->spanned_drul_[d]) { s->set_bounds(d, command_column_l_); - ::warning (_f ("Unbound spanner `%s\'", classname(s))); + ::warning (_f ("unbound spanner `%s'", classname(s))); } } while (flip(&d) != LEFT); } diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 8890ddbdd7..590a10c78b 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -41,10 +41,10 @@ Separating_group_spanner::get_rods () const { Single_malt_grouping_item *l =spacing_unit_l_arr_[i]; Single_malt_grouping_item *lb - = dynamic_cast(l->find_prebroken_piece (RIGHT)); + = dynamic_cast(l->find_broken_piece (RIGHT)); Single_malt_grouping_item *r = spacing_unit_l_arr_[i+1]; Single_malt_grouping_item *rb - = dynamic_cast(r->find_prebroken_piece (LEFT)); + = dynamic_cast(r->find_broken_piece (LEFT)); a.push (make_rod(spacing_unit_l_arr_[i], spacing_unit_l_arr_[i+1])); if (lb) diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index edc59bb49a..479855cdcd 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -74,8 +74,8 @@ Spacing_spanner::do_measure (int col1, int col2) const { Item * l = scol(i); Item * r = scol(i+1); - Item * lb = l->find_prebroken_piece (RIGHT); - Item * rb = r->find_prebroken_piece (LEFT); + Item * lb = l->find_broken_piece (RIGHT); + Item * rb = r->find_broken_piece (LEFT); Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}}; @@ -215,7 +215,7 @@ Spacing_spanner::note_spacing (Score_column *lc, Score_column *rc, Moment shorte Moment shortest_playing_len = lc->shortest_playing_mom_; if (! shortest_playing_len) { - programming_error ("can't find a ruling note at " + lc->when_mom ().str ()); + programming_error ("Can't find a ruling note at " + lc->when_mom ().str ()); shortest_playing_len = 1; } diff --git a/lily/spanner.cc b/lily/spanner.cc index ca2f5d5618..bc168836be 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -38,7 +38,7 @@ Spanner::break_into_pieces () if (left == right) { - warning (_ ("left spanpoint is right spanpoint\n")); + warning (_ ("Left spanpoint is right spanpoint")); return; } @@ -49,35 +49,31 @@ Spanner::break_into_pieces () for (int i=1; i < break_points.size(); i++) { - Breaking_information info; - info.bounds_[LEFT] = break_points[i-1]; - info.bounds_[RIGHT] = break_points[i]; + Drul_array bounds; + bounds[LEFT] = break_points[i-1]; + bounds[RIGHT] = break_points[i]; Direction d = LEFT; do { - Item *&pc_l = info.bounds_[d] ; + Item *&pc_l = bounds[d] ; if (!pc_l->line_l()) - pc_l = pc_l->find_prebroken_piece(- d); + pc_l = pc_l->find_broken_piece(- d); assert (pc_l); - if (!info.line_l_) - info.line_l_ = pc_l-> line_l (); - else - assert( info.line_l_ = pc_l->line_l ()); - } while ((flip(&d))!= LEFT); Spanner *span_p = dynamic_cast(clone ()); - span_p->set_bounds(LEFT,info.bounds_[LEFT]); - span_p->set_bounds(RIGHT,info.bounds_[RIGHT]); + span_p->set_bounds(LEFT,bounds[LEFT]); + span_p->set_bounds(RIGHT,bounds[RIGHT]); + pscore_l_->typeset_element (span_p); - - info.broken_spanner_l_ = span_p; span_p->handle_broken_dependencies(); broken_into_l_arr_.push (span_p); } + + broken_into_l_arr_.sort (Spanner::compare); } void @@ -87,7 +83,7 @@ Spanner::set_my_columns() do { if (!spanned_drul_[i]->line_l()) - set_bounds(i,spanned_drul_[i]->find_prebroken_piece((Direction)-i)); + set_bounds(i,spanned_drul_[i]->find_broken_piece((Direction)-i)); } while (flip(&i) != 1); } @@ -101,14 +97,17 @@ Spanner::set_bounds(Direction d, Item*i) i->used_b_ = true; } - if (d== LEFT) + /** + Prevent the column -> line_of_score -> column -> line_of_score -> etc situation + */ + if (d== LEFT && !dynamic_cast (this)) { - set_parent ( i, X_AXIS); + set_parent (i, X_AXIS); } if (spanned_drul_[Direction(-d)] == spanned_drul_[d] && i) - warning (_f ("Spanner `%s\' with equal left and right spanpoints", classname (this))); + warning (_f ("Spanner `%s' has equal left and right spanpoints", classname (this))); } void @@ -140,7 +139,7 @@ Spanner::do_width() const Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS); if (r< l) - warning ("Spanner with negative length"); + warning (_ ("spanner with negative length")); return Interval (0, r-l); } @@ -150,22 +149,36 @@ Spanner::line_l() const { if (!spanned_drul_[LEFT] || !spanned_drul_[RIGHT]) return 0; - if (spanned_drul_[LEFT]->line_l() != spanned_drul_[RIGHT]->line_l()) + if (spanned_drul_[LEFT]->line_l () != spanned_drul_[RIGHT]->line_l ()) return 0; return spanned_drul_[LEFT]->line_l(); } -Spanner* +Score_element* Spanner::find_broken_piece (Line_of_score*l) const { + int idx = binsearch_link_array (broken_into_l_arr_, (Spanner*)l, Spanner::compare); + if (idx < 0) + return 0; + else + return broken_into_l_arr_ [idx]; +} + +/* for (int i=0; i < broken_into_l_arr_.size (); i++) { if (broken_into_l_arr_[i]->line_l () == l) return broken_into_l_arr_[i]; } + return 0; +*/ + - return 0; +int +Spanner::compare (Spanner * const &p1, Spanner * const &p2) +{ + return p1->line_l ()->rank_i_ - p2->line_l ()->rank_i_; } bool @@ -218,23 +231,25 @@ Spanner::handle_broken_dependents () if (refpoint) { - Spanner * broken_refpoint = refpoint->find_broken_piece (line_l ()); + Score_element * broken_refpoint = refpoint->find_broken_piece (line_l ()); if (broken_refpoint) - set_parent ( broken_refpoint,Y_AXIS); + set_parent (broken_refpoint,Y_AXIS); else programming_error ("Spanner y -refpoint lost."); } } -// If this is a broken spanner, return the amount the left end is to -// be shifted horizontally so that the spanner starts after the -// initial clef and key on the staves. This is necessary for ties, -// slurs, crescendo and decrescendo signs, for example. +/* + If this is a broken spanner, return the amount the left end is to be + shifted horizontally so that the spanner starts after the initial + clef and key on the staves. This is necessary for ties, slurs, + crescendo and decrescendo signs, for example. +*/ Real Spanner::get_broken_left_end_align () const { int i; - Line_of_score *l; + Score_column *sc = dynamic_cast (spanned_drul_[LEFT]->column_l()); // Relevant only if left span point is first column in line diff --git a/lily/staff-sym.cc b/lily/staff-sym.cc index 2065ef5d42..2940d13a9a 100644 --- a/lily/staff-sym.cc +++ b/lily/staff-sym.cc @@ -40,10 +40,24 @@ Staff_symbol::do_height() const Molecule* Staff_symbol::do_brew_molecule_p() const { - Real w = extent (X_AXIS).length (); - Paper_def * p = paper_l (); - Real t = p->get_var ("rulethickness"); - Molecule rule = lookup_l ()->filledbox (Box (Interval (0,w), + Graphical_element * common + = spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS); + +#if 0 + Interval r = spanned_drul_[RIGHT]->extent (X_AXIS); + Interval l = spanned_drul_[LEFT]->extent (X_AXIS); + + Real left_shift =l.empty_b () ? 0.0: l[LEFT]; + Real right_shift =r.empty_b () ? 0.0: r[RIGHT]; +#endif + Real width = + // right_shift - left_shift + + spanned_drul_[RIGHT]->relative_coordinate (common , X_AXIS) + - spanned_drul_[LEFT]->relative_coordinate (common, X_AXIS) + ; + + Real t = paper_l ()->get_var ("rulethickness"); + Molecule rule = lookup_l ()->filledbox (Box (Interval (0,width), Interval (-t/2, t/2))); Real height = (no_lines_i_-1) * staff_line_leading_f_ /2; @@ -55,6 +69,7 @@ Staff_symbol::do_brew_molecule_p() const m->add_molecule (a); } + // m->translate_axis (left_shift, X_AXIS); return m; } diff --git a/stepmake/stepmake/documentation-rules.make b/stepmake/stepmake/documentation-rules.make index 534db01acb..8cb7ce851d 100644 --- a/stepmake/stepmake/documentation-rules.make +++ b/stepmake/stepmake/documentation-rules.make @@ -15,6 +15,5 @@ $(outdir)/%.png: %.xpm $(outdir)/%.txt: $(outdir)/%.1 troff -man -Tascii $< | grotty -b -u -o > $@ -include $(stepdir)/yodl-rules.make include $(stepdir)/texinfo-rules.make diff --git a/stepmake/stepmake/executable-targets.make b/stepmake/stepmake/executable-targets.make index db4a7e0b99..85d77ef212 100644 --- a/stepmake/stepmake/executable-targets.make +++ b/stepmake/stepmake/executable-targets.make @@ -7,7 +7,7 @@ default: $(EXECUTABLE) $(EXECUTABLE): $(depth)/config.h $(O_FILES) $(outdir)/version.hh $(foreach a, $(MODULE_LIBS), $(MAKE) -C $(a) && ) true - $(LD_COMMAND) $(O_FILES) $(LOADLIBES) + $(LD_COMMAND) $(O_FILES) $(LOADLIBES) $(USER_LDFLAGS) exe: $(EXECUTABLE) diff --git a/stepmake/stepmake/executable-vars.make b/stepmake/stepmake/executable-vars.make index 203c64be65..117bfc5a5c 100644 --- a/stepmake/stepmake/executable-vars.make +++ b/stepmake/stepmake/executable-vars.make @@ -1,5 +1,5 @@ # empty -LDFLAGS = $(ILDFLAGS) $(USER_LDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS) +LDFLAGS = $(ILDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS) MODULE_LIBES =$(addsuffix /$(outdir)/library.a, $(MODULE_LIBS)) LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES) -- 2.39.5