--- /dev/null
+\version "1.0.21";
+
+\score {
+ \notes \relative c' {
+ \key es; \time 3/4;
+ < \context Voice = two { \stemdown es4 bes es }
+ \context Voice = one { \stemup g4 as g }
+ > |
+ < \context Voice = two { \stemdown es4 \breathe bes es }
+ \context Voice = one { \stemup g4 as g }
+ > |
+ es8 d es f g4 \breathe |
+ es8 d \breathe es f g f |
+ es2 r4 \bar "||";
+ }
+}
--- /dev/null
+/*
+ breathing_sign-engraver.cc -- implement Breathing_sign_engraver
+
+ Copyright (C) 1999 Michael Krause
+
+ written for the GNU LilyPond music typesetter
+
+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
+
+*/
+
+#include "breathing-sign-engraver.hh"
+#include "breathing-sign.hh"
+#include "musical-request.hh"
+#include "command-request.hh"
+#include "engraver-group.hh"
+#include "note-head.hh"
+#include "local-key-item.hh"
+
+#include <iostream.h>
+
+Breathing_sign_engraver::Breathing_sign_engraver()
+{
+ breathing_sign_p_ = 0;
+ breathing_sign_req_l_ = 0;
+}
+
+bool
+Breathing_sign_engraver::do_try_music (Music*r_l)
+{
+ if (Breathing_sign_req * b= dynamic_cast <Breathing_sign_req *> (r_l)) {
+ breathing_sign_req_l_ = b;
+ return true;
+ }
+
+ return false;
+}
+
+void
+Breathing_sign_engraver::do_process_requests()
+{
+ if(breathing_sign_req_l_) {
+ breathing_sign_p_ = new Breathing_sign;
+
+ Scalar prop = get_property ("verticalDirection", 0);
+ if(prop.isnum_b())
+ breathing_sign_p_->set_vertical_position((Direction)int(prop));
+
+ announce_element (Score_element_info (breathing_sign_p_, breathing_sign_req_l_));
+ }
+}
+
+void
+Breathing_sign_engraver::do_pre_move_processing()
+{
+ if(breathing_sign_p_) {
+ typeset_element(breathing_sign_p_);
+ breathing_sign_p_ = 0;
+ }
+}
+
+void
+Breathing_sign_engraver::do_post_move_processing()
+{
+ breathing_sign_req_l_ = 0;
+}
+
+ADD_THIS_TRANSLATOR(Breathing_sign_engraver);
--- /dev/null
+/*
+ breathing_sign.cc -- implement Breathing_sign
+
+ Copyright (C) 1999 Michael Krause
+
+ written for the GNU LilyPond music typesetter
+
+TODO: --> see breathing-sign-engraver.cc
+
+*/
+
+#include "breathing-sign.hh"
+#include "string.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "debug.hh"
+#include "dimensions.hh"
+#include "direction.hh"
+
+#include <iostream.h>
+
+Breathing_sign::Breathing_sign ()
+{
+ vertical_position_i_ = UP;
+ set_elt_property (breakable_scm_sym, SCM_BOOL_T);
+ set_elt_property (break_priority_scm_sym, gh_int2scm (-4));
+ set_elt_property (visibility_lambda_scm_sym,
+ gh_eval_str ("non_postbreak_visibility"));
+}
+
+void
+Breathing_sign::set_vertical_position (Direction updown)
+{
+ assert(updown >= -1 && updown <= +1);
+
+ if(updown != 0)
+ vertical_position_i_ = updown;
+}
+
+Molecule*
+Breathing_sign::do_brew_molecule_p () const
+{
+ Real dl = staff_line_leading_f();
+ Interval i1(0, dl / 6), i2(-dl / 2, dl / 2);
+ Box b(i1, i2);
+
+ Molecule *output = new Molecule (lookup_l()->filledbox(b));
+
+ return output;
+}
+
+void
+Breathing_sign::do_post_processing()
+{
+ Real dl = staff_line_leading_f();
+
+ translate_axis(2.0 * dl * vertical_position_i_, Y_AXIS);
+}
--- /dev/null
+/*
+ breathing-sign.hh
+
+ Copyright (C) 1999 Michael Krause
+
+ written for the GNU LilyPond music typesetter
+
+*/
+
+#ifndef BREATHING_SIGN_HH
+#define BREATHING_SIGN_HH
+
+#include "item.hh"
+#include "staff-symbol-referencer.hh"
+#include "parray.hh"
+
+class Breathing_sign : public Item, public Staff_symbol_referencer {
+public:
+ VIRTUAL_COPY_CONS(Score_element);
+ Breathing_sign ();
+
+ void set_vertical_position (Direction);
+
+protected:
+ virtual void do_post_processing ();
+ virtual Molecule* do_brew_molecule_p () const;
+
+private:
+ Direction vertical_position_i_;
+};
+
+#endif // BREATHING_SIGN_HH