]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.66
authorfred <fred>
Sun, 24 Mar 2002 19:44:52 +0000 (19:44 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:44:52 +0000 (19:44 +0000)
lily/.version
lily/p-score.cc
lily/spanner.cc

index b7c968121e75269fe617fb017b70adb501d22a0a..de91678501b039c30e5e314d9c25f4b509fc4fe0 100644 (file)
@@ -1,6 +1,6 @@
 MAJOR_VERSION = 0
 MINOR_VERSION = 0
-PATCH_LEVEL = 65
+PATCH_LEVEL = 66
 
 # use to send patches, always empty for released version:
 # include separator: ".postfix", "-pl" makes rpm barf
index bf91890d77dee78491daf405623a6000e9e3104c..6bec375634935a8ca488ffef4f8804a79468318b 100644 (file)
@@ -1,7 +1,7 @@
 /*
   p-score.cc -- implement PScore
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 #include "lookup.hh"
 #include "spanner.hh"
 #include "paper-def.hh"
-#include "molecule.hh"
-#include "dimen.hh"
 #include "scoreline.hh"
 #include "p-score.hh"
 #include "tex-stream.hh"
-#include "item.hh"
 #include "break.hh"
 #include "p-col.hh"
 
@@ -238,7 +235,23 @@ PScore::process()
     *mlog << "\nPostprocessing elements..." << endl;
     postprocess();
 }
+/** Get all breakable columns between l and r, (not counting l and r).  */
+Link_array<PCol>
+PScore::breakable_col_range(PCol*l,PCol*r)const
+{
+    Link_array<PCol> ret;
+
+    PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
+    PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+  
+    while ( start < stop ) {
+       if (start->breakable_b())
+           ret.push(start);
+       start++;
+    }
 
+    return ret;
+}
 Link_array<PCol>
 PScore::col_range(PCol*l,PCol*r)const
 {
@@ -252,3 +265,20 @@ PScore::col_range(PCol*l,PCol*r)const
     ret.push(r);
     return ret;
 }
+
+Link_array<PCol>
+PScore::broken_col_range(PCol*l,PCol*r)const
+{
+    Link_array<PCol> ret;
+
+    PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
+    PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+  
+    while ( start < stop ) {
+       if (start->breakable_b() && !start->line_l_ )
+           ret.push(start);
+       start++;
+    }
+
+    return ret;
+}
index 4c8376ce5a650a303710f8d51ae0823a388cc48b..10ee753e1996544db1e6c4f3b08b510298b1b845 100644 (file)
@@ -17,7 +17,7 @@ void
 Spanner::do_print()const
 {
     if (broken_into_l_arr_.size())
-       mtor << "Spanner with broken pieces\n";
+       mtor << "with broken pieces\n";
 }
 
 void
@@ -25,35 +25,35 @@ Spanner::break_into_pieces()
 {
     PCol * left = left_col_l_;
     PCol * right = right_col_l_;
-    if (left->daddy_l_)
-       left = left->daddy_l_;
-    if (right->daddy_l_)
-       right = right->daddy_l_;
+    if(left->daddy_l_) left = left->daddy_l_;
+    if(right->daddy_l_) right = right->daddy_l_;
     
-    Link_array<PCol> all_cols = pscore_l_->col_range(left, right);
     
-    Line_of_score *line = left->line_l_;
-    if (!line) {
-       left  = left->postbreak_p_;
-       line = left->line_l_;
+    Link_array<PCol> break_cols = pscore_l_->broken_col_range(left,right);
+    Link_array<Spanner> broken_into_l_arr;
+
+    break_cols.insert(left,0);
+    break_cols.push(right);
+
+    for (int i=1; i < break_cols.size(); i++) {
+       Spanner* span_p = clone();
+       left = break_cols[i-1];
+       right = break_cols[i];
+       if (!right->line_l_)
+           right = right->prebreak_p_;
+       if (!left->line_l_)
+           left = left->postbreak_p_;
+
+       assert(left&&right && left->line_l_ == right->line_l_);
+
+       span_p->left_col_l_  = left;
+       span_p->right_col_l_ = right;
+       
+       pscore_l_->typeset_broken_spanner(span_p);
+       broken_into_l_arr.push( span_p );
     }
     
-    for (int i=1; i < all_cols.size(); i++) {
-       if (!all_cols[i]->line_l_) {
-
-           Spanner* span_p = clone();
-           right =  all_cols[i]->prebreak_p_;
-           assert(left&&right && left->line_l_ == right->line_l_);
-
-           span_p->left_col_l_  = left;
-           span_p->right_col_l_ = right;
-           left = all_cols[i]->postbreak_p_;
-           line = left->line_l_;
-           
-           pscore_l_->typeset_broken_spanner(span_p);
-           broken_into_l_arr_.push( span_p );
-       }
-    }
+    broken_into_l_arr_ = broken_into_l_arr;
 }
 
 void