]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/scoreline.cc
release: 0.1.11
[lilypond.git] / lily / scoreline.cc
index 7bb391211a21ac9f7ec6cd8b249fe28a440ec50b..f3324091527ee8bc34753d749d4050003068de87 100644 (file)
    take out hard coded TeX stuff.
    */
 String
-Line_of_score::TeX_string() const
+Line_of_score::TeX_output_str () const
 {
-   String s ("\\hbox{%<- line of score\n");
-   if (error_mark_b_)
-        s+= "\\scorelineerrormark";
-   
-   
-   Real lastpos = cols[0]->hpos_f_;
-   for (int i=0; i < cols.size();  i++)
-     {
-        PCol* col_l= cols[i];
-        // all items in the current line & staff.
-        String chunk_str;
-
-           
-        Link_array<Score_elem> elems;
-           
-        if (col_l->error_mark_b_) 
-          {
-            chunk_str += String ("\\columnerrormark");
-          }
-        
-        // now output the items.
-        for (iter_top (col_l->its,j); j.ok(); j++) 
-          {
-            elems.push (j);
-          }
-
-        // spanners.
-        for (iter_top (col_l->starters,j); j.ok(); j++) 
-          {
-            if (j->name() != name ())
-               elems.push (j);
-          }
-        
-        for (int j =0; j< elems.size(); j++) 
-          {
-            Offset o = elems[j]->absolute_offset();
-            o[X_AXIS] += cols[i]->hpos_f_;
-            s += elems[j]->TeX_string_without_offset (o);
-          }
-     }
-   s += "}";
-   return s;
+  String s ("\\hbox{%<- line of score\n");
+  if (error_mark_b_)
+    s+= "\\scorelineerrormark";
+  
+  s+= Score_elem::TeX_output_str();
+  s += "}";
+  return s;
 }
 
 
@@ -73,23 +38,20 @@ Line_of_score::Line_of_score()
 }
 
 
-
-
-
 IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
 
 void
 Line_of_score::add (Score_elem*e)
 {
   // avoid excess dependencies.
-  if (!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
-       add_dependency (e);
+  if (!(e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
+    add_dependency (e);
 }
 
 bool
-Line_of_score::contains_b (PCol const* c)const
+Line_of_score::contains_b (Paper_column const* c) const
 {
-  return cols.find_l ((PCol*)c);
+  return cols.find_l ((Paper_column*)c);
 }
 
 void
@@ -97,72 +59,82 @@ Line_of_score::set_breaking (Array<Col_hpositions> const &breaking)
 {
   for (int j=0; j < breaking.size(); j++) 
     {
-       const Array<PCol*> &curline (breaking[j].cols);
-       const Array<PCol*> &errors (breaking[j].error_col_l_arr_);
-       const Array<Real> &config (breaking[j].config);
+      const Array<Paper_column*> &curline (breaking[j].cols);
+      const Array<Paper_column*> &errors (breaking[j].error_col_l_arr_);
+      const Array<Real> &config (breaking[j].config);
        
-       for (int i=0; i < errors.size(); i++)
-           errors[i]->error_mark_b_ = true;
+      for (int i=0; i < errors.size(); i++)
+       errors[i]->error_mark_b_ = true;
 
-       Line_of_score *line_l=0;
-       Line_of_score *line_p =0;
-       
-       if (breaking.size() >1) 
-         {
-           line_p = (Line_of_score*)clone()->spanner ();
-           line_p->copy_dependencies (*this);
-           line_l = line_p;
-         }
-       else 
-           line_l =  this;
+      Line_of_score *line_l=0;
+      Line_of_score *line_p =0;
        
-       ((Array<PCol*> &)line_l->cols) = curline;
-       line_l->left_col_l_ =  curline[0];
-       line_l->right_col_l_= curline.top();
+      if (breaking.size() >1) 
+       {
+         line_p = (Line_of_score*)clone()->spanner ();
+         line_l = line_p;
+       }
+      else 
+       line_l =  this;
        
-       if (line_p) 
-         {
-           pscore_l_->typeset_broken_spanner (line_p);
-           broken_into_l_arr_.push (line_p);
-         }
+      ((Array<Paper_column*> &)line_l->cols) = curline;
+      line_l->set_bounds(LEFT,curline[0]);
+      
+      line_l->set_bounds(RIGHT,curline.top());
        
-       for (int i=0; i < curline.size(); i++)
-         {
-           curline[i]->hpos_f_ = config[i];
-           curline[i]->line_l_ = (Line_of_score*)line_l;
-         }
+      if (line_p) 
+       {
+         pscore_l_->typeset_broken_spanner (line_p);
+         broken_into_l_arr_.push (line_p);
+       }
+
+      for (int i=0; i < curline.size(); i++)
+       {
+         curline[i]->translate(config[i],X_AXIS);
+         curline[i]->line_l_ = (Line_of_score*)line_l;
+       }
     }
 }
 
+
 void
 Line_of_score::break_into_pieces (bool)
 {
+  
 }
 
 Link_array<Line_of_score>
-Line_of_score::get_lines()const
+Line_of_score::get_lines() const
 {
   Link_array<Line_of_score> ret;
 
   if (broken_into_l_arr_.size())
-       for (int i=0; i < broken_into_l_arr_.size(); i++) 
-         {
-           ret.push ((Line_of_score*)broken_into_l_arr_[i]);
-         }
+    for (int i=0; i < broken_into_l_arr_.size(); i++) 
+      {
+       ret.push ((Line_of_score*)broken_into_l_arr_[i]);
+      }
   else 
-       ret.push ((Line_of_score*)this);        // ugh
+    ret.push ((Line_of_score*)this);   // ugh
   
   return ret;
 }
 
 void
-Line_of_score::do_print()const
+Line_of_score::do_print() const
 {
   Spanner::do_print();
 }
 
 Interval
-Line_of_score::do_width()const
+Line_of_score::do_width() const
 { 
   return Spanner::do_width();
 }
+
+void
+Line_of_score::do_breakable_col_processing() 
+{
+  for (int i=0; i < cols.size (); i++)
+    cols[i]->breakable_col_processing();
+  Spanner::do_breakable_col_processing();
+}