From 51138b193c8568e54188ab51fb83a5873b5bd5d9 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:22:03 +0000 Subject: [PATCH] lilypond-1.3.53 --- flower/dstream.cc | 5 +- flower/include/dictionary.hh | 17 ++-- input/bugs/cross-staff-tuplet.ly | 10 +++ input/bugs/weird-x-staff-tuplet.ly | 10 +++ input/trip.ly | 24 ++++-- lily/afm.cc | 6 +- lily/break-algorithm.cc | 1 - lily/column-x-positions.cc | 1 - lily/crescendo.cc | 2 +- lily/dots.cc | 4 +- lily/gourlay-breaking.cc | 2 - lily/grace-align-item.cc | 2 +- lily/idealspacing.cc | 27 ------ lily/include/break-algorithm.hh | 3 - lily/include/column-x-positions.hh | 2 - lily/include/dimension-cache.hh | 2 +- lily/include/gourlay-breaking.hh | 2 - lily/include/idealspacing.hh | 3 - lily/include/lily-guile.hh | 3 + lily/include/line-of-score.hh | 34 ++++---- lily/include/molecule.hh | 12 +-- lily/include/paper-column.hh | 11 ++- lily/include/paper-outputter.hh | 16 +++- lily/include/rod.hh | 7 +- lily/include/score-element.hh | 29 +++---- lily/include/simple-spacer.hh | 6 +- lily/include/spring.hh | 1 - lily/key-item.cc | 2 - lily/lily-guile.cc | 13 +++ lily/line-of-score.cc | 108 ++++++++++++++++-------- lily/lookup.cc | 4 +- lily/molecule.cc | 25 ++---- lily/music-output-def.cc | 7 +- lily/note-head.cc | 15 ++-- lily/paper-column.cc | 43 +++------- lily/paper-outputter.cc | 130 +++++++++++++---------------- lily/paper-score.cc | 18 +--- lily/rod.cc | 33 ++++---- lily/separating-group-spanner.cc | 26 +++++- lily/simple-spacer.cc | 40 ++------- lily/spacing-spanner.cc | 31 ++++--- lily/spring.cc | 18 +--- lily/stem-tremolo.cc | 4 +- lily/stem.cc | 2 +- lily/system-start-delimiter.cc | 3 +- lily/text-item.cc | 9 +- lily/translator-ctors.cc | 2 +- lily/tuplet-spanner.cc | 12 ++- 48 files changed, 389 insertions(+), 398 deletions(-) create mode 100644 input/bugs/cross-staff-tuplet.ly create mode 100644 input/bugs/weird-x-staff-tuplet.ly diff --git a/flower/dstream.cc b/flower/dstream.cc index 72b3d248db..46394bf4d5 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -201,9 +201,10 @@ Dstream::~Dstream() void Dstream::clear_silence() { - for (Dictionary_iter i (*silent_dict_p_); i.ok(); i++) + for (map::iterator ki(silent_dict_p_->begin ()); + silent_dict_p_->end () != ki; ki++) { - i.val_ref() = false; + (*ki).second = false; } } diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh index 9134b80afc..ab756d9930 100644 --- a/flower/include/dictionary.hh +++ b/flower/include/dictionary.hh @@ -13,6 +13,8 @@ #include "string.hh" #include "array.hh" +#include + #include "hash-table.hh" @@ -28,25 +30,28 @@ struct Dict_initialiser /* - DEPRECATED. Use either SCM (preferred) or STL + interface to STL function. */ template -class Dictionary : public Hash_table +class Dictionary : public map { public: Dictionary () { - hash_func_ = string_hash; } Dictionary (Dict_initialiser *p) { hash_func_ = string_hash; for (Dict_initialiser *q = p; q->key_; q++) - elem (q->key_) = q->value_; + (*this) [q->key_] = q->value_; } - - friend class Dictionary_iter; + bool elem_b (String s) + { + map::const_iterator ki (find (s)); + return ki != end (); + } + }; diff --git a/input/bugs/cross-staff-tuplet.ly b/input/bugs/cross-staff-tuplet.ly new file mode 100644 index 0000000000..10f689b469 --- /dev/null +++ b/input/bugs/cross-staff-tuplet.ly @@ -0,0 +1,10 @@ + +\score { \context PianoStaff \notes < +\context Staff = up <{ c4 } + \times 2/3 { [c8 c\translator Staff = down c] }> + \context Staff = down c4 + + > + + } + diff --git a/input/bugs/weird-x-staff-tuplet.ly b/input/bugs/weird-x-staff-tuplet.ly new file mode 100644 index 0000000000..51d57cc733 --- /dev/null +++ b/input/bugs/weird-x-staff-tuplet.ly @@ -0,0 +1,10 @@ + +\score { \context PianoStaff \notes < + +{ \times 2/3 { [c8 c\translator Staff = down c] }} + \context Staff = down c4 + + > + + } + diff --git a/input/trip.ly b/input/trip.ly index 4ea9a9beae..1e4cbcb2b4 100644 --- a/input/trip.ly +++ b/input/trip.ly @@ -1,11 +1,23 @@ \header { title = "Trip"; - enteredby = "JCN"; copyright = "public domain"; } -% todo: clef ch . +%{ + +This file tests as much features of lily as possible. If there are any +basic faults in , this file will not run correctly. + +TODO: + +* add tuplets + +* repeats. + +* tremolo + +%} praeludiumRight = \notes { \key e; @@ -41,12 +53,14 @@ praeludiumLeft = \notes \relative c { \context Staff < \context Voice = two { r4 } \context Voice = one { \stemup s4 dis' cis cis ~ | - [cis8 - ( + % BUG -> (insane springs.) + \times 4/5 + { [cis8 ( cis + a \translator Staff = treble \stemdown \shifton d ) - cis] + cis] } \translator Staff = bass \shiftoff [bis gis] cis4 | diff --git a/lily/afm.cc b/lily/afm.cc index 791311adb8..1f1d22f1db 100644 --- a/lily/afm.cc +++ b/lily/afm.cc @@ -48,7 +48,9 @@ Adobe_font_metric::find_ascii_metric (int a , bool warn) const AFM_CharMetricInfo const * Adobe_font_metric::find_char_metric (String nm, bool warn) const { - if (!name_to_metric_dict_.elem_b (nm)) + map::const_iterator ai = name_to_metric_dict_.find (nm); + + if (ai == name_to_metric_dict_.end ()) { if (warn) { @@ -57,7 +59,7 @@ Adobe_font_metric::find_char_metric (String nm, bool warn) const return 0; } else - return font_inf_->cmi + name_to_metric_dict_ [nm]; + return font_inf_->cmi + (*ai).second; } diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc index 3337bff317..7c679d76fb 100644 --- a/lily/break-algorithm.cc +++ b/lily/break-algorithm.cc @@ -63,7 +63,6 @@ Break_algorithm::generate_spacing_problem (Link_array curline, Int { Simple_spacer * sp = new Simple_spacer; Paper_def * d = pscore_l_->paper_l_; - sp->compression_energy_factor_f_ = d->get_var ("compression_energy_factor"); sp->default_space_f_ = d->get_var ("loose_column_distance"); sp->indent_f_ = line[LEFT]; diff --git a/lily/column-x-positions.cc b/lily/column-x-positions.cc index 080c178ce0..3a56d61cce 100644 --- a/lily/column-x-positions.cc +++ b/lily/column-x-positions.cc @@ -12,7 +12,6 @@ Column_x_positions::Column_x_positions() { - energy_f_ = infinity_f; satisfies_constraints_b_ = false; force_f_ = 0; } diff --git a/lily/crescendo.cc b/lily/crescendo.cc index ffe11eaefb..236fbfb53c 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -91,7 +91,7 @@ Crescendo::do_brew_molecule () const pad = paper_l ()->get_var ("interline") / 2; - width -= start_text.extent ()[X_AXIS].length (); + width -= start_text.extent (X_AXIS).length (); width -= pad; width = width >? 0; } diff --git a/lily/dots.cc b/lily/dots.cc index 6f098e6110..2487268c2b 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -44,10 +44,10 @@ Molecule Dots::do_brew_molecule () const { Molecule mol (lookup_l ()->blank (Box (Interval (0,0), - Interval (0,0)))); + Interval (0,0)))); Molecule d = lookup_l ()->afm_find (String ("dots-dot")); - Real dw = d.dim_[X_AXIS].length (); + Real dw = d.extent (X_AXIS).length (); d.translate_axis (-dw, X_AXIS); diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 696a0d88a6..3f9662a99a 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -62,7 +62,6 @@ Gourlay_breaking::do_solve () const optimal_paths.set_size (breaks.size ()); Break_node first_node ; - first_node.line_config_.energy_f_ = 0; optimal_paths[0] = first_node; int break_idx=1; @@ -166,7 +165,6 @@ Gourlay_breaking::do_solve () const Gourlay_breaking::Gourlay_breaking () { - energy_bound_f_ = infinity_f; } diff --git a/lily/grace-align-item.cc b/lily/grace-align-item.cc index b2830a2050..73ef013c07 100644 --- a/lily/grace-align-item.cc +++ b/lily/grace-align-item.cc @@ -26,7 +26,7 @@ Grace_align_item::Grace_align_item () void Grace_align_item::before_line_breaking () { - Real nhw = // lookup_l ()->notehead (2, "").dim_[X_AXIS].length(); + Real nhw = // lookup_l ()->notehead (2, "")..extent (X_AXIS).length(); paper_l ()->get_var ("quartwidth"); set_elt_property ("threshold", diff --git a/lily/idealspacing.cc b/lily/idealspacing.cc index d7379218f1..90cfa1dbae 100644 --- a/lily/idealspacing.cc +++ b/lily/idealspacing.cc @@ -11,15 +11,6 @@ #include "paper-score.hh" #include "debug.hh" -void -Idealspacing::print() const -{ -#ifndef NPRINT - DEBUG_OUT << "idealspacing {" ; - DEBUG_OUT << "distance " << space_f_ << " strength " << hooke_f_; - DEBUG_OUT << "left " << cols_drul_[LEFT] << " right " << cols_drul_[RIGHT] << "}\n"; -#endif -} Idealspacing::Idealspacing() { @@ -27,21 +18,3 @@ Idealspacing::Idealspacing() hooke_f_ = 0.0; cols_drul_[LEFT] = cols_drul_[RIGHT] = -1; } - -void -Idealspacing::OK() const -{ - assert (hooke_f_ >= 0); -} - -Real -Idealspacing::energy_f(Real x) const -{ - Real dx = (space_f_ - x); - - Real e = sqr(dx); - if ( dx < 0) - e *= 4; // ugh. - - return hooke_f_ * e; -} diff --git a/lily/include/break-algorithm.hh b/lily/include/break-algorithm.hh index 00da3940ce..b01487e171 100644 --- a/lily/include/break-algorithm.hh +++ b/lily/include/break-algorithm.hh @@ -34,9 +34,6 @@ protected: /// helper: solve for the columns in #curline#. void solve_line (Column_x_positions*) const; - /// helper: approximate the energyv - void approximate_solve_line (Column_x_positions*) const; - /// does curline fit on the paper? bool feasible (Link_array) const; diff --git a/lily/include/column-x-positions.hh b/lily/include/column-x-positions.hh index dd5c323755..23bea78d2e 100644 --- a/lily/include/column-x-positions.hh +++ b/lily/include/column-x-positions.hh @@ -15,9 +15,7 @@ struct Column_x_positions { Link_array cols_; Array config_; - Real force_f_; - Real energy_f_; bool satisfies_constraints_b_; Column_x_positions(); diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index f40337564c..a5033b7914 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -62,7 +62,7 @@ public: */ Real relative_coordinate (Dimension_cache *d) const; Dimension_cache*common_refpoint (Dimension_cache const* s) const; - Dimension_cache*common_refpoint (Link_array caches) const; + void set_empty (bool); void translate (Real); diff --git a/lily/include/gourlay-breaking.hh b/lily/include/gourlay-breaking.hh index 6baa4780d7..68361114b1 100644 --- a/lily/include/gourlay-breaking.hh +++ b/lily/include/gourlay-breaking.hh @@ -17,8 +17,6 @@ */ struct Gourlay_breaking : public Break_algorithm { - Real energy_bound_f_ ; - Array do_solve() const; Gourlay_breaking(); Real combine_demerits (Column_x_positions const&,Column_x_positions const&) const; diff --git a/lily/include/idealspacing.hh b/lily/include/idealspacing.hh index 6b8d2a44ba..3e9585d145 100644 --- a/lily/include/idealspacing.hh +++ b/lily/include/idealspacing.hh @@ -21,9 +21,6 @@ struct Idealspacing { /// the two columns Drul_array cols_drul_; - Real energy_f (Real x) const; - void print() const; - void OK() const ; Idealspacing(); }; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index cb0fb40491..ffe7c21c53 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -27,6 +27,9 @@ String ly_symbol2string (SCM); SCM ly_offset2scm (Offset); Offset ly_scm2offset (SCM); +Interval ly_scm2interval (SCM); +SCM ly_interval2scm (Interval); + SCM ly_parse_scm (char const* s, int* n); SCM ly_quote_scm (SCM s); SCM ly_type (SCM); diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 1e81b087f9..2a0af1ab1f 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -11,25 +11,30 @@ #include "column-x-positions.hh" #include "spanner.hh" -/// the columns of a score that form one line. FIXME: multiple inheritance +/** + The columns of a score that form one line. The toplevel element. + Any element has a Line_of_score as both X and Y reference + point. The Paper_score contains one element of this type. Control + enters the Score_element dependency calculation from this single + Line_of_score object. + + + properties: + + all-elements -- list of all score elements in this line. Needed + for protecting elements from GC. + + columns -- list of all paper columns + + */ class Line_of_score : public Spanner { public: -/* - imported the following from Super_element - - The toplevel element. The Paper_score contains this element, and any - element shoud be a dependency for the super element. - It is the entry point for the "constraint solver"/ dependency - tracker. Every XXXX_processing () call traverses the entire - dependency graph, and calls the appropriate - Score_element::do_XXX_processing function on each Score_element it encounters. - */ void post_processing(); - void output_all (); + /// -> SCM int rank_i_; Protected_scm output_; @@ -38,12 +43,9 @@ public: /// is #c# contained in #*this#? bool contains_b (Paper_column const *c) const; - static int compare (Line_of_score* const &,Line_of_score* const &); void break_into_pieces (Array const&); - - SCM output_lines (); - + void output_lines (); Link_array broken_col_range (Item const*, Item const*) const; Link_array column_l_arr () const; diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index ec5ed0e409..d9cd2bb11a 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -42,9 +42,12 @@ class Molecule { /// can't alloc on heap. void * operator new (size_t s); -public: Box dim_; SCM expr_; + +public: + + SCM get_expr () const; Molecule (Box, SCM s); Molecule(); @@ -66,16 +69,9 @@ public: */ void align_to (Axis a, Direction d); void translate_axis (Real,Axis); - - - /// how big is #this#? - Box extent() const; Interval extent (Axis) const; bool empty_b() const; - - - /*******/ }; SCM fontify_atom (Font_metric*, SCM atom); diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 796781a2b2..8bf231d3f4 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -34,10 +34,16 @@ public: /* ugh. + + TODO: + + * junk these after spacing is done. + + * Put these in Scheme. */ - Drul_array > minimal_dists_arr_drul_; - Drul_array > spring_arr_drul_; + Array minimal_dists_; + Array springs_; /// set a minimum distance void add_rod (Paper_column * to, Real distance); @@ -58,7 +64,6 @@ public: bool musical_b () const; void set_rank (int); - virtual void do_print() const; private: /** diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index 73ad6aecf0..8758535ea8 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -21,12 +21,22 @@ */ class Paper_outputter { -public: +#if 0 Protected_scm molecules_; SCM last_cons_; - Paper_outputter (); +#endif + + bool verbatim_scheme_b_; + Paper_stream * stream_p_; +public: + /** + Assumes responsibility for deletion of P + */ + Paper_outputter (Paper_stream*p); + ~Paper_outputter (); + + void dump_scheme (SCM); - void dump_onto (Paper_stream *); void output_int_def (String k, int v); void output_Real_def (String k, Real v); void output_String_def (String k, String v); diff --git a/lily/include/rod.hh b/lily/include/rod.hh index 4374f3c4ef..4edf21b1cd 100644 --- a/lily/include/rod.hh +++ b/lily/include/rod.hh @@ -20,7 +20,6 @@ struct Column_rod Column_rod (); static int compare (const Column_rod &r1, const Column_rod &r2); - void print () const; }; @@ -28,6 +27,12 @@ struct Rod { Drul_array item_l_drul_; Real distance_f_; + + /** + translate the rod so as to refer to Paper_columns + */ + void columnize (); + void add_to_cols (); Rod (); diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 8bc4761cf1..8c4b9aa3a0 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -75,11 +75,17 @@ public: Score_element::calcalute_dependencies () 0 means ORPHAN, - -1 means deleted - */ - int status_i_; + char status_i_; + /** + Set this if anyone points to me, or if I point to anyone. + JUNKME. + */ + bool used_b_; + + char const * name () const; + Paper_score *pscore_l_; Score_element (); @@ -154,8 +160,9 @@ public: virtual void before_line_breaking (); /// do calculations after determining horizontal spacing virtual void after_line_breaking (); - virtual void output_processing (); - + + Molecule get_molecule () const; + void suicide (); static Interval preset_extent (Dimension_cache const*); static Interval molecule_extent (Dimension_cache const*); @@ -192,15 +199,6 @@ public: public: Dimension_cache *dim_cache_[NO_AXES]; - /** - Set this if anyone points to me, or if I point to anyone. - - JUNKME. - */ - bool used_b_; - - char const * name () const; - bool empty_b (Axis a) const; Interval extent (Axis) const; @@ -215,8 +213,7 @@ public: Find the group-element which has both #this# and #s# */ Score_element*common_refpoint (Score_element const* s, Axis a) const; - Score_element*common_refpoint (Link_array elems, Axis a) const; - + Score_element*common_refpoint (SCM elt_list, Axis a) const; bool has_offset_callback_b (Offset_cache_callback, Axis)const; void add_offset_callback (Offset_cache_callback, Axis); diff --git a/lily/include/simple-spacer.hh b/lily/include/simple-spacer.hh index 5a1501347a..0cc519fdbb 100644 --- a/lily/include/simple-spacer.hh +++ b/lily/include/simple-spacer.hh @@ -24,7 +24,7 @@ struct Spring_description Real length (Real force) const; Spring_description (); - Real energy_f (Real) const; + bool sane_b () const; }; @@ -68,7 +68,7 @@ struct Simple_spacer Real indent_f_; Real line_len_f_; Real default_space_f_; - Real compression_energy_factor_f_; + Simple_spacer (); @@ -83,8 +83,6 @@ struct Simple_spacer Real active_blocking_force ()const; Real configuration_length ()const; void set_active_states (); - Real energy_f () const; - bool active_b () const; }; diff --git a/lily/include/spring.hh b/lily/include/spring.hh index 739df44dd2..3e88aadf38 100644 --- a/lily/include/spring.hh +++ b/lily/include/spring.hh @@ -20,7 +20,6 @@ struct Column_spring { Column_spring (); static int compare (const Column_spring &r1, const Column_spring &r2); - void print () const; }; struct Spring{ diff --git a/lily/key-item.cc b/lily/key-item.cc index 72380e7311..143d7da103 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -87,8 +87,6 @@ Key_item::calculate_position(SCM pair) const TODO - space the `natural' signs wider - - */ Molecule diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 9d030b8e86..ebe2ff5b69 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -21,6 +21,7 @@ #include "debug.hh" #include "direction.hh" #include "offset.hh" +#include "interval.hh" SCM ly_str02scm (char const*c) @@ -263,7 +264,19 @@ to_dir (SCM s) return (Direction) gh_scm2int (s); } +Interval +ly_scm2interval (SCM p) +{ + return Interval (gh_scm2double (gh_car (p)), + gh_scm2double (gh_cdr (p))); +} +SCM +ly_interval2scm (Interval i) +{ + return gh_cons (gh_double2scm (i[LEFT]), + gh_double2scm (i[RIGHT])); +} bool diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 5ca3685dee..06b20f4e44 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -17,6 +17,8 @@ #include "string.hh" #include "warn.hh" #include "dimensions.hh" +#include "molecule.hh" +#include "all-font-metrics.hh" Line_of_score::Line_of_score() { @@ -30,7 +32,6 @@ Line_of_score::Line_of_score() /* Ugh. this is grossly hairy. */ - void Line_of_score::typeset_element (Score_element * elem_p) { @@ -39,7 +40,7 @@ Line_of_score::typeset_element (Score_element * elem_p) scm_unprotect_object (elem_p->self_scm_); } -SCM +void Line_of_score::output_lines () { for (SCM s = get_elt_property ("all-elements"); @@ -49,8 +50,8 @@ Line_of_score::output_lines () } /* - fixups must be done in broken line_of_scores, because new elements are put over there. - */ + fixups must be done in broken line_of_scores, because new elements + are put over there. */ for (int i=0; i < broken_into_l_arr_.size (); i++) { Score_element *se = broken_into_l_arr_[i]; @@ -87,14 +88,6 @@ Line_of_score::output_lines () progress_indication (to_str (i)); progress_indication ("]"); } - - SCM list = SCM_EOL; - for (int i=broken_into_l_arr_.size (); i--;) - { - Line_of_score * l = dynamic_cast (broken_into_l_arr_[i]); - list = gh_cons (gh_cdr (l->output_), list); - } - return list; } // const? @@ -146,18 +139,19 @@ enter: } else { - output_scheme (gh_list (ly_symbol2scm ("placebox"), - gh_double2scm (o[X_AXIS]), - gh_double2scm (o[Y_AXIS]), - expr, - SCM_UNDEFINED)); + pscore_l_->outputter_l_-> + output_scheme (gh_list (ly_symbol2scm ("placebox"), + gh_double2scm (o[X_AXIS]), + gh_double2scm (o[Y_AXIS]), + expr, + SCM_UNDEFINED)); } } void Line_of_score::output_scheme (SCM s) { - gh_set_cdr_x (output_, gh_cons (s, gh_cdr (output_))); + pscore_l_->outputter_l_->output_scheme (s); } void @@ -177,18 +171,27 @@ Line_of_score::add_column (Paper_column*p) Link_array Line_of_score::column_l_arr ()const { - return Group_interface__extract_elements (this, - (Paper_column*) 0, "columns"); - -} - -int -Line_of_score::compare (Line_of_score* const &p1,Line_of_score* const &p2) -{ - return p1->rank_i_ - p2->rank_i_; + Link_array acs + = Group_interface__extract_elements (this, (Paper_column*) 0, "columns"); + bool bfound = false; + for (int i= acs.size (); i -- ; ) + { + bool brb = acs[i]->breakable_b(); + bfound = bfound || brb; + + /* + the last column should be breakable. Weed out any columns that + seem empty. We need to retain breakable columns, in case + someone forced a breakpoint. + */ + if (!bfound + || (acs[i]->get_elt_property ("elements") == SCM_EOL + && !brb)) + acs.del (i); + } + return acs; } - void fixup_refpoints (SCM s) { @@ -251,21 +254,54 @@ Line_of_score::post_processing () height = 50 CM; } - output_ = gh_cons (SCM_EOL, SCM_EOL); - output_scheme (gh_list (ly_symbol2scm ("stop-line"), SCM_UNDEFINED)); + /* + generate all molecules to trigger all font loads. + + (ugh. This is not very memory efficient.) */ for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) - unsmob_element (gh_car (s))->output_processing (); + unsmob_element (gh_car (s))->get_molecule (); + + /* + font defs; + */ + SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ()); + output_scheme (gh_list (ly_symbol2scm ("define-fonts"), + font_names, + SCM_UNDEFINED)); + + /* + line preamble. + */ output_scheme (gh_list (ly_symbol2scm ("start-line"), gh_double2scm (height), SCM_UNDEFINED)); -} + + Real il = paper_l ()->get_var ("interline"); -void -Line_of_score::output_all () -{ - calculate_dependencies (BREWED, BREWING, &Score_element::output_processing); + /* + all elements. + */ + for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) + { + Score_element * sc = unsmob_element (gh_car (s)); + Molecule m = sc->get_molecule (); + + Offset o (sc->relative_coordinate (this, X_AXIS), + sc->relative_coordinate (this, Y_AXIS)); + + SCM e = sc->get_elt_property ("extra-offset"); + if (gh_pair_p (e)) + { + o[X_AXIS] += il * gh_scm2double (gh_car (e)); + o[Y_AXIS] += il * gh_scm2double (gh_cdr (e)); + } + + output_molecule (m.get_expr (), o); + } + output_scheme (gh_list (ly_symbol2scm ("stop-line"), SCM_UNDEFINED)); } + Link_array Line_of_score::broken_col_range (Item const*l, Item const*r) const { diff --git a/lily/lookup.cc b/lily/lookup.cc index 166af27043..85b9a02bd6 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -127,9 +127,7 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash) Molecule Lookup::blank (Box b) { - Molecule m; - m.dim_ = b; - return m; + return Molecule (b, SCM_EOL); } diff --git a/lily/molecule.cc b/lily/molecule.cc index db6472b9e5..538edc4f9b 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -6,11 +6,6 @@ (c) 1997--2000 Han-Wen Nienhuys */ -/* - ugh. Rewrite not finished yet. Still must copy atom lists. - */ - - #include #include "font-metric.hh" @@ -18,17 +13,9 @@ #include "interval.hh" #include "string.hh" #include "molecule.hh" - #include "debug.hh" #include "killing-cons.tcc" - -Box -Molecule::extent() const -{ - return dim_; -} - Interval Molecule::extent(Axis a) const { @@ -38,7 +25,7 @@ Molecule::extent(Axis a) const Molecule::Molecule (Box b, SCM func) { expr_ = func; - dim_ = b ; + dim_ = b; } Molecule::Molecule() @@ -113,12 +100,11 @@ Molecule::align_to (Axis a, Direction d) translate_axis (-r, a); } - void Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding) { Real my_extent= empty_b () ? 0.0 : dim_[a][d]; - Interval i (m.extent ()[a]); + Interval i (m.extent (a)); if (i.empty_b ()) programming_error ("Molecule::add_at_edge: adding empty molecule."); @@ -135,10 +121,15 @@ Molecule::empty_b () const return expr_ == SCM_EOL; } - SCM fontify_atom(Font_metric * met, SCM f) { return gh_list (ly_symbol2scm ("fontify"), ly_quote_scm (met->description ()), f, SCM_UNDEFINED); } + +SCM +Molecule::get_expr () const +{ + return expr_; +} diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 4330d1733a..a673d9fcb9 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -69,8 +69,11 @@ Music_output_def::find_translator_l (String name) const if (translator_p_dict_p_->elem_b (name)) return translator_p_dict_p_->elem (name)->access_content_Translator_group (false); - if (global_translator_dict_p->elem_b (name)) - return global_translator_dict_p->elem(name); + map::const_iterator ki + =global_translator_dict_p->find (name); + + if (ki != global_translator_dict_p->end ()) + return (*ki).second ; return 0; } diff --git a/lily/note-head.cc b/lily/note-head.cc index 91dbeec61d..027f736c54 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -29,13 +29,13 @@ Note_head::ledger_line (Interval xwid) const Molecule *e = &endings[LEFT]; endings[RIGHT] = *e; - Real thick = e->dim_[Y_AXIS].length(); - Real len = e->dim_[X_AXIS].length () - thick; + Real thick = e->extent (Y_AXIS).length(); + Real len = e->extent (X_AXIS).length () - thick; Molecule total; Direction d = LEFT; do { - endings[d].translate_axis (xwid[d] - endings[d].dim_[X_AXIS][d], X_AXIS); + endings[d].translate_axis (xwid[d] - endings[d].extent (X_AXIS)[d], X_AXIS); total.add_molecule (endings[d]); } while ((flip(&d)) != LEFT); @@ -96,17 +96,16 @@ Note_head::do_brew_molecule() const ly_quote_scm(style), SCM_UNDEFINED)))); - Box ledgerless = out.dim_; - if (streepjes_i) { Direction dir = (Direction)sign (p); - Interval hd = out.dim_[X_AXIS]; + Interval hd = out.extent (X_AXIS); Real hw = hd.length ()/4; - Molecule ledger (ledger_line (Interval (hd[LEFT] - hw, hd[RIGHT] + hw))); + + ledger.set_empty (true); int parity = abs(int (p)) % 2; for (int i=0; i < streepjes_i; i++) @@ -117,8 +116,6 @@ Note_head::do_brew_molecule() const out.add_molecule (s); } } - - out.dim_ = ledgerless; return out; } diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 2f225d0718..d81fc89911 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -16,15 +16,15 @@ Paper_column::add_rod (Paper_column * p, Real d) { Direction dir = Direction (sign (p->rank_i () - rank_i ())); - if (!dir) + if (dir != RIGHT) { - programming_error ("Must set minimum distance between differing columns."); + programming_error ("Must set minimum distance LTOR."); return; } - for (int i=0; i < minimal_dists_arr_drul_[dir].size (); i++) + for (int i=0; i < minimal_dists_.size (); i++) { - Column_rod &rod = minimal_dists_arr_drul_[dir][i]; + Column_rod &rod = minimal_dists_[i]; if (rod.other_l_ == p) { rod.distance_f_ = rod.distance_f_ >? d; @@ -36,7 +36,7 @@ Paper_column::add_rod (Paper_column * p, Real d) cr.distance_f_ = d; cr.other_l_ = p; - minimal_dists_arr_drul_[dir].push (cr); + minimal_dists_.push (cr); } void @@ -44,15 +44,15 @@ Paper_column::add_spring (Paper_column * p, Real d, Real s) { Direction dir = Direction (sign (p->rank_i () - rank_i ())); - if (!dir) + if (dir != RIGHT) { - warning (_ ("Must set spring between differing columns")); + programming_error ("Must set springs LTOR"); return; } - for (int i=0; i < spring_arr_drul_[dir].size (); i++) + for (int i=0; i < springs_.size (); i++) { - Column_spring &spring = spring_arr_drul_[dir][i]; + Column_spring &spring = springs_[i]; if (spring.other_l_ == p) { spring.distance_f_ = spring.distance_f_ >? d; @@ -65,7 +65,7 @@ Paper_column::add_spring (Paper_column * p, Real d, Real s) cr.strength_f_ = s; cr.other_l_ = p; - spring_arr_drul_[dir].push (cr); + springs_.push (cr); } int @@ -80,28 +80,7 @@ Paper_column::set_rank (int i) rank_i_ = i; } -void -Paper_column::do_print() const -{ -#ifndef NPRINT - DEBUG_OUT << "rank: " << rank_i_ << '\n'; - Direction d = LEFT; - do - { - for (int i=0; i < minimal_dists_arr_drul_[d].size (); i++) - { - minimal_dists_arr_drul_[d][i].print (); - } - for (int i=0; i < spring_arr_drul_[d].size (); i++) - { - spring_arr_drul_[d][i].print (); - } - - } - while ((flip (&d))!=LEFT); - Item::do_print (); -#endif -} + Line_of_score* Paper_column::line_l() const diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 1d5ee856a1..3e2bcaa7d2 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -32,10 +32,40 @@ Ugh, this is messy. */ -Paper_outputter::Paper_outputter () +Paper_outputter::Paper_outputter (Paper_stream * ps ) { +#if 0 molecules_ = gh_cons (SCM_EOL, SCM_EOL); last_cons_ = molecules_; +#endif + + /* + lilypond -f scm x.ly + guile -s x.scm + */ + verbatim_scheme_b_ = output_global_ch == String ("scm"); + + if (verbatim_scheme_b_) + { + *ps << "" + ";;; Usage: guile -s x.scm > x.tex\n" + "(primitive-load-path 'lily.scm)\n" + "(scm-tex-output)\n" + ";(scm-ps-output)\n" + "(map (lambda (x) (display (eval x))) '(\n" + ; + } + + stream_p_ = ps; +} + +Paper_outputter::~Paper_outputter () +{ + if (verbatim_scheme_b_) + { + *stream_p_ << "))"; + } + delete stream_p_; } @@ -94,89 +124,47 @@ Paper_outputter::output_comment (String str) void Paper_outputter::output_scheme (SCM scm) { +#if 0 SCM c = gh_cons (scm,gh_cdr (last_cons_)); gh_set_cdr_x(last_cons_, c); last_cons_ = c; +#endif + + dump_scheme (scm); } +#if 0 void -Paper_outputter::dump_onto (Paper_stream *ps) +Paper_outputter::dump () { - if (String (output_global_ch) == "scm") -#if 1 // both are fine + + for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s)) { - /* - default to stdin - */ - int fd = 1; - if (ofstream* of = dynamic_cast (ps->os)) - fd = of->rdbuf ()->fd (); - SCM port = scm_fdes_to_port (fd, "a", SCM_EOL); - - /* - lilypond -f scm x.ly - guile -s x.scm - */ - scm_display (gh_str02scm ( - ";;; Usage: guile -s x.scm > x.tex\n" - "(primitive-load-path 'lily.scm)\n" - "(scm-as-output)\n" - ";(scm-tex-output)\n" - ";(scm-ps-output)\n" - "(map (lambda (x) (display (eval x))) '(\n" - ), port); - - SCM newline = gh_str02scm ("\n"); - for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s)) - { - scm_write (gh_car (s), port); - scm_display (newline, port); - scm_flush (port); - } - scm_display (gh_str02scm ("))"), port); - scm_display (newline, port); - scm_flush (port); - scm_close_port (port); + dump_scheme (gh_car (s)); } -#else +} +#endif + +void +Paper_outputter::dump_scheme (SCM s) +{ + if (verbatim_scheme_b_) { - /* - lilypond -f scm x.ly - guile -s x.scm - */ - if (output_global_ch == String ("scm")) - *ps << "" - ";;; Usage: guile -s x.scm > x.tex\n" - "(primitive-load-path 'lily.scm)\n" - "(scm-tex-output)\n" - ";(scm-ps-output)\n" - "(map (lambda (x) (display (eval x))) '(\n" - ; - for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s)) - { - SCM result = scm_eval (scm_listify (ly_symbol2scm ("scm->string"), - ly_quote_scm (gh_car (s)), SCM_UNDEFINED)); + SCM result = scm_eval (scm_listify (ly_symbol2scm ("scm->string"), + ly_quote_scm (gh_car (s)), SCM_UNDEFINED)); - *ps << ly_scm2string (result); - } - *ps << "))"; + *stream_p_ << ly_scm2string (result); } -#endif - else { - for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s)) - { - SCM result = scm_eval (gh_car (s)); - char *c=gh_scm2newstr (result, NULL); - - *ps << c; - free (c); - } - } + SCM result = scm_eval (s); + char *c=gh_scm2newstr (result, NULL); + + *stream_p_ << c; + free (c); + } } - void Paper_outputter::output_scope (Scope *scope, String prefix) { @@ -238,8 +226,6 @@ Paper_outputter::output_Real_def (String k, Real v) ly_str02scm (to_str(v).ch_l ()), SCM_UNDEFINED); output_scheme (scm); - - // gh_define (k.ch_l (), gh_double2scm (v)); } void @@ -251,8 +237,6 @@ Paper_outputter::output_String_def (String k, String v) ly_str02scm (v.ch_l ()), SCM_UNDEFINED); output_scheme (scm); - - // gh_define (k.ch_l (), ly_str02scm (v.ch_l ())); } void @@ -263,8 +247,6 @@ Paper_outputter::output_int_def (String k, int v) ly_str02scm (to_str (v).ch_l ()), SCM_UNDEFINED); output_scheme (scm); - - // gh_define (k.ch_l (), gh_int2scm (v)); } diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 941cfe71ab..a398ccac79 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -82,9 +82,9 @@ Paper_score::process () Array breaking = calc_breaking (); line_l_->break_into_pieces (breaking); - SCM lines = line_l_->output_lines (); - outputter_l_ = new Paper_outputter ; + outputter_l_ = new Paper_outputter (paper_l_->paper_stream_p ()); +; outputter_l_->output_header (); outputter_l_->output_version(); @@ -108,24 +108,14 @@ Paper_score::process () scm = gh_list (ly_symbol2scm ("header-end"), SCM_UNDEFINED); outputter_l_->output_scheme (scm); - SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ()); - outputter_l_->output_scheme (gh_list (ly_symbol2scm ("define-fonts"), - font_names, - SCM_UNDEFINED)); - - for (SCM i = lines ; gh_pair_p (i); i = gh_cdr (i)) - for (SCM j = gh_car (i) ; gh_pair_p (j); j = gh_cdr (j)) - outputter_l_->output_scheme (gh_car (j)); + line_l_->output_lines (); + scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED); outputter_l_->output_scheme (scm); - - Paper_stream* psp = paper_l_->paper_stream_p (); - outputter_l_->dump_onto (psp); // huh? delete outputter_l_; outputter_l_ = 0; - delete psp; } diff --git a/lily/rod.cc b/lily/rod.cc index 0db3c85885..90af9edf1b 100644 --- a/lily/rod.cc +++ b/lily/rod.cc @@ -19,14 +19,6 @@ Rod::Rod () item_l_drul_[LEFT] = item_l_drul_[RIGHT] =0; } -void -Column_rod::print () const -{ -#ifndef NDEBUG - DEBUG_OUT << "Column_rod { rank = " - << other_l_->rank_i () << ", dist = " << distance_f_ << "}\n"; -#endif -} Column_rod::Column_rod () { @@ -40,22 +32,25 @@ Column_rod::compare (const Column_rod &r1, const Column_rod &r2) return r1.other_l_->rank_i() - r2.other_l_->rank_i(); } + void -Rod::add_to_cols () +Rod::columnize () { Direction d = LEFT; - Drul_array cols; - Real extra_dist = 0.0; do { - cols[d] = item_l_drul_[d]->column_l (); - extra_dist += item_l_drul_[d]->relative_coordinate (cols[d], X_AXIS); + Paper_column * pc = item_l_drul_[d]->column_l (); + distance_f_ += - d * item_l_drul_[d]->relative_coordinate (pc, X_AXIS); + item_l_drul_[d] = pc; } while ((flip (&d))!=LEFT); - if (cols[LEFT] != cols[RIGHT]) - do - { - cols[-d]->add_rod(cols[d], distance_f_ + extra_dist); - } - while ((flip (&d))!=LEFT); +} + +void +Rod::add_to_cols () +{ + columnize(); + if (item_l_drul_[LEFT] != item_l_drul_[RIGHT]) + dynamic_cast (item_l_drul_[LEFT])-> + add_rod(dynamic_cast(item_l_drul_[RIGHT]), distance_f_ ); } diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 43e7d0d8c0..295bef4824 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -17,17 +17,19 @@ static Rod make_rod (Single_malt_grouping_item *l, Single_malt_grouping_item *r) { Rod rod; - rod.item_l_drul_[LEFT] =l; - rod.item_l_drul_[RIGHT]=r; Interval li (l->my_width ()); Interval ri (r->my_width ()); - + + rod.item_l_drul_[LEFT] =l; + rod.item_l_drul_[RIGHT]=r; + if (li.empty_b () || ri.empty_b ()) rod.distance_f_ = 0; else rod.distance_f_ = li[RIGHT] - ri[LEFT]; + rod.columnize (); return rod; } @@ -75,7 +77,23 @@ Separating_group_spanner::get_rods () const a.push (rod); } } - + + /* + We've done our job, so we get lost. + */ + for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) + { + Item * it =dynamic_cast(unsmob_element (gh_car (s))); + if (it && it->broken_b ()) + { + it->find_prebroken_piece (LEFT) ->suicide (); + it->find_prebroken_piece (RIGHT)->suicide (); + } + it->suicide (); + } + + ((Separating_group_spanner *)this)->suicide (); + return a; } diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index 85ec848123..905158ae1f 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -7,8 +7,6 @@ TODO: - add support for different stretch/shrink constants? - - Use force as a minimizing function, and use it to discourage mixes of - wide and tight lines. */ @@ -27,7 +25,6 @@ Simple_spacer::Simple_spacer () force_f_ = 0.; indent_f_ =0.0; default_space_f_ = 20 PT; - compression_energy_factor_f_ = 3.0; } void @@ -172,9 +169,9 @@ Simple_spacer::add_columns (Link_array cols) { Paper_column * c = cols [i]; Column_spring *to_next = 0; - for (int j =0; !to_next && j < c->spring_arr_drul_[RIGHT].size( ); j++) + for (int j =0; !to_next && j < c->springs_.size( ); j++) { - Column_spring &sp = c->spring_arr_drul_[RIGHT] [j]; + Column_spring &sp = c->springs_ [j]; if (sp.other_l_ != cols[i+1]) continue; @@ -195,8 +192,9 @@ Simple_spacer::add_columns (Link_array cols) if (!desc.sane_b ()) { - programming_error ("Insane spring."); - continue; + programming_error ("Insane spring found. Setting to unit spring."); + desc.hooke_f_ = 1.0; + desc.ideal_f_ = 1.0; } desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0 @@ -205,7 +203,7 @@ Simple_spacer::add_columns (Link_array cols) for (int i=0; i < cols.size () - 1; i++) { - Array * rods = &cols [i]->minimal_dists_arr_drul_[RIGHT]; + Array * rods = &cols [i]->minimal_dists_; for (int j =0; j < rods->size( ); j++) { int oi = cols.find_i (rods->elem (j).other_l_ ); @@ -216,6 +214,9 @@ Simple_spacer::add_columns (Link_array cols) } } + /* + TODO: should support natural length on only the last line. + */ if (line_len_f_ < 0) my_solve_natural_len (); else @@ -225,7 +226,6 @@ Simple_spacer::add_columns (Link_array cols) void Simple_spacer::solve (Column_x_positions *positions) const { - positions->energy_f_ = energy_f (); // abs (force_f_); positions->force_f_ = force_f_; positions->config_.push (indent_f_); @@ -247,13 +247,6 @@ Spring_description::Spring_description( ) block_force_f_ = 0.0; } -Real -Spring_description::energy_f (Real force) const -{ - Real stretch = (force >? block_force_f_) / hooke_f_; - Real e = 0.5 * stretch * stretch * hooke_f_; - return e; -} bool Spring_description::sane_b () const @@ -262,18 +255,3 @@ Spring_description::sane_b () const } -Real -Simple_spacer::energy_f () const -{ - Real e =0.; - - for (int i=0; i cols) const stretch_dist += right_dist; if (s.distance_f_ <0) - programming_error("negative dist"); - + { + programming_error("Negative dist, setting to 1.0 PT"); + s.distance_f_ = 1.0; + } if (stretch_dist == 0.0) { /* @@ -313,22 +315,27 @@ Array Spacing_spanner::get_springs () const { Array springs; - - SCM last_col = pscore_l_->line_l_->get_elt_property ("columns"); - Link_array measure; - for (SCM s = last_col; gh_pair_p (s); s = gh_cdr (s)) + + Link_array all (pscore_l_->line_l_->column_l_arr ()) ; + + int j = 0; + + for (int i = 1; i < all.size (); i++) { - Score_element * elt = unsmob_element (gh_car (s)); - Paper_column* sc = dynamic_cast (elt); - measure.push (sc); + Paper_column* sc = dynamic_cast (all[i]); if (sc->breakable_b ()) { - measure.reverse (); + Link_array measure (all.slice (j, i+1)); springs.concat (do_measure (measure)); - measure.clear (); - measure.push (sc); + j = i; } } + + /* + farewell, cruel world + */ + ((Spacing_spanner*)this)->suicide (); + return springs; } diff --git a/lily/spring.cc b/lily/spring.cc index b061067833..ae5f33da74 100644 --- a/lily/spring.cc +++ b/lily/spring.cc @@ -22,14 +22,7 @@ Spring::Spring () void Spring::add_to_cols () { - Direction d = LEFT; - do - { - item_l_drul_[-d]->column_l ()->add_spring - (item_l_drul_[d]->column_l (), - distance_f_, strength_f_); - } - while ((flip (&d))!=LEFT); + item_l_drul_[LEFT]->column_l ()->add_spring (item_l_drul_[RIGHT]->column_l (), distance_f_, strength_f_); } @@ -47,12 +40,3 @@ Column_spring::compare (Column_spring const & r1, Column_spring const &r2) return r1.other_l_->rank_i() - r2.other_l_->rank_i(); } -void -Column_spring::print () const -{ -#ifndef NPRINT - DEBUG_OUT << "Column_spring { rank = " - << other_l_->rank_i () << ", dist = " << distance_f_ << "}\n"; - -#endif -} diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 855aa46d03..1bc5041b29 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -91,7 +91,7 @@ Stem_tremolo::do_brew_molecule () const mol.add_molecule (b); } if (tremolo_flags) - mol.translate_axis (-mol.extent ()[Y_AXIS].center (), Y_AXIS); + mol.translate_axis (-mol.extent (Y_AXIS).center (), Y_AXIS); Real half_space = Staff_symbol_referencer_interface (stem).staff_space () / 2; @@ -109,7 +109,7 @@ Stem_tremolo::do_brew_molecule () const Beams should intersect one beamthickness below stem end */ Real dy = stem->stem_end_position () * half_space; - dy -= mol.extent ()[Y_AXIS].length () / 2 * stem->get_direction (); + dy -= mol.extent (Y_AXIS).length () / 2 * stem->get_direction (); /* uhg. Should use relative coords and placement diff --git a/lily/stem.cc b/lily/stem.cc index 22344c6099..ce5103d7df 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -447,7 +447,7 @@ Stem::dim_callback (Dimension_cache const* c) ; // TODO! else { - r = s->flag ().dim_.x (); + r = s->flag ().extent (X_AXIS); } return r; } diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index be44c6c6e2..b851480961 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -34,8 +34,7 @@ System_start_delimiter::staff_bracket (Real height) const Real h = height + 2 * arc_height; Box b (Interval (0, 1.5 * staff_space), Interval (-h/2, h/2)); Molecule mol (b, at); - - mol.translate_axis (- mol.dim_[X_AXIS].length () / 2, X_AXIS); + mol.align_to (X_AXIS, CENTER); return mol; } diff --git a/lily/text-item.cc b/lily/text-item.cc index 0b0845e143..9eb3047356 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -26,9 +26,12 @@ Text_item::do_brew_molecule () const SCM s = get_elt_property ("word-space"); if (gh_number_p (s)) - mol.dim_.interval_a_[X_AXIS][RIGHT] += gh_scm2double (s) - * staff_symbol_referencer (this).staff_space (); - + { + Molecule m; + m.set_empty (false); + mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (s)* + staff_symbol_referencer (this).staff_space ()); + } return mol; } diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc index 8c72758890..53dee7207d 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -26,7 +26,7 @@ add_translator (Translator *t) if (!global_translator_dict_p) global_translator_dict_p = new Dictionary; - global_translator_dict_p->elem (classname (t)) = t; + (*global_translator_dict_p)[classname (t)] = t; } Translator* diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index f68d175a0b..6c690bb8e7 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -135,7 +135,9 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const Link_array column_arr= Group_interface__extract_elements (this, (Note_column*)0, "columns"); - + + Score_element * common = common_refpoint (get_elt_property ("columns"), Y_AXIS); + Direction d = directional_element (this).get (); /* @@ -151,8 +153,8 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const if (l < r) { - *dy = column_arr[r]->extent (Y_AXIS) [d] - - column_arr[l]->extent (Y_AXIS) [d]; + *dy = column_arr[r]->extent (Y_AXIS) [d] + column_arr[r]->relative_coordinate (common, Y_AXIS) + - column_arr[l]->extent (Y_AXIS) [d] - column_arr[l]->relative_coordinate (common, Y_AXIS); } else * dy = 0; @@ -167,7 +169,9 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const for (int i = 0; i < column_arr.size (); i++) { - Real notey = column_arr[i]->extent (Y_AXIS)[d]; + Real notey = column_arr[i]->extent (Y_AXIS)[d] + + column_arr[i]->relative_coordinate (common, Y_AXIS) + ; Real x = column_arr[i]->relative_coordinate (0, X_AXIS) - x0; Real tuplety = *dy * x * factor; -- 2.39.5