From 87aedc5e4e7c56bb54a29f604eafc177a37e3f05 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 11 May 2000 22:10:56 +0200 Subject: [PATCH] patch::: 1.3.49.hwn1: deze dus 1.3.49.hwn1 =========== * Junked Dictionary from Piano_pedal_engraver and Piano_pedal_performer. Marked kerning as TODO. * Introduced boolean element property no-spacing-rods: ignore this item for hard constraints. --- Generated by hanwen@cs.uu.nl, >From = lilypond-1.3.49, To = lilypond-1.3.49.hwn1 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.49.hwn1.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure --- CHANGES | 17 +- ROADMAP | 3 - VERSION | 2 +- flower/include/dictionary.hh | 3 + flower/include/hash-table.hh | 4 +- input/bugs/addlyrmus.fly | 4 - input/bugs/b.fly | 4 - input/bugs/grace-grace.fly | 2 - input/bugs/grace.sly | 1 - lily/bezier.cc | 2 - lily/chord-name.cc | 5 +- lily/include/ly-smobs.icc | 4 +- lily/include/score-element-callback.hh | 21 ++ lily/include/score-element.hh | 7 +- lily/include/sustain-pedal.hh | 43 +++++ lily/piano-pedal-engraver.cc | 254 +++++++++++-------------- lily/piano-pedal-performer.cc | 78 +++++--- lily/property-engraver.cc | 5 +- lily/score-element-callback.cc | 57 ++++++ lily/single-malt-grouping-item.cc | 5 + lily/sustain-pedal.cc | 62 ++++++ lily/text-engraver.cc | 6 +- lily/translator-ctors.cc | 3 + scripts/mudela-book.py | 7 + 24 files changed, 392 insertions(+), 207 deletions(-) delete mode 100644 input/bugs/addlyrmus.fly delete mode 100644 input/bugs/b.fly delete mode 100644 input/bugs/grace-grace.fly delete mode 100644 input/bugs/grace.sly create mode 100644 lily/include/score-element-callback.hh create mode 100644 lily/include/sustain-pedal.hh create mode 100644 lily/score-element-callback.cc create mode 100644 lily/sustain-pedal.cc diff --git a/CHANGES b/CHANGES index 8ecaab17c8..3335da4946 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,19 @@ -1.3.49.jcn1 +--- ../lilypond-1.3.49/CHANGES Thu May 11 15:31:37 2000 +++ b/CHANGES Thu May 11 22:01:01 2000 +@@ -1,3 +1,13 @@ +1.3.49.hwn1 +=========== + +* Junked Dictionary from Piano_pedal_engraver and +Piano_pedal_performer. Marked kerning as TODO. + +* Introduced boolean element property no-spacing-rods: ignore this +item for hard constraints. + + + 1.3.48.uu1 + ========== + 1.3.49.jcn1 ========== * Made silly faq.texi fixes (time to get my verbatim patch in :-) diff --git a/ROADMAP b/ROADMAP index 3894dd5d9e..dfe496a678 100644 --- a/ROADMAP +++ b/ROADMAP @@ -31,9 +31,6 @@ LilyPond's source files. F.Schubert/ Hymns/ J.S.Bach/ - L.Mozart/ - N.W.Gade/ - W.A.Mozart/ intl/ library for gettext po/ translations ps/ postscript library files diff --git a/VERSION b/VERSION index ac6ae4db85..308d07ced0 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=49 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=hwn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh index 3cb1069b39..9134b80afc 100644 --- a/flower/include/dictionary.hh +++ b/flower/include/dictionary.hh @@ -27,6 +27,9 @@ struct Dict_initialiser }; +/* + DEPRECATED. Use either SCM (preferred) or STL + */ template class Dictionary : public Hash_table { diff --git a/flower/include/hash-table.hh b/flower/include/hash-table.hh index bd437e6e97..f3f5bfe234 100644 --- a/flower/include/hash-table.hh +++ b/flower/include/hash-table.hh @@ -43,7 +43,9 @@ struct Hash_table_entry A hash table of prime size. We use quadratic probing. - */ + + DEPRECATED. Use either SCM (preferred) or STL +*/ template class Fixed_size_hash_table { diff --git a/input/bugs/addlyrmus.fly b/input/bugs/addlyrmus.fly deleted file mode 100644 index 32b095b864..0000000000 --- a/input/bugs/addlyrmus.fly +++ /dev/null @@ -1,4 +0,0 @@ - -\context Voice \addlyrics - { s8 s16 s32 s64 } - { [c16 c c c] } diff --git a/input/bugs/b.fly b/input/bugs/b.fly deleted file mode 100644 index 0b3c3a38d8..0000000000 --- a/input/bugs/b.fly +++ /dev/null @@ -1,4 +0,0 @@ - -\time 3/2; < a1. - { s1 \> s4 \! s4\ppp} > - diff --git a/input/bugs/grace-grace.fly b/input/bugs/grace-grace.fly deleted file mode 100644 index 8b43d9da49..0000000000 --- a/input/bugs/grace-grace.fly +++ /dev/null @@ -1,2 +0,0 @@ -% core -\grace a8 \grace b8 c4 diff --git a/input/bugs/grace.sly b/input/bugs/grace.sly deleted file mode 100644 index a488e30572..0000000000 --- a/input/bugs/grace.sly +++ /dev/null @@ -1 +0,0 @@ -c'' \grace c8 c c \grace c8 c diff --git a/lily/bezier.cc b/lily/bezier.cc index 0ced85b840..72bd0e0f46 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -31,8 +31,6 @@ binomial_coefficient (Real over , int under) void flip (Array* arr_p, Axis a) { - // huh? - // for (int i = c.size (); i--;) for (int i = 0; i < arr_p->size (); i++) (*arr_p)[i][a] = - (*arr_p)[i][a]; } diff --git a/lily/chord-name.cc b/lily/chord-name.cc index bb6fbbc1ea..3bc56b107e 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -25,10 +25,13 @@ "text" ("style" . "text") */ +/* + UGH. remove Dictionary< > + */ Molecule Chord_name::ly_word2molecule (SCM word) const { - Dictionary option_dict; + Dictionary option_dict; // junkme if (gh_pair_p (word)) { SCM options = gh_cdr (word); diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index 9b54ddc24e..b652432ca8 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -31,7 +31,9 @@ return s;\ }\ - +/* + should include equal_p ? + */ #define IMPLEMENT_SMOBS(CL)\ long CL::smob_tag_;\ static scm_smobfuns CL ## _funs = { \ diff --git a/lily/include/score-element-callback.hh b/lily/include/score-element-callback.hh new file mode 100644 index 0000000000..949ceec254 --- /dev/null +++ b/lily/include/score-element-callback.hh @@ -0,0 +1,21 @@ +/* + score-element-callback.hh -- declare Score_element callbacks + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef SCORE_ELEMENT_CALLBACK_HH +#define SCORE_ELEMENT_CALLBACK_HH + +#include "lily-proto.hh" +#include "lily-guile.hh" + +typedef SCM (* Score_element_callback) (Score_element * , SCM extra_params); +SCM smobify_callback (Score_element_callback cb); + + +#endif /* SCORE_ELEMENT_CALLBACK_HH */ + diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 768152545e..8bc4761cf1 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -140,6 +140,7 @@ public: */ void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr); + static SCM handle_broken_smobs (SCM, SCM criterion); void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)()); @@ -199,11 +200,7 @@ public: bool used_b_; char const * name () const; - /** - Set empty in direction A. - JUNKME - */ - void set_empty (Axis a); + bool empty_b (Axis a) const; Interval extent (Axis) const; diff --git a/lily/include/sustain-pedal.hh b/lily/include/sustain-pedal.hh new file mode 100644 index 0000000000..b2ae20e984 --- /dev/null +++ b/lily/include/sustain-pedal.hh @@ -0,0 +1,43 @@ +/* + sustain-pedal.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef SUSTAIN_PEDAL_HH +#define SUSTAIN_PEDAL_HH + +#include "item.hh" + + +/* + Urg. + This is almost text + Problem is: + * we have no kerning + * symbols are at wrong place in font + + + + Properties: + + glyph -- text string (TODO: make one large glyph of the Ped symbol, removes need for do_brew_molecule ()) + +*/ + +class Sustain_pedal : public Item +{ +public: + VIRTUAL_COPY_CONS (Score_element); + +protected: + virtual Molecule do_brew_molecule () const; + virtual void after_line_breaking (); +}; + + +#endif /* SUSTAIN_PEDAL_HH */ + diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 61d00a4e96..3fdbf0352a 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -16,106 +16,38 @@ #include "stem.hh" #include "side-position-interface.hh" #include "staff-symbol-referencer.hh" -#include "dictionary.hh" -#include "dictionary-iter.hh" #include "text-item.hh" - -/* - Urg. - This is almost text - Problem is: - * we have no kerning - * symbols are at wrong place in font -*/ - -class Sustain_pedal : public Item -{ -public: - VIRTUAL_COPY_CONS (Score_element); - -protected: - virtual Molecule do_brew_molecule () const; - virtual void after_line_breaking (); -}; - -void -Sustain_pedal::after_line_breaking () -{ - Side_position_interface i (this); - Direction d = i.get_direction (); - i.set_direction (d); -} - -Molecule -Sustain_pedal::do_brew_molecule () const -{ - Molecule mol; - SCM glyph = get_elt_property ("glyph"); - if (glyph == SCM_UNDEFINED) - return mol; - String text = ly_scm2string (glyph); - - for (int i = 0; i < text.length_i (); i++) - { - // leuke koor dump door tiepo, snapnie helemaal: - //String idx = ("pedal-") + text[i]; - // urg, Byte* ?? - // braak: waarom vindt String het zo moeilijk om - // String + char te doen? - //String idx = "pedal-" + String (&text.byte_C ()[i], 1); - String idx = String ("pedal-") + String (&text.byte_C ()[i], 1); - Molecule m = lookup_l ()->afm_find (idx); - if (m.empty_b ()) - continue; - Real kern = 0; - if (i) - { - SCM s = scm_eval (gh_list (ly_symbol2scm ("pedal-kerning"), - ly_str02scm (String (&text.byte_C ()[i - 1], 1).ch_C ()), - ly_str02scm (String (&text.byte_C ()[i], 1).ch_C ()), - SCM_UNDEFINED)); - if (gh_number_p (s)) - { - Staff_symbol_referencer_interface st (this); - Real staff_space = st.staff_space (); - kern = gh_scm2double (s) * staff_space; - } - } - mol.add_at_edge (X_AXIS, RIGHT, m, kern); - } - - return mol; -} - - - +#include "sustain-pedal.hh" /* TODO: - * it would be real cool if an engraver could be initialised with a + * it would be really cool if an engraver could be initialised with a string, ie: Piano_pedal_engraver::"sostenuto" Piano_pedal_engraver::"sustain" Piano_pedal_engraver::"una-chorda" + + + */ +/* + Would it? The semantics are unclear, and real benefits are muddy + too. --hwn */ + + + /** - engrave Piano pedals + engrave Piano pedals symbols. */ class Piano_pedal_engraver : public Engraver { - struct Pedal_info - { - Span_req* start_req_l_; - Drul_array req_l_drul_; - Item* item_p_; - }; - public: VIRTUAL_COPY_CONS (Translator); Piano_pedal_engraver (); - + ~Piano_pedal_engraver (); protected: + virtual void do_creation_processing (); virtual bool do_try_music (Music*); virtual void do_process_music (); virtual void do_pre_move_processing (); @@ -123,24 +55,49 @@ protected: virtual void acknowledge_element (Score_element_info); private: - Dictionary info_dict_; + struct Pedal_info + { + char const * name_; + Span_req* start_req_l_; + Drul_array req_l_drul_; + Item* item_p_; + }; + + + Pedal_info *info_list_; }; ADD_THIS_TRANSLATOR (Piano_pedal_engraver); Piano_pedal_engraver::Piano_pedal_engraver () { - (void)info_dict_["Sostenuto"]; - (void)info_dict_["Sustain"]; - (void)info_dict_["UnaChorda"]; - for (Dictionary_iter i (info_dict_); i.ok (); i++) + info_list_ = 0; +} +void +Piano_pedal_engraver::do_creation_processing() +{ + info_list_ = new Pedal_info[4]; + Pedal_info *p = info_list_; + + + char * names [] = { "Sostenuto", "Sustain", "UnaChorda", 0 }; + char **np = names ; + do { - Pedal_info& p = i.val_ref (); - p.item_p_ = 0; - p.req_l_drul_[START] = 0; - p.req_l_drul_[STOP] = 0; - p.start_req_l_ = 0; + p->name_ = *np; + p->item_p_ = 0; + p->req_l_drul_[START] = 0; + p->req_l_drul_[STOP] = 0; + p->start_req_l_ = 0; + + p++; } + while (*(np ++)); +} + +Piano_pedal_engraver::~Piano_pedal_engraver() +{ + delete[] info_list_; } /* @@ -150,22 +107,21 @@ Piano_pedal_engraver::Piano_pedal_engraver () void Piano_pedal_engraver::acknowledge_element (Score_element_info info) { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + for (Pedal_info*p = info_list_; p->name_; p ++) { - Pedal_info& p = i.val_ref (); - if (p.item_p_) + if (p->item_p_) { if (Note_head* n = dynamic_cast (info.elem_l_)) { - Side_position_interface st (p.item_p_); + Side_position_interface st (p->item_p_); st.add_support (n); if (st.get_axis( ) == X_AXIS - && !p.item_p_->parent_l (Y_AXIS)) - p.item_p_->set_parent (n, Y_AXIS); + && !p->item_p_->parent_l (Y_AXIS)) + p->item_p_->set_parent (n, Y_AXIS); } if (Stem* s = dynamic_cast (info.elem_l_)) { - Side_position_interface st (p.item_p_); + Side_position_interface st (p->item_p_); st.add_support (s); } } @@ -175,14 +131,13 @@ Piano_pedal_engraver::acknowledge_element (Score_element_info info) bool Piano_pedal_engraver::do_try_music (Music *m) { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + if (Span_req * s = dynamic_cast(m)) { - Pedal_info& p = i.val_ref (); - if (Span_req * s = dynamic_cast(m)) + for (Pedal_info*p = info_list_; p->name_; p ++) { - if (s->span_type_str_ == i.key ()) + if (s->span_type_str_ == p->name_) { - p.req_l_drul_[s->span_dir_] = s; + p->req_l_drul_[s->span_dir_] = s; return true; } } @@ -193,70 +148,70 @@ Piano_pedal_engraver::do_try_music (Music *m) void Piano_pedal_engraver::do_process_music () { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + for (Pedal_info*p = info_list_; p->name_; p ++) { - Pedal_info& p = i.val_ref (); SCM s = SCM_UNDEFINED; - if (p.req_l_drul_[STOP] && p.req_l_drul_[START]) + if (p->req_l_drul_[STOP] && p->req_l_drul_[START]) { - if (!p.start_req_l_) + if (!p->start_req_l_) { - p.req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", i.key ())); + p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", p->name_ )); } else { - s = get_property ("stopStart" + i.key ()); + s = get_property ("stopStart" + String (p->name_ )); } - p.start_req_l_ = p.req_l_drul_[START]; + p->start_req_l_ = p->req_l_drul_[START]; } - else if (p.req_l_drul_[STOP]) + else if (p->req_l_drul_[STOP]) { - if (!p.start_req_l_) + if (!p->start_req_l_) { - p.req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", i.key ())); + p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", p->name_ )); } else { - s = get_property ("stop" + i.key ()); + s = get_property ("stop" + String (p->name_ )); } - p.start_req_l_ = 0; + p->start_req_l_ = 0; } - else if (p.req_l_drul_[START]) + else if (p->req_l_drul_[START]) { - p.start_req_l_ = p.req_l_drul_[START]; - s = get_property ("start" + i.key ()); + p->start_req_l_ = p->req_l_drul_[START]; + s = get_property ("start" + String (p->name_ )); } if (s != SCM_UNDEFINED) { - if (i.key () == "Sustain") + if (p->name_ == String ("Sustain")) { - p.item_p_ = new Sustain_pedal; - p.item_p_->set_elt_property ("glyph", s); + p->item_p_ = new Sustain_pedal; + p->item_p_->set_elt_property ("text", s); } else { - p.item_p_ = new Text_item; - p.item_p_->set_elt_property ("text", s); + p->item_p_ = new Text_item; + p->item_p_->set_elt_property ("text", s); // guh - p.item_p_->set_elt_property ("style", ly_str02scm ("italic")); + p->item_p_->set_elt_property ("style", ly_str02scm ("italic")); } - Side_position_interface si (p.item_p_); + Side_position_interface si (p->item_p_); si.set_axis (Y_AXIS); /* Hmm, If set to empty, it can't be centred Howto centre non-fat text? - p.item_p_->set_empty (X_AXIS); + p->item_p_->set_empty (X_AXIS); */ - p.item_p_->set_elt_property ("self-alignment-X", gh_int2scm (0)); - p.item_p_->add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS); - p.item_p_->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS); - announce_element (Score_element_info (p.item_p_, - p.req_l_drul_[START] - ? p.req_l_drul_[START] - : p.req_l_drul_[STOP])); + p->item_p_->set_elt_property ("no-spacing-rods" , SCM_BOOL_T); + p->item_p_->set_elt_property ("self-alignment-X", gh_int2scm (0)); + p->item_p_->add_offset_callback (Side_position_interface::aligned_on_self, X_AXIS); + p->item_p_->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS); + announce_element (Score_element_info (p->item_p_, + p->req_l_drul_[START] + ? p->req_l_drul_[START] + : p->req_l_drul_[STOP])); } } } @@ -264,36 +219,41 @@ Piano_pedal_engraver::do_process_music () void Piano_pedal_engraver::do_pre_move_processing () { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + Item * sustain = 0; + for (Pedal_info*p = info_list_; p->name_; p ++) + { + if (p->name_ == String ("Sustain")) + sustain = p->item_p_; + } + + for (Pedal_info*p = info_list_; p->name_; p ++) { - Pedal_info& p = i.val_ref (); - if (p.item_p_) + if (p->item_p_) { - side_position (p.item_p_).add_staff_support (); + side_position (p->item_p_).add_staff_support (); /* Hmm. */ - if (i.key () != "Sustain") + if (p->name_ != String ("Sustain")) { - if (Item* sustain = info_dict_["Sustain"].item_p_) + if (sustain) { - Side_position_interface st (p.item_p_); + Side_position_interface st (p->item_p_); st.add_support (sustain); } } - typeset_element (p.item_p_); + typeset_element (p->item_p_); } - p.item_p_ = 0; + p->item_p_ = 0; } } void Piano_pedal_engraver::do_post_move_processing () { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + for (Pedal_info*p = info_list_; p->name_; p ++) { - Pedal_info& p = i.val_ref (); - p.req_l_drul_[STOP] = 0; - p.req_l_drul_[START] = 0; + p->req_l_drul_[STOP] = 0; + p->req_l_drul_[START] = 0; } } diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index 01dfab892f..c3d2a1a0f4 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -20,16 +20,18 @@ class Piano_pedal_performer : public Performer { struct Pedal_info { + char const *name_; Span_req* start_req_l_; Drul_array req_l_drul_; }; public: VIRTUAL_COPY_CONS (Translator); - Piano_pedal_performer (); - + ~Piano_pedal_performer (); + protected: + virtual void do_creation_processing (); virtual bool do_try_music (Music*); virtual void do_process_music (); virtual void do_pre_move_processing (); @@ -37,52 +39,68 @@ protected: private: Link_array audio_p_arr_; - Dictionary info_dict_; + Pedal_info * info_alist_; }; ADD_THIS_TRANSLATOR (Piano_pedal_performer); Piano_pedal_performer::Piano_pedal_performer () { - (void)info_dict_["Sostenuto"]; - (void)info_dict_["Sustain"]; - (void)info_dict_["UnaChorda"]; - for (Dictionary_iter i (info_dict_); i.ok (); i++) + info_alist_ = 0; +} + +Piano_pedal_performer::~Piano_pedal_performer() +{ + delete[] info_alist_; +} + +void +Piano_pedal_performer::do_creation_processing () +{ + info_alist_ = new Pedal_info[4]; + Pedal_info *p = info_alist_; + + char * names [] = { "Sostenuto", "Sustain", "UnaChorda", 0 }; + char **np = names ; + do { - Pedal_info& p = i.val_ref (); - p.req_l_drul_[START] = 0; - p.req_l_drul_[STOP] = 0; - p.start_req_l_ = 0; + p->name_ = *np; + p->req_l_drul_[START] = 0; + p->req_l_drul_[STOP] = 0; + p->start_req_l_ = 0; + + p++; } + while (*(np ++)); } void Piano_pedal_performer::do_process_music () { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + for (Pedal_info*p = info_alist_; p->name_; p ++) + { - Pedal_info& p = i.val_ref (); - if (p.req_l_drul_[STOP]) + if (p->req_l_drul_[STOP]) { - if (!p.start_req_l_) + if (!p->start_req_l_) { - p.req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", i.key ())); + p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", String (p->name_))); } else { Audio_piano_pedal* a = new Audio_piano_pedal; - a->type_str_ = i.key (); + a->type_str_ = String (p->name_); a->dir_ = STOP; audio_p_arr_.push (a); } - p.start_req_l_ = 0; + p->start_req_l_ = 0; } - if (p.req_l_drul_[START]) + if (p->req_l_drul_[START]) { - p.start_req_l_ = p.req_l_drul_[START]; + p->start_req_l_ = p->req_l_drul_[START]; Audio_piano_pedal* a = new Audio_piano_pedal; - a->type_str_ = i.key (); + a->type_str_ = String (p->name_); a->dir_ = START; audio_p_arr_.push (a); } @@ -92,7 +110,7 @@ Piano_pedal_performer::do_process_music () void Piano_pedal_performer::do_pre_move_processing () { - for (int i=0; i < audio_p_arr_.size (); i++) + for (int i=0; i< audio_p_arr_.size (); i++) play_element (audio_p_arr_[i]); audio_p_arr_.clear (); } @@ -100,25 +118,23 @@ Piano_pedal_performer::do_pre_move_processing () void Piano_pedal_performer::do_post_move_processing () { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + for (Pedal_info*p = info_alist_; p->name_; p ++) { - Pedal_info& p = i.val_ref (); - p.req_l_drul_[STOP] = 0; - p.req_l_drul_[START] = 0; + p->req_l_drul_[STOP] = 0; + p->req_l_drul_[START] = 0; } } bool Piano_pedal_performer::do_try_music (Music* r) { - for (Dictionary_iter i (info_dict_); i.ok (); i++) + if (Span_req * s = dynamic_cast(r)) { - Pedal_info& p = i.val_ref (); - if (Span_req * s = dynamic_cast(r)) + for (Pedal_info*p = info_alist_; p->name_; p ++) { - if (s->span_type_str_ == i.key ()) + if (s->span_type_str_ == String (p->name_)) { - p.req_l_drul_[s->span_dir_] = s; + p->req_l_drul_[s->span_dir_] = s; return true; } } diff --git a/lily/property-engraver.cc b/lily/property-engraver.cc index c0f2887008..07eff6b441 100644 --- a/lily/property-engraver.cc +++ b/lily/property-engraver.cc @@ -15,7 +15,10 @@ class Property_engraver : public Engraver { - Dictionary prop_dict_; + /* + UGH. Junk Dictionary + */ + Dictionary prop_dict_; // junkme void apply_properties (SCM, Score_element*); protected: diff --git a/lily/score-element-callback.cc b/lily/score-element-callback.cc new file mode 100644 index 0000000000..f0cf1234ff --- /dev/null +++ b/lily/score-element-callback.cc @@ -0,0 +1,57 @@ +/* + score-element-callback.cc -- implement Callback smob. + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#include "score-element-callback.hh" + + +static long callback_tag; + +static +SCM mark_smob (SCM) +{ + return SCM_EOL; +} + +static int +print_smob (SCM, SCM port, scm_print_state *) +{ + scm_puts ("#", port); + return 1; +} + +static +scm_sizet free_smob (SCM) +{ + return 0; +} + +static scm_smobfuns callback_funs = { + mark_smob, free_smob, + print_smob, 0, +}; + +static +void start_callback_smobs() +{ + callback_tag = scm_newsmob (&callback_funs); +} + + +SCM smobify_callback (Score_element_callback cb ) +{ + SCM z; + + SCM_NEWCELL(z); + SCM_SETCDR(z, cb); + SCM_SETCAR(z, callback_tag); + + return z; +} + +ADD_SCM_INIT_FUNC(callback, start_callback_smobs); diff --git a/lily/single-malt-grouping-item.cc b/lily/single-malt-grouping-item.cc index b03d4c59be..b017addc21 100644 --- a/lily/single-malt-grouping-item.cc +++ b/lily/single-malt-grouping-item.cc @@ -55,6 +55,11 @@ Single_malt_grouping_item::my_width () const continue; /*UGH UGH*/ } + if (to_boolean (il->get_elt_property ("no-spacing-rods"))) + { + continue; + } + Interval iv (il->extent (X_AXIS)); if (!iv.empty_b ()) { diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc new file mode 100644 index 0000000000..a6388d658e --- /dev/null +++ b/lily/sustain-pedal.cc @@ -0,0 +1,62 @@ +/* + sustain-pedal.cc -- implement Sustain_pedal + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#include "sustain-pedal.hh" +#include "side-position-interface.hh" +#include "molecule.hh" +#include "lookup.hh" +#include "staff-symbol-referencer.hh" + +void +Sustain_pedal::after_line_breaking () +{ + /* + UGH. Should work automatically via offset callback. + */ + Side_position_interface i (this); + Direction d = i.get_direction (); + i.set_direction (d); +} + +Molecule +Sustain_pedal::do_brew_molecule () const +{ + Molecule mol; + SCM glyph = get_elt_property ("text"); + if (glyph == SCM_UNDEFINED) + return mol; + String text = ly_scm2string (glyph); + + for (int i = 0; i < text.length_i (); i++) + { + String idx = String ("pedal-") + String (&text.byte_C ()[i], 1); + Molecule m = lookup_l ()->afm_find (idx); + if (m.empty_b ()) + continue; + Real kern = 0; + if (i) + { + SCM s = scm_eval (gh_list (ly_symbol2scm ("pedal-kerning"), + ly_str02scm (String (&text.byte_C ()[i - 1], 1).ch_C ()), + ly_str02scm (String (&text.byte_C ()[i], 1).ch_C ()), + SCM_UNDEFINED)); + if (gh_number_p (s)) + { + Staff_symbol_referencer_interface st (this); + Real staff_space = st.staff_space (); + kern = gh_scm2double (s) * staff_space; + } + } + mol.add_at_edge (X_AXIS, RIGHT, m, kern); + } + + return mol; +} + + diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 0f222daab1..c0ab613937 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -104,8 +104,10 @@ Text_engraver::do_process_music () SCM empty = get_property ("textNonEmpty"); if (!to_boolean (empty)) - text->set_extent_callback (0, X_AXIS); - + { + text->set_elt_property ("no-spacing-rods" , SCM_BOOL_T); + text->set_extent_callback (0, X_AXIS); + } announce_element (Score_element_info (text, r)); texts_.push (text); } diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc index acb9523cc0..8c72758890 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -15,6 +15,9 @@ should delete these after exit. */ +/* + UGH. Dictionary is deprecated + */ Dictionary *global_translator_dict_p=0; void diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index a78822588d..ca4b70f8ad 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -19,6 +19,13 @@ dep_prefix = '' # BUG: does not handle \verb|\begin{verbatim}\end{verbatim}| correctly. # Should make a joint RE for \verb and \begin, \end{verbatim} + +# TODO: add an option to read the .ly files from a previous run and dump +# the .tex file, so you can do +# +# * mudela-book file.tex +# * convert-mudela *.ly +# * mudela-book --read-lys *.ly # default_music_fontsize = 16 -- 2.39.2