Index: lily/piano-pedal-engraver.cc
===================================================================
RCS file: /home/lilypond/lilypond/lily/piano-pedal-engraver.cc,v
retrieving revision 1.33
diff -p -u -r1.33 piano-pedal-engraver.cc
--- lily/piano-pedal-engraver.cc 24 Mar 2002 20:46:54 -0000 1.33
+++ lily/piano-pedal-engraver.cc 6 Apr 2002 23:26:34 -0000
@@ -7,9 +7,6 @@
Chris Jackson
- extended to support
bracketed pedals.
-
- TODO: support for __| |__ or __| Ped instead of ___/\__ for pedal up-down
-
*/
#include "engraver.hh"
@@ -58,6 +55,7 @@ private:
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.
void create_text_grobs (Pedal_info *p, SCM pedaltype);
void create_bracket_grobs (Pedal_info *p, SCM pedaltype);
void typeset_all();
@@ -291,10 +289,14 @@ Piano_pedal_engraver::create_bracket_gro
p->bracket_p_->set_bound (RIGHT, unsmob_grob(get_property ("currentMusicalColumn")));
- // Set a property so that the molecule-creating function will know whether the right edge should be flared ___/
- p->bracket_p_->set_grob_property("right-widen", gh_bool2scm((bool) p->req_l_drul_[START]) );
+ // 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));
-
+
p->finished_bracket_p_ = p->bracket_p_;
p->bracket_p_ = 0;
p->current_bracket_req_ = 0;
@@ -308,8 +310,14 @@ Piano_pedal_engraver::create_bracket_gro
p->bracket_p_ = new Spanner (get_property ("PianoPedalBracket"));
- // Set a property so that the molecule-creating function will know whether the left edge should be flared \___
- p->bracket_p_->set_grob_property("left-widen", gh_bool2scm((bool) p->req_l_drul_[STOP]) );
+ // 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") );
+ 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.
@@ -319,7 +327,7 @@ Piano_pedal_engraver::create_bracket_gro
gh_bool2scm(false));
if (p->item_p_)
p->bracket_p_->set_parent (p->item_p_, Y_AXIS);
-
+
p->bracket_p_->set_bound (LEFT, unsmob_grob (get_property ("currentMusicalColumn")));
Axis_group_interface::add_element (p->line_spanner_, p->bracket_p_);
Index: lily/text-spanner.cc
===================================================================
RCS file: /home/lilypond/lilypond/lily/text-spanner.cc,v
retrieving revision 1.50
diff -p -u -r1.50 text-spanner.cc
--- lily/text-spanner.cc 1 Apr 2002 22:53:26 -0000 1.50
+++ lily/text-spanner.cc 6 Apr 2002 23:26:34 -0000
@@ -172,7 +172,7 @@ Text_spanner::brew_molecule (SCM smob)
m.add_at_edge (X_AXIS, RIGHT, edge_line[LEFT], 0);
if (!line.empty_b ())
m.add_at_edge (X_AXIS, RIGHT, line,
- edge_line[LEFT].empty_b () ? 0 : - thick/2);
+ edge_line[LEFT].empty_b () ? 0 : -thick/2);
if (!edge_line[RIGHT].empty_b ())
m.add_at_edge (X_AXIS, RIGHT, edge_line[RIGHT], -thick/2);
if (!edge[RIGHT].empty_b ())
@@ -202,25 +202,13 @@ Text_spanner::setup_pedal_bracket(Spanne
thick *= gh_scm2double (st);
}
- Drul_array w, broken;
+ Drul_array broken;
Drul_array height, width, shorten, r;
- /*
- FIXME: too many new property names.
- */
SCM pa = me->get_grob_property ("if-text-padding");
SCM ew = me->get_grob_property ("edge-width");
SCM eh = me->get_grob_property ("edge-height");
SCM sp = me->get_grob_property ("shorten-pair");
- SCM wl = me->get_grob_property ("left-widen");
- SCM wr = me->get_grob_property ("right-widen");
-
- // Pedal has an angled left edge \__ or an angled right edge __/
- w[LEFT] = w[RIGHT] = false;
- if (gh_boolean_p (wl) )
- w[LEFT] = to_boolean (wl);
- if (gh_boolean_p (wr) )
- w[RIGHT] = to_boolean (wr);
Direction d = LEFT;
Interval e;
@@ -240,12 +228,12 @@ Text_spanner::setup_pedal_bracket(Spanne
width[d] = 0;
height[d] = 0;
shorten[d] = 0;
- if ( w[d] && gh_pair_p (ew) )
+ 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));
+ height[d] += gh_scm2double (index_cell (eh, d));
if ( gh_pair_p (sp) )
- shorten[d] = gh_scm2double (index_cell (sp, d));
+ shorten[d] += gh_scm2double (index_cell (sp, d));
}
while (flip (&d) != LEFT);
@@ -257,12 +245,6 @@ Text_spanner::setup_pedal_bracket(Spanne
height[LEFT] = 0;
Grob * textbit = me->get_parent(Y_AXIS);
extra_short = padding;
- if (textbit->has_interface(ly_symbol2scm("piano-pedal-interface")))
- // for pretty Ped. scripts.
- {
- e = textbit->extent(textbit, Y_AXIS);
- extra_short += e.length();
- }
if (textbit->has_interface(ly_symbol2scm("text-interface")))
// for plain text, e.g., Sost. Ped.
{
@@ -276,16 +258,19 @@ Text_spanner::setup_pedal_bracket(Spanne
shorten[RIGHT] -= thick;
}
- // Shorten a \____ on the left so that it will touch an adjoining ___/
- shorten[LEFT] += abs(width[LEFT]) * 2 + extra_short ;
+ shorten[LEFT] += extra_short ;
if (broken[LEFT]) {
- shorten[LEFT] -= me->get_broken_left_end_align () ;
- shorten[RIGHT] -= r[RIGHT];
+ 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]);
}
- else
- // Shorten bracket on the right so it ends just before the spanned note.
- shorten[RIGHT] += thick - (r[LEFT] + r[RIGHT]);
me->set_grob_property ("edge-height", gh_cons ( gh_double2scm ( height[LEFT] ) ,
gh_double2scm ( height[RIGHT]) ) );