From: fred Date: Tue, 26 Mar 2002 23:57:17 +0000 (+0000) Subject: lilypond-1.3.96 X-Git-Tag: release/1.5.59~1240 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2c74d067e27682f3b96993ec4207a86cdf08694a;p=lilypond.git lilypond-1.3.96 --- diff --git a/lily/include/span-arpeggio.hh b/lily/include/span-arpeggio.hh index a494fbeb26..e69de29bb2 100644 --- a/lily/include/span-arpeggio.hh +++ b/lily/include/span-arpeggio.hh @@ -1,24 +0,0 @@ -/* - span-arpegio.hh -- declare Span_arpeggio - - source file of the GNU LilyPond music typesetter - - (c) 2000 Jan Nieuwenhuizen -*/ - -#ifndef SPAN_ARPEGGIO_HH -#define SPAN_ARPEGGIO_HH - -#include "lily-guile.hh" -#include "lily-proto.hh" -#include "interval.hh" - -class Span_arpeggio -{ -public: - DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM)); - static bool has_interface (Score_element*); -}; - -#endif /* SPAN_ARPEGGIO_HH */ - diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 90b0767e67..5ae4d1295d 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -17,7 +17,6 @@ /** - Make arpeggios that span multiple staffs. Catch arpeggios, and span a Span_arpeggio over them if we find more than two arpeggios. */ @@ -56,20 +55,19 @@ Span_arpeggio_engraver::acknowledge_element (Score_element_info info) void Span_arpeggio_engraver::process_acknowledged () { + /* + connectArpeggios is slightly brusque; we should really read a elt + property of the caught non-span arpeggios. That way, we can have + + both non-connected and connected arps in one pianostaff. + + + */ if (!span_arpeggio_ && arpeggios_.size () > 1 && to_boolean (get_property ("connectArpeggios"))) { - span_arpeggio_ = new Item (get_property ("SpanArpeggio")); - span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS); - Side_position::set_axis (span_arpeggio_, X_AXIS); - Pointer_group_interface pgi (span_arpeggio_, "arpeggios"); - for (int i = 0; i < arpeggios_.size () ; i++) - { - pgi.add_element (arpeggios_[i]); - span_arpeggio_->add_dependency (arpeggios_[i]); - } - - announce_element (span_arpeggio_, 0); + span_arpeggio_ = new Item (get_property ("Arpeggio")); + announce_element (span_arpeggio_, 0); } } @@ -78,6 +76,26 @@ Span_arpeggio_engraver::do_pre_move_processing () { if (span_arpeggio_) { + /* + we do this very late, to make sure we also catch `extra' + side-pos support like accidentals. + */ + for (int i=0; i < arpeggios_.size (); i ++) + { + for (SCM s = arpeggios_[i]->get_elt_property ("stems"); + gh_pair_p (s); s = gh_cdr (s)) + Group_interface::add_thing (span_arpeggio_, "stems", gh_car (s)); + for (SCM s = arpeggios_[i]->get_elt_property ("side-support-elements"); + gh_pair_p (s); s = gh_cdr (s)) + Group_interface::add_thing (span_arpeggio_, "side-support-elements", gh_car (s)); + + /* + we can't kill the children, since we don't want to the + previous note to bump into the span arpeggio; so we make + it transparent. */ + arpeggios_[i]->set_elt_property ("molecule-callback", SCM_BOOL_T); + } + typeset_element (span_arpeggio_); span_arpeggio_ = 0; } diff --git a/lily/span-arpeggio.cc b/lily/span-arpeggio.cc index 2dc2ca7761..e69de29bb2 100644 --- a/lily/span-arpeggio.cc +++ b/lily/span-arpeggio.cc @@ -1,67 +0,0 @@ -/* - span-arpeggio.cc -- implement Span_arpeggio - - source file of the GNU LilyPond music typesetter - - (c) 2000 Jan Nieuwenhuizen -*/ - -#include "axis-group-interface.hh" -#include "molecule.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "arpeggio.hh" -#include "span-arpeggio.hh" -#include "score-element.hh" -#include "stem.hh" -#include "staff-symbol-referencer.hh" - -bool -Span_arpeggio::has_interface (Score_element* me) -{ - return me && me->has_interface (ly_symbol2scm ("span-arpeggio-interface")); -} - -/* - We could collapse this with Arpeggio::brew_molecule, but that requires - hairy scm callback hacking. - */ -MAKE_SCHEME_CALLBACK (Span_arpeggio, brew_molecule, 1); -SCM -Span_arpeggio::brew_molecule (SCM smob) -{ - Score_element *me = unsmob_element (smob); - - Interval iv; - Score_element *common = me; - for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s)) - { - Score_element *arpeggio = unsmob_element (gh_car (s)); - common = arpeggio->common_refpoint (common, Y_AXIS); - } - // Hmm, nothing in common? - if (0) //common) - for (SCM s = me->get_elt_property ("arpeggios"); gh_pair_p (s); s = gh_cdr (s)) - { - Score_element *arpeggio = unsmob_element (gh_car (s)); - Real c = common->relative_coordinate (arpeggio, Y_AXIS); - //iv.unite (Arpeggio::head_positions (stem)); - iv.unite (Interval (c, c)); - } - else - iv = Interval (-23, 5); - - Molecule mol; - Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio"); - Real staff_space = Staff_symbol_referencer::staff_space (me); - for (int i = (int)iv[MIN]/ 2; i < (int)(iv[MAX] - 1)/ 2; i++) - { - Molecule a (arpeggio); - a.translate_axis (i * staff_space, Y_AXIS); - mol.add_molecule (a); - } - mol.translate (Offset (-2 * staff_space, 0)); - - return mol.create_scheme (); -} - diff --git a/ly/engraver.ly b/ly/engraver.ly index 53c4a8aab1..d24a5da6f2 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -32,7 +32,6 @@ StaffContext=\translator { \consists "Rest_collision_engraver"; \consists "Local_key_engraver"; \consists "Piano_pedal_engraver"; - \consists "Arpeggio_engraver"; \consistsend "Axis_group_engraver"; @@ -100,8 +99,10 @@ VoiceContext = \translator { Generic_property_list = #generic-voice-properties \consists "Output_property_engraver"; + \consists "Arpeggio_engraver"; \consists "Dynamic_engraver"; % must come before text_engraver. + \consists "Text_spanner_engraver"; \consists "Property_engraver"; \consists "Breathing_sign_engraver"; @@ -439,9 +440,14 @@ ScoreContext = \translator { % staffspace (distances) % Arpeggio = #`( - (interfaces . (arpeggio-interface)) + (interfaces . (arpeggio-interface side-position-interface)) + (X-extent-callback . ,Arpeggio::width_callback) (molecule-callback . ,Arpeggio::brew_molecule) - (name . "arpeggio") + (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) + (X-offset-callbacks . (,Side_position::aligned_side)) + (direction . -1) + (staff-position . 0.0) + (name . "Arpeggio") ) BarLine = #`( (interfaces . (bar-interface staff-bar-interface)) @@ -638,6 +644,8 @@ ScoreContext = \translator { Accidentals = #`( (molecule-callback . ,Local_key_item::brew_molecule) + (X-offset-callbacks . (,Side_position::aligned_side)) + (direction . -1) (left-padding . 0.2) (right-padding . 0.4) (interfaces . (accidentals-interface)) @@ -712,11 +720,8 @@ ScoreContext = \translator { (self-alignment-X . 0) (text . "8") (visibility-lambda . ,begin-of-line-visible) - (X-offset-callbacks . - (,Side_position::centered_on_parent - ,Side_position::aligned_on_self - ,Side_position::aligned_side - )) + (X-offset-callbacks . (,Side_position::centered_on_parent ,Side_position::aligned_on_self)) + (Y-offset-callbacks . (,Side_position::aligned_side)) (molecule-callback . ,Text_item::brew_molecule) (style . "italic") (name . "OctavateEight") @@ -764,11 +769,6 @@ ScoreContext = \translator { (maximum-duration-for-spacing . ,(make-moment 1 8)) (name . "SpacingSpanner") ) - SpanArpeggio = #`( - (interfaces . (span-arpeggio-interface)) - (molecule-callback . ,Span_arpeggio::brew_molecule) - (name . "SpanArpeggio") - ) SpanBar = #`( (interfaces . (bar-interface span-bar-interface)) (break-align-symbol . Staff_bar) @@ -827,10 +827,17 @@ ScoreContext = \translator { (molecule-callback . ,Text_item::brew_molecule) (no-spacing-rods . #t) (interfaces . (text-script-interface text-item-interface side-position-interface)) - (padding . 3.0) + (padding . 0.5) (name . "TextScript") ) - + TextSpanner = #`( + (interfaces . (text-spanner-interface)) + (molecule-callback . ,Text_spanner::brew_molecule) + (type . "line") + (direction . 1) + (text-style . "italic") + (name . "TextSpanner") + ) Tie = #`( (interfaces . (tie-interface)) (molecule-callback . ,Tie::brew_molecule) @@ -933,7 +940,6 @@ ScoreContext = \translator { (name . "SustainPedal") ) - UnaChordaPdeal = #`( (molecule-callback . ,Text_item::brew_molecule) (style . "italic")