]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/breathing-sign-engraver.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / breathing-sign-engraver.cc
index 439e09bee37b6d9d88f67797883b8d9aa21ea233..c4a7340adbea55603079262c74a0b1f2aa46c077 100644 (file)
@@ -1,95 +1,89 @@
 /*
-  breathing_sign-engraver.cc -- implement Breathing_sign_engraver
+  This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1999 Michael Krause
+  Copyright (C) 1999--2014 Michael Krause
 
   written for the GNU LilyPond music typesetter
 
-TODO:
+  TODO:
 
-  . Cancel any beams running through the breathing sign
- ([e8 \breathe f e f] should become [e8] \breathe [f e f])
   . Spacing is not yet completely pretty
 
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "staff-symbol-referencer.hh"
 #include "breathing-sign.hh"
-#include "musical-request.hh"
-#include "command-request.hh"
-#include "engraver-group-engraver.hh"
-#include "item.hh"
 #include "engraver.hh"
-#include "command-request.hh"
+#include "item.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
-class Breathing_sign_engraver : public Engraver {
+class Breathing_sign_engraver : public Engraver
+{
 public:
-  TRANSLATOR_DECLARATIONS(Breathing_sign_engraver);
-  
+  TRANSLATOR_DECLARATIONS (Breathing_sign_engraver);
+
 protected:
-  virtual bool try_music (Music *req_l);
-  virtual void create_grobs ();
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  void process_music ();
+  void stop_translation_timestep ();
 
+  DECLARE_TRANSLATOR_LISTENER (breathing);
 private:
-  Breathing_sign_req * breathing_sign_req_l_;
-  Grob * breathing_sign_p_;
+  Stream_event *breathing_sign_event_;
+  Grob *breathing_sign_;
 };
 
 Breathing_sign_engraver::Breathing_sign_engraver ()
 {
-  breathing_sign_p_ = 0;
-  breathing_sign_req_l_ = 0;
+  breathing_sign_ = 0;
+  breathing_sign_event_ = 0;
 }
 
-bool
-Breathing_sign_engraver::try_music (Music*r_l)
+IMPLEMENT_TRANSLATOR_LISTENER (Breathing_sign_engraver, breathing);
+void
+Breathing_sign_engraver::listen_breathing (Stream_event *ev)
 {
-  if (Breathing_sign_req  * b= dynamic_cast <Breathing_sign_req *> (r_l))
-    {
-      breathing_sign_req_l_ = b;
-      return true;
-    }
-  return false;
+  ASSIGN_EVENT_ONCE (breathing_sign_event_, ev);
 }
 
 void
-Breathing_sign_engraver::create_grobs ()
+Breathing_sign_engraver::process_music ()
 {
-  if (breathing_sign_req_l_ && ! breathing_sign_p_)
+  if (breathing_sign_event_)
     {
-      SCM b = get_property ("BreathingSign");
-      breathing_sign_p_ = new Item (b);
-
-      Breathing_sign::set_interface (breathing_sign_p_);
-
-      announce_grob(breathing_sign_p_, breathing_sign_req_l_->self_scm());
-      breathing_sign_req_l_ = 0;
+      breathing_sign_ = make_item ("BreathingSign", breathing_sign_event_->self_scm ());
     }
 }
 
-void 
+void
 Breathing_sign_engraver::stop_translation_timestep ()
 {
-  if (breathing_sign_p_)
-    {
-      typeset_grob (breathing_sign_p_);
-      breathing_sign_p_ = 0;
-    }
+  breathing_sign_ = 0;
+  breathing_sign_event_ = 0;
 }
 
-void
-Breathing_sign_engraver::start_translation_timestep ()
-{
-  breathing_sign_req_l_ = 0;
-}
+ADD_TRANSLATOR (Breathing_sign_engraver,
+                /* doc */
+                "Create a breathing sign.",
+
+                /* create */
+                "BreathingSign ",
 
+                /* read */
+                "",
 
-ENTER_DESCRIPTION(Breathing_sign_engraver,
-/* descr */       "",
-/* creats*/       "BreathingSign",
-/* acks  */       "",
-/* reads */       "",
-/* write */       "");
+                /* write */
+                ""
+               );