]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/volta-spanner.cc
release: 1.1.29
[lilypond.git] / lily / volta-spanner.cc
index 751314638832671df76da764cc76a6695fa6a728..a9836484d07e9eea548ff83a76dee4dfdd69a9b5 100644 (file)
@@ -3,30 +3,31 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c)  1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include "atom.hh"
+
 #include "box.hh"
 #include "debug.hh"
 #include "lookup.hh"
 #include "molecule.hh"
 #include "note-column.hh"
-#include "p-col.hh" // urg
-#include "bar.hh"
 #include "p-col.hh"
+#include "bar.hh"
 #include "paper-def.hh"
 #include "volta-spanner.hh"
 #include "stem.hh"
 #include "text-def.hh"
+#include "pointer.tcc"
+
+template class P<Text_def>;            // UGH
 
 Volta_spanner::Volta_spanner ()
 {
   last_b_ = false;
+  visible_b_ = true;
   number_p_.set_p (new Text_def);
   number_p_->align_dir_ = LEFT;
-  dot_p_.set_p (new Text_def);
-  dot_p_->align_dir_ = LEFT;
 }
 
 Molecule*
@@ -37,15 +38,17 @@ Volta_spanner::do_brew_molecule_p () const
   if (!column_arr_.size ())
     return mol_p;
 
+  if (!visible_b_)
+    return mol_p;
+
   Real internote_f = paper ()->internote_f ();
   Real dx = internote_f;
-  Real w = extent (X_AXIS).length () - 2 * dx;
-  Atom volta (lookup_l ()->volta (w, last_b_));
+  Real w = extent (X_AXIS).length () - dx;
+  Molecule volta (lookup_l ()->volta (w, last_b_));
   Real h = volta.dim_.y ().length ();
-  Atom num (number_p_->get_atom (paper (), LEFT));
-  Atom dot (dot_p_->get_atom (paper (), LEFT));
+  Molecule num (number_p_->get_molecule (paper (), LEFT));
   Real dy = column_arr_.top ()->extent (Y_AXIS) [UP] > 
-    column_arr_[0]->extent (Y_AXIS) [UP];
+     column_arr_[0]->extent (Y_AXIS) [UP];
   dy += 2 * h;
 
   /*
@@ -55,17 +58,17 @@ Volta_spanner::do_brew_molecule_p () const
     dy = dy >? note_column_arr_[i]->extent (Y_AXIS).max ();
   dy -= h;
 
-  Real gap = num.dim_.x ().length () / 2;
+  Text_def two_text;
+  two_text.text_str_ = "2";
+  two_text.style_str_ = number_p_->style_str_;
+  Molecule two (two_text.get_molecule (paper (), LEFT));
+  Real gap = two.dim_.x ().length () / 2;
   Offset off (num.dim_.x ().length () + gap, 
-    (h - num.dim_.y ().length ()) / internote_f - gap);
+             h / internote_f - gap);
   num.translate (off);
-  Real dotheight = dot.dim_.y ().length () / 7;
-  off -= Offset (0, dotheight);
-  dot.translate (off);
-  mol_p->add_atom (volta);
-  mol_p->add_atom (num);
-  mol_p->add_atom (dot);
-  mol_p->translate (Offset (dx, dy));
+  mol_p->add_molecule (volta);
+  mol_p->add_molecule (num);
+  mol_p->translate (Offset (0, dy));
   return mol_p;
 }
   
@@ -77,11 +80,20 @@ Volta_spanner::do_add_processing ()
       set_bounds (LEFT, column_arr_[0]);
       set_bounds (RIGHT, column_arr_.top ());  
     }
-  number_p_->style_str_ = "number-1";
-  dot_p_->text_str_ = ".";
-  dot_p_->style_str_ = "bold";
+
+  number_p_->style_str_ = "number";
 }
   
+Interval
+Volta_spanner::do_height () const
+{
+  /*
+    in most cases, it's a lot better not no have height...
+  */
+  Interval i;
+  return i;
+}
+
 void
 Volta_spanner::do_post_processing ()
 {