]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/rest.cc
release: 1.3.6
[lilypond.git] / lily / rest.cc
index 39347b1d5bc1f7bf8628d3ab8818a2b0bf3d134d..fbfbdb5ff1fe3b6a3c46c88fe4463479866d3f7e 100644 (file)
@@ -1,42 +1,66 @@
-#include "rest.hh"
-#include "dimen.hh" 
-#include "debug.hh"
+/*
+  rest.cc -- implement Rest
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "molecule.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
-#include "molecule.hh"
-
+#include "rest.hh"
+#include "dots.hh"
+#include "axis-group-element.hh"
+#include "paper-score.hh"
 
-Rest::Rest(int t, int d)
+void
+Rest::do_add_processing ()
 {
-    balltype = t;
-    dots = d;
-}
+  if (balltype_i_ == 0)
+    set_position (position_f () + 2);
 
+  Rhythmic_head::do_add_processing ();
+}
 
 void
-Rest::do_print()const
+Rest::do_post_processing ()
 {
-#ifndef NPRINT
-    mtor << "Rest "<<balltype<< "dots " << dots;
-    Item::print();
-#endif
+  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
+
+Molecule *
+Rest::do_brew_molecule_p () const
 {
-    Paper_def *p =paper();
-
-    Symbol s;
-    s = p->lookup_l()->rest(balltype);
-    
-    Molecule *m = new Molecule(Atom(s));
-    if (dots) {
-       Symbol d =p->lookup_l()->dots(dots);
-       Molecule dm;
-       dm.add(Atom(d));
-       m->add_right(dm);
+  bool ledger_b =false;
+
+  if (balltype_i_ == 0 || balltype_i_ == 1)
+    ledger_b = abs(position_f ()  - (2* balltype_i_ - 1)) > lines_i (); 
+
+  
+  String style; 
+  SCM style_sym =get_elt_property ("style");
+  if (balltype_i_ >= 2 && style_sym != SCM_UNDEFINED)
+    {
+      style = ly_scm2string (style_sym);
     }
-    return m;
+
+  String idx =  ("rests-") + to_str (balltype_i_) + (ledger_b ? "o" : "") + style;
+
+  return new Molecule(lookup_l ()->afm_find (idx));
 }
 
+
+