From: Han-Wen Nienhuys Date: Wed, 15 Mar 2000 13:08:34 +0000 (+0100) Subject: release: 1.3.34 X-Git-Tag: release/1.3.34 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dd36ce6e97590323a7b6a61eb4a3f08d265c5b6e;p=lilypond.git release: 1.3.34 ====== 1.3.33.h --- diff --git a/CHANGES b/CHANGES index 143b66cbd5..7f45cd778b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,19 @@ +1.3.34 +====== +1.3.33.hwn2 +=========== + +* Print key without setting key, syntax "\key ;". General cleanups of +key-item. + +* Add paragraph tags in HTML output of mudela-book. Music fragment +don't run into the text anymore. + +* Bugfix: don't align the first line of text. (Lookup::text ()). + +* Abstract away data members of Axis_group_element, Align_element + + 1.3.33.jcn3 =========== @@ -10,9 +26,6 @@ moving in case of a collision) more than maximumRestCount similar rests. WIP! -1.3.33.jcn1 -=========== - * Rewrote Staff_margin_engraver. Staff margin texts now hang on a new breakable item: Left_edge_item. @@ -20,15 +33,13 @@ (not supported by a Dynamic_line_spanner) still collide with Staff, although they now have staff support, which was supposed to fix this. -1.3.32.jcn4 -=========== - * Fixed Staff_margin_engraver for "instrument", "instr" is still broken. * Dynamic elements are only put in a Dynamic_line_spanner if there actually is more than one adjacent note-column with a dynamic. This breaks the fine looks of all dynamics, again :-) + 1.3.33 ====== diff --git a/VERSION b/VERSION index bf5765c717..42ffa362e5 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=33 -MY_PATCH_LEVEL=jcn3 +PATCH_LEVEL=34 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/flower/include/timer.hh b/flower/include/timer.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/input/bugs/hara-clef.ly b/input/bugs/hara-clef.ly new file mode 100644 index 0000000000..639ebaa150 --- /dev/null +++ b/input/bugs/hara-clef.ly @@ -0,0 +1,10 @@ + +\score { +\notes < \context Staff { \clef "G^8"; s1 s1 s1 } + \context Staff = CC { c1 c c } > + +\paper { +\translator { + \HaraKiriStaffContext +}} +} diff --git a/input/bugs/k.fly b/input/bugs/k.fly new file mode 100644 index 0000000000..b7d1761124 --- /dev/null +++ b/input/bugs/k.fly @@ -0,0 +1,2 @@ + +\key e; c2 \clef "treble";\key es; c \break c1 diff --git a/lily/align-element.cc b/lily/align-element.cc index c75902783b..d892e73316 100644 --- a/lily/align-element.cc +++ b/lily/align-element.cc @@ -13,23 +13,39 @@ #include "hash-table-iter.hh" #include "dimension-cache.hh" -void -Align_element::after_line_breaking() +/* + This callback is set in the children of the align element. It does + not compute anything, but a side effect of a->do_side_processing () + is that the elements are placed correctly. */ +Real +Align_element::alignment_callback (Dimension_cache const *c) { - if (axis () == Y_AXIS) - do_side_processing (); + Axis ax = c->axis (); + Score_element * sc = c->element_l ()->parent_l (ax); + Align_element * a = dynamic_cast (sc); + if (a && a->get_elt_property ("alignment-done") == SCM_UNDEFINED) + { + a->do_side_processing (ax); + } + return 0.0; } void -Align_element::before_line_breaking () +Align_element::add_element (Score_element* s) { - if (axis () == X_AXIS) - do_side_processing (); + s->add_offset_callback (alignment_callback, axis ()); + Axis_group_element::add_element (s); } +/* + Hairy function to put elements where they should be. Can be tweaked + from the outside by setting minimum-space and extra-space in its + children */ void -Align_element::do_side_processing () +Align_element::do_side_processing (Axis a) { + set_elt_property ("alignment-done", SCM_BOOL_T); + SCM d = get_elt_property ("stacking-dir"); Direction stacking_dir = gh_number_p(d) ? to_dir (d) : CENTER; if (!stacking_dir) @@ -42,7 +58,7 @@ Align_element::do_side_processing () Link_array all_elts (elem_l_arr ()); for (int i=0; i < all_elts.size(); i++) { - Interval y = all_elts[i]->extent(axis ()) + all_elts[i]->relative_coordinate (this, axis ()); + Interval y = all_elts[i]->extent(a) + all_elts[i]->relative_coordinate (this, a); if (!y.empty_b()) { Score_element *e =dynamic_cast(all_elts[i]); @@ -71,6 +87,15 @@ Align_element::do_side_processing () } } + + Interval threshold = Interval (0, Interval::infinity ()); + SCM thr = get_elt_property ("threshold"); + if (gh_pair_p (thr)) + { + threshold[SMALLER] = gh_scm2double (gh_car (thr)); + threshold[BIGGER] = gh_scm2double (gh_cdr (thr)); + } + Real where_f=0; for (int i=0 ; i < elems.size(); i++) { @@ -80,20 +105,15 @@ Align_element::do_side_processing () if (i) { - dy = (dy >? threshold_interval_[SMALLER] ) - ? threshold[SMALLER] ) + translate_axis (where_f, axis ()); + elems[i]->translate_axis (where_f, a); } } -Align_element::Align_element() -{ - threshold_interval_ = Interval (0, Interval::infinity ()); -} int Align_element::get_count (Score_element*s)const @@ -113,13 +133,13 @@ Align_element::get_count (Score_element*s)const Axis Align_element::axis () const { - return axes_[0]; + return Axis (gh_scm2int (gh_car (get_elt_property ("axes")))); } void Align_element::set_axis (Axis a) { - set_axes (a,a); + set_axes (a, a); } diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index 42e973765e..5bde41d6bf 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -59,7 +59,6 @@ Align_note_column_engraver::do_removal_processing () { Direction d = to_dir (al); directional_element (align_item_p_).set (d); - align_item_p_->set_elt_property ("align-dir", to_dir (-d)); } typeset_element (align_item_p_); diff --git a/lily/atom.cc b/lily/atom.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/axis-group-element.cc b/lily/axis-group-element.cc index 7e2cdacf13..d3235510d4 100644 --- a/lily/axis-group-element.cc +++ b/lily/axis-group-element.cc @@ -10,13 +10,6 @@ #include "dimension-cache.hh" #include "group-interface.hh" -Link_array -Axis_group_element::get_extra_dependencies() const -{ - Link_array e(elem_l_arr ()); - return e; -} - Link_array Axis_group_element::elem_l_arr () const { @@ -44,9 +37,6 @@ Axis_group_element::get_children () Axis_group_element::Axis_group_element() { - axes_[0] = (Axis)-1 ; - axes_[1] = (Axis)-1 ; - set_elt_property ("elements", SCM_EOL); set_elt_property ("transparent", SCM_BOOL_T); } @@ -54,8 +44,13 @@ Axis_group_element::Axis_group_element() void Axis_group_element::set_axes (Axis a1, Axis a2) { - axes_[0] = a1 ; - axes_[1] = a2 ; + SCM ax = gh_cons (gh_int2scm (a1), SCM_EOL); + if (a1 != a2) + ax= gh_cons (gh_int2scm (a2), ax); + + + set_elt_property ("axes", ax); + if (a1 != X_AXIS && a2 != X_AXIS) set_empty (X_AXIS); if (a1 != Y_AXIS && a2 != Y_AXIS) @@ -87,19 +82,29 @@ Axis_group_element::extent_callback (Dimension_cache const *c) } +bool +Axis_group_element::axis_b (Axis a )const +{ + return dim_cache_[a]->extent_callback_l_ == extent_callback; +} + void Axis_group_element::add_element (Score_element *e) { used_b_ =true; e->used_b_ = true; - - for (int i = 0; i < 2; i++) + + for (SCM ax = get_elt_property ("axes"); ax != SCM_EOL ; ax = gh_cdr (ax)) { - if (!e->parent_l (axes_[i])) - e->set_parent (this, axes_[i]); + Axis a = (Axis) gh_scm2int (gh_car (ax)); + + if (!e->parent_l (a)) + e->set_parent (this, a); } Group_interface gi (this); gi.add_element (e); + + add_dependency (e); } diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index dfb91c3845..0d67818da9 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -155,5 +155,5 @@ Break_align_item::Break_align_item () set_elt_property ("stacking-dir" , gh_int2scm (RIGHT)); set_axis (X_AXIS); - dim_cache_[X_AXIS]->off_callbacks_.push (Side_position_interface::aligned_on_self); + add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 835b2c5760..cffdd3f340 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -124,7 +124,7 @@ Clef_engraver::acknowledge_element (Score_element_info info) } else if (Key_item *k = dynamic_cast(it_l)) { - k-> set_c_position (c0_position_i_); + k->set_elt_property ("c0-position", gh_int2scm (c0_position_i_)); } } } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index d49534d727..a7c9661293 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -74,9 +74,9 @@ Clef_item::do_add_processing () g->set_parent (this, X_AXIS); g->set_elt_property ("self-alignment-X", gh_int2scm (0)); - g->dim_cache_[X_AXIS]->off_callbacks_.push (Side_position_interface::aligned_on_self); - g->dim_cache_[X_AXIS]->off_callbacks_.push (Side_position_interface::centered_on_parent); - + g->add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS); + g->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS); + g->set_elt_property ("direction", octave_dir); add_dependency (g); // just to be sure. diff --git a/lily/command-request.cc b/lily/command-request.cc index 58f4d434d0..68016b6683 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -106,17 +106,25 @@ Tempo_req::do_equal_b (Request const *r) const void Key_change_req::do_print () const { -#ifndef NPRINT - for (int i=0; i < key_.pitch_arr_.size (); i++) - { - key_.pitch_arr_[i].print (); - } +#if 0 + key_->print(); #endif } Key_change_req::Key_change_req () { + key_ = 0; +} +Key_change_req::Key_change_req (Key_change_req const&s) + : Request (s) +{ + key_ = new Key_def (*s.key_); } +Key_change_req::~Key_change_req () +{ + delete key_; +} + Break_req::Break_req () { @@ -134,8 +142,6 @@ Mark_req::do_equal_b (Request const * r) const void Key_change_req::transpose (Musical_pitch p) { - key_.transpose (p); + key_->transpose (p); } - - diff --git a/lily/cross-staff.cc b/lily/cross-staff.cc index ca44c30e9d..c7855b5836 100644 --- a/lily/cross-staff.cc +++ b/lily/cross-staff.cc @@ -12,11 +12,14 @@ calc_interstaff_dist (Item const *item, Spanner const *span) Align_element * align = dynamic_cast (common); if (align && align->axis() == Y_AXIS) { - if (align->threshold_interval_[MIN] != - align->threshold_interval_[MAX]) + SCM threshold = align->get_elt_property ("threshold"); + if (!gh_pair_p (threshold) + || !scm_equal_p (gh_car (threshold), gh_cdr (threshold))) warning (_ ("minVerticalAlign != maxVerticalAlign: cross staff spanners may be broken")); - interstaff = align->threshold_interval_[MIN]; + interstaff = 0.0; + if (gh_pair_p (threshold)) + interstaff = gh_scm2double (gh_car (threshold)); Score_element const * span_refpoint = span; while (span_refpoint->parent_l (Y_AXIS) != common) diff --git a/lily/dimension-cache.cc b/lily/dimension-cache.cc index 69ff282b0a..f314dbc24e 100644 --- a/lily/dimension-cache.cc +++ b/lily/dimension-cache.cc @@ -14,7 +14,7 @@ Dimension_cache::Dimension_cache (Dimension_cache const &d) { init(); - callback_l_ = d.callback_l_; + extent_callback_l_ = d.extent_callback_l_; basic_offset_ = d.basic_offset_; extra_offset_ = d.extra_offset_; off_valid_b_ = d.off_valid_b_; @@ -30,7 +30,7 @@ Dimension_cache::Dimension_cache () void Dimension_cache::init() { - callback_l_ =0; + extent_callback_l_ =0; basic_offset_ =0.0; extra_offset_ =0.0; @@ -113,13 +113,13 @@ Dimension_cache::get_dim () const { Interval r; Dimension_cache *nc = ((Dimension_cache*)this); - if (!callback_l_) + if (!extent_callback_l_) { nc->dim_.set_empty (); } else if (!valid_b_) { - nc->dim_= (*callback_l_ ) (nc); + nc->dim_= (*extent_callback_l_ ) (nc); nc->valid_b_ = true; } @@ -130,7 +130,7 @@ Dimension_cache::get_dim () const void Dimension_cache::set_callback (Dim_cache_callback c) { - callback_l_ =c; + extent_callback_l_ =c; } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index b68a2b2788..9bd790f001 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -206,19 +206,8 @@ Dynamic_engraver::do_process_music () gh_int2scm (100)); pending_element_arr_.push (text_p_); text_p_->set_elt_property ("self-alignment-Y", gh_int2scm (0)); - text_p_->dim_cache_[Y_AXIS]->off_callbacks_.push - (Side_position_interface::aligned_on_self); - /* - Don't crash into staff - */ -#if 0 - // nogo - text_p_->dim_cache_[Y_AXIS]->off_callbacks_.push - (Side_position_interface::aligned_side); -#else - // doet't ook niet, maar breekt wel alignment op line-spanner - //side_position (text_p_).set_axis (Y_AXIS); -#endif + text_p_->add_offset_callback (Side_position_interface::aligned_on_self, + Y_AXIS); announce_element (Score_element_info (text_p_, text_req_l_)); } @@ -303,19 +292,8 @@ Dynamic_engraver::do_process_music () } pending_element_arr_.push (cresc_p_); cresc_p_->set_elt_property ("self-alignment-Y", gh_int2scm (0)); - cresc_p_->dim_cache_[Y_AXIS]->off_callbacks_.push - (Side_position_interface::aligned_on_self); - /* - Don't crash into staff - */ -#if 0 - // nogo - cresc_p_->dim_cache_[Y_AXIS]->off_callbacks_.push - (Side_position_interface::aligned_side); -#else - // doet't ook niet, maar breekt wel alignment op line-spanner - //side_position (cresc_p_).set_axis (Y_AXIS); -#endif + cresc_p_->add_offset_callback + (Side_position_interface::aligned_on_self, Y_AXIS); announce_element (Score_element_info (cresc_p_, span_req_l_drul_[START])); } } diff --git a/lily/engraver.cc b/lily/engraver.cc index 40bc87f9c1..2211e8ac32 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -25,7 +25,9 @@ void Engraver::announce_element (Score_element_info i) { Score_element * e = i.elem_l_; - group (e, "interfaces").add_thing (ly_symbol2scm (e->name())); + + if (e->get_elt_property ("interfaces") == SCM_EOL) + group (e, "interfaces").add_thing (ly_symbol2scm (e->name())); if (!i.origin_trans_l_) i.origin_trans_l_ = this; diff --git a/lily/grace-align-item.cc b/lily/grace-align-item.cc index e397ba9c56..0ddf8481b7 100644 --- a/lily/grace-align-item.cc +++ b/lily/grace-align-item.cc @@ -24,7 +24,9 @@ Grace_align_item::before_line_breaking () Real nhw = // lookup_l ()->notehead (2, "").dim_[X_AXIS].length(); paper_l ()->get_var ("quartwidth"); - threshold_interval_[MIN] = nhw* 1.5; + set_elt_property ("threshold", + gh_cons (gh_double2scm (nhw* 1.5), + gh_double2scm (infinity_f))); column_l ()->set_elt_property ("contains-grace", SCM_BOOL_T); diff --git a/lily/include/align-element.hh b/lily/include/align-element.hh index 49d4e4bab1..b4fae22642 100644 --- a/lily/include/align-element.hh +++ b/lily/include/align-element.hh @@ -34,24 +34,18 @@ Which side to align? -1: left side, 0: centered (around center_l_ if not nil, or around center of width), 1: right side - ***** - - align-dir: deprecate! Use Side_pos_interface::self_align - */ class Align_element : public virtual Axis_group_element { public: - Interval threshold_interval_ ; - Axis axis () const; - - Align_element (); + void set_axis (Axis); int get_count (Score_element*)const; + void add_element (Score_element *); + static Real alignment_callback (Dimension_cache const *); protected: - virtual void after_line_breaking () ; - virtual void before_line_breaking (); - virtual void do_side_processing (); + virtual void do_side_processing (Axis); + }; #endif // VERTICAL_ALIGN_ITEM_HH diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh index 83acd188b1..75cf8d13d9 100644 --- a/lily/include/axis-group-element.hh +++ b/lily/include/axis-group-element.hh @@ -21,19 +21,13 @@ */ class Axis_group_element : public virtual Score_element { - /// modify fields of E for removal. - void do_remove (Score_element*e); - protected: - virtual Link_array get_extra_dependencies() const; virtual Link_array elem_l_arr() const; static Interval extent_callback (Dimension_cache const*); public: - Axis axes_[2]; - void add_element (Score_element*); - + bool axis_b (Axis) const; Axis_group_element (); void set_axes (Axis,Axis); diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index c21b1d0b3c..5f138b28b0 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -106,7 +106,9 @@ class Key_change_req : public Request { public: Key_change_req (); - Key_def key_; + ~Key_change_req(); + Key_change_req(Key_change_req const &); + Key_def *key_; protected: VIRTUAL_COPY_CONS(Music); diff --git a/lily/include/dimension-cache-callback.hh b/lily/include/dimension-cache-callback.hh new file mode 100644 index 0000000000..b12dc1078d --- /dev/null +++ b/lily/include/dimension-cache-callback.hh @@ -0,0 +1,18 @@ +/* + dimension-cache-callback.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef DIMENSION_CACHE_CALLBACK_HH +#define DIMENSION_CACHE_CALLBACK_HH + +class Dimension_cache; +typedef Interval (*Dim_cache_callback)(Dimension_cache const *); +typedef Real (*Offset_cache_callback)(Dimension_cache const *); + +#endif /* DIMENSION_CACHE_CALLBACK_HH */ + diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index 52985161a3..e110041d0b 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -14,10 +14,8 @@ #include "real.hh" #include "lily-proto.hh" #include "parray.hh" +#include "dimension-cache-callback.hh" -class Dimension_cache; -typedef Interval (*Dim_cache_callback)(Dimension_cache const *); -typedef Real (*Offset_cache_callback)(Dimension_cache const *); /** Adminstration of offset dimension info. @@ -38,12 +36,12 @@ class Dimension_cache friend class Score_element; void init (); -public: Array off_callbacks_; /** What to call to find extent. Nil means empty. */ - Dim_cache_callback callback_l_; +public: + Dim_cache_callback extent_callback_l_; static Interval point_dimension_callback (Dimension_cache const* ); Axis axis () const; Real get_offset () const; diff --git a/lily/include/directional-spanner.hh b/lily/include/directional-spanner.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/key-def.hh b/lily/include/key-def.hh index 6ed1137895..2b9fdccff2 100644 --- a/lily/include/key-def.hh +++ b/lily/include/key-def.hh @@ -15,6 +15,8 @@ /** Universal key definition (Should rename class Key to 'Accidentals'?) + + FIXME: merge key.hh and key-def.hh classes. */ class Key_def { diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 55f320c9c9..d8a7f295a0 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -11,28 +11,23 @@ #include "array.hh" -/// An item which places accidentals at the start of the line +/** An item which places accidentals at the start of the line + + TODO: Schemify me. + */ class Key_item :public Item { Array pitch_arr_; Array acc_arr_; Array old_pitch_arr_; Array old_acc_arr_; - int c0_position_; - public: - bool multi_octave_b_; - - int get_c_position () const; - - VIRTUAL_COPY_CONS(Score_element); - Key_item (); void add (int pitch, int acc); void add_old (int pitch, int acc); - void set_c_position (int); + int calculate_position(int p, int a) const; protected: diff --git a/lily/include/leastsquares.hh b/lily/include/leastsquares.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/note-head-side.hh b/lily/include/note-head-side.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 886659fe35..9bcbd2e33c 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -12,6 +12,8 @@ #include "lily-guile.hh" #include "lily-proto.hh" #include "smobs.hh" +#include "dimension-cache-callback.hh" + typedef void (Score_element::*Score_element_method_pointer) (void); @@ -150,8 +152,6 @@ protected: /// do calculations after determining horizontal spacing virtual void after_line_breaking (); - virtual Link_array get_extra_dependencies () const; - static Interval dim_cache_callback (Dimension_cache const*); public: static SCM ly_set_elt_property (SCM, SCM,SCM); @@ -194,6 +194,9 @@ public: Score_element*common_refpoint (Score_element const* s, Axis a) const; Score_element*common_refpoint (Link_array elems, Axis a) const; + + bool has_offset_callback_b (Offset_cache_callback, Axis)const; + void add_offset_callback (Offset_cache_callback, Axis); /** Set the parent refpoint of THIS to E */ diff --git a/lily/include/staff-margin-engraver.hh b/lily/include/staff-margin-engraver.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index b9f0ec4e29..88ca9e102c 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -131,6 +131,9 @@ Key_engraver::do_pre_move_processing () void Key_engraver::read_req (Key_change_req const * r) { + if (!r->key_) + return; + old_accidental_idx_arr_ = accidental_idx_arr_; key_.clear (); SCM prop = get_property ("keyOctaviation"); @@ -139,9 +142,9 @@ Key_engraver::read_req (Key_change_req const * r) accidental_idx_arr_.clear (); - if (r->key_.ordinary_key_b_) + if (r->key_->ordinary_key_b_) { - int no_of_acc = r->key_.ordinary_accidentals_i (); + int no_of_acc = r->key_->ordinary_accidentals_i (); // Hmm, can't these be handled/constructed by Key_change_req? if (no_of_acc < 0) @@ -181,9 +184,9 @@ Key_engraver::read_req (Key_change_req const * r) } else // Special key { - for (int i = 0; i < r->key_.pitch_arr_.size (); i ++) + for (int i = 0; i < r->key_->pitch_arr_.size (); i ++) { - Musical_pitch m_l =r->key_.pitch_arr_[i]; + Musical_pitch m_l =r->key_->pitch_arr_[i]; if (key_.multi_octave_b_) key_.set (m_l); else diff --git a/lily/key-item.cc b/lily/key-item.cc index bd12e97bee..e6b8df7b44 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -23,27 +23,9 @@ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ Key_item::Key_item () { set_elt_property ("breakable", SCM_BOOL_T); - set_c_position (0); + set_elt_property ("c0-position", gh_int2scm (0)); } -int -Key_item::get_c_position () const -{ - // Find the c in the range -4 through 2 - int from_bottom_pos = c0_position_ + 4; - from_bottom_pos = from_bottom_pos%7; - from_bottom_pos = (from_bottom_pos + 7)%7; // Precaution to get positive. - return from_bottom_pos - 4; -} - - -void -Key_item::set_c_position (int c0) -{ - c0_position_ = c0; -} - - void Key_item::add (int p, int a) { @@ -64,27 +46,35 @@ Key_item::calculate_position(int p, int a) const { if (to_boolean (get_elt_property ("multi-octave"))) { - return p + c0_position_; + return p + gh_scm2int (get_elt_property ("c0-position")); } else { - if ((a<0 && ((p>FLAT_TOP_PITCH) || (p+get_c_position ()>4)) && (p+get_c_position ()>1)) + // Find the c in the range -4 through 2 + int from_bottom_pos = gh_scm2int (get_elt_property ("c0-position")) + 4; + from_bottom_pos = from_bottom_pos%7; + from_bottom_pos = (from_bottom_pos + 7)%7; // Precaution to get positive. + int c0 = from_bottom_pos - 4; + + + if ((a<0 && ((p>FLAT_TOP_PITCH) || (p+c0>4)) && (p+c0>1)) || - (a>0 && ((p>SHARP_TOP_PITCH) || (p+get_c_position ()>5)) && (p+get_c_position ()>2))) + (a>0 && ((p>SHARP_TOP_PITCH) || (p+c0>5)) && (p+c0>2))) { p -= 7; /* Typeset below c_position */ } /* Provide for the four cases in which there's a glitch */ /* it's a hack, but probably not worth */ /* the effort of finding a nicer solution. dl. */ - if (get_c_position ()==2 && a>0 && p==3) + if (c0==2 && a>0 && p==3) p -= 7; - if (get_c_position ()==-3 && a>0 && p==-1) + if (c0==-3 && a>0 && p==-1) p += 7; - if (get_c_position ()==-4 && a<0 && p==-1) + if (c0==-4 && a<0 && p==-1) p += 7; - if (get_c_position ()==-2 && a<0 && p==-3) + if (c0==-2 && a<0 && p==-3) p += 7; - return p + get_c_position (); + + return p + c0; } } diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 6c4132a451..ea2668b926 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -37,9 +37,9 @@ Key_performer::do_print () const void Key_performer::do_process_music () { - if (key_req_l_) + if (key_req_l_ && key_req_l_->key_) { - audio_p_ = new Audio_key (key_req_l_->key_); + audio_p_ = new Audio_key (*key_req_l_->key_); Audio_element_info info (audio_p_, key_req_l_); announce_element (info); key_req_l_ = 0; diff --git a/lily/lookup.cc b/lily/lookup.cc index 0f422458ee..fc4d696d93 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -273,27 +273,36 @@ Lookup::text (String style, String text, Paper_def *paper_l) Array lines = String_convert::split_arr (text, '\n'); - Molecule mol; - Real kern = paper_l->get_var ("line_kern"); - for (i = 0; i< lines.size (); i++) + for (int i=0; i < lines.size (); i++) { - /* - Huh? This way we'll still see \foo sequences in ps output. - */ - String str = lines[i]; + String str (lines[i]); if (output_global_ch == "tex") str = sanitise_TeX_string (str); else if (output_global_ch == "ps") str = sanitise_PS_string (str); + lines[i] = str; + } + + + SCM first = gh_list (ly_symbol2scm ("text"), + ly_str02scm (lines[0].ch_C()), + SCM_UNDEFINED); + first = fontify_atom (metric_l, first); + + + Molecule mol (metric_l->text_dimension (lines[0]), first); + + for (i = 1; i < lines.size (); i++) + { SCM line = (gh_list (ly_symbol2scm ("text"), - ly_str02scm (str.ch_C ()), + ly_str02scm (lines[i].ch_C ()), SCM_UNDEFINED)); line = fontify_atom (metric_l, line); mol.add_at_edge (Y_AXIS, DOWN, - Molecule (metric_l->text_dimension (str), line), + Molecule (metric_l->text_dimension (lines[i]), line), kern); } diff --git a/lily/parser.yy b/lily/parser.yy index 580d7dcee5..3b9df13d04 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1039,19 +1039,31 @@ verbose_command_req: $$ = new Clef_change_req (ly_scm2string ($2)); } + | KEY { + Key_change_req *key_p= new Key_change_req; + key_p->key_ = 0; + $$ = key_p; + } /* UGH. optional. */ + | KEY NOTENAME_PITCH optional_modality { Key_change_req *key_p= new Key_change_req; - key_p->key_.pitch_arr_.push (*$2); - key_p->key_.ordinary_key_b_ = true; - key_p->key_.modality_i_ = $3; + Key_def d; + d.pitch_arr_.push (*$2); + d.ordinary_key_b_ = true; + d.modality_i_ = $3; + + key_p->key_ = new Key_def (d); $$ = key_p; delete $2; } | KEYSIGNATURE pitch_list { Key_change_req *key_p= new Key_change_req; - key_p->key_.pitch_arr_ = *$2; - key_p->key_.ordinary_key_b_ = false; + Key_def d; + d.pitch_arr_ = *$2; + d.ordinary_key_b_ = false; + + key_p->key_ = new Key_def(d); $$ = key_p; delete $2; } diff --git a/lily/score-element.cc b/lily/score-element.cc index 141d95a22d..a2d31ab4a5 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -202,14 +202,14 @@ Score_element::add_processing() if (get_elt_property ("self-alignment-X") != SCM_UNDEFINED && !dim_cache_[X_AXIS]->off_callback_l_) { - dim_cache_[X_AXIS]->off_callbacks_.push (Side_position_interface::aligned_on_self); + add_offset_callback (Side_position_interface::aligned_on_self,X_AXIS); } if (get_elt_property ("self-alignment-Y") != SCM_UNDEFINED && !dim_cache_[X_AXIS]->off_callback_l_) { - dim_cache_[Y_AXIS]->set_offset_callback (Side_position_interface::aligned_on_self); + add_offset_callback (Side_position_interface::aligned_on_self, Y_AXIS); } #endif @@ -228,16 +228,12 @@ Score_element::calculate_dependencies (int final, int busy, assert (status_i_!= busy); status_i_= busy; - Link_array dependency_arr = - Group_interface__extract_elements (this, (Score_element*)0, "dependencies"); - - for (int i=0; i < dependency_arr.size(); i++) - dependency_arr[i]->calculate_dependencies (final, busy, funcptr); + for (SCM d= get_elt_property ("dependencies"); d != SCM_EOL; d = gh_cdr (d)) + { + unsmob_element (gh_car (d)) + ->calculate_dependencies (final, busy, funcptr); + } - Link_array extra (get_extra_dependencies()); - for (int i=0; i < extra.size(); i++) - extra[i]->calculate_dependencies (final, busy, funcptr); - (this->*funcptr)(); status_i_= final; } @@ -453,13 +449,6 @@ Score_element::handle_prebroken_dependencies() } } -Link_array -Score_element::get_extra_dependencies() const -{ - Link_array empty; - return empty; -} - bool Score_element::linked_b() const { @@ -499,13 +488,13 @@ Score_element::common_refpoint (Score_element const* s, Axis a) const void Score_element::set_empty (Axis a) { - dim_cache_[a]->callback_l_ =0; + dim_cache_[a]->extent_callback_l_ =0; } bool Score_element::empty_b (Axis a)const { - return !dim_cache_[a]->callback_l_; + return !dim_cache_[a]->extent_callback_l_; } Interval @@ -542,6 +531,22 @@ Score_element::name () const return classname (this); } +void +Score_element::add_offset_callback (Offset_cache_callback cb, Axis a) +{ + dim_cache_[a]->off_callbacks_.push (cb); +} + +bool +Score_element::has_offset_callback_b (Offset_cache_callback cb, Axis a)const +{ + for (int i= dim_cache_[a]->off_callbacks_.size (); i--;) + { + if (dim_cache_[a]->off_callbacks_[i] == cb) + return true; + } + return false; +} void Score_element::set_parent (Score_element *g, Axis a) diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index ba8861c502..787a22ac94 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -230,26 +230,22 @@ Side_position_interface::set_axis (Axis a) if (elt_l_->get_elt_property ("side-support") == SCM_UNDEFINED) elt_l_->set_elt_property ("side-support" ,SCM_EOL); - elt_l_->dim_cache_[a]->off_callbacks_.push (aligned_side); + elt_l_->add_offset_callback (aligned_side, a); } void Side_position_interface::set_quantised (Axis a) { - Dimension_cache * c = elt_l_->dim_cache_[a]; - - c->off_callbacks_.push (quantised_position); + elt_l_->add_offset_callback (quantised_position, a); } Axis Side_position_interface::get_axis () const { - Dimension_cache * c = elt_l_->dim_cache_[X_AXIS]; - for (int i=0 ; i < c->off_callbacks_.size();i ++) - if (c->off_callbacks_[i] == side_position - ||c->off_callbacks_[i] == aligned_side) - return X_AXIS; + if (elt_l_->has_offset_callback_b (&side_position, X_AXIS) + || elt_l_->has_offset_callback_b (&aligned_side , X_AXIS)) + return X_AXIS; return Y_AXIS; diff --git a/lily/staff-margin-engraver.cc b/lily/staff-margin-engraver.cc index fd68c6fb4b..3472bcf54f 100644 --- a/lily/staff-margin-engraver.cc +++ b/lily/staff-margin-engraver.cc @@ -97,8 +97,7 @@ Staff_margin_engraver::create_text (SCM text) Text_item* t = new Text_item; t->set_elt_property ("self-alignment-Y", gh_int2scm (0)); - t->dim_cache_[Y_AXIS]->off_callbacks_.push - (Side_position_interface::aligned_on_self); + t->add_offset_callback (Side_position_interface::aligned_on_self, Y_AXIS); t->set_parent (l, X_AXIS); t->set_parent (l, Y_AXIS); diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 53adce0e07..8126bbbcf1 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -22,7 +22,8 @@ void Staff_symbol_referencer_interface::set_interface () { elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0)); - elt_l_->dim_cache_[Y_AXIS]->off_callbacks_.push (callback); + elt_l_->add_offset_callback (callback, Y_AXIS); + } @@ -138,12 +139,10 @@ Staff_symbol_referencer_interface::set_position (Real p) } - Array &callbacks (elt_l_->dim_cache_[Y_AXIS]->off_callbacks_); - for (int i=0; i < callbacks.size ();i++) - if (callbacks[i] == callback) - return ; + if (elt_l_->has_offset_callback_b (callback, Y_AXIS)) + return ; - callbacks.push (callback); + elt_l_->add_offset_callback (callback, Y_AXIS); } Staff_symbol_referencer_interface diff --git a/lily/stem.cc b/lily/stem.cc index 8258775abf..470d324552 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -219,7 +219,7 @@ Stem::Stem () set_elt_property ("heads", SCM_EOL); set_elt_property ("rests", SCM_EOL); - dim_cache_[X_AXIS]->off_callbacks_.push ( &Stem::off_callback); + add_offset_callback ( &Stem::off_callback, X_AXIS); } bool diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 001d79f494..46da337596 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -32,18 +32,17 @@ Vertical_align_engraver::do_creation_processing() void Vertical_align_engraver::do_removal_processing() { - SCM dist (get_property ("maxVerticalAlign")); - if (gh_number_p(dist)) - { - valign_p_->threshold_interval_[BIGGER] = gh_scm2double (dist); - } - - dist = get_property ("minVerticalAlign"); - if (gh_number_p(dist)) - { - valign_p_->threshold_interval_[SMALLER] = gh_scm2double (dist); - } + SCM min = get_property ("maxVerticalAlign"); + SCM max = get_property ("minVerticalAlign"); + if (gh_number_p (min) || gh_number_p (max)) + { + min = gh_number_p (min) ? min : gh_double2scm (0.0); + max = gh_number_p (max) ? max : gh_double2scm (infinity_f); + + valign_p_->set_elt_property ("threshold", + gh_cons (min,max)); + } valign_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ()); typeset_element (valign_p_); valign_p_ =0; @@ -57,7 +56,7 @@ Vertical_align_engraver::qualifies_b (Score_element_info i) const Axis_group_element * elt = dynamic_cast (i.elem_l_); - return sz > 1 && elt && elt->axes_[0] == Y_AXIS && !elt->parent_l (Y_AXIS); + return sz > 1 && elt && !elt->parent_l (Y_AXIS) && elt->axis_b (Y_AXIS); } void diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 00de2551e9..8aa23b5e34 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.33 -Entered-date: 14MAR00 +Version: 1.3.34 +Entered-date: 15MAR00 Description: Keywords: music notation typesetting midi fonts engraving Author: hanwen@cs.uu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 1000k lilypond-1.3.33.tar.gz + 1000k lilypond-1.3.34.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.33.tar.gz + 1000k lilypond-1.3.34.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 94972a476e..6556e08990 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.33 +Version: 1.3.34 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.33.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.34.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # get Packager from (undocumented?) ~/.rpmmacros! diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index f84a660505..a78822588d 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -96,6 +96,9 @@ output_dict= { # override EndLilyPondOutput, since @tex is done # in a sandbox, you can't do \input lilyponddefs at the # top of the document. + +# should also support fragment in + 'output-all': r"""@tex \catcode`\@=12 \input lilyponddefs @@ -104,6 +107,7 @@ output_dict= { \catcode`\@=0 @end tex @html +

@end html """,