]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/piano-pedal-engraver.cc
patch::: 1.3.135.jcn3
[lilypond.git] / lily / piano-pedal-engraver.cc
index dd85bb6370ac370e1c26cc00c74288f37057a115..527bd396c775745b99cd4197e1af8f5a917e60af 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 2000--2001 Jan Nieuwenhuizen <janneke@gnu.org>
  */
 
 #include "engraver.hh"
 #include "staff-symbol-referencer.hh"
 #include "item.hh"
 
-
-
-
-
-/**
-   engrave Piano pedals symbols.
- */
 class Piano_pedal_engraver : public Engraver
 {
 public:
@@ -31,7 +24,7 @@ public:
   Piano_pedal_engraver ();
   ~Piano_pedal_engraver ();
 protected:
-  virtual void do_creation_processing ();
+  virtual void initialize ();
   virtual bool try_music (Music*);
   virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
@@ -58,7 +51,7 @@ Piano_pedal_engraver::Piano_pedal_engraver ()
   info_list_ = 0;
 }
 void
-Piano_pedal_engraver::do_creation_processing()
+Piano_pedal_engraver::initialize()
 {
   info_list_ = new Pedal_info[4];
   Pedal_info *p = info_list_;
@@ -97,15 +90,15 @@ Piano_pedal_engraver::acknowledge_grob (Grob_info info)
        {
          if (Rhythmic_head::has_interface (info.elem_l_))
            {
-             Side_position::add_support (p->item_p_, info.elem_l_);
+             Side_position_interface::add_support (p->item_p_, info.elem_l_);
 
-             if (Side_position::get_axis(p->item_p_) == X_AXIS
+             if (Side_position_interface::get_axis(p->item_p_) == X_AXIS
                  && !p->item_p_->parent_l (Y_AXIS))
                p->item_p_->set_parent (info.elem_l_, Y_AXIS);
            }
          if (Stem::has_interface (info.elem_l_))
            {
-             Side_position::add_support (p->item_p_,info.elem_l_);
+             Side_position_interface::add_support (p->item_p_,info.elem_l_);
            }
        }
     }
@@ -134,9 +127,14 @@ Piano_pedal_engraver::create_grobs ()
 {
   for (Pedal_info*p = info_list_; p && p->name_; p ++)
     {
-      if (p->item_p_)
+      if (p->item_p_ || ! (p->req_l_drul_[STOP] || p->req_l_drul_[START]))
        continue;
+      
       SCM s = SCM_EOL;
+      SCM strings = get_property( ("pedal" + String (p->name_) + "Strings").ch_C());
+      if( scm_ilength (strings) < 3)
+       continue;
+      
       if (p->req_l_drul_[STOP] && p->req_l_drul_[START])
        {
          if (!p->start_req_l_)
@@ -145,7 +143,7 @@ Piano_pedal_engraver::create_grobs ()
            }
          else
            {
-             s = get_property (("stopStart" + String (p->name_ )).ch_C());
+             s = gh_cadr (strings);
            }
          p->start_req_l_ = p->req_l_drul_[START];
        }
@@ -157,14 +155,14 @@ Piano_pedal_engraver::create_grobs ()
            }
          else
            {
-             s = get_property (("stop" + String (p->name_ )).ch_C());
+             s = gh_car (strings);
            }
          p->start_req_l_ = 0;
        }
       else if (p->req_l_drul_[START])
        {
          p->start_req_l_ = p->req_l_drul_[START];
-         s = get_property (("start" + String (p->name_ )).ch_C());
+         s = gh_caddr (strings);
        }
 
       if (gh_string_p (s))
@@ -197,7 +195,8 @@ Piano_pedal_engraver::stop_translation_timestep ()
     {
       if (p->item_p_)
        {
-         Side_position::add_staff_support (p->item_p_);
+         Side_position_interface::add_staff_support (p->item_p_);
+         
          /*
            Hmm.
          */
@@ -205,7 +204,7 @@ Piano_pedal_engraver::stop_translation_timestep ()
            {
              if (sustain)
                {
-                 Side_position::add_support (p->item_p_,sustain);
+                 Side_position_interface::add_support (p->item_p_,sustain);
                }
            }
          typeset_grob (p->item_p_);