]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.50
authorfred <fred>
Wed, 23 Jun 1999 14:11:50 +0000 (14:11 +0000)
committerfred <fred>
Wed, 23 Jun 1999 14:11:50 +0000 (14:11 +0000)
input/test/breathing-sign.ly [new file with mode: 0644]
lily/breathing-sign-engraver.cc [new file with mode: 0644]
lily/breathing-sign.cc [new file with mode: 0644]
lily/include/breathing-sign.hh [new file with mode: 0644]

diff --git a/input/test/breathing-sign.ly b/input/test/breathing-sign.ly
new file mode 100644 (file)
index 0000000..9cc9944
--- /dev/null
@@ -0,0 +1,16 @@
+\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 "||";
+  }
+}
diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc
new file mode 100644 (file)
index 0000000..d7a1a05
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+  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);
diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc
new file mode 100644 (file)
index 0000000..c9f3b1f
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+  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);
+}
diff --git a/lily/include/breathing-sign.hh b/lily/include/breathing-sign.hh
new file mode 100644 (file)
index 0000000..c2f99c8
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+  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