From: Han-Wen Nienhuys Date: Sun, 2 Jul 2000 18:59:31 +0000 (+0200) Subject: release: 1.3.68 X-Git-Tag: release/1.3.68 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=refs%2Ftags%2Frelease%2F1.3.68;p=lilypond.git release: 1.3.68 ====== * ly2dvi: changed back to original semantics of latexheaders. * Stem_tremolo, Crescendo, Hara_kiri_group_spanner, Tuplet_spanner, Volta_spanner changed into interface. * Related cleanups for Tie, Tie_column cleanups. * Made Time_signature, Single_malt_grouping_item, Script_column, Chord_name, Dot_column, Breathing_sign, Key_item type into interface. * Removed const declaration from callback arguments. * Pagebreak support. See input/test/between-systems.ly * Fixed a problem with accidentals in combination with non-nil key signatures. 1.3 --- diff --git a/CHANGES b/CHANGES index fb39f85323..31c3968012 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,25 @@ -1.3.67.mb1 -=========== +1.3.68 +====== * ly2dvi: changed back to original semantics of latexheaders. -1.3.66.hwn1 -=========== +* Stem_tremolo, Crescendo, Hara_kiri_group_spanner, Tuplet_spanner, +Volta_spanner changed into interface. + +* Related cleanups for Tie, Tie_column cleanups. + +* Made Time_signature, Single_malt_grouping_item, Script_column, +Chord_name, Dot_column, Breathing_sign, Key_item type into interface. + +* Removed const declaration from callback arguments. + +* Pagebreak support. See input/test/between-systems.ly + +* Fixed a problem with accidentals in combination with +non-nil key signatures. + +1.3.67 +====== * Use callbacks for augmentation dot positioning. diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 60e4ba57a8..e25c9789df 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -208,6 +208,11 @@ second slur has slurDirection set to down, overriding the stemup setting. @mudelafile{generic-property-override.ly} +Paper column supports a special output property that allows you to force +page breaks (among others). + +@mudelafile{between-systems.ly} + @section Repeats LilyPond has three modes for repeats: folded, unfolded and diff --git a/VERSION b/VERSION index 8ffd3296d3..37215af175 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 -PATCH_LEVEL=67 -MY_PATCH_LEVEL=mb1 +PATCH_LEVEL=68 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/prefatory-spacing.ly b/input/bugs/prefatory-spacing.ly new file mode 100644 index 0000000000..6ffeb877e8 --- /dev/null +++ b/input/bugs/prefatory-spacing.ly @@ -0,0 +1,10 @@ +% the space after clef/key is stretched too much. + +foo = \notes\relative c'' { \key as \major; dis4 dis dis! dis? } + +\score { + + < \foo + \context NoteNames \foo + > +} diff --git a/input/test/accidental.ly b/input/test/accidental.ly index 89aafb10e9..23a0c7ca7f 100644 --- a/input/test/accidental.ly +++ b/input/test/accidental.ly @@ -1,8 +1,9 @@ -foo = \notes\relative c'' { cis4 cis cis! cis? } +foo = \notes\relative c'' { \key as \major; dis4 dis dis! dis? } + \score { - <\foo - \context NoteNames \foo -> + < \foo + \context NoteNames \foo + > } diff --git a/input/test/between-systems.ly b/input/test/between-systems.ly new file mode 100644 index 0000000000..1f72c7a90f --- /dev/null +++ b/input/test/between-systems.ly @@ -0,0 +1,11 @@ + +\score { +\notes { c1 + + \context Score \outputproperty #(make-type-checker 'paper-column-interface) + #'between-system-string = #"(pagebreak)\n\n" + \break + +c1 } + +} diff --git a/input/test/generic-output-property.ly b/input/test/generic-output-property.ly index 0e7d2695b7..5adbba97c8 100644 --- a/input/test/generic-output-property.ly +++ b/input/test/generic-output-property.ly @@ -1,11 +1,11 @@ \score{ \notes\relative c''{ - \outputproperty #(make-type-checker 'Note_head) + \outputproperty #(make-type-checker 'note-head-interface) #'extra-offset = #'(2 . 3) c2 c \context Score { - \outputproperty #(make-type-checker 'Mark) + \outputproperty #(make-type-checker 'mark-interface) #'extra-offset = #'(-1 . 4) } \mark A; diff --git a/lily/align-interface.cc b/lily/align-interface.cc index c377935871..fdeefe5d29 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -18,7 +18,7 @@ not compute anything, but a side effect of a->do_side_processing () is that the elements are placed correctly. */ Real -Align_interface::alignment_callback (Score_element const *sc, Axis ax) +Align_interface::alignment_callback (Score_element *sc, Axis ax) { Score_element * par = sc->parent_l (ax); if (par && par->get_elt_property ("alignment-done") == SCM_UNDEFINED) @@ -30,7 +30,7 @@ Align_interface::alignment_callback (Score_element const *sc, Axis ax) Real -Align_interface::center_on_element (Score_element const *me, Axis a) +Align_interface::center_on_element (Score_element *me, Axis a) { Score_element *cent = unsmob_element (me->get_elt_pointer ("group-center-element")); diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index f346fb9191..2ffb4d178a 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -11,7 +11,6 @@ #include "grace-align-item.hh" #include "align-interface.hh" #include "note-column.hh" -#include "local-key-item.hh" #include "warn.hh" #include "directional-element-interface.hh" #include "side-position-interface.hh" @@ -23,7 +22,7 @@ class Align_note_column_engraver: public Engraver { Grace_align_item * align_item_p_; Note_column * now_column_l_; - Local_key_item * accidental_l_; + Score_element * accidental_l_; virtual void process_acknowledged (); virtual void do_post_move_processing (); @@ -74,9 +73,9 @@ Align_note_column_engraver::acknowledge_element (Score_element_info inf) { now_column_l_ =n; } - else if (Local_key_item * it = dynamic_cast (inf.elem_l_)) + else if (to_boolean (inf.elem_l_->get_elt_property ("accidentals-interface"))) { - accidental_l_ = it; + accidental_l_ = inf.elem_l_; } } void diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 1d88248b40..433f469f67 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -9,9 +9,7 @@ #include "beaming.hh" #include "auto-beam-engraver.hh" #include "musical-request.hh" -#include "bar.hh" #include "beam.hh" -#include "rest.hh" #include "stem.hh" #include "debug.hh" #include "timing-engraver.hh" @@ -310,7 +308,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info) { end_beam (); } - else if (Bar *b = dynamic_cast (info.elem_l_)) + else if (to_boolean (info.elem_l_->get_elt_property ("bar-interface"))) { end_beam (); } diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 00c4c8d32c..f426b856c9 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -59,7 +59,7 @@ Axis_group_interface::relative_group_extent (Axis a, Score_element *common, SCM } Interval -Axis_group_interface::group_extent_callback (Score_element const*me, Axis a) +Axis_group_interface::group_extent_callback (Score_element *me, Axis a) { Score_element * common =(Score_element*) me; diff --git a/lily/beam.cc b/lily/beam.cc index 5b50831fca..c007e311bf 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -857,7 +857,7 @@ Beam::last_visible_stem () const rest -> stem -> beam -> interpolate_y_position () */ Real -Beam::rest_collision_callback (Score_element const *rest, Axis a ) +Beam::rest_collision_callback (Score_element *rest, Axis a ) { assert (a == Y_AXIS); diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index bbea713e2b..2977cde738 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -10,13 +10,12 @@ #include "side-position-interface.hh" #include "warn.hh" -#include "dimension-cache.hh" #include "lily-guile.hh" #include "break-align-item.hh" #include "dimensions.hh" -#include "paper-score.hh" #include "paper-def.hh" #include "paper-column.hh" + #include "group-interface.hh" #include "align-interface.hh" diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc index 151fbbff79..1088b39d33 100644 --- a/lily/breathing-sign-engraver.cc +++ b/lily/breathing-sign-engraver.cc @@ -36,7 +36,7 @@ protected: private: Breathing_sign_req * breathing_sign_req_l_; - Breathing_sign * breathing_sign_p_; + Score_element * breathing_sign_p_; }; Breathing_sign_engraver::Breathing_sign_engraver() @@ -63,9 +63,9 @@ Breathing_sign_engraver::do_process_music() if(breathing_sign_req_l_) { SCM b = get_property ("basicBreathingSignProperties"); - breathing_sign_p_ = new Breathing_sign (b); - Staff_symbol_referencer_interface st (breathing_sign_p_); - st.set_interface (); + breathing_sign_p_ = new Item (b); + + Breathing_sign::set_interface (breathing_sign_p_); announce_element (Score_element_info (breathing_sign_p_, breathing_sign_req_l_)); } diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index cc743c5a28..73580c0f2c 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -21,12 +21,6 @@ #include "direction.hh" -Breathing_sign::Breathing_sign (SCM s) - : Item (s) -{ -} - - MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Breathing_sign,brew_molecule); @@ -45,20 +39,25 @@ Breathing_sign::brew_molecule (SCM smob) return sc->lookup_l()->filledbox(b).create_scheme (); } -GLUE_SCORE_ELEMENT(Breathing_sign,after_line_breaking); -SCM -Breathing_sign::member_after_line_breaking () +Real +Breathing_sign::offset_callback (Score_element * b, Axis a) { - Real space = Staff_symbol_referencer_interface (this).staff_space(); - Direction d = Directional_element_interface (this). get (); + Score_element * me = (Score_element*)b; + + Real space = Staff_symbol_referencer_interface (b).staff_space(); + Direction d = Directional_element_interface (b). get (); if (!d) { d = UP; - Directional_element_interface (this).set (d); + Directional_element_interface (me).set (d); } - translate_axis(2.0 * space * d, Y_AXIS); - - return SCM_UNDEFINED; + return 2.0 * space * d; } +void +Breathing_sign::set_interface (Score_element *b) +{ + Staff_symbol_referencer_interface::set_interface (b); + b->add_offset_callback (Breathing_sign::offset_callback,Y_AXIS); +} diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index cab0239b3c..3e82a77350 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -6,8 +6,9 @@ (c) 1998--2000 Jan Nieuwenhuizen */ -#include "chord-name-engraver.hh" +#include "engraver.hh" #include "chord-name.hh" +#include "chord.hh" #include "musical-request.hh" #include "paper-def.hh" #include "lookup.hh" @@ -15,7 +16,27 @@ #include "main.hh" #include "dimensions.hh" #include "item.hh" +#include "musical-pitch.hh" +class Chord_name_engraver : public Engraver +{ +public: + Chord_name_engraver (); + VIRTUAL_COPY_CONS (Translator); + +protected: + virtual void do_pre_move_processing (); + virtual void acknowledge_element (Score_element_info i); + virtual void do_process_music (); + virtual bool do_try_music (Music* m); + +private: + Array pitch_arr_; + Item* chord_name_p_; + Tonic_req* tonic_req_; + Inversion_req* inversion_req_; + Bass_req* bass_req_; +}; ADD_THIS_TRANSLATOR (Chord_name_engraver); @@ -73,7 +94,7 @@ Chord_name_engraver::do_process_music () if (gh_boolean_p (chord_inversion)) find_inversion_b = gh_scm2bool (chord_inversion); - chord_name_p_ = new Chord_name (get_property ("basicChordNameProperties")); + chord_name_p_ = new Item (get_property ("basicChordNameProperties")); Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_, find_inversion_b); diff --git a/lily/chord-name.cc b/lily/chord-name.cc index 0d4ff13849..bcc0abea3d 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -7,14 +7,10 @@ */ #include "chord-name.hh" -#include "musical-request.hh" -#include "warn.hh" -#include "debug.hh" #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" -#include "staff-symbol-referencer.hh" - +#include "score-element.hh" /* TODO: move text lookup out of Chord_name @@ -27,7 +23,7 @@ */ Molecule -Chord_name::ly_word2molecule (SCM word, Real* x) const +Chord_name::ly_word2molecule (Score_element * me, SCM word, Real* x) { *x = 0; @@ -43,10 +39,10 @@ Chord_name::ly_word2molecule (SCM word, Real* x) const /* UGH. Should read from font metric structure. */ - Real ex = lookup_l ()->text ("", "x", - paper_l ()).extent (Y_AXIS).length (); - Real em = lookup_l ()->text ("", "m", - paper_l ()).extent (X_AXIS).length (); + Real ex = me->lookup_l ()->text ("", "x", + me->paper_l ()).extent (Y_AXIS).length (); + Real em = me->lookup_l ()->text ("", "m", + me->paper_l ()).extent (X_AXIS).length (); String w = ly_scm2string (word); @@ -90,9 +86,9 @@ Chord_name::ly_word2molecule (SCM word, Real* x) const Molecule mol; s = scm_assoc (ly_symbol2scm ("font"), options_alist); if (s != SCM_BOOL_F && ly_scm2string (gh_cdr (s)) == "feta") - mol = paper_l ()->lookup_l (size)->afm_find (w); + mol = me->paper_l ()->lookup_l (size)->afm_find (w); else - mol = paper_l ()->lookup_l (size)->text (style, w, paper_l ()); + mol = me->paper_l ()->lookup_l (size)->text (style, w, me->paper_l ()); mol.translate (offset); return mol; @@ -106,7 +102,7 @@ Chord_name::ly_word2molecule (SCM word, Real* x) const ;; property: align, kern, font (?), size */ Molecule -Chord_name::ly_text2molecule (SCM text) const +Chord_name::ly_text2molecule (Score_element * me, SCM text) { Molecule mol; if (gh_list_p (text)) @@ -114,7 +110,7 @@ Chord_name::ly_text2molecule (SCM text) const while (gh_cdr (text) != SCM_EOL) { Real x; - Molecule m = ly_word2molecule (gh_car (text), &x); + Molecule m = ly_word2molecule (me, gh_car (text), &x); if (!m.empty_b ()) mol.add_at_edge (X_AXIS, RIGHT, m, x); text = gh_cdr (text); @@ -122,7 +118,7 @@ Chord_name::ly_text2molecule (SCM text) const text = gh_car (text); } Real x; - Molecule m = ly_word2molecule (text, &x); + Molecule m = ly_word2molecule (me,text, &x); if (!m.empty_b ()) mol.add_at_edge (X_AXIS, RIGHT, m, x); return mol; @@ -154,11 +150,5 @@ Chord_name::brew_molecule (SCM smob) ly_quote_scm (gh_cons (inversion, bass)), SCM_UNDEFINED)); - return dynamic_cast (sc)-> - ly_text2molecule (text).create_scheme (); -} - -Chord_name::Chord_name (SCM s) - : Item (s) -{ + return ly_text2molecule (sc, text).create_scheme (); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index def1a62622..4267a35779 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -11,14 +11,8 @@ #include #include "staff-symbol-referencer.hh" -#include "bar.hh" - #include "debug.hh" #include "command-request.hh" -#include "timing-translator.hh" -#include "rhythmic-head.hh" -#include "key-item.hh" -#include "local-key-item.hh" #include "array.hh" #include "engraver.hh" #include "direction.hh" @@ -126,22 +120,23 @@ Clef_engraver::set_type (String s) void Clef_engraver::acknowledge_element (Score_element_info info) { - if (dynamic_cast(info.elem_l_) - && gh_string_p (clef_glyph_)) - create_clef(); - - Item * it_l =dynamic_cast (info.elem_l_); - if (it_l) + Item * item =dynamic_cast (info.elem_l_); + if (item) { - if (to_boolean (it_l->get_elt_property("note-head-interface")) - || dynamic_cast (it_l)) + if (to_boolean (info.elem_l_->get_elt_property ("bar-interface")) + && gh_string_p (clef_glyph_)) + create_clef(); + + + if (to_boolean (item->get_elt_property("note-head-interface")) + || to_boolean (item->get_elt_property ("accidentals-interface"))) { - Staff_symbol_referencer_interface si (it_l); + Staff_symbol_referencer_interface si (item); si.set_position (int (si.position_f ()) + c0_position_i_); } - else if (Key_item *k = dynamic_cast(it_l)) + else if (to_boolean (item->get_elt_property ("key-item-interface"))) { - k->set_elt_property ("c0-position", gh_int2scm (c0_position_i_)); + item->set_elt_property ("c0-position", gh_int2scm (c0_position_i_)); } } } @@ -180,8 +175,7 @@ Clef_engraver::create_clef() Item *c= new Item ( current_settings_); announce_element (Score_element_info (c, clef_req_l_)); - Staff_symbol_referencer_interface si(c); - si.set_interface (); + Staff_symbol_referencer_interface::set_interface (c); clef_p_ = c; } diff --git a/lily/collision.cc b/lily/collision.cc index 9cedc34479..9316fcd2f3 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -22,7 +22,7 @@ Collision::add_column (Note_column* ncol_l) } Real -Collision::force_shift_callback (Score_element const * c, Axis a) +Collision::force_shift_callback (Score_element * c, Axis a) { assert (a == X_AXIS); diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 7890d5cf00..8ba2b7ef9e 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -8,51 +8,48 @@ #include "molecule.hh" #include "crescendo.hh" +#include "spanner.hh" #include "lookup.hh" #include "dimensions.hh" #include "paper-def.hh" #include "debug.hh" #include "paper-column.hh" - -Crescendo::Crescendo (SCM s) - : Spanner (s) +void +Crescendo::set_interface (Score_element*s) { - set_elt_property ("dynamic-drul", gh_cons (SCM_BOOL_F, SCM_BOOL_F)); + s->set_elt_pointer ("dynamic-drul", gh_cons (SCM_UNDEFINED, SCM_UNDEFINED)); } - -GLUE_SCORE_ELEMENT(Crescendo,brew_molecule); - +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Crescendo,brew_molecule); SCM -Crescendo::member_brew_molecule () const +Crescendo::brew_molecule (SCM smob) { - Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten"); - Real extra_left = get_broken_left_end_align (); + Score_element *me= unsmob_element (smob); + Spanner * sp = dynamic_cast(me); + Real absdyn_dim = me->paper_l ()-> get_var ("crescendo_shorten"); + Real extra_left = sp->get_broken_left_end_align (); - SCM dir = get_elt_property("grow-direction"); - SCM dyns = get_elt_property ("dynamic-drul"); + SCM dir = me->get_elt_property("grow-direction"); + SCM dyns = me->get_elt_property ("dynamic-drul"); if (!isdir_b (dir) || !gh_pair_p (dyns)) { - Crescendo * me = (Crescendo*)this; me->suicide (); return SCM_EOL; } Direction gd = to_dir (dir); - bool dynleft= to_boolean (gh_car (dyns)); - bool dynright = to_boolean (gh_cdr (dyns)); + bool dynleft= unsmob_element (gh_car (dyns)); + bool dynright = unsmob_element (gh_cdr (dyns)); if (dynleft) extra_left += absdyn_dim; - - - Real width = spanner_length()- get_broken_left_end_align (); + Real width = sp->spanner_length()- sp->get_broken_left_end_align (); if (dynleft) { @@ -73,7 +70,7 @@ Crescendo::member_brew_molecule () const Direction d = LEFT; do { - Paper_column* s = dynamic_cast(get_bound (d)); // UGH + Paper_column* s = dynamic_cast(sp->get_bound (d)); // UGH broken[d] = (!s->musical_b ()); } while (flip (&d) != LEFT); @@ -82,15 +79,15 @@ Crescendo::member_brew_molecule () const Molecule m; Real pad = 0; - SCM s = get_elt_property ("start-text"); + SCM s = me->get_elt_property ("start-text"); if (gh_string_p (s)) { - Molecule start_text (lookup_l ()->text ("italic", + Molecule start_text (me->lookup_l ()->text ("italic", ly_scm2string (s), - paper_l ())); + me->paper_l ())); m.add_molecule (start_text); - pad = paper_l ()->get_var ("interline") / 2; + pad = me->paper_l ()->get_var ("interline") / 2; width -= start_text.extent (X_AXIS).length (); width -= pad; @@ -98,12 +95,12 @@ Crescendo::member_brew_molecule () const } SCM at; - s = get_elt_property ("spanner"); + s =me->get_elt_property ("spanner"); Real height; if (gh_string_p (s) && ly_scm2string (s) == "dashed-line") { - Real thick = paper_l ()->get_var ("crescendo_dash_thickness"); - Real dash = paper_l ()->get_var ("crescendo_dash"); + Real thick = me->paper_l ()->get_var ("crescendo_dash_thickness"); + Real dash = me->paper_l ()->get_var ("crescendo_dash"); height = thick; at = gh_list (ly_symbol2scm (ly_scm2string (s).ch_C ()), gh_double2scm (thick), @@ -114,8 +111,8 @@ Crescendo::member_brew_molecule () const else { bool continued = broken[Direction (-gd)]; - height = paper_l()->get_var ("crescendo_height"); - Real thick = paper_l ()->get_var ("crescendo_thickness"); + height = me->paper_l()->get_var ("crescendo_height"); + Real thick = me->paper_l ()->get_var ("crescendo_thickness"); const char* hairpin = (gd < 0)? "decrescendo" : "crescendo"; diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index d555327c8e..908851d168 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -7,10 +7,25 @@ */ -#include "dot-column-engraver.hh" + #include "rhythmic-head.hh" #include "dot-column.hh" #include "side-position-interface.hh" +#include "engraver.hh" + +class Dot_column_engraver : public Engraver +{ + Score_element *dotcol_p_ ; + Link_array head_l_arr_; +public: + VIRTUAL_COPY_CONS(Translator); + Dot_column_engraver(); + +protected: + virtual void acknowledge_element (Score_element_info); + virtual void do_pre_move_processing (); +}; + Dot_column_engraver::Dot_column_engraver () { @@ -31,22 +46,21 @@ Dot_column_engraver::do_pre_move_processing () void Dot_column_engraver::acknowledge_element (Score_element_info info) { - Rhythmic_head * h = dynamic_cast(info.elem_l_); - if (!h) - return; + Score_element *d = unsmob_element (info.elem_l_->get_elt_pointer ("dot")); + if (d) + { + if (!dotcol_p_) + { + dotcol_p_ = new Item(get_property ("basicDotColumnProperties")); - if (!h->dots_l ()) - return; + Dot_column::set_interface (dotcol_p_); + Side_position_interface (dotcol_p_).set_axis (X_AXIS); + Side_position_interface (dotcol_p_).set_direction (RIGHT); + announce_element (Score_element_info (dotcol_p_, 0)); + } - if (!dotcol_p_) - { - dotcol_p_ = new Dot_column(get_property ("basicDotColumnProperties")); - Side_position_interface (dotcol_p_).set_axis (X_AXIS); - Side_position_interface (dotcol_p_).set_direction (RIGHT); - announce_element (Score_element_info (dotcol_p_, 0)); + Dot_column::add_head (dotcol_p_, info.elem_l_); } - - dotcol_p_->add_head (h); } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index a725998bcf..f3ce19ad83 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -18,20 +18,18 @@ void -Dot_column::add_head (Rhythmic_head *r) +Dot_column::add_head (Score_element * dc, Score_element *rh) { - if (!r->dots_l ()) - return ; - - Side_position_interface (this).add_support (r); - Item * d = r->dots_l (); + Score_element * d = unsmob_element (rh->get_elt_pointer ("dot")); if (d) { - Pointer_group_interface gi (this, "dots"); + Side_position_interface (dc).add_support (rh); + + Pointer_group_interface gi (dc, "dots"); gi.add_element (d); d->add_offset_callback (force_shift_callback , Y_AXIS); - Axis_group_interface (this).add_element (d); + Axis_group_interface (dc).add_element (d); } } @@ -46,14 +44,14 @@ Dot_column::compare (Score_element * const &d1, Score_element * const &d2) } -Dot_column::Dot_column (SCM s) - : Item (s) +void +Dot_column::set_interface (Score_element* dc) { - this->set_elt_pointer ("dots", SCM_EOL); - Directional_element_interface (this).set (RIGHT); + dc->set_elt_pointer ("dots", SCM_EOL); + Directional_element_interface (dc).set (RIGHT); - Axis_group_interface (this).set_interface (); - Axis_group_interface (this).set_axes(X_AXIS,X_AXIS); + Axis_group_interface (dc).set_interface (); + Axis_group_interface (dc).set_axes(X_AXIS,X_AXIS); } /* @@ -74,7 +72,7 @@ Dot_column::Dot_column (SCM s) Real -Dot_column::force_shift_callback (Score_element const * dot, Axis a) +Dot_column::force_shift_callback (Score_element * dot, Axis a) { assert (a == Y_AXIS); Score_element * me = dot->parent_l (X_AXIS); diff --git a/lily/dots.cc b/lily/dots.cc index 6a037d9f80..929aabf96f 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -16,7 +16,7 @@ Real -Dots::quantised_position_callback (Score_element const* me, Axis a) +Dots::quantised_position_callback (Score_element * me, Axis a) { assert (a == Y_AXIS); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 8224b1f6f6..1e329f4f73 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -7,22 +7,15 @@ */ #include "debug.hh" #include "dimensions.hh" -#include "dimension-cache.hh" #include "crescendo.hh" #include "musical-request.hh" -#include "lookup.hh" -#include "paper-def.hh" #include "paper-column.hh" -#include "staff-symbol.hh" #include "note-column.hh" #include "item.hh" #include "side-position-interface.hh" #include "engraver.hh" -#include "stem.hh" -#include "rhythmic-head.hh" #include "group-interface.hh" #include "directional-element-interface.hh" -#include "staff-symbol-referencer.hh" #include "translator-group.hh" #include "axis-group-interface.hh" @@ -40,8 +33,8 @@ class Dynamic_engraver : public Engraver { Item * text_p_; - Crescendo * finished_cresc_p_; - Crescendo * cresc_p_; + Spanner * finished_cresc_p_; + Spanner * cresc_p_; Text_script_req* text_req_l_; @@ -214,7 +207,8 @@ Dynamic_engraver::do_process_music () else { current_cresc_req_ = accepted_spanreqs_drul_[START]; - cresc_p_ = new Crescendo (get_property ("basicCrescendoProperties")); + cresc_p_ = new Spanner (get_property ("basicCrescendoProperties")); + Crescendo::set_interface (cresc_p_); cresc_p_->set_elt_property ("grow-direction", gh_int2scm ((accepted_spanreqs_drul_[START]->span_type_str_ == "crescendo") @@ -262,11 +256,11 @@ Dynamic_engraver::do_process_music () if (text_p_) { - index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"), - LEFT, SCM_BOOL_T); + index_set_cell (cresc_p_->get_elt_pointer ("dynamic-drul"), + LEFT, text_p_->self_scm_); if (finished_cresc_p_) - index_set_cell (finished_cresc_p_->get_elt_property ("dynamic-drul"), - RIGHT, SCM_BOOL_T); + index_set_cell (finished_cresc_p_->get_elt_pointer ("dynamic-drul"), + RIGHT, text_p_->self_scm_); } Axis_group_interface (line_spanner_).add_element (cresc_p_); diff --git a/lily/hara-kiri-engraver.cc b/lily/hara-kiri-engraver.cc index 10eca4fe1d..1ef2d1ac3c 100644 --- a/lily/hara-kiri-engraver.cc +++ b/lily/hara-kiri-engraver.cc @@ -9,11 +9,14 @@ #include "hara-kiri-group-spanner.hh" #include "hara-kiri-engraver.hh" #include "rhythmic-head.hh" +#include "spanner.hh" Spanner* Hara_kiri_engraver::get_spanner_p () const { - return new Hara_kiri_group_spanner (get_property ("basicHaraKiriVerticalGroupspannerProperties")); + Spanner * sp = new Spanner (get_property ("basicHaraKiriVerticalGroupspannerProperties")); + Hara_kiri_group_spanner::set_interface (sp); + return sp; } void @@ -25,9 +28,7 @@ Hara_kiri_engraver::acknowledge_element (Score_element_info i) if (Rhythmic_head *h = dynamic_cast (i.elem_l_)) { - dynamic_cast (staffline_p_) - ->add_interesting_item (h); + Hara_kiri_group_spanner::add_interesting_item (staffline_p_, h); } - } ADD_THIS_TRANSLATOR(Hara_kiri_engraver); diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index 3161032716..125b686f37 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -8,49 +8,41 @@ */ #include "axis-group-interface.hh" +#include "spanner.hh" #include "hara-kiri-group-spanner.hh" #include "debug.hh" #include "item.hh" -/* - */ -Hara_kiri_group_spanner::Hara_kiri_group_spanner(SCM s) - : Spanner (s) +void +Hara_kiri_group_spanner::set_interface (Score_element*me) { - set_elt_pointer ("items-worth-living", SCM_EOL); + me->set_elt_pointer ("items-worth-living", SCM_EOL); } void -Hara_kiri_group_spanner::add_interesting_item (Item* n) +Hara_kiri_group_spanner::add_interesting_item (Score_element* me,Item* n) { - add_dependency (n); - Pointer_group_interface (this, "items-worth-living").add_element (n); + me->add_dependency (n); + Pointer_group_interface (me, "items-worth-living").add_element (n); } -GLUE_SCORE_ELEMENT(Hara_kiri_group_spanner,after_line_breaking); -SCM -Hara_kiri_group_spanner::member_after_line_breaking () +void +Hara_kiri_group_spanner::consider_suicide(Score_element*me) { - SCM worth = get_elt_pointer ("items-worth-living"); + SCM worth = me->get_elt_pointer ("items-worth-living"); if (gh_pair_p (worth)) - return SCM_UNDEFINED; + return ; - Link_array childs = Axis_group_interface (this).get_children (); + Link_array childs = Axis_group_interface (me).get_children (); for (int i = 0; i < childs.size (); i++) - { - Score_element* s = childs[i]; + childs[i]->suicide (); - if ( line_l () != s->line_l ()) - programming_error ("Killing other children too"); - s->suicide (); - } /* very appropriate name here :-) */ - suicide (); - return SCM_UNDEFINED; + me->suicide (); } @@ -60,18 +52,16 @@ Hara_kiri_group_spanner::member_after_line_breaking () group. Use a callback to make sure that hara-kiri has been done before asking for offsets. */ Real -Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element const *elt, Axis a) +Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element *elt, Axis a) { - while (elt && !dynamic_cast (elt)) + while (elt + && to_boolean (elt->get_elt_property ("hara-kiri-interface"))) elt = elt->parent_l(a); if (elt) { - Hara_kiri_group_spanner const * seppuku = dynamic_cast (elt); - - ((Hara_kiri_group_spanner*)seppuku)->member_after_line_breaking (); + Hara_kiri_group_spanner::consider_suicide (elt); } - return 0.0; } diff --git a/lily/include/align-interface.hh b/lily/include/align-interface.hh index c9e42d7be1..04b2cca234 100644 --- a/lily/include/align-interface.hh +++ b/lily/include/align-interface.hh @@ -38,7 +38,7 @@ struct Align_interface { Score_element * elt_l_; Align_interface (Score_element const*); - static Real alignment_callback (Score_element const*,Axis); + static Real alignment_callback (Score_element *,Axis); void do_side_processing (Axis a); void set_axis (Axis); Axis axis () const; @@ -46,7 +46,7 @@ struct Align_interface { int get_count (Score_element*)const; void set_interface (); bool has_interface_b (); - static Real center_on_element (Score_element const *c, Axis); + static Real center_on_element (Score_element *c, Axis); }; #endif /* ALIGN_INTERFACE_HH */ diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index 3d72a99494..f99d232133 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -31,7 +31,7 @@ struct Axis_group_interface Score_element *elt_l_; Axis_group_interface (Score_element*); - static Interval group_extent_callback (Score_element const*,Axis); + static Interval group_extent_callback (Score_element *,Axis); static Interval relative_group_extent (Axis, Score_element * common, SCM list); void add_element (Score_element*); diff --git a/lily/include/bar.hh b/lily/include/bar.hh index 92c03f20d8..1e6bf095f8 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -11,7 +11,8 @@ /** A vertical bar. */ -class Bar:public Item { +class Bar:public Item +{ public: VIRTUAL_COPY_CONS(Score_element); Bar(SCM); diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 9a85134d64..3efb7c2827 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -35,7 +35,7 @@ public: int visible_stem_count () const; Stem* first_visible_stem () const; Stem* last_visible_stem () const; - static Real rest_collision_callback (Score_element const*,Axis); + static Real rest_collision_callback (Score_element *,Axis); Beam (SCM); void add_stem (Stem*); void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current); diff --git a/lily/include/breathing-sign.hh b/lily/include/breathing-sign.hh index dd495b1db8..a3c3bb9be0 100644 --- a/lily/include/breathing-sign.hh +++ b/lily/include/breathing-sign.hh @@ -10,24 +10,18 @@ #ifndef BREATHING_SIGN_HH #define BREATHING_SIGN_HH -#include "item.hh" -#include "parray.hh" +#include "lily-guile.hh" /* breathing sign (apostrophe within staff, not the comma above staff type) */ -class Breathing_sign : public Item +class Breathing_sign { public: static SCM brew_molecule (SCM); - - VIRTUAL_COPY_CONS(Score_element); - Breathing_sign (SCM s); -public: - SCM member_after_line_breaking (); - static SCM after_line_breaking (SCM); - SCM member_brew_molecule () const; + static Real offset_callback (Score_element *, Axis); + static void set_interface (Score_element*); }; #endif // BREATHING_SIGN_HH diff --git a/lily/include/chord-name-engraver.hh b/lily/include/chord-name-engraver.hh deleted file mode 100644 index e8b780d383..0000000000 --- a/lily/include/chord-name-engraver.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - chord-name-engraver.hh -- declare Chord_name_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1998--2000 Jan Nieuwenhuizen -*/ - -#ifndef CHORD_NAME_ENGRAVER_HH -#define CHORD_NAME_ENGRAVER_HH - -#include "engraver.hh" -#include "array.hh" -#include "musical-pitch.hh" -#include "lily-proto.hh" - -class Chord_name_engraver : public Engraver -{ -public: - Chord_name_engraver (); - VIRTUAL_COPY_CONS (Translator); - -protected: - virtual void do_pre_move_processing (); - virtual void acknowledge_element (Score_element_info i); - virtual void do_process_music (); - virtual bool do_try_music (Music* m); - -private: - Array pitch_arr_; - Chord_name* chord_name_p_; - Tonic_req* tonic_req_; - Inversion_req* inversion_req_; - Bass_req* bass_req_; -}; - -#endif // CHORD_NAME_ENGRAVER_HH diff --git a/lily/include/chord-name.hh b/lily/include/chord-name.hh index fae9d217b0..b4b55b318b 100644 --- a/lily/include/chord-name.hh +++ b/lily/include/chord-name.hh @@ -9,8 +9,7 @@ #ifndef CHORD_NAME_HH #define CHORD_NAME_HH -#include "chord.hh" -#include "item.hh" +#include "lily-guile.hh" #include "molecule.hh" /** @@ -19,18 +18,12 @@ inversion(optional): musical-pitch bass(optional): musical-pitch */ -class Chord_name : public Item +class Chord_name { public: static SCM brew_molecule (SCM); - - VIRTUAL_COPY_CONS (Score_element); - Molecule ly_word2molecule (SCM scm, Real* x) const; - Molecule ly_text2molecule (SCM scm) const; - Chord_name(SCM s); -public: - SCM member_brew_molecule () const; - + static Molecule ly_word2molecule (Score_element*, SCM scm, Real* x) ; + static Molecule ly_text2molecule (Score_element*, SCM scm) ; }; #endif // CHORD_NAME_HH diff --git a/lily/include/collision.hh b/lily/include/collision.hh index 6f7ffbb471..3e88c982b2 100644 --- a/lily/include/collision.hh +++ b/lily/include/collision.hh @@ -42,7 +42,7 @@ public: Score_element* elt_l_; static SCM automatic_shift (Score_element*); static SCM forced_shift (Score_element*); - static Real force_shift_callback (Score_element const*, Axis); + static Real force_shift_callback (Score_element *, Axis); static void do_shifts (Score_element*); void add_column (Note_column*ncol_l); diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index e45ef61ffd..36639f8586 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -10,23 +10,17 @@ #ifndef CRESCENDO_HH #define CRESCENDO_HH -#include "spanner.hh" +#include "lily-guile.hh" /** The hairpin symbol. (cresc) (normal spanner?) */ -class Crescendo : public Spanner { +struct Crescendo +{ public: - static SCM brew_molecule (SCM); - - Crescendo(SCM); - - VIRTUAL_COPY_CONS(Score_element); - SCM member_brew_molecule() const; - -private: - Molecule get_symbol() const; + static SCM brew_molecule (SCM); + static void set_interface(Score_element*); }; #endif // CRESCENDO_HH diff --git a/lily/include/dimension-cache-callback.hh b/lily/include/dimension-cache-callback.hh index 6c58b1d2e9..b14b0b16aa 100644 --- a/lily/include/dimension-cache-callback.hh +++ b/lily/include/dimension-cache-callback.hh @@ -11,8 +11,8 @@ #define DIMENSION_CACHE_CALLBACK_HH -typedef Interval (*Dim_cache_callback)(Score_element const *,Axis); -typedef Real (*Offset_callback)(Score_element const *,Axis); +typedef Interval (*Dim_cache_callback)(Score_element *,Axis); +typedef Real (*Offset_callback)(Score_element *,Axis); #endif /* DIMENSION_CACHE_CALLBACK_HH */ diff --git a/lily/include/dot-column-engraver.hh b/lily/include/dot-column-engraver.hh deleted file mode 100644 index deec318345..0000000000 --- a/lily/include/dot-column-engraver.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - dot-column-engraver.hh -- declare Dot_column_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef DOT_COLUMN_GRAV_HH -#define DOT_COLUMN_GRAV_HH - -#include "engraver.hh" - -class Dot_column_engraver : public Engraver -{ - Dot_column *dotcol_p_ ; - Link_array head_l_arr_; -public: - VIRTUAL_COPY_CONS(Translator); - Dot_column_engraver(); - -protected: - virtual void acknowledge_element (Score_element_info); - virtual void do_pre_move_processing (); -}; - -#endif // DOT_COLUMN_GRAV_HH diff --git a/lily/include/dot-column.hh b/lily/include/dot-column.hh index e812875e99..db18bf572d 100644 --- a/lily/include/dot-column.hh +++ b/lily/include/dot-column.hh @@ -10,21 +10,18 @@ #ifndef DOT_COLUMN_HH #define DOT_COLUMN_HH -#include "item.hh" - +#include "lily-guile.hh" /** Group dots. This is needed because, the dots have to be aligned per voice */ -class Dot_column : public Item +class Dot_column // interface { - static int compare (Score_element * const&,Score_element * const&); public: - VIRTUAL_COPY_CONS (Score_element); - void add_head (Rhythmic_head*); - Dot_column (SCM); - - static Real force_shift_callback (Score_element const* , Axis); + static int compare (Score_element * const&,Score_element * const&); + static void add_head (Score_element * dotcol, Score_element* rh ); + static void set_interface (Score_element*); + static Real force_shift_callback (Score_element * , Axis); static SCM do_shifts (SCM dotlist); }; #endif // DOT_COLUMN_HH diff --git a/lily/include/dots.hh b/lily/include/dots.hh index 21be4f7747..76189d65f6 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -27,7 +27,7 @@ class Dots // interface { public: - static Real quantised_position_callback(Score_element const*, Axis); + static Real quantised_position_callback(Score_element*, Axis); static SCM brew_molecule (SCM); }; diff --git a/lily/include/hara-kiri-group-spanner.hh b/lily/include/hara-kiri-group-spanner.hh index 476a18a915..912a6f4ffc 100644 --- a/lily/include/hara-kiri-group-spanner.hh +++ b/lily/include/hara-kiri-group-spanner.hh @@ -10,7 +10,8 @@ #ifndef HARA_KIRI_VERTICAL_GROUP_SPANNER_HH #define HARA_KIRI_VERTICAL_GROUP_SPANNER_HH -#include "spanner.hh" +#include "lily-guile.hh" +#include "lily-proto.hh" /** As Vertical_group_spanner, but keep track of interesting items. If @@ -24,17 +25,13 @@ clear this line */ -class Hara_kiri_group_spanner : public Spanner +class Hara_kiri_group_spanner { public: - static Real force_hara_kiri_callback (Score_element const* , Axis); - Hara_kiri_group_spanner (SCM); - SCM member_after_line_breaking (); - static SCM after_line_breaking (SCM); - - void add_interesting_item (Item* n); - - VIRTUAL_COPY_CONS(Score_element); + static Real force_hara_kiri_callback (Score_element * , Axis); + static void set_interface (Score_element*me); + static void consider_suicide (Score_element*me); + static void add_interesting_item (Score_element * me , Item* n); }; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 756a2b0139..e77703b9a3 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -7,9 +7,8 @@ #ifndef KEYITEM_HH #define KEYITEM_HH -#include "item.hh" -#include "array.hh" - +#include "lily-guile.hh" +#include "lily-proto.hh" /** A group of accidentals. @@ -22,18 +21,11 @@ new-accidentals -- list of (pitch, accidental) pairs */ -class Key_item :public Item +struct Key_item { - int calculate_position(SCM pair) const; - -public: - VIRTUAL_COPY_CONS(Score_element); - Key_item (SCM); + static int calculate_position(Score_element*,SCM pair) ; + void set_interface (Score_element*); static SCM brew_molecule (SCM); - - - - SCM member_brew_molecule() const; }; #endif // KEYITEM_HH diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index 0006c857bc..01eba65007 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -6,6 +6,8 @@ #ifndef LOCALKEYITEM_HH #define LOCALKEYITEM_HH + + #include "item.hh" #include "array.hh" #include "musical-pitch.hh" diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index 6a9b31be68..f163bf4816 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -17,17 +17,11 @@ class Multi_measure_rest : public Spanner { public: Multi_measure_rest (SCM); - static SCM brew_molecule (SCM); - - void add_column (Item*); - Molecule compound_rest (int)const; - - SCM member_brew_molecule () const; + static void set_interface (Score_element*); + static SCM brew_molecule (SCM); + static void add_column (Score_element*,Item*); VIRTUAL_COPY_CONS (Score_element); - - SCM member_after_line_breaking (); - static SCM after_line_breaking (SCM); virtual Array get_rods () const; }; diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 5ef166a3ba..fe5dc7c68b 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -49,7 +49,7 @@ public: void add_rod (Paper_column * to, Real distance); void add_spring (Paper_column * to, Real dist, Real strength); - virtual Paper_column * column_l () const; + virtual Paper_column *column_l () const; virtual Line_of_score *line_l () const; /// if lines are broken then this column is in #line# @@ -58,7 +58,7 @@ public: /// which one (left =0) int rank_i() const; - Paper_column (Moment when); + Paper_column (SCM); Moment when_mom ()const; bool musical_b () const; diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index 8758535ea8..ff9846cfbf 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -46,6 +46,7 @@ public: void output_font_switch (int i); void output_header (); void output_comment (String s); + void output_string (SCM s); void output_scheme (SCM scm); }; diff --git a/lily/include/repeat-engraver.hh b/lily/include/repeat-engraver.hh deleted file mode 100644 index bd8bbd9237..0000000000 --- a/lily/include/repeat-engraver.hh +++ /dev/null @@ -1,62 +0,0 @@ -/* - repeat-engraver.hh -- declare Repeat_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1998--2000 Jan Nieuwenhuizen -*/ - -#ifndef REPEAT_ENGRAVER_HH -#define REPEAT_ENGRAVER_HH - -#include "engraver.hh" -#include "cons.hh" - -struct Bar_create_event -{ - Moment when_; - bool bar_b_; - bool last_b_; - String type_; - Bar_create_event(); - Bar_create_event (Moment w, String s); - Bar_create_event (Moment w, int i, int j); -}; - -int compare (Bar_create_event const & c1, Bar_create_event const &c2) -{ - return (c1.when_ - c2.when_).sign(); -} - -/** - Generate repeat-bars |: :| for repeated-music - */ -class Repeat_engraver : public Engraver -{ -public: - VIRTUAL_COPY_CONS(Translator); - Repeat_engraver (); -protected: - virtual void acknowledge_element (Score_element_info i); - virtual void do_removal_processing (); - virtual bool do_try_music (Music *req_l); - virtual void do_process_music(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing (); - void queue_events (); - -private: - Repeated_music *repeated_music_l_; - bool done_this_one_b_; - - /* - Royal_brackla_create_queue is only two Whiskies away. :-) - */ - Cons *create_barmoments_queue_; - - Volta_spanner * volta_span_p_; - Volta_spanner* end_volta_span_p_; -}; - -#endif // REPEAT_ENGRAVER_HH - diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh index 4eaddd45d7..baf03668b4 100644 --- a/lily/include/rest-collision.hh +++ b/lily/include/rest-collision.hh @@ -22,7 +22,7 @@ public: Rest_collision(Score_element*); void set_interface (); - static Real force_shift_callback (Score_element const*, Axis); + static Real force_shift_callback (Score_element *, Axis); static SCM do_shift (Score_element*,SCM); }; #endif // REST_COLLISION_HH diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 32398bb089..9ae036d0d5 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -14,8 +14,8 @@ #include "smobs.hh" #include "dimension-cache.hh" -typedef Interval (*Extent_callback)(Score_element const *,Axis); -typedef Real (*Offset_callback)(Score_element const *,Axis); +typedef Interval (*Extent_callback)(Score_element *,Axis); +typedef Real (*Offset_callback)(Score_element *,Axis); #define READONLY_PROPS // FIXME. @@ -167,9 +167,9 @@ public: Molecule get_molecule () const; void suicide (); - static Interval preset_extent (Score_element const*,Axis); - static Interval point_dimension_callback (Score_element const*,Axis ); - static Interval molecule_extent (Score_element const*,Axis); + static Interval preset_extent (Score_element *,Axis); + static Interval point_dimension_callback (Score_element *,Axis ); + static Interval molecule_extent (Score_element *,Axis); protected: /** diff --git a/lily/include/score-priority-engraver.hh b/lily/include/score-priority-engraver.hh deleted file mode 100644 index 3ec4360f91..0000000000 --- a/lily/include/score-priority-engraver.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* - score-align-engraver.hh -- declare Type_align_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef SCOREF_ALIGN_GRAV_HH -#define SCOREF_ALIGN_GRAV_HH - -#include "engraver.hh" - -/** - Group a number of items across staffs: - - Acknowledge items, put each priority in a separate column. Put all - columns in a horizontal align engraver. We manufacture two types of - elements: the alignment element and the columns. This is probably - more convenient, and I question the use having one without the - other. -*/ -class Score_priority_engraver : public Engraver -{ - Break_align_item * halign_p_; - Link_array column_p_arr_; - - void add_horizontal_group (Item* , int p); -public: - VIRTUAL_COPY_CONS(Translator); - Score_priority_engraver (); - -protected: - virtual void acknowledge_element (Score_element_info); - virtual void do_pre_move_processing(); -}; - -#endif // SCORE_ALIGN_GRAV_HH diff --git a/lily/include/script-column.hh b/lily/include/script-column.hh index 9c580c5083..1e41d86583 100644 --- a/lily/include/script-column.hh +++ b/lily/include/script-column.hh @@ -10,15 +10,13 @@ #ifndef Script_COLUMN_HH #define Script_COLUMN_HH -#include "item.hh" +#include "lily-guile.hh" +#include "lily-proto.hh" -class Script_column : public Item +class Script_column { public: - Script_column(SCM); - void add_staff_sided (Item*); - - SCM member_before_line_breaking (); + static void add_staff_sided (Score_element*, Item*); static SCM before_line_breaking (SCM); }; diff --git a/lily/include/script.hh b/lily/include/script.hh index 4d7bc39cfd..df31d40d15 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -20,18 +20,12 @@ */ class Script : public Item { - Molecule get_molecule (Direction d) const; public: + static Molecule get_molecule (Score_element*,Direction d); Script (SCM); - static SCM brew_molecule (SCM); - - - - SCM member_before_line_breaking (); - static SCM before_line_breaking (SCM); + static SCM brew_molecule (SCM); SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); - SCM member_brew_molecule () const; }; #endif /* Stem_SCRIPT_HH */ diff --git a/lily/include/separating-group-spanner.hh b/lily/include/separating-group-spanner.hh index bfbe265062..f947eb57ba 100644 --- a/lily/include/separating-group-spanner.hh +++ b/lily/include/separating-group-spanner.hh @@ -15,7 +15,7 @@ class Separating_group_spanner : public Spanner { public: - void add_spacing_unit (Single_malt_grouping_item*); + void add_spacing_unit (Item*); Separating_group_spanner(SCM); protected: VIRTUAL_COPY_CONS(Score_element); diff --git a/lily/include/separating-line-group-engraver.hh b/lily/include/separating-line-group-engraver.hh index eccb4b0ee4..6a26cd3194 100644 --- a/lily/include/separating-line-group-engraver.hh +++ b/lily/include/separating-line-group-engraver.hh @@ -9,26 +9,5 @@ #ifndef SEPARATING_LINE_GROUP_GRAV_HH #define SEPARATING_LINE_GROUP_GRAV_HH - -#include "engraver.hh" - -class Separating_line_group_engraver : public Engraver -{ -protected: - Single_malt_grouping_item * break_malt_p_; - Single_malt_grouping_item* nobreak_malt_p_; - Separating_group_spanner * sep_span_p_; - - virtual void acknowledge_element (Score_element_info); - virtual void do_creation_processing (); - virtual void do_removal_processing (); - virtual void do_pre_move_processing (); -public: - Separating_line_group_engraver (); - VIRTUAL_COPY_CONS (Translator); - -}; - - #endif /* SEPARATING_LINE_GROUP_GRAV_HH */ diff --git a/lily/include/separation-item.hh b/lily/include/separation-item.hh new file mode 100644 index 0000000000..a7bfa6e21d --- /dev/null +++ b/lily/include/separation-item.hh @@ -0,0 +1,36 @@ +/* + single-malt-grouping-item.hh -- declare Separation_item + + source file of the GNU LilyPond music typesetter + + (c) 1997--2000 Han-Wen Nienhuys + + */ + +#ifndef SINGLE_MALT_GROUPING_ITEM_HH +#define SINGLE_MALT_GROUPING_ITEM_HH + +#include "lily-proto.hh" + +/** Calc dimensions for the Separating_group_spanner; this has to be + an item to get dependencies correct. It can't be an element_group + since these usually are in a different X_group + + Properties: + + + elements -- list of items. + + no-spacing-rods -- read from elements: boolean that makes Separation_item ignore + this item + +*/ +struct Separation_item +{ + static void set_interface (Score_element*); + static Interval my_width (Score_element*) ; + static void add_item (Score_element*,Item*); +}; + +#endif /* SINGLE_MALT_GROUPING_ITEM_HH */ + diff --git a/lily/include/side-position-interface.hh b/lily/include/side-position-interface.hh index 8ace8fcad8..117fd8caed 100644 --- a/lily/include/side-position-interface.hh +++ b/lily/include/side-position-interface.hh @@ -39,11 +39,11 @@ struct Side_position_interface Score_element * elt_l_; public: Side_position_interface (Score_element const*); - static Real side_position (Score_element const *, Axis); - static Real aligned_on_self (Score_element const *, Axis); - static Real aligned_side (Score_element const *, Axis); - static Real quantised_position (Score_element const*, Axis); - static Real centered_on_parent (Score_element const*, Axis); + static Real side_position (Score_element *, Axis); + static Real aligned_on_self (Score_element *, Axis); + static Real aligned_side (Score_element *, Axis); + static Real quantised_position (Score_element *, Axis); + static Real centered_on_parent (Score_element *, Axis); void set_axis (Axis); void set_minimum_space (Real); void set_padding (Real); diff --git a/lily/include/single-malt-grouping-item.hh b/lily/include/single-malt-grouping-item.hh deleted file mode 100644 index 082a37b517..0000000000 --- a/lily/include/single-malt-grouping-item.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* - single-malt-grouping-item.hh -- declare Single_malt_grouping_item - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys - - */ - -#ifndef SINGLE_MALT_GROUPING_ITEM_HH -#define SINGLE_MALT_GROUPING_ITEM_HH - -#include "item.hh" - -/** Calc dimensions for the Separating_group_spanner; this has to be - an item to get dependencies correct. It can't be an element_group - since these usually are in a different X_group - - It's 1:30 am. Naming suggestions appreciated. - - Properties: - - - elements -- list of items. - - no-spacing-rods -- read from elements: boolean that makes Single_malt_grouping_item ignore - this item - -*/ -class Single_malt_grouping_item : public Item -{ - VIRTUAL_COPY_CONS(Score_element); -public: - Single_malt_grouping_item (SCM); - Interval my_width () const; - void add_item (Item*); -}; - -#endif /* SINGLE_MALT_GROUPING_ITEM_HH */ - diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 9ccb4d65b3..52079f0a5a 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -31,7 +31,7 @@ public: void add_bar (Score_element*); void evaluate_empty (); - static Interval width_callback(Score_element const*, Axis) ; + static Interval width_callback(Score_element *, Axis) ; virtual Real get_bar_size () const; SCM member_before_line_breaking (); diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 3241e27908..4ce355dd4c 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -34,7 +34,7 @@ class Spanner : public Score_element { public: Link_array broken_into_l_arr_; - + Real get_broken_left_end_align () const; // TODO: make virtual and do this for Items as well. Interval_t spanned_rank_iv (); void set_bound (Direction d, Score_element*); @@ -54,7 +54,7 @@ public: protected: void set_my_columns (); VIRTUAL_COPY_CONS(Score_element); - Real get_broken_left_end_align () const; + virtual void do_space_processing (); virtual void do_break_processing (); diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 9734cf17af..202f27f0de 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -21,12 +21,12 @@ class Staff_symbol_referencer_interface { public: - Score_element * elt_l_; + Score_element * elt_l_; // junkme. Staff_symbol_referencer_interface (Score_element const*); - void set_interface (); - bool has_interface_b (); + static void set_interface (Score_element*); + static bool has_interface_b (Score_element*); void set_position (Real); - static Real callback (Score_element const*, Axis a); + static Real callback (Score_element *, Axis a); /** Leading are the lead strips between the sticks (lines) of diff --git a/lily/include/stem-tremolo.hh b/lily/include/stem-tremolo.hh index 2cd904a632..344d1f5568 100644 --- a/lily/include/stem-tremolo.hh +++ b/lily/include/stem-tremolo.hh @@ -10,18 +10,16 @@ #ifndef ABBREV_HH #define ABBREV_HH -#include "item.hh" +#include "lily-proto.hh" +#include "lily-guile.hh" - -class Stem_tremolo : public Item { +class Stem_tremolo +{ public: - Stem * stem_l () const; - SCM member_brew_molecule () const; - + static void set_interface (Score_element*); static Interval dim_callback (Score_element*, Axis); static SCM brew_molecule (SCM); - Stem_tremolo (SCM); - void set_stem (Stem *); + static void set_stem (Score_element*me, Score_element *st); }; #endif /* ABBREV_HH */ diff --git a/lily/include/stem.hh b/lily/include/stem.hh index ed0f619d0f..2897b07d53 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -88,12 +88,12 @@ public: void position_noteheads(); Real stem_end_position () const; - static Real off_callback (Score_element const*, Axis); + static Real off_callback (Score_element *, Axis); Molecule flag () const; SCM member_before_line_breaking (); static SCM before_line_breaking (SCM); - static Interval dim_callback (Score_element const*,Axis); + static Interval dim_callback (Score_element *,Axis); SCM member_brew_molecule() const; void set_spacing_hints () ; diff --git a/lily/include/system-start-delimiter.hh b/lily/include/system-start-delimiter.hh index 659b166514..b5c500c6f7 100644 --- a/lily/include/system-start-delimiter.hh +++ b/lily/include/system-start-delimiter.hh @@ -23,8 +23,8 @@ public: VIRTUAL_COPY_CONS (Score_element); - virtual SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); + static void try_collapse (Score_element*); Molecule staff_bracket (Real) const; Molecule staff_brace (Real) const; diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh deleted file mode 100644 index 8b13789179..0000000000 --- a/lily/include/text-item.hh +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lily/include/tie-column.hh b/lily/include/tie-column.hh index d4ff9f41e7..c8a7b8bca3 100644 --- a/lily/include/tie-column.hh +++ b/lily/include/tie-column.hh @@ -16,13 +16,13 @@ class Tie_column : public Spanner { public: - VIRTUAL_COPY_CONS (Score_element); - void add_tie (Tie*); Tie_column (SCM s); + VIRTUAL_COPY_CONS (Score_element); + static void set_interface (Score_element*me); + static void add_tie (Score_element*me,Tie*); - SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); - void set_directions (); + static void set_directions (Score_element*me); }; #endif /* TIE_COLUMN_HH */ diff --git a/lily/include/tie.hh b/lily/include/tie.hh index 92a2b24719..347c0be237 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -20,29 +20,24 @@ class Tie : public Spanner { public: Tie (SCM); - void set_head (Direction, Item*head_l); + static void set_head (Score_element*,Direction, Item*head_l); + static void set_interface (Score_element*); VIRTUAL_COPY_CONS(Score_element); - - Rhythmic_head* head (Direction) const; - Real position_f () const; + static Rhythmic_head* head (Score_element*,Direction) ; + static Real position_f (Score_element*) ; static SCM brew_molecule (SCM); - Direction get_default_dir() const; - SCM member_brew_molecule () const; - Array get_encompass_offset_arr () const; - Bezier get_curve () const; + static Direction get_default_dir(Score_element*) ; + static SCM after_line_breaking (SCM); + /* JUNKME */ + Array get_encompass_offset_arr () const; + Bezier get_curve () const; Drul_array dy_f_drul_; Drul_array dx_f_drul_; - - virtual void do_add_processing (); - SCM member_after_line_breaking (); - static SCM after_line_breaking (SCM); - virtual Array get_rods () const; - Array get_controls () const; }; diff --git a/lily/include/time-signature-engraver.hh b/lily/include/time-signature-engraver.hh deleted file mode 100644 index 11959f816f..0000000000 --- a/lily/include/time-signature-engraver.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - time_signature-engraver.hh -- declare Time_signature_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--2000 Han-Wen Nienhuys -*/ - - -#ifndef TIME_SIG_ENGRAVER_HH -#define TIME_SIG_ENGRAVER_HH - -#include "engraver.hh" - -/** - generate time_signatures. - */ -class Time_signature_engraver : public Engraver { -protected: - virtual void do_process_music(); - virtual void do_pre_move_processing(); -public: - VIRTUAL_COPY_CONS(Translator); - Time_signature * time_signature_p_; - - Time_signature_engraver(); -}; -#endif // TIME_SIG_ENGRAVER_HH diff --git a/lily/include/time-signature.hh b/lily/include/time-signature.hh index 80a08ac7a6..f25d12c866 100644 --- a/lily/include/time-signature.hh +++ b/lily/include/time-signature.hh @@ -8,34 +8,20 @@ #define METER_HH #include "item.hh" -#include "array.hh" -#include "real.hh" /** Print a time_signature sign. - TODO: - C style time_signatures, 2+3+2/8 time_signatures, alla breve. + TODO: + + 2+3+2/8 time_signatures */ -class Time_signature: public Item +struct Time_signature { - Molecule special_time_signature (String,int,int) const; - Molecule time_signature (int, int)const; - -public: - SCM member_brew_molecule() const; - - Time_signature (SCM); - static SCM brew_molecule (SCM); - - - /* - TODO: make this SCM! - */ - Array args_; - - VIRTUAL_COPY_CONS(Score_element); + static Molecule special_time_signature (Score_element*,String,int,int) ; + static Molecule time_signature (Score_element*,int, int); + static SCM brew_molecule (SCM); }; #endif // METER_HH diff --git a/lily/include/tuplet-spanner.hh b/lily/include/tuplet-spanner.hh index 90496b424e..73370baea3 100644 --- a/lily/include/tuplet-spanner.hh +++ b/lily/include/tuplet-spanner.hh @@ -7,7 +7,7 @@ #ifndef Tuplet_spanner_HH #define Tuplet_spanner_HH -#include "spanner.hh" +#include "lily-guile.hh" /** supportable plet: triplets, eentweetjes, ottava, etc. @@ -16,26 +16,21 @@ todo: handle breaking elegantly. */ -class Tuplet_spanner : public Spanner +class Tuplet_spanner { public: - Tuplet_spanner (SCM); static SCM brew_molecule (SCM); - + static void set_interface (Score_element*); - void add_column (Note_column*); - void add_beam (Beam*); + static void add_column (Score_element*me,Item*); + static void add_beam (Score_element*me,Score_element*); - void calc_dy (Real *) const; - void calc_position_and_height (Real*,Real *dy)const; + static void calc_dy (Score_element*,Real *) ; + static void calc_position_and_height (Score_element*,Real*,Real *dy); - SCM member_after_line_breaking (); static SCM after_line_breaking (SCM); - SCM member_brew_molecule () const; - VIRTUAL_COPY_CONS(Score_element); - - Direction get_default_dir () const; + static Direction get_default_dir (Score_element*); }; #endif // Tuplet_spanner_HH diff --git a/lily/include/volta-spanner.hh b/lily/include/volta-spanner.hh index ba28f37e6a..c95961909b 100644 --- a/lily/include/volta-spanner.hh +++ b/lily/include/volta-spanner.hh @@ -12,20 +12,14 @@ /** Volta bracket with number */ -class Volta_spanner : public Spanner +class Volta_spanner { public: - Volta_spanner (SCM); + static void set_interface (Score_element*); static SCM brew_molecule (SCM); - void add_column (Note_column*); - void add_bar (Bar*); - - SCM member_brew_molecule () const; - VIRTUAL_COPY_CONS (Score_element); + static void add_column (Score_element*, Score_element*col); + static void add_bar (Score_element*me, Item*bar); - - SCM member_after_line_breaking (); - static SCM after_line_breaking (SCM); }; #endif // VOLTA_SPANNER_HH diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 524d32cffa..3d5f48e83a 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -32,8 +32,8 @@ public: VIRTUAL_COPY_CONS(Translator); Key_change_req * keyreq_l_; - Key_item * item_p_; - Protected_scm old_accs_; + Item * item_p_; + Protected_scm old_accs_; // ugh. -> property protected: virtual void do_creation_processing(); @@ -56,16 +56,15 @@ Key_engraver::create_key (bool def) { if (!item_p_) { - item_p_ = new Key_item ( get_property ("basicKeyProperties")); - + item_p_ = new Item ( get_property ("basicKeyProperties")); + item_p_->set_elt_property ("c0-position", gh_int2scm (0)); // todo: put this in basic props. item_p_->set_elt_property ("old-accidentals", old_accs_); item_p_->set_elt_property ("new-accidentals", get_property ("keySignature")); - Staff_symbol_referencer_interface st (item_p_); - st.set_interface (); + Staff_symbol_referencer_interface::set_interface (item_p_); SCM prop = get_property ("keyOctaviation"); bool multi = to_boolean (prop); diff --git a/lily/key-item.cc b/lily/key-item.cc index 77a9e10418..871abd31ce 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -8,20 +8,13 @@ keyplacement by Mats Bengtsson */ -#include "group-interface.hh" +#include "item.hh" #include "key-item.hh" #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" #include "staff-symbol-referencer.hh" -Key_item::Key_item (SCM s) - : Item (s) -{ - set_elt_property ("c0-position", gh_int2scm (0)); -} - - /* FIXME: too much hardcoding here. */ @@ -34,18 +27,18 @@ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ the thinking to other parties. */ int -Key_item::calculate_position(SCM pair) const +Key_item::calculate_position(Score_element *ki, SCM pair) { int p = gh_scm2int (gh_car (pair)); int a = gh_scm2int (gh_cdr (pair)); - - if (to_boolean (get_elt_property ("multi-octave"))) + int c0p = gh_scm2int (ki->get_elt_property ("c0-position")); + if (to_boolean (ki->get_elt_property ("multi-octave"))) { - return p + gh_scm2int (get_elt_property ("c0-position")); + return p + c0p; } else { // Find the c in the range -4 through 2 - int from_bottom_pos = gh_scm2int (get_elt_property ("c0-position")) + 4; + int from_bottom_pos = c0p + 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; @@ -78,17 +71,18 @@ Key_item::calculate_position(SCM pair) const TODO - space the `natural' signs wider */ -GLUE_SCORE_ELEMENT(Key_item,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Key_item,brew_molecule); SCM -Key_item::member_brew_molecule () const +Key_item::brew_molecule (SCM smob) { - Molecule mol; + Score_element*me =unsmob_element (smob); - Staff_symbol_referencer_interface si (this); + + Staff_symbol_referencer_interface si (me); Real inter = si.staff_space ()/2.0; - SCM newas = get_elt_property ("new-accidentals"); - + SCM newas = me->get_elt_property ("new-accidentals"); + Molecule mol; /* SCM lists are stacks, so we work from right to left, ending with the cancellation signature. @@ -96,14 +90,15 @@ Key_item::member_brew_molecule () const for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s)) { int a = gh_scm2int (gh_cdar (s)); - Molecule m = lookup_l ()->afm_find ("accidentals-" + to_str (a)); - m.translate_axis (calculate_position(gh_car (s)) * inter, Y_AXIS); + Molecule m = me->lookup_l ()->afm_find ("accidentals-" + to_str (a)); + m.translate_axis (calculate_position(me, gh_car (s)) * inter, Y_AXIS); mol.add_at_edge (X_AXIS, LEFT, m, 0); } - - if (break_status_dir () != RIGHT) + + Item *it = dynamic_cast (me) ; + if (it->break_status_dir () != RIGHT) { - SCM old = get_elt_property ("old-accidentals"); + SCM old = me->get_elt_property ("old-accidentals"); /* Add half a space between cancellation and key sig. @@ -112,7 +107,7 @@ Key_item::member_brew_molecule () const Interval x(0, inter); Interval y(0,0); - mol.add_at_edge (X_AXIS, LEFT, lookup_l()->blank (Box(x,y)),0); + mol.add_at_edge (X_AXIS, LEFT, me->lookup_l()->blank (Box(x,y)),0); for (; gh_pair_p (old); old = gh_cdr (old)) { @@ -127,9 +122,9 @@ Key_item::member_brew_molecule () const if (found == SCM_EOL || gh_cdr (found) != gh_cdar (old)) { - Molecule m =lookup_l ()->afm_find ("accidentals-0"); + Molecule m =me->lookup_l ()->afm_find ("accidentals-0"); - m.translate_axis (calculate_position(gh_car(old)) * inter, Y_AXIS); + m.translate_axis (calculate_position (me, gh_car (old)) * inter, Y_AXIS); mol.add_at_edge (X_AXIS, LEFT, m,0); } } diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 62bd6a153d..274a558a07 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -101,6 +101,17 @@ Line_of_score::output_lines () progress_indication (to_str (i)); progress_indication ("]"); } + + if (i < broken_into_l_arr_.size () - 1) + { + SCM lastcol = gh_car (line_l->get_elt_pointer ("columns")); + Score_element* e = unsmob_element (lastcol); + SCM inter = e->get_elt_property ("between-system-string"); + if (gh_string_p (inter)) + { + pscore_l_->outputter_l_->output_string (inter); + } + } } } @@ -179,7 +190,6 @@ Line_of_score::add_column (Paper_column*p) set_elt_pointer ("columns", gh_cons (p->self_scm_, cs)); Axis_group_interface (this).add_element (p); - typeset_element (p); } diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 9fcde99872..96e4cec5df 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -65,10 +65,10 @@ Local_key_engraver::do_creation_processing () void Local_key_engraver::process_acknowledged () { - SCM localsig = get_property ("localKeySignature"); - if (!key_item_p_ && mel_l_arr_.size()) { + SCM localsig = get_property ("localKeySignature"); + SCM f = get_property ("forgetAccidentals"); bool forget = to_boolean (f); for (int i=0; i < mel_l_arr_.size(); i++) @@ -100,7 +100,7 @@ Local_key_engraver::process_acknowledged () key_item_p_ = new Local_key_item (get_property ("basicLocalKeyProperties")); Side_position_interface (key_item_p_).set_axis (X_AXIS); Side_position_interface (key_item_p_).set_direction (LEFT); - Staff_symbol_referencer_interface (key_item_p_).set_interface (); + Staff_symbol_referencer_interface::set_interface (key_item_p_); announce_element (Score_element_info (key_item_p_, 0)); } @@ -137,13 +137,13 @@ Local_key_engraver::process_acknowledged () #endif } } - } + daddy_trans_l_->set_property ("localKeySignature", localsig); + } /* - UGH ! */ if (key_item_p_ && grace_align_l_) @@ -192,12 +192,12 @@ Local_key_engraver::acknowledge_element (Score_element_info info) { grace_align_l_ = gai; } - Note_req * note_l = dynamic_cast (info.req_l_); - Rhythmic_head * note_head = dynamic_cast (info.elem_l_); - if (he_gr != selfgr) return; + Note_req * note_l = dynamic_cast (info.req_l_); + Rhythmic_head * note_head = dynamic_cast (info.elem_l_); + if (note_l && note_head) { mel_l_arr_.push (note_l); @@ -205,12 +205,12 @@ Local_key_engraver::acknowledge_element (Score_element_info info) } else if (Tie * tie_l = dynamic_cast (info.elem_l_)) { - tied_l_arr_.push (tie_l->head (RIGHT)); + tied_l_arr_.push (Tie::head (tie_l, RIGHT)); } } /* - ugh. deep_copy uses lots of space. + ugh. repeated deep_copy generates lots of garbage. */ void Local_key_engraver::do_process_music() @@ -227,6 +227,7 @@ Local_key_engraver::do_process_music() else if (last_keysig_ != sig) { daddy_trans_l_->set_property ("localKeySignature", ly_deep_copy (sig)); + last_keysig_ = sig; } } diff --git a/lily/lookup.cc b/lily/lookup.cc index 61326091ea..a139f21ca5 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -220,7 +220,7 @@ sanitise_PS_string (String t) } /** -TODO: move into Text_item +TODO: move into Text_item. UGH: paper_l argument shoudl be junked. */ Molecule Lookup::text (String style, String text, Paper_def *paper_l) diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 943092d400..762deb8825 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -57,9 +57,9 @@ Multi_measure_rest_engraver::acknowledge_element (Score_element_info i) if (Bar *c = dynamic_cast (i.elem_l_)) { if (mmrest_p_) - mmrest_p_->add_column (c); + Multi_measure_rest::add_column (mmrest_p_,c); if (lastrest_p_) - lastrest_p_->add_column (c); + Multi_measure_rest::add_column (mmrest_p_,c); } } @@ -110,8 +110,8 @@ Multi_measure_rest_engraver::do_process_music () if (busy_span_req_l_ && !mmrest_p_) { mmrest_p_ = new Multi_measure_rest (get_property ("basicMultiMeasureRestProperties")); - Staff_symbol_referencer_interface si (mmrest_p_); - si.set_interface (); + Multi_measure_rest::set_interface (mmrest_p_); + Staff_symbol_referencer_interface::set_interface (mmrest_p_); announce_element (Score_element_info (mmrest_p_, busy_span_req_l_)); start_measure_i_ diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 97d1401c17..72b5468993 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -19,32 +19,34 @@ #include "group-interface.hh" #include "stem.hh" #include "staff-symbol-referencer.hh" - -Multi_measure_rest::Multi_measure_rest (SCM s) - : Spanner (s) +void +Multi_measure_rest::set_interface (Score_element*me) { - set_elt_pointer ("columns", SCM_EOL); + me->set_elt_pointer ("columns", SCM_EOL); } +Multi_measure_rest::Multi_measure_rest (SCM s) + : Spanner(s) +{} /* [TODO] 17 * variable-sized multi-measure rest symbol: |====| ?? */ - -GLUE_SCORE_ELEMENT(Multi_measure_rest,brew_molecule); - +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Multi_measure_rest,brew_molecule); SCM -Multi_measure_rest::member_brew_molecule () const +Multi_measure_rest::brew_molecule (SCM smob) { + Score_element *me = unsmob_element (smob); + Spanner * sp = dynamic_cast (me); Real staff_space - = Staff_symbol_referencer_interface (this).staff_space (); + = Staff_symbol_referencer_interface (me).staff_space (); Interval sp_iv; Direction d = LEFT; do { - Item * col = get_bound (d)->column_l (); + Item * col = sp->get_bound (d)->column_l (); Interval coldim = col->extent (X_AXIS) + col->relative_coordinate (0, X_AXIS); @@ -55,7 +57,7 @@ Multi_measure_rest::member_brew_molecule () const Molecule mol; Real x_off = 0.0; - Real rx = get_bound (LEFT)->relative_coordinate (0, X_AXIS); + Real rx = sp->get_bound (LEFT)->relative_coordinate (0, X_AXIS); /* we gotta stay clear of sp_iv, so move a bit to the right if needed. @@ -71,14 +73,14 @@ Multi_measure_rest::member_brew_molecule () const Molecule s; int measures = 1; - SCM m (get_elt_property ("measure-count")); + SCM m (me->get_elt_property ("measure-count")); if (gh_number_p (m)) { measures = gh_scm2int (m); } - if (measures <= paper_l() ->get_var ("multi_measure_rest_expand_limit")) + if (measures <= me->paper_l() ->get_var ("multi_measure_rest_expand_limit")) { /* Build a rest from smaller parts. Distances inbetween are @@ -105,9 +107,9 @@ Multi_measure_rest::member_brew_molecule () const } Real pad = s.empty_b () - ? 0.0 : paper_l ()->get_var ("multi_measure_rest_padding"); + ? 0.0 : me->paper_l ()->get_var ("multi_measure_rest_padding"); - Molecule r (lookup_l ()->afm_find ("rests-" + to_str (k))); + Molecule r (me->lookup_l ()->afm_find ("rests-" + to_str (k))); if (k == 0) r.translate_axis (staff_space, Y_AXIS); @@ -120,14 +122,14 @@ Multi_measure_rest::member_brew_molecule () const else { String idx = ("rests-") + to_str (-4); - s = lookup_l ()->afm_find (idx); + s = me->lookup_l ()->afm_find (idx); } mol.add_molecule (s); if (measures > 1) { - Molecule s (lookup_l ()->text ("number", to_str (measures), paper_l ())); + Molecule s (me->lookup_l ()->text ("number", to_str (measures), me->paper_l ())); s.align_to (X_AXIS, CENTER); s.translate_axis (3.0 * staff_space, Y_AXIS); mol.add_molecule (s); @@ -139,19 +141,13 @@ Multi_measure_rest::member_brew_molecule () const /* UGH. JUNKME elt prop "columns" isn't really needed. */ - - - - void -Multi_measure_rest::add_column (Item* c) +Multi_measure_rest::add_column (Score_element*me,Item* c) { - Pointer_group_interface gi (this, "columns"); + Pointer_group_interface gi (me, "columns"); gi.add_element (c); - add_bound_item (this, c); - - add_dependency (c); + add_bound_item (dynamic_cast (me),c); } diff --git a/lily/note-head.cc b/lily/note-head.cc index c072d2f461..035b18a378 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -16,8 +16,6 @@ #include "dimension-cache.hh" #include "staff-symbol-referencer.hh" - - /* build a ledger line for small pieces. */ diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index fa72a59e2f..49524aea21 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -87,8 +87,8 @@ Note_heads_engraver::do_process_music() { Rhythmic_head *note_p = new Rhythmic_head (get_property ("basicNoteHeadProperties")); - Staff_symbol_referencer_interface si (note_p); - si.set_interface (); + Staff_symbol_referencer_interface::set_interface (note_p); + Note_req * note_req_l = note_req_l_arr_[i]; @@ -100,8 +100,7 @@ Note_heads_engraver::do_process_music() { Item * d = new Item (get_property ("basicDotsProperties")); - Staff_symbol_referencer_interface sd (d); - sd.set_interface (); + Staff_symbol_referencer_interface::set_interface (d); note_p->set_dots (d); @@ -114,7 +113,8 @@ Note_heads_engraver::do_process_music() announce_element (Score_element_info (d,0)); dot_p_arr_.push (d); } - si.set_position(note_req_l->pitch_.steps ()); + + note_p->set_elt_property("staff-position", gh_int2scm (note_req_l->pitch_.steps ())); Score_element_info itinf (note_p,note_req_l); announce_element (itinf); diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 5ab553257f..b7e18f9aa4 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -94,12 +94,9 @@ Paper_column::column_l () const return (Paper_column*)(this); } -Paper_column::Paper_column (Moment w) - : Item (SCM_EOL) // guh.? +Paper_column::Paper_column (SCM l) + : Item (l) // guh.? { - SCM when = smobify (new Moment (w)); - set_elt_property ("when", when); - Axis_group_interface (this).set_interface (); Axis_group_interface (this).set_axes (X_AXIS, X_AXIS); set_elt_pointer ("bounded-by-me", SCM_EOL); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 8329051981..0277f753a7 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -231,5 +231,8 @@ Paper_outputter::output_int_def (String k, int v) - - +void +Paper_outputter::output_string (SCM str) +{ + *stream_p_ << ly_scm2string (str); +} diff --git a/lily/repeat-engraver.cc b/lily/repeat-engraver.cc index 72572c3891..6ed4bf9bb7 100644 --- a/lily/repeat-engraver.cc +++ b/lily/repeat-engraver.cc @@ -6,7 +6,8 @@ (c) 1998--2000 Jan Nieuwenhuizen */ -#include "repeat-engraver.hh" +#include "engraver.hh" +#include "cons.hh" #include "bar.hh" #include "bar-engraver.hh" #include "musical-request.hh" @@ -20,6 +21,56 @@ #include "note-column.hh" #include "paper-def.hh" #include "music-list.hh" +#include "side-position-interface.hh" + +struct Bar_create_event +{ + Moment when_; + bool bar_b_; + bool last_b_; + String type_; + Bar_create_event(); + Bar_create_event (Moment w, String s); + Bar_create_event (Moment w, int i, int j); +}; + +int compare (Bar_create_event const & c1, Bar_create_event const &c2) +{ + return (c1.when_ - c2.when_).sign(); +} + +/** + Generate repeat-bars |: :| for repeated-music + */ +class Repeat_engraver : public Engraver +{ +public: + VIRTUAL_COPY_CONS(Translator); + Repeat_engraver (); +protected: + virtual void acknowledge_element (Score_element_info i); + virtual void do_removal_processing (); + virtual bool do_try_music (Music *req_l); + virtual void do_process_music(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing (); + void queue_events (); + +private: + Repeated_music *repeated_music_l_; + bool done_this_one_b_; + + /* + Royal_brackla_create_queue is only two Whiskies away. :-) + */ + Cons *create_barmoments_queue_; + + Spanner * volta_span_p_; + Spanner* end_volta_span_p_; +}; + + + ADD_THIS_TRANSLATOR (Repeat_engraver); @@ -180,7 +231,8 @@ Repeat_engraver::do_process_music () else { assert (!volta_span_p_); - volta_span_p_ = new Volta_spanner (get_property ("basicVoltaSpannerProperties")); + volta_span_p_ = new Spanner (get_property ("basicVoltaSpannerProperties")); + Volta_spanner::set_interface (volta_span_p_); announce_element (Score_element_info (volta_span_p_,0)); volta_span_p_->set_elt_property ("text", ly_str02scm (t.ch_C())); @@ -212,16 +264,16 @@ Repeat_engraver::acknowledge_element (Score_element_info i) if (Note_column *c = dynamic_cast (i.elem_l_)) { if (volta_span_p_) - volta_span_p_->add_column (c); + Volta_spanner::add_column (volta_span_p_,c); if (end_volta_span_p_) - end_volta_span_p_->add_column (c); + Volta_spanner::add_column (end_volta_span_p_,c); } if (Bar *c = dynamic_cast (i.elem_l_)) { if (volta_span_p_) - volta_span_p_->add_bar (c); + Volta_spanner::add_bar (volta_span_p_,c); if (end_volta_span_p_) - end_volta_span_p_ ->add_bar(c); + Volta_spanner::add_bar(end_volta_span_p_ , c); } } @@ -257,6 +309,8 @@ Repeat_engraver::do_pre_move_processing () { if (end_volta_span_p_) { + Side_position_interface (end_volta_span_p_).add_staff_support (); + typeset_element (end_volta_span_p_ ); end_volta_span_p_ =0; } diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 2a38b27d2b..969741809b 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -20,7 +20,7 @@ #include "duration.hh" Real -Rest_collision::force_shift_callback (Score_element const*them, Axis a) +Rest_collision::force_shift_callback (Score_element *them, Axis a) { assert (a == Y_AXIS); diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index ccc80a3f82..35df3f18ec 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -65,8 +65,8 @@ Rest_engraver::do_process_music () if (rest_req_l_ && !rest_p_) { rest_p_ = new Rhythmic_head (get_property ("basicRestProperties")); - Staff_symbol_referencer_interface si (rest_p_); - si.set_interface (); + Staff_symbol_referencer_interface::set_interface (rest_p_); + rest_p_->set_elt_property ("duration-log", gh_int2scm (rest_req_l_->duration_.durlog_i_)); @@ -75,8 +75,8 @@ Rest_engraver::do_process_music () { dot_p_ = new Item (get_property ("basicDotsProperties")); - Staff_symbol_referencer_interface si (dot_p_); - si.set_interface (); + Staff_symbol_referencer_interface::set_interface (dot_p_); + rest_p_->set_dots (dot_p_); dot_p_->set_parent (rest_p_, Y_AXIS); diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index dba6143faa..632beeb3af 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -21,7 +21,7 @@ class Rhythmic_column_engraver :public Engraver Link_array grace_slur_endings_; Stem * stem_l_; Note_column *ncol_p_; - Dot_column *dotcol_l_; + Score_element *dotcol_l_; protected: VIRTUAL_COPY_CONS(Translator); @@ -67,7 +67,7 @@ Rhythmic_column_engraver::process_acknowledged () if (ncol_p_) { if (dotcol_l_ - && !dotcol_l_->parent_l(X_AXIS)) + && !dotcol_l_->parent_l (X_AXIS)) { ncol_p_->set_dotcol (dotcol_l_); } @@ -108,9 +108,10 @@ Rhythmic_column_engraver::acknowledge_element (Score_element_info i) { rhead_l_arr_.push (r); } - else if (Dot_column*d =dynamic_cast (item)) + else if (item + && to_boolean (item->get_elt_property ("dot-column-interface"))) { - dotcol_l_ = d; + dotcol_l_ = item; } else if (Slur *s = dynamic_cast (i.elem_l_)) { diff --git a/lily/rod.cc b/lily/rod.cc index 90af9edf1b..7d287f84ba 100644 --- a/lily/rod.cc +++ b/lily/rod.cc @@ -10,7 +10,7 @@ #include "paper-column.hh" #include "debug.hh" #include "dimensions.hh" -#include "single-malt-grouping-item.hh" +#include "separation-item.hh" Rod::Rod () diff --git a/lily/score-element-info.cc b/lily/score-element-info.cc index 92c1abd453..c437a655d5 100644 --- a/lily/score-element-info.cc +++ b/lily/score-element-info.cc @@ -35,7 +35,7 @@ Score_element_info::origin_trans_l_arr (Translator* end) const do { r.push (t); t = t->daddy_trans_l_; - } while (t != end->daddy_trans_l_); + } while (t && t != end->daddy_trans_l_); return r; } diff --git a/lily/score-element.cc b/lily/score-element.cc index 5e929206f4..c79813468c 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -138,14 +138,14 @@ Score_element::set_elt_pointer (const char* k, SCM v) Interval -Score_element::molecule_extent (Score_element const *s, Axis a ) +Score_element::molecule_extent (Score_element *s, Axis a) { Molecule m = s->get_molecule (); return m.extent(a); } Interval -Score_element::preset_extent (Score_element const *s , Axis a ) +Score_element::preset_extent (Score_element *s , Axis a) { SCM ext = s->get_elt_property ((a == X_AXIS) ? "extent-X" @@ -508,7 +508,7 @@ Score_element::get_offset (Axis a) const Interval -Score_element::point_dimension_callback (Score_element const* , Axis) +Score_element::point_dimension_callback (Score_element* , Axis) { return Interval (0,0); } @@ -529,7 +529,7 @@ Score_element::extent (Axis a) const } else if (!d->valid_b_) { - d->dim_= (*d->extent_callback_l_ ) (this, a); + d->dim_= (*d->extent_callback_l_ ) ((Score_element*)this, a); d->valid_b_ = true; } diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index c8933e0396..8c878da7bf 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -31,9 +31,22 @@ void Score_engraver::prepare (Moment w) { Global_translator::prepare (w); - set_columns (new Paper_column (w), new Paper_column (w)); + SCM props = get_property (ly_symbol2scm ("basicPaperColumnProperties")); + set_columns (new Paper_column (props), new Paper_column (props)); + + SCM when = smobify (new Moment (w)); + command_column_l_->set_elt_property ("when", when); + musical_column_l_->set_elt_property ("when", when); command_column_l_->set_elt_property ("breakable", SCM_BOOL_T); + + Score_element_info i1(command_column_l_, 0), i2 (musical_column_l_,0); + + i1.origin_trans_l_ = this; + i2.origin_trans_l_ = this; + announce_element (i1); + announce_element (i2); + post_move_processing(); } @@ -181,19 +194,10 @@ Score_engraver::set_columns (Paper_column *new_command_l, { if (*current[i]) { - scoreline_l_->add_column ((*current[i])); + scoreline_l_->add_column ((*current[i])); if (!(*current[i])->used_b()) { - /* - We're forgetting about this column. Dump it, and make SCM - forget it. - - FIXME: we should have another way of not putting this - column into the spacing problem. Maybe we shouldn't - even prevent this. - - */ - (*current[i])->suicide (); + (*current[i])->suicide (); *current[i] =0; } } diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 9fbf4f567d..e76d3c41a7 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -9,15 +9,15 @@ #include "engraver.hh" #include "script-column.hh" +#include "item.hh" #include "side-position-interface.hh" -#include "dimension-cache.hh" /** Find potentially colliding scripts, and put them in a Script_column, that will fix the collisions. */ class Script_column_engraver : public Engraver { - Script_column *scol_p_; + Score_element *scol_p_; Link_array script_l_arr_; public: @@ -73,14 +73,16 @@ Script_column_engraver::process_acknowledged () { if (!scol_p_ && script_l_arr_.size () > 1) { - scol_p_ = new Script_column (SCM_EOL); + scol_p_ = new Item (get_property ("basicScriptColumnProperties")); + scol_p_->set_elt_pointer ("scripts", SCM_EOL); + announce_element (Score_element_info (scol_p_, 0)); } if (scol_p_) { for (int i=0; i < script_l_arr_.size (); i++) - scol_p_->add_staff_sided (script_l_arr_[i]); + Script_column::add_staff_sided (scol_p_, script_l_arr_[i]); script_l_arr_.clear (); } } diff --git a/lily/script-column.cc b/lily/script-column.cc index cc8cfcacb0..7d047b97f5 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -12,28 +12,21 @@ #include "group-interface.hh" void -Script_column::add_staff_sided (Item *i) +Script_column::add_staff_sided (Score_element *me, Item *i) { SCM p = i->get_elt_property ("script-priority"); if (!gh_number_p (p)) return; - - Pointer_group_interface gi (this, "scripts"); + Pointer_group_interface gi (me, "scripts"); gi.add_element (i); - add_dependency (i); -} - -Script_column::Script_column (SCM s) - : Item (s) -{ - set_elt_pointer ("scripts", SCM_EOL); + me->add_dependency (i); } static int -staff_side_compare (Item * const &i1, - Item * const &i2) +staff_side_compare (Score_element * const &i1, + Score_element * const &i2) { SCM p1 = i1->get_elt_property ("script-priority"); SCM p2 = i2->get_elt_property ("script-priority"); @@ -41,13 +34,15 @@ staff_side_compare (Item * const &i1, return gh_scm2int (p1) - gh_scm2int (p2); } -GLUE_SCORE_ELEMENT(Script_column,before_line_breaking); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Script_column,before_line_breaking); + SCM -Script_column::member_before_line_breaking () +Script_column::before_line_breaking (SCM smob) { - Drul_array > arrs; - Link_array staff_sided - = Pointer_group_interface__extract_elements (this, (Item*)0, "scripts"); + Score_element* me = unsmob_element (smob); + Drul_array > arrs; + Link_array staff_sided + = Pointer_group_interface__extract_elements (me, (Score_element*)0, "scripts"); for (int i=0; i < staff_sided.size (); i++) @@ -58,11 +53,11 @@ Script_column::member_before_line_breaking () Direction d = DOWN; do { - Link_array &arr(arrs[d]); + Link_array &arr(arrs[d]); arr.sort (staff_side_compare); - Item * last = 0; + Score_element * last = 0; for (int i=0; i < arr.size (); i++) { Side_position_interface s (arr[i]); diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 04f8bf4f8d..a12f671bbd 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -71,6 +71,8 @@ Script_engraver::do_process_music() } // todo -> use result of articulation-to-scriptdef directly as basic prop list. Script *p =new Script (get_property ("basicScriptProperties")); + + p->add_offset_callback (Side_position_interface::centered_on_parent, X_AXIS); Side_position_interface stafy (p); diff --git a/lily/script.cc b/lily/script.cc index 326667e7b4..5ad45f28ca 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -20,40 +20,29 @@ Script ::Script (SCM s) } Molecule -Script::get_molecule(Direction d) const +Script::get_molecule(Score_element * me, Direction d) { - SCM s = get_elt_property ("molecule"); + SCM s = me->get_elt_property ("molecule"); assert (gh_pair_p (s)); SCM key = gh_car (s); if (key == ly_symbol2scm ("feta")) { - return lookup_l ()->afm_find ("scripts-" + + return me->lookup_l ()->afm_find ("scripts-" + ly_scm2string (index_cell (gh_cdr (s), d))); } else if (key == ly_symbol2scm ("accordion")) { - return lookup_l ()->accordion (gh_cdr (s), paper_l()->get_var("interline")); + return me->lookup_l ()->accordion (gh_cdr (s), me->paper_l()->get_var("interline")); } - - else assert (false); + else + assert (false); return Molecule (); } -GLUE_SCORE_ELEMENT(Script,before_line_breaking); -SCM -Script::member_before_line_breaking () -{ - /* - center my self on the note head. - */ - Score_element * e = parent_l(X_AXIS); - translate_axis (e->extent (X_AXIS).center (), X_AXIS); - return SCM_UNDEFINED; -} GLUE_SCORE_ELEMENT(Script,after_line_breaking); SCM @@ -67,17 +56,18 @@ Script::member_after_line_breaking () } -GLUE_SCORE_ELEMENT(Script,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Script,brew_molecule); SCM -Script::member_brew_molecule () const +Script::brew_molecule (SCM smob) { + Score_element *me= unsmob_element (smob); Direction dir = DOWN; - SCM d = get_elt_property ("direction"); + SCM d = me->get_elt_property ("direction"); if (isdir_b (d)) dir = to_dir (d); - return get_molecule (dir).create_scheme(); + return get_molecule (me, dir).create_scheme(); } diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 9ce1156d17..d627cb6da1 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -8,19 +8,19 @@ */ #include "separating-group-spanner.hh" -#include "single-malt-grouping-item.hh" +#include "separation-item.hh" #include "paper-column.hh" #include "paper-def.hh" #include "dimensions.hh" #include "group-interface.hh" static Rod -make_rod (Single_malt_grouping_item *l, Single_malt_grouping_item *r) +make_rod (Item *l, Item *r) { Rod rod; - Interval li (l->my_width ()); - Interval ri (r->my_width ()); + Interval li (Separation_item::my_width (l)); + Interval ri (Separation_item::my_width (r)); rod.item_l_drul_[LEFT] =l; rod.item_l_drul_[RIGHT]=r; @@ -48,17 +48,17 @@ Separating_group_spanner::get_rods () const SCM elt = gh_cadr (s); SCM next_elt = gh_car (s); - Single_malt_grouping_item *l = dynamic_cast (unsmob_element (elt)); - Single_malt_grouping_item *r = dynamic_cast (unsmob_element ( next_elt)); + Item *l = dynamic_cast (unsmob_element (elt)); + Item *r = dynamic_cast (unsmob_element ( next_elt)); if (!r || !l) continue; - Single_malt_grouping_item *lb - = dynamic_cast(l->find_prebroken_piece (RIGHT)); + Item *lb + = dynamic_cast(l->find_prebroken_piece (RIGHT)); - Single_malt_grouping_item *rb - = dynamic_cast(r->find_prebroken_piece (LEFT)); + Item *rb + = dynamic_cast(r->find_prebroken_piece (LEFT)); a.push (make_rod(l, r)); if (lb) @@ -99,7 +99,7 @@ Separating_group_spanner::get_rods () const } void -Separating_group_spanner::add_spacing_unit (Single_malt_grouping_item*i) +Separating_group_spanner::add_spacing_unit (Item*i) { Pointer_group_interface (this, "elements").add_element (i); add_dependency (i); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index a46608d0ab..8b5c2f2327 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -7,11 +7,27 @@ */ -#include "separating-line-group-engraver.hh" #include "separating-group-spanner.hh" -#include "single-malt-grouping-item.hh" +#include "separation-item.hh" #include "paper-column.hh" #include "paper-def.hh" +#include "engraver.hh" + +class Separating_line_group_engraver : public Engraver +{ +protected: + Item * break_malt_p_; + Item * nobreak_malt_p_; + Separating_group_spanner * sep_span_p_; + + virtual void acknowledge_element (Score_element_info); + virtual void do_creation_processing (); + virtual void do_removal_processing (); + virtual void do_pre_move_processing (); +public: + Separating_line_group_engraver (); + VIRTUAL_COPY_CONS (Translator); +}; Separating_line_group_engraver::Separating_line_group_engraver () { @@ -43,20 +59,20 @@ Separating_line_group_engraver::acknowledge_element (Score_element_info i) if (it && !it->parent_l (X_AXIS)) { bool ib =it->breakable_b (); - Single_malt_grouping_item *&p_ref_ (ib ? break_malt_p_ - : nobreak_malt_p_); + Item *&p_ref_ (ib ? break_malt_p_ + : nobreak_malt_p_); if (!p_ref_) { p_ref_ - = new Single_malt_grouping_item + = new Item (get_property ("basicSingleMaltGroupingItemProperties")); if (ib) p_ref_->set_elt_property ("breakable", SCM_BOOL_T); announce_element (Score_element_info (p_ref_, 0)); } - p_ref_->add_item (it); + Separation_item::add_item (p_ref_,it); } } diff --git a/lily/separation-item.cc b/lily/separation-item.cc new file mode 100644 index 0000000000..f51345bdc2 --- /dev/null +++ b/lily/separation-item.cc @@ -0,0 +1,70 @@ +/* + single-malt-grouping-item.cc -- implement Separation_item + + source file of the GNU LilyPond music typesetter + + (c) 1998--2000 Han-Wen Nienhuys + + */ + +#include "separation-item.hh" +#include "paper-column.hh" +#include "debug.hh" +#include "group-interface.hh" + +void +Separation_item::set_interface (Score_element*s) +{ + s->set_elt_pointer ("elements", SCM_EOL); + s->set_extent_callback (0, X_AXIS); + s->set_extent_callback (0, Y_AXIS); +} + +void +Separation_item::add_item (Score_element*s,Item* i) +{ + assert (i); + Pointer_group_interface (s).add_element (i); + s->add_dependency (i); +} + +Interval +Separation_item::my_width (Score_element *me) +{ + Item *item = dynamic_cast (me); + Paper_column * pc = item->column_l (); + Interval w; + + for (SCM s = me->get_elt_pointer ("elements"); gh_pair_p (s); s = gh_cdr (s)) + { + SCM elt = gh_car (s); + if (!SMOB_IS_TYPE_B(Score_element, elt)) + continue; + + Item *il = dynamic_cast (unsmob_element (elt)); + if (pc != il->column_l ()) + { + /* this shouldn't happen, but let's continue anyway. */ + programming_error (_("Separation_item: I've been drinking too much")); + continue; /*UGH UGH*/ + } + + if (to_boolean (il->get_elt_property ("no-spacing-rods"))) + { + continue; + } + + Interval iv (il->extent (X_AXIS)); + if (!iv.empty_b ()) + { + Real off = il->relative_coordinate (pc, X_AXIS); + w.unite (iv + off); + } + } + + return w; + // add this->offset_ ? this-> relative_coordinate ()? +} + + + diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 21f8d227dc..c52646506a 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -59,7 +59,7 @@ Side_position_interface::get_direction () const */ Real -Side_position_interface::side_position (Score_element const *cme, Axis axis) +Side_position_interface::side_position (Score_element *cme, Axis axis) { Score_element* me = (Score_element*)cme; Score_element *common = me->parent_l (axis); @@ -114,7 +114,7 @@ Side_position_interface::side_position (Score_element const *cme, Axis axis) callback that centers the element on itself */ Real -Side_position_interface::aligned_on_self (Score_element const*elm, Axis ax) +Side_position_interface::aligned_on_self (Score_element *elm, Axis ax) { String s ("self-alignment-"); @@ -156,14 +156,14 @@ directed_round (Real f, Direction d) Callback that quantises in staff-spaces, rounding in the direction of the elements "direction" elt property. */ Real -Side_position_interface::quantised_position (Score_element const *me, Axis a) +Side_position_interface::quantised_position (Score_element *me, Axis a) { Side_position_interface s(me); Direction d = s.get_direction (); - Staff_symbol_referencer_interface si (me); - if (si.has_interface_b ()) + if (Staff_symbol_referencer_interface::has_interface_b (me)) { + Staff_symbol_referencer_interface si (me); Real p = si.position_f (); Real rp = directed_round (p, d); @@ -183,7 +183,7 @@ Side_position_interface::quantised_position (Score_element const *me, Axis a) Position next to support, taking into account my own dimensions and padding. */ Real -Side_position_interface::aligned_side (Score_element const*me, Axis ax) +Side_position_interface::aligned_side (Score_element *me, Axis ax) { Side_position_interface s(me); Direction d = s.get_direction (); @@ -206,7 +206,7 @@ Side_position_interface::aligned_side (Score_element const*me, Axis ax) Position centered on parent. */ Real -Side_position_interface::centered_on_parent (Score_element const* me, Axis a) +Side_position_interface::centered_on_parent (Score_element * me, Axis a) { Score_element *him = me->parent_l (a); diff --git a/lily/single-malt-grouping-item.cc b/lily/single-malt-grouping-item.cc deleted file mode 100644 index 84d10f7230..0000000000 --- a/lily/single-malt-grouping-item.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - single-malt-grouping-item.cc -- implement Single_malt_grouping_item - - source file of the GNU LilyPond music typesetter - - (c) 1998--2000 Han-Wen Nienhuys - - */ - -#include "single-malt-grouping-item.hh" -#include "paper-column.hh" -#include "debug.hh" -#include "group-interface.hh" - -Single_malt_grouping_item ::Single_malt_grouping_item(SCM s) - : Item (s) -{ - set_elt_pointer ("elements", SCM_EOL); - - // this is weird! , but needed! - set_extent_callback (0, X_AXIS); - set_extent_callback (0, Y_AXIS); - -} - -void -Single_malt_grouping_item::add_item (Item* i) -{ - assert (i); - Pointer_group_interface (this).add_element (i); - - add_dependency (i); -} - -Interval -Single_malt_grouping_item::my_width () const -{ - Paper_column * pc = column_l (); - Interval w; - - for (SCM s = get_elt_pointer ("elements"); gh_pair_p (s); s = gh_cdr (s)) - { - SCM elt = gh_car (s); - if (!SMOB_IS_TYPE_B(Score_element, elt)) - continue; - - Item *il = dynamic_cast (SMOB_TO_TYPE (Score_element, elt)); - if (pc != il->column_l ()) - { - /* this shouldn't happen, but let's continue anyway. */ - programming_error (_("Single_malt_grouping_item: I've been drinking too much")); - continue; /*UGH UGH*/ - } - - if (to_boolean (il->get_elt_property ("no-spacing-rods"))) - { - continue; - } - - Interval iv (il->extent (X_AXIS)); - if (!iv.empty_b ()) - { - Real off = il->relative_coordinate (pc, X_AXIS); - w.unite (iv + off); - } - } - - return w; - // add this->offset_ ? this-> relative_coordinate ()? -} - - - diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 91ab2a0ab2..0012dab45f 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -26,7 +26,7 @@ Span_bar::add_bar (Score_element*b) Interval -Span_bar::width_callback (Score_element const *se, Axis ) +Span_bar::width_callback (Score_element *se, Axis ) { Span_bar* s= dynamic_cast ((Score_element*)se); String gl = ly_scm2string (s->get_elt_property ("glyph")); @@ -101,7 +101,7 @@ Span_bar::evaluate_empty () Interval Span_bar::get_spanned_interval () const { - return Axis_group_interface::group_extent_callback (this, Y_AXIS); + return Axis_group_interface::group_extent_callback ((Span_bar*)this, Y_AXIS); } diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index ca3c938ed8..b2ed112f90 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -19,19 +19,19 @@ Staff_symbol_referencer_interface::Staff_symbol_referencer_interface (Score_elem } void -Staff_symbol_referencer_interface::set_interface () +Staff_symbol_referencer_interface::set_interface (Score_element * e) { - if (!gh_number_p (elt_l_->get_elt_property ("staff-position"))) - elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0)); + if (!gh_number_p (e->get_elt_property ("staff-position"))) + e->set_elt_property ("staff-position", gh_double2scm (0.0)); - elt_l_->add_offset_callback (callback, Y_AXIS); + e->add_offset_callback (callback, Y_AXIS); } bool -Staff_symbol_referencer_interface::has_interface_b () +Staff_symbol_referencer_interface::has_interface_b (Score_element*e) { - return unsmob_element (elt_l_->get_elt_pointer ("staff-symbol")) - || gh_number_p (elt_l_->get_elt_property ("staff-position")); + return unsmob_element (e->get_elt_pointer ("staff-symbol")) + || gh_number_p (e->get_elt_property ("staff-position")); } @@ -91,7 +91,7 @@ Staff_symbol_referencer_interface::position_f () const should use offset callback! */ Real -Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis ) +Staff_symbol_referencer_interface::callback (Score_element * sc,Axis ) { Score_element* me = (Score_element*)sc; // UGH. diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 0deb53ab44..08b598f1e2 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -35,7 +35,7 @@ protected: private: int default_tremolo_type_i_; Stem *stem_p_; - Stem_tremolo *tremolo_p_; + Score_element *tremolo_p_; Rhythmic_req *rhythmic_req_l_; Tremolo_req* tremolo_req_l_; }; @@ -77,8 +77,8 @@ Stem_engraver::acknowledge_element(Score_element_info i) if (!stem_p_) { stem_p_ = new Stem (get_property ("basicStemProperties")); - Staff_symbol_referencer_interface st(stem_p_); - st.set_interface (); + Staff_symbol_referencer_interface::set_interface(stem_p_); + stem_p_->set_elt_property ("duration-log", gh_int2scm (duration_log)); @@ -101,7 +101,9 @@ Stem_engraver::acknowledge_element(Score_element_info i) if (requested_type) { - tremolo_p_ = new Stem_tremolo (get_property ("basicStemTremoloProperties")); + tremolo_p_ = new Item (get_property ("basicStemTremoloProperties")); + Stem_tremolo::set_interface (tremolo_p_); + announce_element (Score_element_info (tremolo_p_, tremolo_req_l_)); /* The number of tremolo flags is the number of flags of @@ -133,7 +135,7 @@ Stem_engraver::do_pre_move_processing() { if (tremolo_p_) { - tremolo_p_->set_stem (stem_p_); + Stem_tremolo::set_stem (tremolo_p_, stem_p_); typeset_element (tremolo_p_); tremolo_p_ = 0; } diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 0d26fcd52a..a2e174f69b 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -23,37 +23,28 @@ lengthen stem if necessary */ -Stem_tremolo::Stem_tremolo (SCM s) - : Item (s) +void +Stem_tremolo::set_interface (Score_element *me) { - set_elt_pointer ("stem", SCM_EOL); +me->set_elt_pointer ("stem", SCM_EOL); } -Stem * -Stem_tremolo::stem_l ()const -{ - SCM s = get_elt_pointer ("stem"); - - return dynamic_cast ( unsmob_element (s)); -} - Interval Stem_tremolo::dim_callback (Score_element * se, Axis ) { - Stem_tremolo * s = dynamic_cast (se); - Real space = Staff_symbol_referencer_interface (s->stem_l ()) - .staff_space (); + Real space = Staff_symbol_referencer_interface (se).staff_space (); return Interval (-space, space); } -GLUE_SCORE_ELEMENT(Stem_tremolo,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Stem_tremolo,brew_molecule); SCM -Stem_tremolo::member_brew_molecule () const +Stem_tremolo::brew_molecule (SCM smob) { - Stem * stem = stem_l (); + Score_element *me= unsmob_element (smob); + Stem * stem = dynamic_cast (unsmob_element (me->get_elt_pointer ("stem"))); Beam * beam = stem->beam_l (); Real dydx; @@ -72,16 +63,16 @@ Stem_tremolo::member_brew_molecule () const dydx = 0.25; Real ss = Staff_symbol_referencer_interface (stem).staff_space (); - Real thick = gh_scm2double (get_elt_property ("beam-thickness")); - Real width = gh_scm2double (get_elt_property ("beam-width")); + Real thick = gh_scm2double (me->get_elt_property ("beam-thickness")); + Real width = gh_scm2double (me->get_elt_property ("beam-width")); width *= ss; thick *= ss; - Molecule a (lookup_l ()->beam (dydx, width, thick)); + Molecule a (me->lookup_l ()->beam (dydx, width, thick)); a.translate (Offset (-width/2, width / 2 * dydx)); int tremolo_flags; - SCM s = get_elt_property ("tremolo-flags"); + SCM s = me->get_elt_property ("tremolo-flags"); if (gh_number_p (s)) tremolo_flags = gh_scm2int (s); else @@ -89,7 +80,7 @@ Stem_tremolo::member_brew_molecule () const tremolo_flags = 1; int mult = beam ? beam->get_multiplicity () : 0; - Real interbeam_f = paper_l ()->interbeam_f (mult); + Real interbeam_f = me->paper_l ()->interbeam_f (mult); Molecule mol; for (int i = 0; i < tremolo_flags; i++) { @@ -103,7 +94,7 @@ Stem_tremolo::member_brew_molecule () const { // ugh, rather calc from Stem_tremolo_req int beams_i = stem->beam_count(RIGHT) >? stem->beam_count (LEFT); - mol.translate (Offset(stem->relative_coordinate (0, X_AXIS) - relative_coordinate (0, X_AXIS), + mol.translate (Offset(stem->relative_coordinate (0, X_AXIS) - me->relative_coordinate (0, X_AXIS), stem->stem_end_position () * ss / 2 - Directional_element_interface (beam).get () * beams_i * interbeam_f)); } @@ -125,7 +116,7 @@ Stem_tremolo::member_brew_molecule () const else whole_note_correction = 0; - mol.translate (Offset (stem->relative_coordinate (0, X_AXIS) - relative_coordinate (0, X_AXIS) + + mol.translate (Offset (stem->relative_coordinate (0, X_AXIS) - me->relative_coordinate (0, X_AXIS) + whole_note_correction, dy)); } @@ -134,9 +125,8 @@ Stem_tremolo::member_brew_molecule () const void -Stem_tremolo::set_stem (Stem *s) +Stem_tremolo::set_stem (Score_element*me,Score_element *s) { - set_elt_pointer ("stem", s->self_scm_); - add_dependency (s); + me->set_elt_pointer ("stem", s->self_scm_); } diff --git a/lily/stem.cc b/lily/stem.cc index 694be6fde2..cbbc19ddec 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -440,7 +440,7 @@ Stem::flag () const } Interval -Stem::dim_callback (Score_element const *se, Axis ) +Stem::dim_callback (Score_element *se, Axis ) { Stem * s = dynamic_cast ((Score_element*)se); @@ -498,7 +498,7 @@ Stem::member_brew_molecule () const } Real -Stem::off_callback (Score_element const* se, Axis) +Stem::off_callback (Score_element * se, Axis) { Stem *st = dynamic_cast ((Score_element*)se); diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 5be06b334e..051e0a844b 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -55,19 +55,28 @@ System_start_delimiter::simple_bar (Real h) const return lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2))); } -GLUE_SCORE_ELEMENT(System_start_delimiter,after_line_breaking); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(System_start_delimiter,after_line_breaking); + SCM -System_start_delimiter::member_after_line_breaking () +System_start_delimiter::after_line_breaking (SCM smob) +{ + try_collapse (unsmob_element (smob)); + return SCM_UNDEFINED; +} + +void +System_start_delimiter::try_collapse (Score_element*me) { - SCM gl = get_elt_property ("glyph"); + SCM gl = me->get_elt_property ("glyph"); - if (scm_ilength (get_elt_pointer ("elements")) <= 1 && gl == ly_symbol2scm ("bar-line")) + if (scm_ilength (me->get_elt_pointer ("elements")) <= 1 && gl == ly_symbol2scm ("bar-line")) { - suicide (); + me->suicide (); } - return SCM_UNDEFINED; + } + MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(System_start_delimiter,brew_molecule); SCM diff --git a/lily/text-item.cc b/lily/text-item.cc index 84a006243d..931c5b843d 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -1,5 +1,5 @@ /* - text-item.cc -- implement Item + text-item.cc -- implement Text_item source file of the GNU LilyPond music typesetter diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 63e3d2a465..5fccceba2c 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -16,23 +16,28 @@ Tie_column::Tie_column (SCM s) : Spanner (s) { - set_elt_pointer ("ties", SCM_EOL); - set_extent_callback (0, X_AXIS); - set_extent_callback (0, Y_AXIS); + +} +void +Tie_column::set_interface (Score_element*me) +{ + me-> set_elt_pointer ("ties", SCM_EOL); + me->set_extent_callback (0, X_AXIS); + me->set_extent_callback (0, Y_AXIS); } void -Tie_column::add_tie (Tie *s) +Tie_column::add_tie (Score_element*me,Tie *s) { - Pointer_group_interface g (this, "ties"); + Pointer_group_interface g (me, "ties"); if (!g.count ()) { - set_bound (LEFT, s->head (LEFT)); - set_bound (RIGHT, s->head (RIGHT)); + dynamic_cast (me)->set_bound (LEFT, Tie::head (s,LEFT)); + dynamic_cast (me)->set_bound (RIGHT, Tie::head (s,RIGHT)); } - Pointer_group_interface (this, "ties").add_element (s); - s->add_dependency (this); + Pointer_group_interface (me, "ties").add_element (s); + s->add_dependency (me); } @@ -40,7 +45,7 @@ int tie_compare (Tie* const & s1, Tie* const & s2) { - return sign (s1->position_f () - s2->position_f()); + return sign (Tie::position_f (s1) - Tie::position_f(s2)); } /* @@ -51,15 +56,15 @@ tie_compare (Tie* const & s1, direction of the rest is determined by their staff position. Ross forgets about the tie that is *on* the middle staff line. We - assume it goes UP. (TODO: make this settable) */ + assume it goes UP. (TODO: make me settable) */ void -Tie_column::set_directions () +Tie_column::set_directions (Score_element*me) { Link_array ties = - Pointer_group_interface__extract_elements (this, (Tie*)0, "ties"); + Pointer_group_interface__extract_elements (me, (Tie*)0, "ties"); - Direction d = Directional_element_interface (this).get (); + Direction d = Directional_element_interface (me).get (); if (d) { @@ -74,7 +79,7 @@ Tie_column::set_directions () if (ties.size () == 1) { Tie * t = ties[0]; - Directional_element_interface (t).set (t->get_default_dir ()); + Directional_element_interface (t).set (Tie::get_default_dir (t)); return; } @@ -89,7 +94,7 @@ Tie_column::set_directions () for (int i=ties.size(); i--; ) { Tie * t = ties[i]; - Real p = t->position_f (); + Real p = Tie::position_f (t); Direction d = (Direction) sign (p); if (!d) d = UP; @@ -98,10 +103,10 @@ Tie_column::set_directions () } -GLUE_SCORE_ELEMENT(Tie_column,after_line_breaking); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Tie_column,after_line_breaking); SCM -Tie_column::member_after_line_breaking () +Tie_column::after_line_breaking (SCM smob) { - set_directions (); + set_directions (unsmob_element (smob)); return SCM_UNDEFINED; } diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 020779e482..59a05f4c50 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -59,7 +59,7 @@ protected: virtual bool do_try_music (Music*); virtual void do_process_music (); virtual void process_acknowledged (); - + void typeset_tie (Score_element*); public: VIRTUAL_COPY_CONS(Translator); Tie_engraver(); @@ -174,8 +174,8 @@ Tie_engraver::process_acknowledged () SCM pair = gh_list_ref (head_list, gh_int2scm (i/2)); Tie * p = new Tie (basic); - p->set_head (LEFT, dynamic_cast (unsmob_element (gh_car (pair)))); - p->set_head (RIGHT, dynamic_cast (unsmob_element (gh_cdr (pair)))); + Tie::set_head (p,LEFT, dynamic_cast (unsmob_element (gh_car (pair)))); + Tie::set_head (p,RIGHT, dynamic_cast (unsmob_element (gh_cdr (pair)))); tie_p_arr_.push (p); announce_element (Score_element_info (p, req_l_)); @@ -183,8 +183,10 @@ Tie_engraver::process_acknowledged () else for (SCM s = head_list; gh_pair_p (s); s = gh_cdr (s)) { Tie * p = new Tie (basic); - p->set_head (LEFT, dynamic_cast (unsmob_element (gh_caar (s)))); - p->set_head (RIGHT, dynamic_cast (unsmob_element (gh_cdar (s)))); + Tie::set_interface (p); + + Tie::set_head (p, LEFT, dynamic_cast (unsmob_element (gh_caar (s)))); + Tie::set_head (p, RIGHT, dynamic_cast (unsmob_element (gh_cdar (s)))); tie_p_arr_.push (p); announce_element (Score_element_info (p, req_l_)); @@ -197,8 +199,9 @@ Tie_engraver::process_acknowledged () else if (tie_p_arr_.size () > 1 && !tie_column_p_) { tie_column_p_ = new Tie_column (get_property ("basicTieColumnProperties")); + Tie_column::set_interface (tie_column_p_); for (int i = tie_p_arr_.size (); i--; ) - tie_column_p_->add_tie (tie_p_arr_ [i]); + Tie_column::add_tie (tie_column_p_,tie_p_arr_ [i]); announce_element (Score_element_info (tie_column_p_, 0)); } } @@ -216,16 +219,37 @@ Tie_engraver::do_pre_move_processing () for (int i=0; i< tie_p_arr_.size (); i++) { - typeset_element (tie_p_arr_[i]); + typeset_tie (tie_p_arr_[i]); } tie_p_arr_.clear (); if (tie_column_p_) { - typeset_element (tie_column_p_); + typeset_tie (tie_column_p_); tie_column_p_ =0; } } +void +Tie_engraver::typeset_tie (Score_element *her) +{ + if (!(Tie::head (her,LEFT) && Tie::head (her,RIGHT))) + warning (_ ("lonely tie")); + + Direction d = LEFT; + Drul_array new_head_drul; + new_head_drul[LEFT] = Tie::head(her,LEFT); + new_head_drul[RIGHT] = Tie::head (her,RIGHT); + do { + if (!Tie::head (her,d)) + new_head_drul[d] = Tie::head(her,(Direction)-d); + } while (flip(&d) != LEFT); + + index_set_cell (her->get_elt_pointer ("heads"), LEFT, new_head_drul[LEFT]->self_scm_ ); + index_set_cell (her->get_elt_pointer ("heads"), RIGHT, new_head_drul[RIGHT]->self_scm_ ); + + typeset_element (her); +} + void Tie_engraver::do_post_move_processing () { diff --git a/lily/tie.cc b/lily/tie.cc index e777a74fba..7a2a81ef87 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -21,39 +21,42 @@ #include "stem.hh" void -Tie::set_head (Direction d, Item * head_l) +Tie::set_head (Score_element*me,Direction d, Item * head_l) { - assert (!head (d)); - index_set_cell (get_elt_pointer ("heads"), d, head_l->self_scm_); + assert (!head (me,d)); + index_set_cell (me->get_elt_pointer ("heads"), d, head_l->self_scm_); - set_bound (d, head_l); - add_dependency (head_l); + dynamic_cast (me)->set_bound (d, head_l); + me->add_dependency (head_l); } Tie::Tie(SCM s) : Spanner (s) { - set_elt_pointer ("heads", gh_cons (SCM_EOL, SCM_EOL)); dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0; dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; - +} +void +Tie::set_interface (Score_element*me) +{ + me->set_elt_pointer ("heads", gh_cons (SCM_EOL, SCM_EOL)); } Rhythmic_head* -Tie::head (Direction d) const +Tie::head (Score_element*me, Direction d) { - SCM c = get_elt_pointer ("heads"); + SCM c = me->get_elt_pointer ("heads"); c = index_cell (c, d); return dynamic_cast (unsmob_element (c)); } Real -Tie::position_f () const +Tie::position_f (Score_element*me) { - return head (LEFT) - ? Staff_symbol_referencer_interface (head (LEFT)).position_f () - : Staff_symbol_referencer_interface (head (RIGHT)).position_f () ; + return head (me,LEFT) + ? Staff_symbol_referencer_interface (head (me,LEFT)).position_f () + : Staff_symbol_referencer_interface (head (me,RIGHT)).position_f () ; } @@ -61,10 +64,10 @@ Tie::position_f () const ugh: direction of the Tie is more complicated. See [Ross] p136 and further */ Direction -Tie::get_default_dir () const +Tie::get_default_dir (Score_element*me) { - Stem * sl = head(LEFT) ? head (LEFT)->stem_l () :0; - Stem * sr = head(RIGHT) ? head (RIGHT)->stem_l () :0; + Stem * sl = head(me,LEFT) ? head (me,LEFT)->stem_l () :0; + Stem * sr = head(me,RIGHT) ? head (me,RIGHT)->stem_l () :0; if (sl && Directional_element_interface (sl).get () == UP && sr && Directional_element_interface (sr).get () == UP) @@ -73,47 +76,28 @@ Tie::get_default_dir () const return UP; } -/* - fixme must use spanned drul from heads elt property - */ -void -Tie::do_add_processing() -{ - if (!(head (LEFT) && head (RIGHT))) - warning (_ ("lonely tie")); - - Direction d = LEFT; - Drul_array new_head_drul; - new_head_drul[LEFT] = head(LEFT); - new_head_drul[RIGHT] = head(RIGHT); - do { - if (!head (d)) - new_head_drul[d] = head((Direction)-d); - } while (flip(&d) != LEFT); - - index_set_cell (get_elt_pointer ("heads"), LEFT, new_head_drul[LEFT]->self_scm_ ); - index_set_cell (get_elt_pointer ("heads"), RIGHT, new_head_drul[RIGHT]->self_scm_ ); -} -GLUE_SCORE_ELEMENT(Tie,after_line_breaking); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Tie,after_line_breaking); SCM -Tie::member_after_line_breaking () +Tie::after_line_breaking (SCM smob) { - if (!head (LEFT) && !head (RIGHT)) + Tie*me = dynamic_cast (unsmob_element (smob)); + + if (!head (me,LEFT) && !head (me,RIGHT)) { programming_error ("Tie without heads."); - suicide (); + me->suicide (); return SCM_UNDEFINED; } - if (!Directional_element_interface (this).get ()) - Directional_element_interface (this).set (get_default_dir ()); + if (!Directional_element_interface (me).get ()) + Directional_element_interface (me).set (Tie::get_default_dir (me)); - Real staff_space = Staff_symbol_referencer_interface (this).staff_space (); + Real staff_space = Staff_symbol_referencer_interface (me).staff_space (); Real half_space = staff_space / 2; - Real x_gap_f = paper_l ()->get_var ("tie_x_gap"); - Real y_gap_f = paper_l ()->get_var ("tie_y_gap"); + Real x_gap_f = me->paper_l ()->get_var ("tie_x_gap"); + Real y_gap_f = me->paper_l ()->get_var ("tie_y_gap"); /* Slur and tie placement [OSU] @@ -126,18 +110,18 @@ Tie::member_after_line_breaking () /* - OSU: not different for outer notes, so why all this code? - ie, can we drop this, or should it be made switchable. + OSU: not different for outer notes, so why all me code? + ie, can we drop me, or should it be made switchable. */ - if (head (LEFT)) - dx_f_drul_[LEFT] = head (LEFT)->extent (X_AXIS).length (); + if (head (me,LEFT)) + me->dx_f_drul_[LEFT] = Tie::head (me,LEFT)->extent (X_AXIS).length (); else - dx_f_drul_[LEFT] = get_broken_left_end_align (); - dx_f_drul_[LEFT] += x_gap_f; - dx_f_drul_[RIGHT] -= x_gap_f; + me->dx_f_drul_[LEFT] = dynamic_cast(me)->get_broken_left_end_align (); + me->dx_f_drul_[LEFT] += x_gap_f; + me->dx_f_drul_[RIGHT] -= x_gap_f; /* - Slur and tie placement [OSU] -- check this + Slur and tie placement [OSU] -- check me Ties: @@ -152,14 +136,14 @@ Tie::member_after_line_breaking () */ - Real ypos = position_f (); + Real ypos = Tie::position_f (me); Real y_f = half_space * ypos; int ypos_i = int (ypos); - Real dx_f = extent (X_AXIS).length () + dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]; - Direction dir = Directional_element_interface (this).get(); - if (dx_f < paper_l ()->get_var ("tie_staffspace_length")) + Real dx_f = me->extent (X_AXIS).length () + me->dx_f_drul_[RIGHT] - me->dx_f_drul_[LEFT]; + Direction dir = Directional_element_interface (me).get(); + if (dx_f < me->paper_l ()->get_var ("tie_staffspace_length")) { if (abs (ypos_i) % 2) y_f += dir * half_space; @@ -173,7 +157,7 @@ Tie::member_after_line_breaking () y_f -= dir * y_gap_f; } - dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = y_f; + me->dy_f_drul_[LEFT] = me->dy_f_drul_[RIGHT] = y_f; return SCM_UNDEFINED; } @@ -194,20 +178,21 @@ Tie::get_rods () const return a; } -GLUE_SCORE_ELEMENT(Tie,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Tie,brew_molecule); SCM -Tie::member_brew_molecule () const +Tie::brew_molecule (SCM smob) { - Real thick = paper_l ()->get_var ("tie_thickness"); - Bezier one = get_curve (); + Score_element*me = unsmob_element (smob); + Real thick = me->paper_l ()->get_var ("tie_thickness"); + Bezier one = dynamic_cast (me)->get_curve (); Molecule a; - SCM d = get_elt_property ("dashed"); + SCM d = me->get_elt_property ("dashed"); if (gh_number_p (d)) - a = lookup_l ()->dashed_slur (one, thick, gh_scm2int (d)); + a = me->lookup_l ()->dashed_slur (one, thick, gh_scm2int (d)); else - a = lookup_l ()->slur (one, Directional_element_interface (this).get () * thick, thick); + a = me->lookup_l ()->slur (one, Directional_element_interface (me).get () * thick, thick); return a.create_scheme(); } @@ -217,17 +202,18 @@ Tie::member_brew_molecule () const Bezier Tie::get_curve () const { - Direction d (Directional_element_interface (this).get ()); + Score_element*me = (Score_element*)this; + Direction d (Directional_element_interface (me).get ()); Bezier_bow b (get_encompass_offset_arr (), d); - Real staff_space = Staff_symbol_referencer_interface (this).staff_space (); + Real staff_space = Staff_symbol_referencer_interface (me).staff_space (); Real h_inf = paper_l ()->get_var ("tie_height_limit_factor") * staff_space; Real r_0 = paper_l ()->get_var ("tie_ratio"); b.set_default_bezier (h_inf, r_0); Bezier c = b.get_bezier (); - /* should do this for slurs as well. */ + /* should do me for slurs as well. */ Array horizontal (c.solve_derivative (Offset (1,0))); if (horizontal.size ()) diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index 77f1e75e94..9b44c6ded4 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -6,12 +6,29 @@ (c) 1997--2000 Han-Wen Nienhuys */ -#include "time-signature-engraver.hh" #include "time-signature.hh" #include "command-request.hh" +#include "engraver.hh" + #include "timing-engraver.hh" #include "engraver-group-engraver.hh" + +/** + generate time_signatures. + */ +class Time_signature_engraver : public Engraver { +protected: + virtual void do_process_music(); + virtual void do_pre_move_processing(); +public: + VIRTUAL_COPY_CONS(Translator); + Item * time_signature_p_; + + Time_signature_engraver(); +}; + + Time_signature_engraver::Time_signature_engraver() { time_signature_p_ =0; @@ -20,6 +37,10 @@ Time_signature_engraver::Time_signature_engraver() void Time_signature_engraver::do_process_music() { + /* + UGH. + this should use properties. + */ Translator * result = daddy_grav_l()->get_simple_translator ("Timing_engraver"); // ugh @@ -35,8 +56,7 @@ Time_signature_engraver::do_process_music() Time_signature_change_req *req = timing_grav_l->time_signature_req_l(); if (req) { - time_signature_p_ = new Time_signature (get_property ("basicTimeSignatureProperties")); - + time_signature_p_ = new Item (get_property ("basicTimeSignatureProperties")); time_signature_p_->set_elt_property ("fraction", gh_cons (gh_int2scm (req->beats_i_), gh_int2scm (req->one_beat_i_))); diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 50c45abd4c..95cc942a59 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -13,21 +13,14 @@ #include "paper-def.hh" #include "lookup.hh" -Time_signature::Time_signature (SCM s) - : Item (s) -{ - -} +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Time_signature,brew_molecule); -// ugh.! - -GLUE_SCORE_ELEMENT(Time_signature,brew_molecule); SCM -Time_signature::member_brew_molecule () const +Time_signature::brew_molecule (SCM smob) { - SCM st = get_elt_property ("style"); - - SCM frac = get_elt_property ("fraction"); + Score_element * me = unsmob_element (smob); + SCM st = me->get_elt_property ("style"); + SCM frac = me->get_elt_property ("fraction"); int n = 4; int d = 4; if (gh_pair_p (frac)) @@ -42,47 +35,47 @@ Time_signature::member_brew_molecule () const String style (ly_scm2string (st)); if (style[0]=='1') { - return time_signature (n, 0).create_scheme(); + return time_signature (me, n, 0).create_scheme(); } else { - return special_time_signature (style, n, d).create_scheme(); + return special_time_signature (me, style, n, d).create_scheme(); } } else - return time_signature (n,d).create_scheme(); + return time_signature (me, n,d).create_scheme(); } Molecule -Time_signature::special_time_signature (String s, int n, int d) const +Time_signature::special_time_signature (Score_element*me, String s, int n, int d) { // First guess: s contains only the signature style String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d); - Molecule m = lookup_l ()->afm_find (symbolname, false); + Molecule m = me->lookup_l ()->afm_find (symbolname, false); if (!m.empty_b()) return m; // Second guess: s contains the full signature name - m = lookup_l ()->afm_find ("timesig-"+s, false); + m = me->lookup_l ()->afm_find ("timesig-"+s, false); if (!m.empty_b ()) return m; // Resort to default layout with numbers - return time_signature (n,d); + return time_signature (me, n,d); } Molecule -Time_signature::time_signature (int num, int den) const +Time_signature::time_signature (Score_element*me,int num, int den) { String sty = "timesig"; /* UGH: need to look at fontsize. */ - Molecule n (lookup_l ()->text (sty, to_str (num), paper_l ())); - Molecule d (lookup_l ()->text (sty, to_str (den), paper_l ())); + Molecule n (me->lookup_l ()->text (sty, to_str (num), me->paper_l ())); + Molecule d (me->lookup_l ()->text (sty, to_str (den), me->paper_l ())); n.align_to (X_AXIS, CENTER); d.align_to (X_AXIS, CENTER); Molecule m; diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index 355cb64c09..071e55e03b 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -29,7 +29,7 @@ protected: Array span_stop_moments_; /// The spanners. Array order is synced with time_scaled_music_arr_ - Link_array started_span_p_arr_; + Link_array started_span_p_arr_; virtual void do_removal_processing (); virtual void acknowledge_element (Score_element_info); @@ -73,7 +73,8 @@ Tuplet_engraver::do_process_music () if (i < started_span_p_arr_.size () && started_span_p_arr_[i]) continue; - Tuplet_spanner* glep = new Tuplet_spanner (get_property ("basicTupletSpannerProperties")); + Spanner* glep = new Spanner (get_property ("basicTupletSpannerProperties")); + Tuplet_spanner::set_interface (glep); if (i >= started_span_p_arr_.size ()) started_span_p_arr_.push (glep); else @@ -99,13 +100,13 @@ Tuplet_engraver::acknowledge_element (Score_element_info i) { for (int j =0; j add_column (nc); + Tuplet_spanner::add_column (started_span_p_arr_[j],nc); } else if (Beam *b = dynamic_cast (i.elem_l_)) { for (int j = 0; j < started_span_p_arr_.size (); j++) if (started_span_p_arr_[j]) - started_span_p_arr_[j]->add_beam (b); + Tuplet_spanner::add_beam (started_span_p_arr_[j],b); } } diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 3acb6c68f3..00760818d7 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -22,32 +22,32 @@ #include "directional-element-interface.hh" -Tuplet_spanner::Tuplet_spanner (SCM s) - : Spanner (s) -{ - set_elt_pointer ("beams", SCM_EOL); - set_elt_pointer ("columns", SCM_EOL); - // ugh. - set_elt_property ("delta-y", gh_int2scm (0)); +void +Tuplet_spanner::set_interface (Score_element*me) +{ + me-> set_elt_pointer ("beams", SCM_EOL); + me->set_elt_pointer ("columns", SCM_EOL); } /* TODO. */ -GLUE_SCORE_ELEMENT(Tuplet_spanner,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Tuplet_spanner,brew_molecule); + SCM -Tuplet_spanner::member_brew_molecule () const +Tuplet_spanner::brew_molecule (SCM smob) { + Score_element *me= unsmob_element (smob); Molecule mol; // Default behaviour: number always, bracket when no beam! - bool par_beam = to_boolean (get_elt_property ("parallel-beam")); + bool par_beam = to_boolean (me->get_elt_property ("parallel-beam")); bool bracket_visibility = !par_beam; bool number_visibility = true; - SCM bracket = get_elt_property ("tuplet-bracket-visibility"); + SCM bracket = me->get_elt_property ("tuplet-bracket-visibility"); if (gh_boolean_p (bracket)) { bracket_visibility = gh_scm2bool (bracket); @@ -55,7 +55,7 @@ Tuplet_spanner::member_brew_molecule () const else if (bracket == ly_symbol2scm ("if-no-beam")) bracket_visibility = !par_beam; - SCM numb = get_elt_property ("tuplet-number-visibility"); + SCM numb = me->get_elt_property ("tuplet-number-visibility"); if (gh_boolean_p (numb)) { number_visibility = gh_scm2bool (numb); @@ -63,24 +63,23 @@ Tuplet_spanner::member_brew_molecule () const else if (bracket == ly_symbol2scm ("if-no-beam")) number_visibility = !par_beam; - if (gh_pair_p (get_elt_pointer ("columns"))) + if (gh_pair_p (me->get_elt_pointer ("columns"))) { Link_array column_arr= - Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns"); + Pointer_group_interface__extract_elements (me, (Note_column*)0, "columns"); Real ncw = column_arr.top ()->extent(X_AXIS).length (); - Real w = spanner_length () + ncw; + Real w = dynamic_cast(me)->spanner_length () + ncw; - - Real staff_space = paper_l ()->get_var ("interline"); - Direction dir = Directional_element_interface (this).get (); - Real dy = gh_scm2double (get_elt_property ("delta-y")); - SCM number = get_elt_property ("text"); + Real staff_space = me->paper_l ()->get_var ("interline"); + Direction dir = Directional_element_interface (me).get (); + Real dy = gh_scm2double (me->get_elt_property ("delta-y")); + SCM number = me->get_elt_property ("text"); if (gh_string_p (number) && number_visibility) { Molecule - num (lookup_l ()->text ("italic", - ly_scm2string (number), paper_l ())); + num (me->lookup_l ()->text ("italic", + ly_scm2string (number), me->paper_l ())); num.align_to (X_AXIS, CENTER); num.translate_axis (w/2, X_AXIS); num.align_to (Y_AXIS, CENTER); @@ -93,11 +92,11 @@ Tuplet_spanner::member_brew_molecule () const if (bracket_visibility) { - SCM ss = paper_l ()->get_scmvar ("staffspace"); - SCM lt = paper_l ()->get_scmvar ("stafflinethickness"); + SCM ss = me->paper_l ()->get_scmvar ("staffspace"); + SCM lt = me->paper_l ()->get_scmvar ("stafflinethickness"); - SCM thick = get_elt_property ("thick"); - SCM gap = get_elt_property ("number-gap"); + SCM thick = me->get_elt_property ("thick"); + SCM gap = me->get_elt_property ("number-gap"); SCM at =gh_list(ly_symbol2scm ("tuplet"), ss, @@ -122,15 +121,15 @@ Tuplet_spanner::member_brew_molecule () const use first -> last note for slope, and then correct for disturbing notes in between. */ void -Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const +Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real * dy) { Link_array column_arr= - Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns"); + Pointer_group_interface__extract_elements (me, (Note_column*)0, "columns"); - Score_element * common = common_refpoint (get_elt_pointer ("columns"), Y_AXIS); + Score_element * common = me->common_refpoint (me->get_elt_pointer ("columns"), Y_AXIS); - Direction d = Directional_element_interface (this).get (); + Direction d = Directional_element_interface (me).get (); /* Use outer non-rest columns to determine slope @@ -179,64 +178,67 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const use first -> last note for slope, */ void -Tuplet_spanner::calc_dy (Real * dy) const +Tuplet_spanner::calc_dy (Score_element*me,Real * dy) { Link_array column_arr= - Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns"); + Pointer_group_interface__extract_elements (me, (Note_column*)0, "columns"); - Direction d = Directional_element_interface (this).get (); + Direction d = Directional_element_interface (me).get (); *dy = column_arr.top ()->extent (Y_AXIS) [d] - column_arr[0]->extent (Y_AXIS) [d]; } +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Tuplet_spanner,after_line_breaking); -GLUE_SCORE_ELEMENT(Tuplet_spanner,after_line_breaking); SCM -Tuplet_spanner::member_after_line_breaking () +Tuplet_spanner::after_line_breaking (SCM smob) { + Score_element * me = unsmob_element (smob); Link_array column_arr= - Pointer_group_interface__extract_elements (this, (Note_column*)0, "columns"); + Pointer_group_interface__extract_elements (me, (Note_column*)0, "columns"); + Spanner *sp = dynamic_cast (me); + if (!column_arr.size ()) { - suicide (); + me->suicide (); return SCM_UNDEFINED; } - Direction d = Directional_element_interface (this).get (); + Direction d = Directional_element_interface (me).get (); if (!d) { - d = get_default_dir (); - Directional_element_interface (this).set (d); + d = Tuplet_spanner::get_default_dir (me); + Directional_element_interface (me).set (d); } Real dy, offset; - calc_position_and_height (&offset,&dy); + calc_position_and_height (me,&offset,&dy); - set_elt_property ("delta-y", gh_double2scm (dy)); + me->set_elt_property ("delta-y", gh_double2scm (dy)); - translate_axis (offset, Y_AXIS); + me->translate_axis (offset, Y_AXIS); - if (scm_ilength (get_elt_pointer ("beams")) == 1) + if (scm_ilength (me->get_elt_pointer ("beams")) == 1) { - SCM bs = get_elt_pointer ("beams"); + SCM bs = me->get_elt_pointer ("beams"); Score_element *b = unsmob_element (gh_car (bs)); Beam * beam_l = dynamic_cast (b); - if (!broken_b () - && get_bound (LEFT)->column_l () == beam_l->get_bound (LEFT)->column_l () - && get_bound (RIGHT)->column_l () == beam_l->get_bound (RIGHT)->column_l ()) - set_elt_property ("parallel-beam", SCM_BOOL_T); + if (!sp->broken_b () + && sp->get_bound (LEFT)->column_l () == beam_l->get_bound (LEFT)->column_l () + && sp->get_bound (RIGHT)->column_l () == beam_l->get_bound (RIGHT)->column_l ()) + me->set_elt_property ("parallel-beam", SCM_BOOL_T); } return SCM_UNDEFINED; } Direction -Tuplet_spanner::get_default_dir () const +Tuplet_spanner::get_default_dir (Score_element*me) { Direction d = UP; - SCM dir_sym =get_elt_property ("dir-forced"); + SCM dir_sym =me->get_elt_property ("dir-forced"); if (isdir_b (dir_sym)) { d= to_dir (dir_sym); @@ -245,7 +247,7 @@ Tuplet_spanner::get_default_dir () const } d = UP ; - for (SCM s = get_elt_pointer ("columns"); gh_pair_p (s); s = gh_cdr (s)) + for (SCM s = me->get_elt_pointer ("columns"); gh_pair_p (s); s = gh_cdr (s)) { Score_element * sc = unsmob_element (gh_car (s)); Note_column * nc = dynamic_cast (sc); @@ -260,22 +262,21 @@ Tuplet_spanner::get_default_dir () const } void -Tuplet_spanner::add_beam (Beam *b) +Tuplet_spanner::add_beam (Score_element*me, Score_element *b) { - add_dependency (b); - Pointer_group_interface gi (this, "beams"); +me->add_dependency (b); + Pointer_group_interface gi (me, "beams"); gi.add_element (b); } void -Tuplet_spanner::add_column (Note_column*n) +Tuplet_spanner::add_column (Score_element*me, Item*n) { - Pointer_group_interface gi (this, "columns"); + Pointer_group_interface gi (me, "columns"); gi.add_element (n); + me->add_dependency (n); - add_dependency (n); - - add_bound_item (this, n); + add_bound_item (dynamic_cast (me), n); } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 6e99afdb84..fa986542eb 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -11,28 +11,26 @@ #include "debug.hh" #include "lookup.hh" #include "molecule.hh" -#include "note-column.hh" #include "paper-column.hh" #include "bar.hh" #include "paper-def.hh" #include "volta-spanner.hh" -#include "stem.hh" -#include "dimension-cache.hh" #include "group-interface.hh" #include "side-position-interface.hh" #include "directional-element-interface.hh" -Volta_spanner::Volta_spanner (SCM s) - : Spanner (s) + +void +Volta_spanner::set_interface (Score_element*me) { - set_elt_pointer ("bars", SCM_EOL); - Side_position_interface (this).set_axis (Y_AXIS); - Directional_element_interface (this).set (UP); + me->set_elt_pointer ("bars", SCM_EOL); + Side_position_interface (me).set_axis (Y_AXIS); + Directional_element_interface (me).set (UP); } /* - this is too complicated. Yet another version of side-positioning, + me is too complicated. Yet another version of side-positioning, badly implemented. -- @@ -42,37 +40,37 @@ Volta_spanner::Volta_spanner (SCM s) */ -GLUE_SCORE_ELEMENT(Volta_spanner,brew_molecule); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Volta_spanner,brew_molecule); SCM -Volta_spanner::member_brew_molecule () const +Volta_spanner::brew_molecule (SCM smob) { - + Score_element *me = unsmob_element (smob); Link_array bar_arr - = Pointer_group_interface__extract_elements (this, (Bar*)0, "bars"); + = Pointer_group_interface__extract_elements (me, (Bar*)0, "bars"); if (!bar_arr.size ()) return SCM_EOL; bool no_vertical_start = false; - bool no_vertical_end = to_boolean (get_elt_property ("last-volta")); - Spanner *orig_span = dynamic_cast (original_l_); - if (orig_span && (orig_span->broken_into_l_arr_[0] != (Spanner*)this)) + bool no_vertical_end = to_boolean (me->get_elt_property ("last-volta")); + Spanner *orig_span = dynamic_cast (me->original_l_); + if (orig_span && (orig_span->broken_into_l_arr_[0] != (Spanner*)me)) no_vertical_start = true; - if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)this)) + if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)me)) no_vertical_end = true; #if 0 // FIXME - if (bar_arr.top ()->get_elt_property (type_str_.length_i () > 1) + if (bar_arr.top ()->me->get_elt_property (type_str_.length_i () > 1) no_vertical_end = false; #endif - Real staff_space = paper_l ()->get_var ("interline"); + Real staff_space = me->paper_l ()->get_var ("interline"); Real half_space = staff_space / 2; - Real left = get_broken_left_end_align (); - Real w = spanner_length () - left - half_space; - Real h = paper_l()->get_var ("volta_spanner_height"); - Real t = paper_l ()->get_var ("volta_thick"); + Real left = dynamic_cast(me)->get_broken_left_end_align (); + Real w = dynamic_cast(me)->spanner_length () - left - half_space; + Real h = me->paper_l()->get_var ("volta_spanner_height"); + Real t = me->paper_l ()->get_var ("volta_thick"); SCM at = (gh_list (ly_symbol2scm ("volta"), gh_double2scm (h), @@ -84,9 +82,9 @@ Volta_spanner::member_brew_molecule () const Box b (Interval (0, w), Interval (0, h)); Molecule mol (b, at); - Molecule num (lookup_l ()->text ("volta", - ly_scm2string (get_elt_property("text")), - paper_l ())); + Molecule num (me->lookup_l ()->text ("volta", + ly_scm2string (me->get_elt_property("text")), + me->paper_l ())); mol.add_at_edge (X_AXIS, LEFT, num, - num.extent (X_AXIS).length () - staff_space); @@ -95,29 +93,18 @@ Volta_spanner::member_brew_molecule () const } -GLUE_SCORE_ELEMENT(Volta_spanner,after_line_breaking); -SCM -Volta_spanner::member_after_line_breaking () -{ - Side_position_interface (this).add_staff_support (); - return SCM_UNDEFINED; -} - void -Volta_spanner::add_bar (Bar* b) +Volta_spanner::add_bar (Score_element *me, Item* b) { - Pointer_group_interface gi(this, "bars"); + Pointer_group_interface gi(me, "bars"); gi.add_element (b); - Side_position_interface (this).add_support (b); - add_dependency (b); - - add_bound_item (this, b); + Side_position_interface (me).add_support (b); + add_bound_item (dynamic_cast(me), b); } void -Volta_spanner::add_column (Note_column* c) +Volta_spanner::add_column (Score_element*me, Score_element* c) { - Side_position_interface (this).add_support (c); - add_dependency (c); + Side_position_interface (me).add_support (c); } diff --git a/ly/engraver.ly b/ly/engraver.ly index cb548ddced..adac158aac 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -414,6 +414,7 @@ ScoreContext = \translator { (thin-kern . 3.0) (hair-thickness . 1.6) (thick-thickness . 6.0) + (bar-interface . #t) ) basicBarNumberProperties = #`( @@ -437,11 +438,9 @@ ScoreContext = \translator { basicBreathingSignProperties = #`( (break-align-symbol . Breathing_sign) - (after-line-breaking-callback . ,Breathing_sign::after_line_breaking) (breakable . #t ) (molecule-callback . ,Breathing_sign::brew_molecule) (visibility-lambda . ,begin-of-line-invisible) - ) basicClefItemProperties = #`( (molecule-callback . ,Score_element::brew_molecule) @@ -488,7 +487,8 @@ ScoreContext = \translator { (before-line-breaking-callback . ,Grace_align_item::before_line_breaking) ) basicHaraKiriVerticalGroupspannerProperties = #`( - (after-line-breaking-callback . ,Hara_kiri_group_spanner::after_line_breaking) + (hara-kiri-interface . #t) + (axes 1) ) basicHyphenSpannerProperties = #`( (thickness . 1.0) @@ -498,6 +498,7 @@ ScoreContext = \translator { ) basicKeyProperties = #`( (molecule-callback . ,Key_item::brew_molecule) + (key-item-interface . #t) (break-align-symbol . Key_item) (visibility-lambda . ,begin-of-line-visible) (breakable . #t) @@ -506,6 +507,7 @@ ScoreContext = \translator { (molecule-callback . ,Local_key_item::brew_molecule) (left-padding . 0.2) (right-padding . 0.4) + (accidentals-interface . #t) ) basicLyricExtenderProperties = #`( (molecule-callback . ,Lyric_extender::brew_molecule) @@ -519,12 +521,12 @@ ScoreContext = \translator { basicMarkProperties = #`( (molecule-callback . ,Text_item::brew_molecule) (breakable . #t) + (mark-interface . #t) (visibility-lambda . ,end-of-line-invisible) ) basicMultiMeasureRestProperties = #`( (molecule-callback . ,Multi_measure_rest::brew_molecule) (staff-position . 0) - ) basicNoteColumnProperties = #`( (axes 0 1) @@ -543,6 +545,10 @@ ScoreContext = \translator { (molecule-callback . ,Text_item::brew_molecule) (style . "italic") ) + basicPaperColumnProperties = #`( + (paper-column-interface . #t) + (axes 0) + ) basicPedalProperties = #`( (molecule-callback . ,Text_item::brew_molecule) (style . "italic") @@ -563,7 +569,9 @@ ScoreContext = \translator { basicScriptProperties = #`( (molecule-callback . ,Script::brew_molecule) ) - + basicScriptColumnProperties = #`( + (before-line-breaking-callback . ,Script_column::before_line_breaking) + ) basicSlurProperties = #`( (molecule-callback . ,Slur::brew_molecule) (after-line-breaking-callback . ,Slur::after_line_breaking) @@ -585,7 +593,7 @@ ScoreContext = \translator { (thin-kern . 3.0) (hair-thickness . 1.6) (thick-thickness . 6.0) - + (bar-interface . #t) ) basicSustainPedalProperties = #`( (no-spacing-rods . #t) @@ -633,6 +641,7 @@ ScoreContext = \translator { ) basicTupletSpannerProperties = #`( (number-gap . 2.0) + (delta-y . 0) (thick . 1.0) (after-line-breaking-callback . ,Tuplet_spanner::after_line_breaking) (molecule-callback . ,Tuplet_spanner::brew_molecule) @@ -657,7 +666,6 @@ ScoreContext = \translator { ) basicVoltaSpannerProperties = #`( (molecule-callback . ,Volta_spanner::brew_molecule) - (after-line-breaking-callback . ,Volta_spanner::after_line_breaking) ) \accepts "Staff"; diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 00ee1d42b0..5c5c756f9e 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,15 +1,15 @@ Begin3 Title: LilyPond -Version: 1.3.67 -Entered-date: 30JUN00 +Version: 1.3.68 +Entered-date: 02JUL00 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.67.tar.gz + 1000k lilypond-1.3.68.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 1000k lilypond-1.3.67.tar.gz + 1000k lilypond-1.3.68.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 0f23a1b61b..d54470836e 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.3.67 +Version: 1.3.68 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.67.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.68.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond # Icon: lilypond-icon.gif diff --git a/scm/lily.scm b/scm/lily.scm index 80e3ffeb6a..7479ba214e 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -229,9 +229,15 @@ ; Make a function that checks score element for being of a specific type. -(define (make-type-checker name) +(define (make-type-checker symbol) (lambda (elt) - (not (not (memq name (ly-get-elt-property elt 'interfaces)))))) + (display symbol) + (if (eq? #t (ly-get-elt-property elt symbol)) + #t + #f) + )) + + ;;;;;;;;;;;;;;;;;;; TeX output @@ -373,7 +379,7 @@ (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n")) (define (stop-line) - "}\\vss}\\interscoreline") + "}\\vss}\\interscoreline\n") (define (stop-last-line) "}\\vss}") (define (filledbox breapth width depth height)