]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/piano-pedal-engraver.cc
new file.
[lilypond.git] / lily / piano-pedal-engraver.cc
index 2570e2807595f6c73eecb5e4f311c924a11c4c44..d3b2789819c6530263c636ec175187d0f453a422 100644 (file)
@@ -7,8 +7,7 @@
   
   Chris Jackson <chris@fluffhouse.org.uk> - extended to support
   bracketed pedals.
-  TODO: support for __| |__ or __| Ped  instead of  ___/\__ for pedal up-down
- */
+*/
 
 #include "engraver.hh"
 #include "musical-request.hh"
@@ -56,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<SCM> 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();
@@ -172,8 +172,6 @@ Piano_pedal_engraver::create_grobs ()
            {
              p->line_spanner_ = new Spanner (get_property ( ( String (p->name_) + "PedalLineSpanner").ch_C() ));
              Side_position_interface::set_axis (p->line_spanner_, Y_AXIS);
-             Axis_group_interface::set_interface (p->line_spanner_);
-             Axis_group_interface::set_axes (p->line_spanner_, Y_AXIS, 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 ());
            }
@@ -291,10 +289,14 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
 
       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 angled ___/
-      p->bracket_p_->set_grob_property("angle-right", 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;
@@ -307,10 +309,15 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
       p->current_bracket_req_ = p->req_l_drul_[START];
 
       p->bracket_p_  = new Spanner (get_property ("PianoPedalBracket"));
-      p->bracket_p_->set_interface (ly_symbol2scm ("piano-pedal-interface"));
 
-      // Set a property so that the molecule-creating function will know whether the left edge should be angled \___
-      p->bracket_p_->set_grob_property("angle-left", 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. 
@@ -320,9 +327,7 @@ Piano_pedal_engraver::create_bracket_grobs (Pedal_info *p, SCM pedaltype)
                                       gh_bool2scm(false));
       if (p->item_p_)
        p->bracket_p_->set_parent (p->item_p_, Y_AXIS);
-      
-      Side_position_interface::set_axis (p->bracket_p_, Y_AXIS);
-      Side_position_interface::set_direction (p->bracket_p_, UP);
+
       p->bracket_p_->set_bound (LEFT, unsmob_grob (get_property ("currentMusicalColumn")));
       Axis_group_interface::add_element (p->line_spanner_, p->bracket_p_);