]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/text-spanner.cc
release: 1.1.1
[lilypond.git] / lily / text-spanner.cc
index 10bbb0b0fa5db74ac8d88042a85ea2b5420accb4..522081cedfa146e31b50277c983da4eda25c717f 100644 (file)
@@ -3,92 +3,97 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "molecule.hh"
-#include "boxes.hh"
+#include "box.hh"
 #include "text-spanner.hh"
 #include "text-def.hh"
 #include "debug.hh"
 #include "paper-def.hh"
-#include "symbol.hh"
+#include "atom.hh"
 
 
 void
-Text_spanner::set_support(Directional_spanner*d)
+Text_spanner::set_support (Directional_spanner*d)
 {
-    if (support_span_l_)
-       remove_dependency(support_span_l_);
-    
-    support_span_l_ =d;
-    add_dependency(d);
+  if (support_span_l_)
+    remove_dependency (support_span_l_);
+  
+  support_span_l_ =d;
+  add_dependency (d);
+}
+
+void
+Text_spanner::do_add_processing ()
+{
+  set_bounds (LEFT, support_span_l_->spanned_drul_[LEFT]);
+  set_bounds (RIGHT, support_span_l_->spanned_drul_[RIGHT]);
 }
 
 Text_spanner::Text_spanner()
 {
-    spec_p_ = 0;
-    support_span_l_ = 0;
+  spec_p_ = 0;
+  support_span_l_ = 0;
 }
 
-IMPLEMENT_STATIC_NAME(Text_spanner);
+
 IMPLEMENT_IS_TYPE_B1(Text_spanner,Spanner);
 
 void
 Text_spanner::do_print() const
 {
-    spec_p_->print();
+  spec_p_->print();
 }
 
 void
 Text_spanner::do_post_processing()
 {
-    text_off_ = support_span_l_->center() +
-       Offset(0,support_span_l_->dir_i_ * paper()->internote_f() * 4); // todo
+  text_off_ = support_span_l_->center() +
+       Offset (0,support_span_l_->dir_ * paper()->internote_f () * 4); // todo
 }
 
 Molecule*
 Text_spanner::brew_molecule_p() const
 {
-    Atom tsym (spec_p_->get_atom(paper(),0));
-    tsym.translate(text_off_);
+  Atom tsym (spec_p_->get_atom (paper(),CENTER));
+  tsym.translate (text_off_);
 
-    Molecule*output = new Molecule;
-    output->add( tsym );
-    return output;
+  Molecule*output = new Molecule;
+  output->add_atom (tsym);
+  return output;
 }
 
 void
 Text_spanner::do_pre_processing()
 {
-    right_col_l_ = support_span_l_->right_col_l_;
-    left_col_l_ = support_span_l_->left_col_l_;
-    assert(left_col_l_ && right_col_l_);
+  spanned_drul_ = support_span_l_->spanned_drul_;
 }
 
 Interval
-Text_spanner::height()const
+Text_spanner::height() const
 {
-    return brew_molecule_p()->extent().y;
+  return brew_molecule_p()->extent ().y ();
 }
 
 void
-Text_spanner::do_substitute_dependency(Score_elem* o, Score_elem*n)
+Text_spanner::do_substitute_dependency (Score_element* o, Score_element*n)
 {
-    if (support_span_l_ == o) 
-       support_span_l_ = (Directional_spanner*) (n?n->spanner():0);
+  if (support_span_l_ == o) 
+       support_span_l_ = (Directional_spanner*) (n?dynamic_cast <Spanner *> (n):0);
 }
 
 
 Text_spanner::~Text_spanner()
 {
-    delete spec_p_;
+  delete spec_p_;
 }
 
-Text_spanner::Text_spanner(Text_spanner const&s)
-    : Spanner( s)
+Text_spanner::Text_spanner (Text_spanner const&s)
+  : Spanner (s)
 {
-    support_span_l_ = s.support_span_l_;
-    spec_p_ = s.spec_p_? s.spec_p_->clone() : 0;
-    text_off_ = s.text_off_;
+  support_span_l_ = s.support_span_l_;
+  spec_p_ = s.spec_p_? s.spec_p_->clone() : 0;
+  text_off_ = s.text_off_;
 }