]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/rest.cc
release: 1.3.6
[lilypond.git] / lily / rest.cc
index 0028373cf5dfdd9ce5331ccc0d439ae9e78adff6..fbfbdb5ff1fe3b6a3c46c88fe4463479866d3f7e 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "molecule.hh"
 #include "rest.hh"
 #include "dots.hh"
 #include "axis-group-element.hh"
-#include "p-score.hh"
+#include "paper-score.hh"
 
 void
 Rest::do_add_processing ()
 {
-  if (balltype_i_ != 0 && balltype_i_ != 1)
-    position_i_ -= 4;
-  else if (balltype_i_ == 0)
-    position_i_ += 2;
+  if (balltype_i_ == 0)
+    set_position (position_f () + 2);
 
   Rhythmic_head::do_add_processing ();
-  if (dots_l_ && balltype_i_ > 1)
-    {
-      dots_l_->position_i_ = position_i_ + 4;
-    }
 }
 
-Rest::Rest ()
+void
+Rest::do_post_processing ()
 {
-  position_i_ =0;
+  Rhythmic_head::do_post_processing ();
+  if (dots_l_
+      && balltype_i_ > 4) // UGH.
+    {
+      /*
+       UGH. 
+       */
+      if (balltype_i_ == 7)
+       dots_l_->set_position (4);
+      else
+       dots_l_->set_position (3);
+    }
 }
 
+
 Molecule *
-Rest::brew_molecule_p () const
+Rest::do_brew_molecule_p () const
 {
-  int staff_size_i_ = 8;
-  bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&  
-    (balltype_i_ == 0 || balltype_i_ == 1);
+  bool ledger_b =false;
+
+  if (balltype_i_ == 0 || balltype_i_ == 1)
+    ledger_b = abs(position_f ()  - (2* balltype_i_ - 1)) > lines_i (); 
+
   
-  Atom s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b));
-  Molecule * m = new Molecule ( Atom (s));
-  m->translate_axis (position_i_ *  paper ()->internote_f (), Y_AXIS);
-  return m;
+  String style; 
+  SCM style_sym =get_elt_property ("style");
+  if (balltype_i_ >= 2 && style_sym != SCM_UNDEFINED)
+    {
+      style = ly_scm2string (style_sym);
+    }
+
+  String idx =  ("rests-") + to_str (balltype_i_) + (ledger_b ? "o" : "") + style;
+
+  return new Molecule(lookup_l ()->afm_find (idx));
 }
 
-IMPLEMENT_IS_TYPE_B1(Rest, Rhythmic_head);
+
+