From: Han-Wen Nienhuys Date: Sun, 5 May 2002 20:37:57 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/1.5.56~19 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=84914547f5fdfb9b61da9649371b16f88f05c594;p=lilypond.git *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 6d1121484f..47617bf1d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2002-05-05 Han-Wen Nienhuys + * lily/piano-pedal-engraver.cc: cleanups. + * lily/accidental.cc (after_line_breaking): add break tie reminders. diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 8f4cffa99c..91fc994be0 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -147,14 +147,14 @@ Dynamic_engraver::process_music () } } - /* - During a (de)crescendo, pending request will not be cleared, - and a line-spanner will always be created, as \< \! are already - two requests. + /* + During a (de)crescendo, pending request will not be cleared, + and a line-spanner will always be created, as \< \! are already + two requests. - Note: line-spanner must always have at least same duration - as (de)crecsendo, b.o. line-breaking. - */ + Note: line-spanner must always have at least same duration + as (de)crecsendo, b.o. line-breaking. + */ @@ -209,11 +209,11 @@ Dynamic_engraver::process_music () { if (current_cresc_req_) { - accepted_spanreqs_drul_[START]->origin ()->warning - (current_cresc_req_->get_span_dir () == 1 - ? _ ("already have a crescendo") - : _ ("already have a decrescendo")); - + String msg = current_cresc_req_->get_span_dir () == 1 + ? _ ("already have a crescendo") + : _ ("already have a decrescendo"); + + accepted_spanreqs_drul_[START]->origin ()->warning (msg); current_cresc_req_->origin ()->warning (_("Cresc started here")); } else diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index a5d1b283aa..62a00dec4c 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -21,6 +21,7 @@ #include #include "config.h" +#include "drul-array.hh" /* Guile 1.3.4 compatibility */ #if GUILE_MINOR_VERSION < 4 @@ -141,7 +142,7 @@ Offset ly_scm2offset (SCM); SCM ly_assoc_chain (SCM key, SCM achain); SCM ly_assoc_cdr (SCM key, SCM alist); Interval ly_scm2interval (SCM); -SCM ly_interval2scm (Interval); +SCM ly_interval2scm (Drul_array); SCM ly_parse_scm (char const* s, int* n); diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 0a5abcfa0f..4327653e00 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -64,7 +64,7 @@ protected: }; -void add_bound_item (Spanner*, Item* n); +void add_bound_item (Spanner*, Grob*); void extend_spanner_over_elements (Grob* span); diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 26d856955d..9065c09358 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -321,7 +321,7 @@ ly_scm2interval (SCM p) } SCM -ly_interval2scm (Interval i) +ly_interval2scm (Drul_array i) { return gh_cons (gh_double2scm (i[LEFT]), gh_double2scm (i[RIGHT])); diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index d3b2789819..904ae8182f 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 2000--2002 Jan Nieuwenhuizen + (c) 2000--2002 Jan Nieuwenhuizen Chris Jackson - extended to support bracketed pedals. @@ -22,10 +22,28 @@ #include "directional-element-interface.hh" #include "note-column.hh" +struct Pedal_info +{ + char const * name_; + Span_req* start_req_l_; + Drul_array req_l_drul_; + Item* item_p_; + Spanner* bracket_p_; // A single portion of a pedal bracket + Spanner* finished_bracket_p_; + + /* + This grob contains all the pedals of the same type on the same staff + */ + Spanner* line_spanner_; + Spanner* finished_line_spanner_; + Span_req* current_bracket_req_; +}; + + class Piano_pedal_engraver : public Engraver { public: - TRANSLATOR_DECLARATIONS(Piano_pedal_engraver); + TRANSLATOR_DECLARATIONS (Piano_pedal_engraver); ~Piano_pedal_engraver (); protected: virtual void initialize (); @@ -37,43 +55,45 @@ protected: virtual void create_grobs (); private: - struct Pedal_info - { - char const * name_; - Span_req* start_req_l_; - Drul_array req_l_drul_; - Item* item_p_; - Spanner* bracket_p_; // A single portion of a pedal bracket - Spanner* finished_bracket_p_; - Spanner* line_spanner_; // This grob contains all the pedals of the same type on the same staff - Spanner* finished_line_spanner_; - Span_req* current_bracket_req_; - }; - Pedal_info *info_list_; - Spanner *previous_p_ [4]; // Record a stack of the current pedal spanners, so if more than one pedal - int nspanners_i; // occurs simultaneously then extra space can be added between them. - Drul_array edge_width_drul_; // Left and right flare widths of a \___/, as specified by the grob property edge-width. + /* + Record a stack of the current pedal spanners, so if more than one pedal + occurs simultaneously then extra space can be added between them. + + + Why 4, why not 3. Why not 3423 ? ---hwn. + */ + + Spanner *previous_p_ [4]; + + int spanner_count_; + + /* + Left and right flare widths of a \___/, as specified by the grob + property edge-width. + */ + Drul_array edge_width_drul_; + void create_text_grobs (Pedal_info *p, SCM pedaltype); void create_bracket_grobs (Pedal_info *p, SCM pedaltype); - void typeset_all(); + void typeset_all (); }; - Piano_pedal_engraver::Piano_pedal_engraver () { info_list_ = 0; } + void Piano_pedal_engraver::initialize () { info_list_ = new Pedal_info[4]; Pedal_info *p = info_list_; - nspanners_i = 0; + spanner_count_ = 0; for (int i = 0; i < 3; ++i) previous_p_[i] = 0; @@ -112,24 +132,31 @@ Piano_pedal_engraver::acknowledge_grob (Grob_info info) { for (Pedal_info*p = info_list_; p && p->name_; p ++) { - Grob *g = (Grob *) p->item_p_; - int i = 0; - while ( i < 2 ) + Grob *gs[] = {p->item_p_, + p->bracket_p_}; + for (int i = 0; i < 2 ; i++) { + Grob *g = gs[i]; if (g && p->line_spanner_) { if (Note_column::has_interface (info.grob_l_)) { Side_position_interface::add_support (p->line_spanner_, info.grob_l_); - add_bound_item (p->line_spanner_,dynamic_cast (info.grob_l_)); - + add_bound_item (p->line_spanner_,info.grob_l_); + + if (p->bracket_p_) + add_bound_item (p->bracket_p_,info.grob_l_); + + /* + What the h*ll is this supposed to do? --hwn + */ +#if 0 if (Side_position_interface::get_axis (g) == X_AXIS && !g->get_parent (Y_AXIS)) g->set_parent (info.grob_l_, Y_AXIS); +#endif } } - g = (Grob *) p->bracket_p_; - ++i; } } } @@ -170,27 +197,30 @@ Piano_pedal_engraver::create_grobs () { if (!p->line_spanner_) { - p->line_spanner_ = new Spanner (get_property ( ( String (p->name_) + "PedalLineSpanner").ch_C() )); + String name = String (p->name_) + "PedalLineSpanner"; + p->line_spanner_ = new Spanner (get_property (name.ch_C ())); Side_position_interface::set_axis (p->line_spanner_, Y_AXIS); Music * rq = (p->req_l_drul_[START] ? p->req_l_drul_[START] : p->req_l_drul_[STOP]); announce_grob (p->line_spanner_, rq->self_scm ()); } - // Choose the appropriate grobs to add to the line spanner - // These can be text items or text-spanners - - SCM type = ly_cdr (scm_assoc (ly_symbol2scm("pedal-type"), - get_property( ( String (p->name_) + "Pedal").ch_C () ))); - if (type == ly_symbol2scm("text") || // Ped. *Ped. * - type == ly_symbol2scm("mixed") ) // Ped. _____/\____| - if (! p->item_p_) - create_text_grobs(p, type); - - if (type == ly_symbol2scm("bracket") || // |_________/\____| - type == ly_symbol2scm("mixed") ) - create_bracket_grobs(p, type); + /* Choose the appropriate grobs to add to the line spanner + These can be text items or text-spanners + */ + SCM type = ly_cdr (scm_assoc (ly_symbol2scm ("pedal-type"), + get_property ( (String (p->name_) + "Pedal").ch_C ()))); + if (type == ly_symbol2scm ("text") || // Ped. *Ped. * + type == ly_symbol2scm ("mixed") ) // Ped. _____/\____| + { + if (! p->item_p_) + create_text_grobs (p, type); + } + if (type == ly_symbol2scm ("bracket") || // |_________/\____| + type == ly_symbol2scm ("mixed") ) + { + create_bracket_grobs (p, type); + } } - } } @@ -200,13 +230,13 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, SCM pedaltype) { SCM b; SCM s = SCM_EOL; - SCM strings = get_property (("pedal" + String (p->name_) + "Strings").ch_C ()); + SCM strings = get_property ( ("pedal" + String (p->name_) + "Strings").ch_C ()); - if (! (scm_ilength (strings) < 3)) + if (scm_ilength (strings) >= 3) { if (p->req_l_drul_[STOP] && p->req_l_drul_[START]) { - if (pedaltype == ly_symbol2scm("text")) + if (pedaltype == ly_symbol2scm ("text")) { if (!p->start_req_l_) { @@ -219,10 +249,9 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, SCM pedaltype) p->start_req_l_ = p->req_l_drul_[START]; } } - else if (p->req_l_drul_[STOP]) { - if (pedaltype == ly_symbol2scm("text")) + if (pedaltype == ly_symbol2scm ("text")) { if (!p->start_req_l_) { @@ -231,23 +260,24 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, SCM pedaltype) else { s = ly_caddr (strings); - nspanners_i --; + spanner_count_ --; } p->start_req_l_ = 0; } } - - else if ( p->req_l_drul_[START] ) + else if (p->req_l_drul_[START]) { p->start_req_l_ = p->req_l_drul_[START]; s = ly_car (strings); - if (pedaltype == ly_symbol2scm("text")) { - nspanners_i ++; - previous_p_[nspanners_i] = p->line_spanner_; - if (nspanners_i > 1) - // add extra space below the previous already-occuring pedal - Side_position_interface::add_support(p->line_spanner_, previous_p_[nspanners_i - 1]); - } + if (pedaltype == ly_symbol2scm ("text")) + { + spanner_count_ ++; + previous_p_[spanner_count_] = p->line_spanner_; + if (spanner_count_ > 1) + // add extra space below the previous already-occuring pedal + Side_position_interface::add_support (p->line_spanner_, + previous_p_[spanner_count_ - 1]); + } } if (gh_string_p (s)) @@ -261,10 +291,10 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, SCM pedaltype) announce_grob (p->item_p_, (p->req_l_drul_[START] ? p->req_l_drul_[START] - : p->req_l_drul_[STOP])->self_scm() ); + : p->req_l_drul_[STOP])->self_scm ()); } - if (pedaltype == ly_symbol2scm("text")) + if (pedaltype == ly_symbol2scm ("text")) { p->req_l_drul_[START] = 0; p->req_l_drul_[STOP] = 0; @@ -283,19 +313,19 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype) p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", p->name_)); } else if (!p->req_l_drul_[START]) - nspanners_i -- ; + spanner_count_ -- ; assert (!p->finished_bracket_p_ && p->bracket_p_); - p->bracket_p_->set_bound (RIGHT, unsmob_grob(get_property ("currentMusicalColumn"))); + p->bracket_p_->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn"))); - // Set properties so that the molecule-creating function will know whether the right edge should be flared ___/ - SCM eleft = ly_car ( p->bracket_p_->get_grob_property("edge-width") ); - SCM eright = ( (bool) p->req_l_drul_[START] ? - edge_width_drul_[RIGHT] : - gh_double2scm(0) ); - p->bracket_p_->set_grob_property("edge-width", gh_cons ( eleft, eright ) ); - add_bound_item (p->line_spanner_, p->bracket_p_->get_bound (RIGHT)); + /* + Set properties so that the molecule-creating function will + know whether the right edge should be flared ___/ + */ + SCM eleft = ly_car (p->bracket_p_->get_grob_property ("edge-width")); + SCM eright = (p->req_l_drul_[START] ? edge_width_drul_[RIGHT] : gh_double2scm (0)); + p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright)); p->finished_bracket_p_ = p->bracket_p_; p->bracket_p_ = 0; @@ -310,21 +340,29 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype) p->bracket_p_ = new Spanner (get_property ("PianoPedalBracket")); - // Set properties so that the molecule-creating function will know whether the left edge should be flared \___ - edge_width_drul_[LEFT] = ly_car ( p->bracket_p_->get_grob_property("edge-width") ); - edge_width_drul_[RIGHT] = ly_cdr ( p->bracket_p_->get_grob_property("edge-width") ); + /* + Set properties so that the molecule-creating function will + know whether the left edge should be flared \___ + */ + + SCM ew = p->bracket_p_->get_grob_property ("edge-width"); + edge_width_drul_[LEFT] = ly_car (ew); + edge_width_drul_[RIGHT] = ly_cdr (ew); + SCM eleft = ( (bool) p->req_l_drul_[STOP] ? edge_width_drul_[LEFT] : - gh_double2scm(0) ); - SCM eright = gh_double2scm(0); - p->bracket_p_->set_grob_property("edge-width", gh_cons ( eleft, eright ) ); - - // Set this property for 'mixed style' pedals, Ped._______/\ , - // so the molecule function will shorten the ____ line by the length of the Ped. text. - p->bracket_p_->set_grob_property("text-start", - pedaltype == ly_symbol2scm("mixed") ? - gh_bool2scm((bool) ! p->req_l_drul_[STOP]) : - gh_bool2scm(false)); + gh_double2scm (0)); + SCM eright = gh_double2scm (0); + p->bracket_p_->set_grob_property ("edge-width", gh_cons (eleft, eright)); + + /* Set this property for 'mixed style' pedals, Ped._______/\ , + so the molecule function will shorten the ____ line by the length of the Ped. text. + */ + + p->bracket_p_->set_grob_property ("text-start", + pedaltype == ly_symbol2scm ("mixed") ? + gh_bool2scm ( (bool) ! p->req_l_drul_[STOP]) : + gh_bool2scm (false)); if (p->item_p_) p->bracket_p_->set_parent (p->item_p_, Y_AXIS); @@ -332,18 +370,17 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype) Axis_group_interface::add_element (p->line_spanner_, p->bracket_p_); add_bound_item (p->line_spanner_, p->bracket_p_->get_bound (LEFT)); - announce_grob (p->bracket_p_, p->req_l_drul_[START]->self_scm()); - - if (!p->req_l_drul_[STOP]) { + announce_grob (p->bracket_p_, p->req_l_drul_[START]->self_scm ()); - nspanners_i ++; - previous_p_[nspanners_i] = p->line_spanner_; + if (!p->req_l_drul_[STOP]) + { + spanner_count_ ++; + previous_p_[spanner_count_] = p->line_spanner_; - if (nspanners_i > 1) - // position new pedal spanner below the current one - Side_position_interface::add_support(p->line_spanner_, previous_p_[nspanners_i - 1]); - - } + if (spanner_count_ > 1) + // position new pedal spanner below the current one + Side_position_interface::add_support (p->line_spanner_, previous_p_[spanner_count_ - 1]); + } } p->req_l_drul_[START] = 0; @@ -355,9 +392,13 @@ Piano_pedal_engraver::finalize () { for (Pedal_info*p = info_list_; p && p->name_; p ++) { + /* + suicide? + */ if (p->line_spanner_ && p->line_spanner_->immutable_property_alist_ == SCM_EOL) p->line_spanner_ = 0; + if (p->line_spanner_) { p->finished_line_spanner_ = p->line_spanner_; @@ -381,8 +422,13 @@ Piano_pedal_engraver::stop_translation_timestep () { for (Pedal_info*p = info_list_; p && p->name_; p ++) { - p->finished_line_spanner_ = p->line_spanner_; + if (!p->bracket_p_) + { + p->finished_line_spanner_ = p->line_spanner_; + p->line_spanner_ = 0; + } } + typeset_all (); } @@ -390,17 +436,20 @@ Piano_pedal_engraver::stop_translation_timestep () void Piano_pedal_engraver::typeset_all () { - - Item * sustain = 0; for (Pedal_info*p = info_list_; p->name_; p ++) { + /* + Handle suicide. + */ if (p->finished_line_spanner_ && p->finished_line_spanner_->immutable_property_alist_ == SCM_EOL) p->finished_line_spanner_ = 0; if (p->finished_bracket_p_ && p->finished_bracket_p_->immutable_property_alist_ == SCM_EOL) p->finished_bracket_p_ = 0; + + if (p->name_ == String ("Sustain")) sustain = p->item_p_; @@ -422,14 +471,13 @@ Piano_pedal_engraver::typeset_all () if (p->finished_bracket_p_) { - if (!p->finished_bracket_p_->get_bound (RIGHT)) + Grob * l = p->finished_line_spanner_->get_bound (LEFT); + Grob * r = p->finished_line_spanner_->get_bound (RIGHT); + if (!r) { p->finished_bracket_p_->set_bound (RIGHT, unsmob_grob (get_property ("currentMusicalColumn"))); - - if (p->finished_line_spanner_) - add_bound_item (p->finished_line_spanner_, - p->finished_bracket_p_->get_bound (RIGHT)); } + typeset_grob (p->finished_bracket_p_); p->finished_bracket_p_ =0; } @@ -437,7 +485,7 @@ Piano_pedal_engraver::typeset_all () if (p->finished_line_spanner_) { Side_position_interface::add_staff_support (p->finished_line_spanner_); - Grob * l = p->finished_line_spanner_->get_bound (LEFT ); + Grob * l = p->finished_line_spanner_->get_bound (LEFT); Grob * r = p->finished_line_spanner_->get_bound (RIGHT); if (!r && l) p->finished_line_spanner_->set_bound (RIGHT, l); @@ -446,7 +494,7 @@ Piano_pedal_engraver::typeset_all () else if (!r && !l) { Grob * cc = unsmob_grob (get_property ("currentMusicalColumn")); - Item * ci = dynamic_cast(cc); + Item * ci = dynamic_cast (cc); p->finished_line_spanner_->set_bound (RIGHT, ci); p->finished_line_spanner_->set_bound (LEFT, ci); } @@ -465,7 +513,7 @@ Piano_pedal_engraver::start_translation_timestep () p->req_l_drul_[START] = 0; } } -ENTER_DESCRIPTION(Piano_pedal_engraver, +ENTER_DESCRIPTION (Piano_pedal_engraver, /* descr */ "Engrave piano pedal symbols and brackets.", /* creats*/ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner", /* acks */ "note-column-interface", diff --git a/lily/spanner.cc b/lily/spanner.cc index 4dd1dce0a5..e45c74f7e2 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -304,8 +304,15 @@ Spanner::do_derived_mark () return SCM_EOL; } + +/* + Set left or right bound to IT. + + Warning: caller should ensure that subsequent calls put in ITems + that are left-to-right ordered. + */ void -add_bound_item (Spanner* sp, Item*it) +add_bound_item (Spanner* sp, Grob*it) { if (!sp->get_bound (LEFT)) sp->set_bound (LEFT, it); diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 2e4acbfa9a..5dae3a1226 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -45,7 +45,6 @@ Text_spanner::brew_molecule (SCM smob) setup_pedal_bracket(spanner); } - /* Ugh, must be same as Hairpin::brew_molecule. */ Real padding = gh_scm2double (me->get_grob_property ("if-text-padding")); Real broken_left = spanner->get_broken_left_end_align (); @@ -68,10 +67,10 @@ Text_spanner::brew_molecule (SCM smob) Real r = 0.0; if (!e.empty_b ()) r = e[-d] + padding; + /* Text spanners such as ottava, should span from outer limits of noteheads, iso (de)cresc. spanners that span the inner space */ if (me->get_grob_property ("outer") != SCM_EOL) - // r *= -1; // huh? { width -= d * r; } @@ -184,6 +183,7 @@ Text_spanner::brew_molecule (SCM smob) + /* Piano pedal brackets are a special case of a text spanner. Pedal up-down (restart) indicated by the angled right and left edges @@ -217,24 +217,25 @@ Text_spanner::setup_pedal_bracket(Spanner *me) if (gh_number_p (pa) ) padding = gh_scm2double (pa); - do { - Item *b = me->get_bound (d); - - e = b->extent (b, X_AXIS); - if (!e.empty_b ()) - r[d] = d * (e[-d] + padding); - - broken[d] = b->break_status_dir () != CENTER; - width[d] = 0; - height[d] = 0; - shorten[d] = 0; - if ( gh_pair_p (ew) ) - width[d] += gh_scm2double (index_cell (ew, d)) * d; - if ( !broken[d] && (gh_pair_p (eh) ) ) - height[d] += gh_scm2double (index_cell (eh, d)); - if ( gh_pair_p (sp) ) - shorten[d] += gh_scm2double (index_cell (sp, d)); - } + do + { + Item *b = me->get_bound (d); + + e = b->extent (b, X_AXIS); + if (!e.empty_b ()) + r[d] = d * (e[-d] + padding); + + broken[d] = b->break_status_dir () != CENTER; + width[d] = 0; + height[d] = 0; + shorten[d] = 0; + if ( gh_pair_p (ew) ) + width[d] += gh_scm2double (index_cell (ew, d)) * d; + if ( !broken[d] && (gh_pair_p (eh) ) ) + height[d] += gh_scm2double (index_cell (eh, d)); + if ( gh_pair_p (sp) ) + shorten[d] += gh_scm2double (index_cell (sp, d)); + } while (flip (&d) != LEFT); Real extra_short = 0; @@ -260,36 +261,35 @@ Text_spanner::setup_pedal_bracket(Spanner *me) shorten[LEFT] += extra_short ; - if (broken[LEFT]) { - shorten[LEFT] -= me->get_broken_left_end_align () ; - shorten[RIGHT] += abs(width[RIGHT]) + thick - r[RIGHT]; - } - - else { - // Shorten a ____/ on the right so that it will touch an adjoining \___ - shorten[RIGHT] += abs(width[LEFT]) + abs(width[RIGHT]) + thick; - // Also shorten so that it ends just before the spanned note. - shorten[RIGHT] -= (r[LEFT] + r[RIGHT]); - } - - me->set_grob_property ("edge-height", gh_cons ( gh_double2scm ( height[LEFT] ) , - gh_double2scm ( height[RIGHT]) ) ); - me->set_grob_property ("edge-width", gh_cons ( gh_double2scm ( width[LEFT] ), - gh_double2scm ( width[RIGHT] ) )); - me->set_grob_property ("shorten-pair", gh_cons ( gh_double2scm ( shorten[LEFT] ), - gh_double2scm ( shorten[RIGHT] ) )); + if (broken[LEFT]) + { + shorten[LEFT] -= me->get_broken_left_end_align () ; + shorten[RIGHT] += abs(width[RIGHT]) + thick - r[RIGHT]; + } + + else + { + // Shorten a ____/ on the right so that it will touch an adjoining \___ + shorten[RIGHT] += abs(width[LEFT]) + abs(width[RIGHT]) + thick; + // Also shorten so that it ends just before the spanned note. + shorten[RIGHT] -= (r[LEFT] + r[RIGHT]); + } + + me->set_grob_property ("edge-height", ly_interval2scm (height)); + me->set_grob_property ("edge-width", ly_interval2scm(width)); + me->set_grob_property ("shorten-pair", ly_interval2scm (shorten)); } struct Pianopedal { - static bool has_interface (Grob*); + static bool has_interface (Grob*); }; ADD_INTERFACE (Pianopedal,"piano-pedal-interface", - "", - "pedal-type edge-width edge-height shorten-pair text-start left-widen right-widen"); + "", + "pedal-type edge-width edge-height shorten-pair text-start left-widen right-widen"); ADD_INTERFACE (Text_spanner,"text-spanner-interface", - "generic text spanner", - "dash-period if-text-padding dash-length edge-height edge-width edge-text shorten-pair type"); + "generic text spanner", + "dash-period if-text-padding dash-length edge-height edge-width edge-text shorten-pair type");