From cd1c15ac06a3b427e6b4d22061939092751e4a1c Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 17 Mar 2000 11:59:49 +0100 Subject: [PATCH] release: 1.3.36 =========== * textEmptyDimension changed into textNonEmpty, default: off, ie. texts don't occupy space. * Use STL map for Lookup::lookup_p_tab_p_ * Abstracted Axis_group_element into Axis_group_interface, and removed Axis_group_element. This eliminates some multiple inheritance in the backend 1.3.35.j --- CHANGES | 12 ++ VERSION | 4 +- lily/align-element.cc | 18 +-- lily/axis-group-element.cc | 110 ------------------- lily/axis-group-engraver.cc | 16 +-- lily/axis-group-interface.cc | 134 +++++++++++++++++++++++ lily/axis-group-item.cc | 16 +++ lily/axis-group-spanner.cc | 16 +++ lily/break-align-engraver.cc | 5 +- lily/break-align-item.cc | 5 +- lily/collision.cc | 6 +- lily/directional-element.cc | 0 lily/dot-column.cc | 6 +- lily/grace-position-engraver.cc | 4 +- lily/hara-kiri-vertical-group-spanner.cc | 5 +- lily/include/align-element.hh | 9 +- lily/include/axis-group-element.hh | 37 ------- lily/include/axis-group-interface.hh | 31 ++++++ lily/include/axis-group-item.hh | 7 +- lily/include/axis-group-spanner.hh | 5 +- lily/include/music.hh | 2 - lily/include/paper-def.hh | 5 +- lily/line-group-group-engraver.cc | 6 +- lily/line-of-score.cc | 6 +- lily/note-column.cc | 10 +- lily/paper-column.cc | 3 +- lily/paper-def.cc | 30 ++--- lily/rest.cc | 1 - lily/rhythmic-head.cc | 1 - lily/scm-hash.cc | 103 ----------------- lily/score-engraver.cc | 10 +- lily/text-engraver.cc | 8 +- lily/vertical-align-engraver.cc | 7 +- make/out/lilypond.lsm | 8 +- make/out/lilypond.spec | 4 +- scripts/convert-mudela.py | 12 ++ 36 files changed, 320 insertions(+), 342 deletions(-) delete mode 100644 lily/axis-group-element.cc create mode 100644 lily/axis-group-interface.cc create mode 100644 lily/axis-group-item.cc create mode 100644 lily/axis-group-spanner.cc delete mode 100644 lily/directional-element.cc delete mode 100644 lily/include/axis-group-element.hh create mode 100644 lily/include/axis-group-interface.hh diff --git a/CHANGES b/CHANGES index 90f59ba8bc..25d8b6894f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,15 @@ +.3.35.hwn1 +=========== + +* textEmptyDimension changed into textNonEmpty, default: off, +ie. texts don't occupy space. + +* Use STL map for Lookup::lookup_p_tab_p_ + +* Abstracted Axis_group_element into Axis_group_interface, and removed +Axis_group_element. This eliminates some multiple inheritance in the +backend + 1.3.35.jcn1 =========== diff --git a/VERSION b/VERSION index c59e0bd757..c53e8e4d15 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=35 -MY_PATCH_LEVEL=jcn1 +PATCH_LEVEL=36 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/lily/align-element.cc b/lily/align-element.cc index d892e73316..a8b34c0693 100644 --- a/lily/align-element.cc +++ b/lily/align-element.cc @@ -10,8 +10,8 @@ #include "interval.hh" #include "direction.hh" #include "debug.hh" -#include "hash-table-iter.hh" #include "dimension-cache.hh" +#include "axis-group-interface.hh" /* This callback is set in the children of the align element. It does @@ -34,7 +34,7 @@ void Align_element::add_element (Score_element* s) { s->add_offset_callback (alignment_callback, axis ()); - Axis_group_element::add_element (s); + axis_group (this).add_element (s); } /* @@ -55,7 +55,8 @@ Align_element::do_side_processing (Axis a) Array dims; Link_array elems; - Link_array all_elts (elem_l_arr ()); + Link_array all_elts + = Group_interface__extract_elements (this, (Score_element*) 0, "elements"); for (int i=0; i < all_elts.size(); i++) { Interval y = all_elts[i]->extent(a) + all_elts[i]->relative_coordinate (this, a); @@ -139,11 +140,10 @@ Align_element::axis () const void Align_element::set_axis (Axis a) { - set_axes (a, a); + axis_group (this).set_axes (a, a); } - - - - - +Align_element::Align_element () +{ + axis_group (this).set_interface (); +} diff --git a/lily/axis-group-element.cc b/lily/axis-group-element.cc deleted file mode 100644 index d3235510d4..0000000000 --- a/lily/axis-group-element.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* - axis-group-element.cc -- implement Axis_group_element - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - -#include "axis-group-element.hh" -#include "dimension-cache.hh" -#include "group-interface.hh" - -Link_array -Axis_group_element::elem_l_arr () const -{ - return - Group_interface__extract_elements (this, (Score_element*)0, "elements"); -} - -Link_array -Axis_group_element::get_children () -{ - Link_array childs; - Link_array elems = elem_l_arr (); - - for (int i=0; i < elems.size (); i++) - { - Score_element* e = elems[i]; - childs.push (e) ; - Axis_group_element * axis_group= dynamic_cast (e); - if (axis_group) - childs.concat (axis_group->get_children ()); - } - - return childs; -} - -Axis_group_element::Axis_group_element() -{ - set_elt_property ("elements", SCM_EOL); - set_elt_property ("transparent", SCM_BOOL_T); -} - -void -Axis_group_element::set_axes (Axis a1, Axis 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) - set_empty (Y_AXIS); - - dim_cache_[a1]->set_callback(extent_callback); - dim_cache_[a2]->set_callback (extent_callback); -} - -Interval -Axis_group_element::extent_callback (Dimension_cache const *c) -{ - Axis a = c->axis (); - Axis_group_element * me - = dynamic_cast (c->element_l ()); - - Interval r; - for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) - { - SCM e=gh_car (s); - Score_element * se = SMOB_TO_TYPE (Score_element, e); - - Interval dims = se->extent (a); - if (!dims.empty_b ()) - r.unite (dims + se->relative_coordinate (me, a)); - } - - return r; -} - - -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 (SCM ax = get_elt_property ("axes"); ax != SCM_EOL ; ax = gh_cdr (ax)) - { - 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/axis-group-engraver.cc b/lily/axis-group-engraver.cc index f9d813035a..50b76990e5 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -9,6 +9,7 @@ #include "axis-group-engraver.hh" #include "axis-group-spanner.hh" #include "paper-column.hh" +#include "axis-group-interface.hh" Axis_group_engraver::Axis_group_engraver () { @@ -19,7 +20,7 @@ void Axis_group_engraver::do_creation_processing () { staffline_p_ = get_spanner_p (); - staffline_p_->set_axes (Y_AXIS, Y_AXIS); + axis_group (staffline_p_).set_axes (Y_AXIS, Y_AXIS); staffline_p_->set_bound(LEFT,get_staff_info().command_pcol_l ()); announce_element (Score_element_info (staffline_p_, 0)); } @@ -49,16 +50,9 @@ Axis_group_engraver::process_acknowledged () /* UGH UGH UGH */ for (int i=0; i < elts_.size (); i++) { - if (!elts_[i]->parent_l (Y_AXIS)) - staffline_p_->add_element (elts_[i]); - else - if ( - // elts_[i]->get_elt_property ("Axis_group_element::add_extra_element") == SCM_UNDEFINED && - ! dynamic_cast (elts_[i]->parent_l (Y_AXIS))) - - { - staffline_p_->add_element (elts_[i]); - } + Score_element *par = elts_[i]->parent_l (Y_AXIS); + if (!par || !axis_group (par).has_interface_b ()) + axis_group (staffline_p_).add_element (elts_[i]); } elts_.clear (); } diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc new file mode 100644 index 0000000000..d00b7a1cea --- /dev/null +++ b/lily/axis-group-interface.cc @@ -0,0 +1,134 @@ +/* + axis-group-interface.cc -- implement Axis_group_interface + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#include "axis-group-interface.hh" +#include "score-element.hh" +#include "dimension-cache.hh" + +Axis_group_interface::Axis_group_interface (Score_element*s) + : Group_interface (s) +{ + elt_l_ = s; +} + +Axis_group_interface +axis_group (Score_element*s) +{ + return Axis_group_interface (s); +} + +void +Axis_group_interface::add_element (Score_element *e) +{ + elt_l_->used_b_ = true; + e->used_b_ = true; + + for (SCM ax = elt_l_->get_elt_property ("axes"); ax != SCM_EOL ; ax = gh_cdr (ax)) + { + Axis a = (Axis) gh_scm2int (gh_car (ax)); + + if (!e->parent_l (a)) + e->set_parent (elt_l_, a); + } + + Group_interface::add_element (e); + + elt_l_->add_dependency (e); +} + + +bool +Axis_group_interface::axis_b (Axis a )const +{ + return elt_l_->dim_cache_[a]->extent_callback_l_ == group_extent_callback; +} + +Interval +Axis_group_interface::group_extent_callback (Dimension_cache const *c) +{ + Axis a = c->axis (); + Score_element * me = c->element_l (); + + Interval r; + for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s)) + { + SCM e=gh_car (s); + Score_element * se = SMOB_TO_TYPE (Score_element, e); + + Interval dims = se->extent (a); + if (!dims.empty_b ()) + r.unite (dims + se->relative_coordinate (me, a)); + } + + return r; +} + + +void +Axis_group_interface::set_interface () +{ + if (!has_interface_b ()) + { + elt_l_->set_elt_property ("elements", SCM_EOL); + elt_l_->set_elt_property ("transparent", SCM_BOOL_T); + elt_l_->set_elt_property ("axes" , SCM_EOL); + group (elt_l_, "interfaces").add_thing (ly_symbol2scm ("Axis_group")); + } +} + +void +Axis_group_interface::set_axes (Axis a1, Axis a2) +{ + // set_interface () ? + + SCM ax = gh_cons (gh_int2scm (a1), SCM_EOL); + if (a1 != a2) + ax= gh_cons (gh_int2scm (a2), ax); + + + elt_l_->set_elt_property ("axes", ax); + + if (a1 != X_AXIS && a2 != X_AXIS) + elt_l_->set_empty (X_AXIS); + if (a1 != Y_AXIS && a2 != Y_AXIS) + elt_l_->set_empty (Y_AXIS); + + elt_l_->dim_cache_[a1]->set_callback (Axis_group_interface::group_extent_callback); + elt_l_->dim_cache_[a2]->set_callback (Axis_group_interface::group_extent_callback); +} + +Link_array +Axis_group_interface::get_children () +{ + Link_array childs; + childs.push (elt_l_) ; + + if (!has_interface_b ()) + return childs; + + for (SCM ep = elt_l_->get_elt_property ("elements"); gh_pair_p (ep); ep = gh_cdr (ep)) + { + Score_element* e = unsmob_element (gh_car (ep)); + if (e) + childs.concat (axis_group (e).get_children ()); + } + + return childs; +} + +bool +Axis_group_interface::has_interface_b () +{ + SCM memq = scm_memq (ly_symbol2scm ("Axis_group"), + elt_l_->get_elt_property ("interfaces")); + + return (memq != SCM_BOOL_F); +} + + diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc new file mode 100644 index 0000000000..e3dfe358fe --- /dev/null +++ b/lily/axis-group-item.cc @@ -0,0 +1,16 @@ +/* + axis-group-item.cc -- implement Axis_group_interface + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#include "axis-group-item.hh" +#include "axis-group-interface.hh" + +Axis_group_item ::Axis_group_item () +{ + axis_group (this).set_interface (); +} diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc new file mode 100644 index 0000000000..00266e0cf7 --- /dev/null +++ b/lily/axis-group-spanner.cc @@ -0,0 +1,16 @@ +/* + axis-group-spanner.cc -- implement Axis_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#include "axis-group-spanner.hh" +#include "axis-group-interface.hh" + +Axis_group_spanner::Axis_group_spanner() +{ + axis_group (this).set_interface (); +} diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index c111645eee..82f6dd904d 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -10,6 +10,7 @@ #include "protected-scm.hh" #include "break-align-item.hh" #include "axis-group-item.hh" +#include "axis-group-interface.hh" class Break_align_engraver : public Engraver { @@ -111,12 +112,12 @@ Break_align_engraver::acknowledge_element (Score_element_info inf) else { group = new Axis_group_item; - group->set_axes (X_AXIS,X_AXIS); + axis_group(group).set_axes (X_AXIS,X_AXIS); group->set_elt_property ("origin", name); group->set_parent (align_l_, Y_AXIS); announce_element (Score_element_info (group, 0)); column_alist_ = scm_assoc_set_x (column_alist_, name, group->self_scm_); } - group->add_element (item_l); + axis_group (group).add_element (item_l); } } diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index 0d67818da9..c0c2ac4807 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -16,6 +16,7 @@ #include "paper-score.hh" #include "paper-def.hh" #include "paper-column.hh" +#include "group-interface.hh" /* Handle spacing for prefatory matter. @@ -33,7 +34,9 @@ Break_align_item::before_line_breaking () Link_array elems; - Link_array all_elems (elem_l_arr ()); + Link_array all_elems + = Group_interface__extract_elements (this, (Score_element*)0, + "elements"); for (int i=0; i < all_elems.size(); i++) { diff --git a/lily/collision.cc b/lily/collision.cc index 161016104c..f423d2a4a2 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -10,16 +10,18 @@ #include "note-column.hh" #include "note-head.hh" #include "paper-def.hh" +#include "axis-group-interface.hh" + Collision::Collision() { - set_axes (X_AXIS, Y_AXIS); + axis_group (this).set_axes (X_AXIS, Y_AXIS); } void Collision::add_column (Note_column* ncol_l) { - add_element (ncol_l); + axis_group (this).add_element (ncol_l); add_dependency (ncol_l); } diff --git a/lily/directional-element.cc b/lily/directional-element.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lily/dot-column.cc b/lily/dot-column.cc index d9331f8907..29a5789a22 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -13,6 +13,8 @@ #include "staff-symbol-referencer.hh" #include "directional-element-interface.hh" #include "side-position-interface.hh" +#include "axis-group-interface.hh" + void Dot_column::add_dots (Dots *d) @@ -21,7 +23,7 @@ Dot_column::add_dots (Dots *d) gi.add_element (d); add_dependency (d); - add_element (d); + axis_group (this).add_element (d); } void @@ -51,7 +53,7 @@ Dot_column::Dot_column () gi.set_interface (); directional_element (this).set (RIGHT); - set_axes(X_AXIS,X_AXIS); + axis_group (this).set_axes(X_AXIS,X_AXIS); } /* diff --git a/lily/grace-position-engraver.cc b/lily/grace-position-engraver.cc index 866b3a2d80..735ba6b69a 100644 --- a/lily/grace-position-engraver.cc +++ b/lily/grace-position-engraver.cc @@ -14,6 +14,8 @@ #include "paper-column.hh" #include "dimension-cache.hh" #include "side-position-interface.hh" +#include "axis-group-interface.hh" + class Grace_position_engraver:public Engraver { @@ -91,7 +93,7 @@ Grace_position_engraver::do_pre_move_processing () warning (_("Unattached grace notes. Attaching to last musical column.")); align_l_->set_parent (0, X_AXIS); - last_musical_col_l_->add_element (align_l_); + axis_group(last_musical_col_l_).add_element (align_l_); } last_musical_col_l_ = get_staff_info ().musical_pcol_l (); diff --git a/lily/hara-kiri-vertical-group-spanner.cc b/lily/hara-kiri-vertical-group-spanner.cc index b6a6416455..ba10c73d46 100644 --- a/lily/hara-kiri-vertical-group-spanner.cc +++ b/lily/hara-kiri-vertical-group-spanner.cc @@ -8,6 +8,7 @@ Han-Wen Nienhuys */ +#include "axis-group-interface.hh" #include "hara-kiri-vertical-group-spanner.hh" #include "debug.hh" #include "item.hh" @@ -15,7 +16,7 @@ Hara_kiri_group_spanner::Hara_kiri_group_spanner() { set_elt_property ("items-worth-living", SCM_EOL); - set_axes(Y_AXIS,Y_AXIS); + axis_group (this).set_axes(Y_AXIS,Y_AXIS); } void @@ -34,7 +35,7 @@ Hara_kiri_group_spanner::after_line_breaking () if (gh_pair_p (worth)) return; - Link_array childs = get_children (); + Link_array childs = axis_group (this).get_children (); for (int i = 0; i < childs.size (); i++) { Score_element* s = childs[i]; diff --git a/lily/include/align-element.hh b/lily/include/align-element.hh index b4fae22642..19a4e9dcc9 100644 --- a/lily/include/align-element.hh +++ b/lily/include/align-element.hh @@ -10,11 +10,7 @@ #ifndef VERTICAL_ALIGN_ITEM_HH #define VERTICAL_ALIGN_ITEM_HH -#include "axis-group-element.hh" -#include "interval.hh" -#include "direction.hh" -#include "axes.hh" -#include "hash-table.hh" +#include "score-element.hh" /** Order elements top to bottom/left to right/right to left etc.. @@ -36,10 +32,11 @@ */ -class Align_element : public virtual Axis_group_element { +class Align_element : public virtual Score_element { public: Axis axis () const; + Align_element (); void set_axis (Axis); int get_count (Score_element*)const; void add_element (Score_element *); diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh deleted file mode 100644 index 75cf8d13d9..0000000000 --- a/lily/include/axis-group-element.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - axis-group-element.hh -- declare Axis_group_element - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef AXIS_GROUP_ELEMENT_HH -#define AXIS_GROUP_ELEMENT_HH - -#include "score-element.hh" - - -/** - Treat a group of elements a unity in either or both axis sense . - This is a wrapper around Axis_group_administration - - FIXME: remove this class, and make interface of it, so we can remove multiple inheritance. -*/ -class Axis_group_element : public virtual Score_element -{ -protected: - virtual Link_array elem_l_arr() const; - static Interval extent_callback (Dimension_cache const*); - -public: - void add_element (Score_element*); - bool axis_b (Axis) const; - Axis_group_element (); - void set_axes (Axis,Axis); - - Link_array get_children (); -}; - -#endif // AXIS_GROUP_ELEMENT_HH diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh new file mode 100644 index 0000000000..9ceee2fcb1 --- /dev/null +++ b/lily/include/axis-group-interface.hh @@ -0,0 +1,31 @@ +/* + axis-group-interface.hh -- declare Axis_group_interface + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef AXIS_GROUP_INTERFACE_HH +#define AXIS_GROUP_INTERFACE_HH + +#include "group-interface.hh" + +struct Axis_group_interface : Group_interface +{ + Axis_group_interface (Score_element*); + static Interval group_extent_callback (Dimension_cache const*); + void add_element (Score_element*); + void set_axes (Axis,Axis); + bool axis_b (Axis)const; + Link_array get_children (); + bool has_interface_b (); + void set_interface (); +}; + +Axis_group_interface +axis_group (Score_element*); + +#endif /* AXIS_GROUP_INTERFACE_HH */ + diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index 0f88cc78bb..aa2e6392bc 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -10,15 +10,12 @@ #ifndef AXIS_ITEM_HH #define AXIS_ITEM_HH -#include "axis-group-element.hh" #include "item.hh" -/** - A grouping item. Its special support is in do_breakable_col_processing(). - */ -class Axis_group_item : public virtual Axis_group_element, public virtual Item +class Axis_group_item : public virtual Item { public: + Axis_group_item (); VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index d421973f50..9d48108c2e 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -11,17 +11,16 @@ #define AXIS_GROUP_SPANNER_HH #include "spanner.hh" -#include "axis-group-element.hh" /** An element which groups a line in a certain direction. The most useful example of this is the Vertical_group_spanner */ -class Axis_group_spanner : public virtual Axis_group_element, - public virtual Spanner +class Axis_group_spanner : public virtual Spanner { public: + Axis_group_spanner (); VIRTUAL_COPY_CONS(Score_element); }; diff --git a/lily/include/music.hh b/lily/include/music.hh index fc8d7162dd..ce355795d9 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -30,8 +30,6 @@ */ class Music:public Input { public: - - virtual Musical_pitch to_relative_octave (Musical_pitch); /// The duration of this piece of music diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 987c0f25da..4970d49905 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -9,6 +9,9 @@ #ifndef PAPER_DEF_HH #define PAPER_DEF_HH + +#include + #include "lily-proto.hh" #include "lily-guile.hh" #include "real.hh" @@ -44,7 +47,7 @@ */ class Paper_def : public Music_output_def { - Hash_table *lookup_p_tab_p_; + map *lookup_p_tab_p_; static int default_count_i_; protected: diff --git a/lily/line-group-group-engraver.cc b/lily/line-group-group-engraver.cc index a0f8d10dbc..99dc54a202 100644 --- a/lily/line-group-group-engraver.cc +++ b/lily/line-group-group-engraver.cc @@ -13,6 +13,8 @@ #include "debug.hh" #include "line-group-group-engraver.hh" #include "paper-column.hh" +#include "axis-group-interface.hh" + Line_group_engraver_group::Line_group_engraver_group() { @@ -24,7 +26,7 @@ void Line_group_engraver_group::typeset_element (Score_element *elem) { if (!elem->parent_l (Y_AXIS)) - staffline_p_->add_element (elem); + axis_group (staffline_p_).add_element (elem); Engraver_group_engraver::typeset_element (elem); } @@ -52,7 +54,7 @@ void Line_group_engraver_group::create_line_spanner () { staffline_p_ = new Axis_group_spanner ; - staffline_p_->set_axes (Y_AXIS,Y_AXIS); + axis_group (staffline_p_).set_axes (Y_AXIS,Y_AXIS); } diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 3bba1d479b..478a07289d 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -14,11 +14,13 @@ #include "warn.hh" #include "main.hh" #include "debug.hh" +#include "axis-group-interface.hh" + Line_of_score::Line_of_score() { set_elt_property ("columns", SCM_EOL); - set_axes (Y_AXIS,X_AXIS); + axis_group (this).set_axes (Y_AXIS,X_AXIS); } @@ -65,7 +67,7 @@ Line_of_score::add_column (Paper_column*p) { set_elt_property ("columns", gh_cons (p->self_scm_, get_elt_property ("columns"))); - add_element (p); + axis_group (this).add_element (p); } void diff --git a/lily/note-column.cc b/lily/note-column.cc index ab801410ff..3b9a26e89b 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -7,7 +7,7 @@ */ #include // ceil - +#include "axis-group-interface.hh" #include "dot-column.hh" #include "note-column.hh" #include "beam.hh" @@ -42,7 +42,7 @@ Note_column::Note_column() { set_elt_property ("rests", SCM_EOL); set_elt_property ("note-heads", SCM_EOL); - set_axes (X_AXIS, Y_AXIS); + axis_group (this).set_axes (X_AXIS, Y_AXIS); } Stem * @@ -92,7 +92,7 @@ Note_column::set_stem (Stem * stem_l) set_elt_property ("stem", stem_l->self_scm_); add_dependency (stem_l); - add_element (stem_l); + axis_group (this).add_element (stem_l); } @@ -110,7 +110,7 @@ Note_column::add_head (Rhythmic_head *h) Group_interface gi (this, "note-heads"); gi.add_element (nh); } - add_element (h); + axis_group (this).add_element (h); } /** @@ -133,7 +133,7 @@ Note_column::translate_rests (int dy_i) void Note_column::set_dotcol (Dot_column *d) { - add_element (d); + axis_group (this).add_element (d); } /* diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 3117df5b95..14f1340464 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -9,6 +9,7 @@ #include "paper-column.hh" #include "paper-score.hh" #include "debug.hh" +#include "axis-group-interface.hh" void Paper_column::add_rod (Paper_column * p, Real d) @@ -126,7 +127,7 @@ Paper_column::Paper_column (Moment w) scm_unprotect_object (when); set_elt_property ("when", when); - set_axes (X_AXIS, X_AXIS); + axis_group (this).set_axes (X_AXIS, X_AXIS); line_l_=0; rank_i_ = -1; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 2f60f9e14c..9234da4d1c 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -7,6 +7,7 @@ */ #include + #include "all-font-metrics.hh" #include "string.hh" #include "misc.hh" @@ -26,16 +27,16 @@ Paper_def::Paper_def () { - lookup_p_tab_p_ = new Hash_table; - lookup_p_tab_p_->hash_func_ = int_hash; + lookup_p_tab_p_ = new map; } Paper_def::~Paper_def () { - for (Hash_table_iter ai(*lookup_p_tab_p_); ai.ok (); ai++) + for (map::const_iterator ai = lookup_p_tab_p_->begin(); + ai != lookup_p_tab_p_->end (); ai++) { - delete ai.val (); + delete (*ai).second; } delete lookup_p_tab_p_; @@ -45,13 +46,13 @@ Paper_def::Paper_def (Paper_def const&s) : Music_output_def (s) { shape_int_a_ = s.shape_int_a_; - lookup_p_tab_p_ = new Hash_table; - lookup_p_tab_p_->hash_func_ = int_hash; + lookup_p_tab_p_ = new map; - for (Hash_table_iter ai(*s.lookup_p_tab_p_); ai.ok (); ai++) + for (map::const_iterator ai = s.lookup_p_tab_p_->begin(); + ai != s.lookup_p_tab_p_->end (); ai++) { - Lookup * l = new Lookup (*ai.val ()); - set_lookup (ai.key(), l); + Lookup * l = new Lookup (* (*ai).second); + set_lookup ((*ai).first, l); } } @@ -112,9 +113,10 @@ Paper_def::line_dimensions_int (int n) const void Paper_def::set_lookup (int i, Lookup*l) { - if (lookup_p_tab_p_->elem_b (i)) + map :: const_iterator it (lookup_p_tab_p_->find (i)); + if (it != lookup_p_tab_p_->end ()) { - delete lookup_p_tab_p_->elem (i); + delete (*it).second; } (*lookup_p_tab_p_)[i] = l; } @@ -139,9 +141,11 @@ Paper_def::print () const #ifndef NPRINT Music_output_def::print (); DEBUG_OUT << "Paper {"; - for (Hash_table_iter ai(*lookup_p_tab_p_); ai.ok (); ai++) + for (map::const_iterator ai = lookup_p_tab_p_->begin(); + ai != lookup_p_tab_p_->end (); ai++) { - DEBUG_OUT << "Lookup: " << ai.key () << " = " << ai.val ()->font_name_ << '\n'; + DEBUG_OUT << "Lookup: " << (*ai).first + << " = " << (*ai).second->font_name_ << '\n'; } DEBUG_OUT << "}\n"; #endif diff --git a/lily/rest.cc b/lily/rest.cc index 0c4aafee66..89c2d1a9e0 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -11,7 +11,6 @@ #include "lookup.hh" #include "rest.hh" #include "dots.hh" -#include "axis-group-element.hh" #include "paper-score.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index 015fa2f9aa..64d2bd4bdd 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -13,7 +13,6 @@ #include "lookup.hh" #include "rest.hh" #include "dots.hh" -#include "axis-group-element.hh" #include "paper-score.hh" #include "stem.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/scm-hash.cc b/lily/scm-hash.cc index 90009ffcd7..551a050a2a 100644 --- a/lily/scm-hash.cc +++ b/lily/scm-hash.cc @@ -12,9 +12,6 @@ #include "hash-table-iter.hh" -#ifdef usestl - - Scheme_hash_table::Scheme_hash_table () { self_scm_ = SCM_EOL; @@ -130,104 +127,4 @@ Scheme_hash_table::to_alist () const IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash); IMPLEMENT_SMOBS(Scheme_hash_table); -#else -Scheme_hash_table::Scheme_hash_table () -{ - hash_func_ = ly_scm_hash; - self_scm_ = SCM_EOL; - smobify_self (); -} - -void -Scheme_hash_table::operator =(Scheme_hash_table const & src) -{ - Hash_table::operator = (src); - - // we do not copy the self_scm_ field! -} - -void -Scheme_hash_table::do_smobify_self () -{ -} - -SCM -Scheme_hash_table::mark_smob (SCM s) -{ - /* - can't typecheck naively, since GC bit lives in CAR of S - */ - //assert (SMOB_IS_TYPE_B (Scheme_hash_table, s)); - - Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s); - for (Hash_table_iter i (*me); i.ok(); i++) - { - scm_gc_mark (i.key()); - scm_gc_mark (i.val ()); - } - return SCM_EOL; -} - - -Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src) - : Hash_table (src) -{ - hash_func_ = src.hash_func_; - self_scm_ = SCM_EOL; - smobify_self (); -} - -int -Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*) -{ - assert (SMOB_IS_TYPE_B (Scheme_hash_table, s)); - char str[1000]; - sprintf (str, "# i (*me); i.ok(); i++) - { - scm_display (i.key(), p); - scm_puts (" = ",p); - scm_display (i.val (), p); - scm_puts ("\n",p); - } - scm_puts ("> ",p); - return 1; -} - - -void -Scheme_hash_table::set (SCM k, SCM v) -{ - elem (k ) = v; - scm_unprotect_object (v); -} - -SCM -Scheme_hash_table::get (SCM k)const -{ - return const_elem (k); -} - - -Scheme_hash_table::~Scheme_hash_table( ) -{ - unsmobify_self (); -} - -SCM -Scheme_hash_table::to_alist () const -{ - SCM l = SCM_EOL; - for (Hash_table_iter i (*this); i.ok(); i++) - l = gh_cons (gh_cons (i.key (), i.val()), l); - return l; -} - - -#include "ly-smobs.icc" -IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash); -IMPLEMENT_SMOBS(Scheme_hash_table); -#endif diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 0885d2b338..15d490bca6 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -5,6 +5,7 @@ (c) 1997--2000 Han-Wen Nienhuys */ + #include "debug.hh" #include "dimension-cache.hh" #include "line-of-score.hh" @@ -15,6 +16,7 @@ #include "paper-column.hh" #include "command-request.hh" #include "paper-def.hh" +#include "axis-group-interface.hh" Score_engraver::Score_engraver() { @@ -145,14 +147,12 @@ Score_engraver::typeset_all() if (!elem_p->parent_l (X_AXIS)) { bool br = to_boolean (elem_p->remove_elt_property ("breakable")); - if (br) - command_column_l_->add_element(elem_p); - else - musical_column_l_->add_element(elem_p); + Axis_group_interface gi ((br) ? command_column_l_ : musical_column_l_) ; + gi.add_element(elem_p); } } if (!elem_p->parent_l(Y_AXIS)) - scoreline_l_->add_element (elem_p); + axis_group (scoreline_l_).add_element (elem_p); } elem_p_arr_.clear(); } diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index ad69deef94..97b7a18a24 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -102,11 +102,9 @@ Text_engraver::do_process_music () if (r->style_str_.length_i ()) text->set_elt_property ("style", ly_str02scm (r->style_str_.ch_C())); - SCM empty = get_property ("textEmptyDimension"); - if (to_boolean (empty)) - { - text->set_empty (X_AXIS); - } + SCM empty = get_property ("textNonEmpty"); + if (!to_boolean (empty)) + text->set_empty (X_AXIS); announce_element (Score_element_info (text, r)); texts_.push (text); diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 46da337596..2c2d48d9ad 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -12,6 +12,7 @@ #include "axis-align-spanner.hh" #include "axis-group-spanner.hh" #include "span-bar.hh" +#include "axis-group-interface.hh" Vertical_align_engraver::Vertical_align_engraver() { @@ -54,9 +55,11 @@ Vertical_align_engraver::qualifies_b (Score_element_info i) const { int sz = i.origin_trans_l_arr ((Translator*)this).size() ; - Axis_group_element * elt = dynamic_cast (i.elem_l_); - return sz > 1 && elt && !elt->parent_l (Y_AXIS) && elt->axis_b (Y_AXIS); + Axis_group_interface agi(i.elem_l_); + + return sz > 1 && agi.has_interface_b () + && !i.elem_l_->parent_l (Y_AXIS) && agi.axis_b (Y_AXIS); } void diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index f0df4de561..5bcf0d68f4 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.35 -Entered-date: 16MAR00 +Version: 1.3.36 +Entered-date: 17MAR00 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.35.tar.gz + 1000k lilypond-1.3.36.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.35.tar.gz + 1000k lilypond-1.3.36.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index f3e0fbcedd..c9f2186c30 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.35 +Version: 1.3.36 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.35.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.36.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/convert-mudela.py b/scripts/convert-mudela.py index ede540b40b..7714a5695c 100644 --- a/scripts/convert-mudela.py +++ b/scripts/convert-mudela.py @@ -414,6 +414,18 @@ if 1: conversions.append ((1,3,18), conv, 'staffLineLeading -> staffSpace') +if 1: + def conv (str): + str = re.sub ('textEmptyDimension *= *##t', + 'textNonEmpty = ##f', + str) + str = re.sub ('textEmptyDimension *= *##f', + 'textNonEmpty = ##t', + str) + return str + + conversions.append ((1,3,35), conv, 'textEmptyDimension -> textNonEmpty') + ############################ -- 2.39.5