]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.11
authorfred <fred>
Sun, 24 Mar 2002 19:55:44 +0000 (19:55 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:55:44 +0000 (19:55 +0000)
64 files changed:
lily/audio-item.cc
lily/audio-staff.cc
lily/axis-group-item.cc
lily/axis-group-spanner.cc
lily/bar-column-grav.cc
lily/bar-column.cc
lily/bar.cc
lily/break.cc
lily/chord-iterator.cc [new file with mode: 0644]
lily/clef-grav.cc
lily/col-info.cc
lily/colhpos.cc
lily/elem-group-item.cc
lily/elem-group.cc
lily/gourlay-breaking.cc
lily/grouping.cc
lily/horizontal-align-item.cc
lily/identifier.cc
lily/ineq-constrained-qp.cc
lily/input-translator.cc
lily/item.cc
lily/key-grav.cc
lily/key-item.cc
lily/key-performer.cc
lily/keyword.cc
lily/line-group-grav.cc
lily/line-spacer.cc
lily/local-key-item.cc
lily/lyric-performer.cc
lily/main.cc
lily/meter-performer.cc
lily/meter.cc
lily/midi-item.cc
lily/midi-stream.cc
lily/midi-walker.cc
lily/music-iterator.cc
lily/music-list.cc
lily/music.cc
lily/my-lily-lexer.cc
lily/note-performer.cc
lily/p-col.cc
lily/performer-group-performer.cc
lily/performer.cc
lily/request-iterator.cc [new file with mode: 0644]
lily/request.cc
lily/rest-collision-grav.cc
lily/score-align-grav.cc
lily/score-column.cc
lily/score-elem.cc
lily/scoreline.cc
lily/span-bar.cc
lily/span-score-bar.cc
lily/spanner.cc
lily/staff-info.cc
lily/staff-performer.cc
lily/staff-sym-grav.cc
lily/staff-sym.cc
lily/super-elem.cc
lily/symbol.cc
lily/translator.cc
lily/vertical-align-elem.cc
lily/vertical-align-grav.cc
lily/voice-iterator.cc [new file with mode: 0644]
lily/word-wrap.cc

index eaa895049a2651cbc4eb9a85708266b0afdc1c4c..55367026fa56545c46452d976e8f27e465a80d51 100644 (file)
@@ -18,7 +18,7 @@ Audio_instrument::Audio_instrument (String instrument_str)
 Midi_item*
 Audio_instrument::midi_item_p()
 {
-  return str_.length_i() ? new Midi_instrument( 0, str_ ) : 0;
+  return str_.length_i() ? new Midi_instrument(0, str_) : 0;
 }
                                     
 Audio_item::Audio_item (Request* req_l)
@@ -83,7 +83,7 @@ Audio_text::Audio_text (Audio_text::Type type, String text_str)
 Midi_item*
 Audio_text::midi_item_p()
 {
-  return text_str_.length_i() ? new Midi_text( this ) : 0;
+  return text_str_.length_i() ? new Midi_text(this) : 0;
 }
 
 
index 21de1e0c9e40d9e2a25335e383f1e4ddf045d578..199657677c0d4943ec061d15f0b618d4d5b2a23c 100644 (file)
@@ -23,7 +23,7 @@ Audio_staff::output (Midi_stream& midi_stream_r, int track_i)
 {
   Midi_track midi_track;
   midi_track.number_i_ =  track_i;
-  for ( Midi_walker i (this, &midi_track); i.ok(); i++ )
+  for (Midi_walker i (this, &midi_track); i.ok(); i++)
        i.process();
   midi_stream_r << midi_track;
 }
index 325c2a029723f93f5352fb357b030ba1f605a24e..d033d9757166add91c8e565dda288b1cb3741856 100644 (file)
@@ -16,19 +16,17 @@ Axis_group_item::OK() const
   Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
   for (int i=0; i < elems.size(); i++) 
     {
-       Item * it_l = elems[i]->item();
-       assert (it_l);
-  
-       // somebody probably broke it in pieces
-       assert (it_l->pcol_l_ == pcol_l_);
+      Item * it_l = elems[i]->item();
+      assert (it_l);
     }
 }
 
 void
 Axis_group_item::do_breakable_col_processing()
 {
-  if (!pcol_l_->breakable_b())
-       return;
+  if (!breakable_b_)
+    return;
+  
   OK();
   copy_breakable_items();
   
@@ -36,12 +34,15 @@ Axis_group_item::do_breakable_col_processing()
   Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
   for (int i=0; i < elems.size(); i++) 
     {
-       Item* it_l = elems[i]->item();
-       for ( int j=0; j < 2; j++) 
-         {
-           Item *new_l = it_l->find_prebroken_piece (broken_to_a_[j]->pcol_l_);
-           ((Axis_group_item*)broken_to_a_[j])->add_element (new_l);
-         }
+      Item* it_l = elems[i]->item();
+      Direction  j=LEFT;
+      do 
+       {
+         Item *new_l = 
+           it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_i_);
+         ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l);
+       }
+      while ((j*=-1)!=LEFT);
     }
   Item::do_breakable_col_processing();
 }
index 1d45de3ae0e3bd003c7ff457ec5daf88ab859bcd..033a55b33a25be97a84e0af417556f87249d7bc6 100644 (file)
@@ -21,97 +21,95 @@ Axis_group_spanner::do_break_processing_if_unbroken()
   Line_of_score *my_line = line_l();
   for (int i=0; i < elems.size(); i++) 
     {
-       if (!elems[i]->line_l()) 
-         {
-           Item * item_l = elems[i]->item();
-           if  (item_l
-                && item_l->breakable_b_ 
-                && item_l->break_status_i() == 0) 
-                  {
-               // last two checks are paranoia
-               Item * broken_item_l = 
-                   item_l->find_prebroken_piece (my_line);
-               add_element (broken_item_l);
-             }
-           remove_element (elems[i]);  
-         }
+      if (!elems[i]->line_l()) 
+       {
+         Item * item_l = elems[i]->item();
+         if  (item_l
+              && item_l->breakable_b_ 
+              && item_l->break_status_i() == 0) 
+           {
+             // last two checks are paranoia
+             Item * broken_item_l = 
+               item_l->find_prebroken_piece (my_line);
+             add_element (broken_item_l);
+           }
+         remove_element (elems[i]);  
+       }
     }
-  
 }
 void
 Axis_group_spanner::do_break_processing()
 {
-  set_my_columns();
   bool breaking_self_b = ! Spanner::line_l();
   if (!breaking_self_b)  
     {
-       do_break_processing_if_unbroken();
-       Spanner::do_break_processing();
-       return;
+      do_break_processing_if_unbroken();
+      Spanner::do_break_processing();
+      return;
     }
 
-  break_into_pieces (true);
+  break_into_pieces ();
   Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_;
   remove_all();
   
   for (int i=0; i < loose_elems.size(); i++) 
     {
-       Score_elem * elt = loose_elems[i];
-       Line_of_score *elt_line = elt->line_l();
+      Score_elem * elt = loose_elems[i];
+      Line_of_score *elt_line = elt->line_l();
        
-       if ( ! elt_line)
-         {
-           /* this piece doesn't know where it belongs.
-              Find out if it was broken, and use the broken remains
-              */
-           if (elt->spanner()) 
-             {
-               Spanner * sp = elt->spanner();
+      if (! elt_line)
+       {
+         /* this piece doesn't know where it belongs.
+            Find out if it was broken, and use the broken remains
+            */
+         if (elt->spanner()) 
+           {
+             Spanner * sp = elt->spanner();
                
-               for (int j =0; j < broken_into_l_arr_.size(); j++) 
-                 {
-                   Axis_group_spanner * my_broken_l
-                        = (Axis_group_spanner*)broken_into_l_arr_[j];
+             for (int j =0; j < broken_into_l_arr_.size(); j++) 
+               {
+                 Axis_group_spanner * my_broken_l
+                   = (Axis_group_spanner*)broken_into_l_arr_[j];
                    
-                   Spanner * broken_span_l 
-                       = sp->find_broken_piece (
-                           ((Score_elem*)my_broken_l)->line_l());
+                 Spanner * broken_span_l 
+                   = sp->find_broken_piece (
+                                            ((Score_elem*)my_broken_l)->line_l());
                    
-                   if (broken_span_l) 
-                       my_broken_l->add_element (broken_span_l);
-                   
-                 }
-             }
-           else if (elt->item() 
-                      && elt->item()->breakable_b_ 
-                      && elt->item()->break_status_i () == 0) 
-                        {
-
-               // broken items
-               for (int j =0; j < 2; j++) 
-                 {
-                   Item * my_item = elt->item()->broken_to_a_[j];
-                   Line_of_score * item_line_l = my_item->line_l() ;
-                   if ( ! item_line_l) 
-                       continue;
+                 if (broken_span_l) 
+                   my_broken_l->add_element (broken_span_l);
                    
-                   Axis_group_spanner * v
-                       = (Axis_group_spanner*)find_broken_piece (item_line_l);
-                   if (v)
-                       v->add_element (my_item);
-                 }
+               }
+           }
+         else if (elt->item() 
+                  && elt->item()->breakable_b_ 
+                  && elt->item()->break_status_i () == 0) 
+           {
+             // broken items
+             Direction  j=LEFT;
+             do 
+               {
+                 Item * my_item = elt->item()->broken_to_drul_[j];
+                 Line_of_score * item_line_l = my_item->line_l() ;
+                 if (! item_line_l) 
+                   continue;
                    
-             }
-         }
-       else 
-         {
+                 Axis_group_spanner * v
+                   = (Axis_group_spanner*)find_broken_piece (item_line_l);
+                 if (v)
+                   v->add_element (my_item);
+               }
+             while ((j*=-1) != LEFT);
+           }
+       }
+      else 
+       {
          /* this piece *does* know where it belongs.
             Put it in appropriate piece of this spanner
             */
-           Axis_group_spanner * my_broken_l
-               = (Axis_group_spanner*)find_broken_piece (elt->line_l());
-           my_broken_l->add_element (elt);
-         }
+         Axis_group_spanner * my_broken_l
+           = (Axis_group_spanner*)find_broken_piece (elt->line_l());
+         my_broken_l->add_element (elt);
+       }
     }
   
   Spanner::do_break_processing();
index 4c073ac57edf180b90e1ce8ac6e73ca70b3afa1b..ac3e868a522f62d3af3bf9b895348f883c116668 100644 (file)
@@ -36,7 +36,7 @@ Bar_column_engraver::acknowledge_element (Score_elem_info info)
             bar_l_ = (Bar*)info.elem_l_->item();
     }
        
-  if ( bar_l_ && !barcol_p_) 
+  if (bar_l_ && !barcol_p_) 
     {
        barcol_p_ = new Bar_column;
        barcol_p_->breakable_b_ =true;
index f4c4d2f96ba59272cf6fb936deb6e7c66e16cddd..c9a0025208fbb21fdb967d2584697702bc2e5036 100644 (file)
@@ -26,7 +26,7 @@ void
 Bar_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
   Script_column::do_substitute_dependency (o,n);
-  if ( o == bar_l_) 
+  if (o == bar_l_) 
     {
        bar_l_ = n ? (Bar*)n->item() : 0;
     }
index 7dc97c7c59787885016533994bb7d5f4c079f8bd..cbf84388695b42dd74c1f8ab4fc48b4e45a704d7 100644 (file)
@@ -25,13 +25,13 @@ Bar::Bar()
 IMPLEMENT_IS_TYPE_B1(Bar,Item);
 
 void
-Bar::do_print()const
+Bar::do_print() const
 {
   DOUT << type_str_;
 }
 
 Molecule*
-Bar::brew_molecule_p()const
+Bar::brew_molecule_p() const
 {    
   Paper_def *p = paper();
   Symbol s = p->lookup_l()->bar (type_str_, 
index 3ebba2eb63646998e01843dd91240ae3ab2cd148..7f5139a831cf183e000918246d0cd60f0c1ab618 100644 (file)
@@ -20,7 +20,7 @@ Col_stats::str() const {
   String s (count_i_);
   s += " lines";
   if  (count_i_)
-       s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)");
+    s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)");
   
   return s;
 }
@@ -42,14 +42,14 @@ Col_stats::Col_stats()
 /* **************************************************************** */
 
 Line_of_cols
-Break_algorithm::all_cols()const
+Break_algorithm::all_cols() const
 {
   Line_of_cols retval;
-  for (PCursor<PCol*> c (pscore_l_->col_p_list_.top()); 
-        c.ok(); c++) 
-          {
+  for (PCursor<Paper_column*> c (pscore_l_->col_p_list_.top()); 
+       c.ok(); c++) 
+    {
        
-       retval.push (c);
+      retval.push (c);
     }
   return retval;
 }
@@ -61,12 +61,12 @@ Break_algorithm::find_break_indices() const
   Array<int> retval;
   
   for (int i=0; i < all.size(); i++)
-       if (all[i]->breakable_b())
-           retval.push (i);
+    if (all[i]->breakable_b_)
+      retval.push (i);
   
-  if ( linelength <=0)
-       while ( retval.size() >2)
-           retval.del (1);
+  if (linelength <=0)
+    while (retval.size() >2)
+      retval.del (1);
 
   return retval;
 }
@@ -79,13 +79,13 @@ Break_algorithm::find_breaks() const
   Line_of_cols retval;
   
   for (int i=0; i < all.size(); i++)
-       if (all[i]->breakable_b())
-           retval.push (all[i]);
+    if (all[i]->breakable_b_)
+      retval.push (all[i]);
 
 
-  if ( linelength <=0)
-       while ( retval.size() >2)
-           retval.del (1);
+  if (linelength <=0)
+    while (retval.size() >2)
+      retval.del (1);
 
   return retval;
 }
@@ -95,19 +95,19 @@ Break_algorithm::find_breaks() const
  
 
 Line_spacer*
-Break_algorithm::generate_spacing_problem (Line_of_cols curline)const
+Break_algorithm::generate_spacing_problem (Line_of_cols curline) const
 {
   Line_spacer * sp= (*get_line_spacer)();
 
   sp->paper_l_ = pscore_l_->paper_l_;
   sp->add_column (curline[0], true, 0.0);
   for (int i=1; i< curline.size()-1; i++)
-       sp->add_column (curline[i]);
+    sp->add_column (curline[i]);
 
-  if ( linelength > 0)
-       sp->add_column (curline.top(), true, linelength);
+  if (linelength > 0)
+    sp->add_column (curline.top(), true, linelength);
   else
-       sp->add_column (curline.top());
+    sp->add_column (curline.top());
 
   sp->prepare();
   return sp;
@@ -132,11 +132,11 @@ bool
 Break_algorithm::feasible (Line_of_cols curline) const
 {
   if (linelength <=  0)
-       return true;
+    return true;
   
   Real l =0;
   for (int i=0; i < curline.size(); i++)
-       l +=curline[i]->width().length ();
+    l +=curline[i]->width().length ();
   return l < linelength;    
 }
 
@@ -144,24 +144,24 @@ void
 Break_algorithm::problem_OK() const
 {
   if (!pscore_l_->col_p_list_.size())
-       error ("Score does not have any columns");
+    error ("Score does not have any columns");
   OK();
 }
 
 void
-Break_algorithm::OK()const
+Break_algorithm::OK() const
 {
 #ifndef NDEBUG
   iter_top (pscore_l_->col_p_list_,start);
-  PCursor<PCol *> end (pscore_l_->col_p_list_.bottom());
+  PCursor<Paper_column *> end (pscore_l_->col_p_list_.bottom());
   
-  assert (start->breakable_b());    
-  assert (end->breakable_b());
+  assert (start->breakable_b_);    
+  assert (end->breakable_b_);
 #endif
 }
 
 Array<Col_hpositions>
-Break_algorithm::solve()const
+Break_algorithm::solve() const
 {
   return do_solve();
 }
@@ -173,10 +173,10 @@ Break_algorithm::do_set_pscore()
 }
 
 void
-Break_algorithm::print_stats()const
+Break_algorithm::print_stats() const
 {
   if (approx_stats_.count_i_)
-       *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
+    *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
   if (exact_stats_.count_i_)
-       *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
+    *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
 }
diff --git a/lily/chord-iterator.cc b/lily/chord-iterator.cc
new file mode 100644 (file)
index 0000000..2bca2b1
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+  chord-iter.cc -- implement Chord_iterator
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "translator.hh"
+#include "debug.hh"
+#include "chord-iterator.hh"
+
+#include "music-list.hh"
+
+
+Chord_iterator::~Chord_iterator()
+{
+}
+
+Chord_iterator::Chord_iterator (Chord const *chord_C)
+{
+  chord_C_ = chord_C;
+}
+
+void
+Chord_iterator::construct_children()
+{
+  int j = 0;
+  for (PCursor<Music*> i (chord_C_->music_p_list_.top());  //, int j = 0; 
+       i.ok(); j++, i++) 
+    {
+      Music_iterator * mi =  get_iterator_p (i.ptr());
+      if (mi->ok()) 
+       {
+         set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_));
+         children_p_list_.bottom().add (mi);
+       }
+      else 
+       delete mi;
+    }
+}
+void
+Chord_iterator::do_print() const
+{
+#ifndef NPRINT
+  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++) 
+    {
+      i->print();
+    }
+#endif
+}
+
+void
+Chord_iterator::process_and_next (Moment until)
+{
+  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok ();) 
+    {
+      if  (i->next_moment() == until) 
+       {
+         i->process_and_next (until);
+       }
+      if (!i->ok()) 
+       delete i.remove_p();
+      else
+       i++;
+    }
+  Music_iterator::process_and_next (until);
+}
+
+
+IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator);
+
+Moment
+Chord_iterator::next_moment() const
+{
+  Moment next_ = infinity_mom;
+  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
+    next_ = next_ <? i->next_moment() ;
+  return next_;
+}
+
+
+
+bool
+Chord_iterator::ok() const
+{
+  return children_p_list_.size();
+}
index 1afaa3cc4470eee7bfe993ffd06f3947f8f01a77..a9bea179f0d4c6bc2c76e1605e67bba40ec19c36 100644 (file)
@@ -66,7 +66,7 @@ Clef_engraver::acknowledge_element (Score_elem_info info)
   if (info.elem_l_->name() == Bar::static_name ()) 
     {
        create_clef();
-       if ( !clef_req_l_)
+       if (!clef_req_l_)
            clef_p_->default_b_ = true;
     }
 }
index e05498f0e15c489718c901b3c25d72ca4f33237d..086b7c7e3e9492a9db256872c6f4ab931755a695 100644 (file)
@@ -16,20 +16,22 @@ Colinfo::print() const
 #ifndef NPRINT
   DOUT << "column { ";
   if (fixed())
-       DOUT << "fixed at " << fixed_position()<<", ";
+    DOUT << "fixed at " << fixed_position()<<", ";
   assert (pcol_l_);
   DOUT << "[" << minleft() << ", " << minright () << "]";
   DOUT <<"}\n";
 #endif
 }
 
-Colinfo::Colinfo (PCol *col_l, Real const *fixed_C)
+Colinfo::Colinfo (Paper_column *col_l, Real const *fixed_C)
 {
   if (fixed_C)
-       fixpos_p_.set_l (fixed_C);
+    fixpos_p_.set_l (fixed_C);
   ugh_b_ = false;
   pcol_l_ = col_l;
   width = pcol_l_->width();
+  if (width.empty_b())
+    width = Interval(0,0);
 }
 
 
index d7850f5c27f1ccf0cf3f43587d20cfccf109dc22..62cc881bdebe42ea1aceaa27f46329e2c6818513 100644 (file)
@@ -26,7 +26,7 @@ Col_hpositions::~Col_hpositions()
 }
 
 void
-Col_hpositions::add (PCol*c)
+Col_hpositions::add (Paper_column*c)
 {
   cols.push (c);
 }
@@ -43,7 +43,7 @@ Col_hpositions::print() const
 }
 
 void
-Col_hpositions::OK()const
+Col_hpositions::OK() const
 {
 #ifndef NDEBUG
   assert (config.size() == cols.size ());
index ec744fee4563e588281bd81258382dfceabdacd7..9209796caee198ae25244265182e105041711116 100644 (file)
@@ -11,7 +11,7 @@
 #include "p-col.hh"
 
 void
-Horizontal_vertical_group_item::do_print()const
+Horizontal_vertical_group_item::do_print() const
 {
   Horizontal_vertical_group_element::do_print();
 }
index 807573384f4022aa696d16eacafcc7b30159f9dc..8c4c573b26e478654de6b38fca1bb58536c05eaa 100644 (file)
@@ -17,25 +17,37 @@ Axis_group_element::do_unlink()
   remove_all();
 }
 
+void
+Axis_group_element::do_junk_links()
+{
+  axis_admin_.elem_l_arr_.set_size (0);
+}
+
 
 bool
-Axis_group_element::contains_b (Score_elem const*e)const
+Axis_group_element::contains_b (Score_elem const*e) const
 {
   return axis_admin_.contains_b (e);
 }
 
 Link_array<Score_elem>
-Axis_group_element::get_extra_dependencies()const
+Axis_group_element::get_extra_dependencies() const
 {
   return axis_admin_.elem_l_arr_;
 }
 
 void
-Axis_group_element::do_print()const
+Axis_group_element::do_print() const
 {
   axis_admin_.print();
 }
 
+
+Axis_group_element::Axis_group_element()
+{
+  transparent_b_ = true;
+}
+
 // ****************
 
 
@@ -62,6 +74,7 @@ Vertical_group_element::remove_all()
 {
   axis_admin_.remove_all (Y_AXIS,Y_AXIS);
 }
+
 // ****************
 
 void
@@ -84,7 +97,7 @@ Horizontal_group_element::remove_element (Score_elem*e)
 
 
 Interval
-Horizontal_group_element::do_width()const
+Horizontal_group_element::do_width() const
 {
   return axis_admin_.extent (X_AXIS);
 }
index 90d07e68512f7a8ce3a4d3b997f74a7ecea535d1..740899418b133a2f71c053397ecc3d16f31f98ed 100644 (file)
@@ -39,7 +39,7 @@ struct Break_node {
  */
 
 Array<Col_hpositions>
-Gourlay_breaking::do_solve()const
+Gourlay_breaking::do_solve() const
 {
 
   Array<Break_node> optimal_paths;
@@ -78,8 +78,8 @@ Gourlay_breaking::do_solve()const
            
          Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1);
            
-         line[0] = line[0]->postbreak_p_;
-         line.top() = line.top ()->prebreak_p_;
+         line[0] = line[0]->postbreak_l();
+         line.top() = line.top ()->prebreak_l();
            
          if (!feasible (line))
            break;
@@ -110,22 +110,22 @@ Gourlay_breaking::do_solve()const
       for (int j=0; j < candidates.size(); j++) 
        {
          int start = candidates[j];
-         if ( optimal_paths[start].line_config_.energy_f_
+         if (optimal_paths[start].line_config_.energy_f_
               + candidate_lines[j].energy_f_  > minimal_energy)
                
            continue;
 
-         if ( !candidate_lines[j].satisfies_constraints_b_) 
+         if (!candidate_lines[j].satisfies_constraints_b_) 
            {
              candidate_lines[j].solve_line();
-             ((Break_algorithm*)this)->exact_stats_.add ( candidate_lines[j].cols);
+             ((Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols);
            }
            
          Real this_energy 
            = optimal_paths[start].line_config_.energy_f_ 
            + candidate_lines[j].energy_f_ ;
            
-         if ( this_energy < minimal_energy) 
+         if (this_energy < minimal_energy) 
            {
              minimal_j = j;
              minimal_energy = this_energy;
@@ -143,24 +143,24 @@ Gourlay_breaking::do_solve()const
          optimal_paths[break_idx].line_config_ = candidate_lines[minimal_j];
        }
 
-      if ( !(break_idx % HAPPY_DOTS_I))
+      if (!(break_idx % HAPPY_DOTS_I))
        *mlog << "[" << break_idx << "]"<<flush;
     }
 
-  if  ( break_idx % HAPPY_DOTS_I) 
+  if  (break_idx % HAPPY_DOTS_I) 
     *mlog << "[" << break_idx << "]"<<flush;
 
   Array<int> final_breaks;
 
   Array<Col_hpositions> lines;
-  Real min_energy_f_ = infinity_f;
-  Real max_energy_f_ = 0;
+
+  Real max_energy_f = 0;
   
   /* skip 0-th element, since it is a "dummy" elt*/
   for (int i = optimal_paths.size()-1; i> 0;) 
     {
-      final_breaks.push ( i);
-      assert ( i > optimal_paths[i].prev_break_i_);
+      final_breaks.push (i);
+      assert (i > optimal_paths[i].prev_break_i_);
 
       // there was no "feasible path"
       if (!optimal_paths[i].line_config_.config.size()) {
@@ -174,7 +174,7 @@ Gourlay_breaking::do_solve()const
   /*
     TODO print variation in energy
    */
-  if (max_energy_f
+  if (max_energy_f) 
     {
       ;
     }
@@ -182,7 +182,7 @@ Gourlay_breaking::do_solve()const
   
 
   for (int i= final_breaks.size(); i--;) 
-    lines.push ( optimal_paths[final_breaks[i]].line_config_);
+    lines.push (optimal_paths[final_breaks[i]].line_config_);
 
   
   return lines;
index c106db08619a7971ce79e4db86bfb1f6fca62a9c..15401fced94581d929e41531601992163a92a9ed 100644 (file)
@@ -18,7 +18,7 @@ Rhythmic_grouping::init()
 }
 
 void
-Rhythmic_grouping::OK()const
+Rhythmic_grouping::OK() const
 {
 #ifndef NDEBUG
   assert (bool (children.size()) != bool (interval_));
@@ -40,7 +40,7 @@ Rhythmic_grouping::length() const
 }
 
 MInterval
-Rhythmic_grouping::interval()const
+Rhythmic_grouping::interval() const
 {
   if (interval_)
        return *interval_;
@@ -138,7 +138,7 @@ Rhythmic_grouping::split (Array<MInterval> splitpoints)
   Array<Rhythmic_grouping*> ch;
   while (1) 
     {
-       if  ( i >= children.size() || j >= splitpoints.size ())
+       if  (i >= children.size() || j >= splitpoints.size ())
            break;
        
        assert (
@@ -235,7 +235,7 @@ Rhythmic_grouping::junk()
 }
 
 void
-Rhythmic_grouping::print()const    
+Rhythmic_grouping::print() const    
 {
 #ifndef NPRINT
   DOUT << "{ \n";
@@ -253,7 +253,7 @@ bool
 Rhythmic_grouping::child_fit_b (Moment start)
 {
   if (children.size())
-       return ( children.top()->interval ().right== start);
+       return (children.top()->interval ().right== start);
 
   return true;
 }  
@@ -347,7 +347,7 @@ Rhythmic_grouping::translate (Moment m)
 }
 
 void
-Rhythmic_grouping::extend (MInterval m)const
+Rhythmic_grouping::extend (MInterval m) const
 {    
   assert (m.left >= interval().left);
   while (m.right  >interval().right) 
index 163a1bf61c12df191437e150ce98f7c0d607aeaa..48701d148a9b9e9545209da0af0c15baf8ec8ec2 100644 (file)
 
 
 IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item);
-void
-Horizontal_align_item::OK() const
-{
-   for  (int i =0; i < item_l_arr_.size(); i++) 
-     assert ( pcol_l_ == item_l_arr_[i]->pcol_l_);
-}
+
 bool
-Horizontal_align_item::contains_b (Item *i)const
+Horizontal_align_item::contains_b (Item *i) const
 {
   return item_l_arr_.find_l (i);
 }
@@ -37,10 +32,10 @@ Horizontal_align_item::do_substitute_dependency (Score_elem*o,Score_elem*n)
   int i;
   while ((i = item_l_arr_.find_i (o->item())) >=0) 
     {
-       if (n)
-           item_l_arr_[i] = n->item();
-       else
-           item_l_arr_.del (i);
+      if (n)
+       item_l_arr_[i] = n->item();
+      else
+       item_l_arr_.del (i);
     }
 }
 
@@ -48,15 +43,15 @@ struct Horizontal_align_item_content {
   Item * item_l_;
   int priority_i_;
   static int compare (Horizontal_align_item_content const &h1, 
-                       Horizontal_align_item_content const &h2) 
-                         {
-       return h1.priority_i_ - h2.priority_i_;
-    }
+                     Horizontal_align_item_content const &h2) 
+  {
+    return h1.priority_i_ - h2.priority_i_;
+  }
   Horizontal_align_item_content (Item*i, int p) 
-    {
-       priority_i_ = p;
-       item_l_ = i;
-    }
+  {
+    priority_i_ = p;
+    item_l_ = i;
+  }
   Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; }
 };
 
@@ -64,50 +59,49 @@ struct Horizontal_align_item_content {
 void
 Horizontal_align_item::do_pre_processing()
 {
-  OK();
   {  
-       Array<Horizontal_align_item_content> content;
-       for  (int i =0; i < item_l_arr_.size(); i++) 
-           content.push (
-               Horizontal_align_item_content (
-                   item_l_arr_[i], priority_i_arr_[i]));
-       content.sort (Horizontal_align_item_content::compare);
-       item_l_arr_.clear();
-       priority_i_arr_.clear();
-       for  (int i =0; i < content.size(); i++) 
-         {
-           item_l_arr_.push (content[i].item_l_);
-           priority_i_arr_.push (content[i].priority_i_);
-         }
-    }
+    Array<Horizontal_align_item_content> content;
+    for  (int i =0; i < item_l_arr_.size(); i++) 
+      content.push (
+                   Horizontal_align_item_content (
+                                                  item_l_arr_[i], priority_i_arr_[i]));
+    content.sort (Horizontal_align_item_content::compare);
+    item_l_arr_.clear();
+    priority_i_arr_.clear();
+    for  (int i =0; i < content.size(); i++) 
+      {
+       item_l_arr_.push (content[i].item_l_);
+       priority_i_arr_.push (content[i].priority_i_);
+      }
+  }
   
   Array<Interval> dims;
   Real total =0;
   for  (int i =0; i < item_l_arr_.size(); i++) 
     {
        
-       Interval item_width= item_l_arr_[i]->width();
-       if (item_width.empty_b()) 
-         {
-           item_width = Interval (0,0);
-         }
-       dims.push (item_width);
-       total += item_width.length();
+      Interval item_width= item_l_arr_[i]->width();
+      if (item_width.empty_b()) 
+       {
+         item_width = Interval (0,0);
+       }
+      dims.push (item_width);
+      total += item_width.length();
     }
 
   Real where_f= total * (align_i_-1.0)/2.0;
   Real center_dx_f = 0;
-  for ( int i=0 ;  i < item_l_arr_.size(); i++) 
+  for (int i=0 ;  i < item_l_arr_.size(); i++) 
     {
-       Real dx = where_f -dims[i][-1];
-       item_l_arr_[i]->translate (dx , X_AXIS);
-       if (item_l_arr_[i] == center_l_)
-           center_dx_f = where_f;
-       where_f += dims[i].length();
+      Real dx = where_f -dims[i][-1];
+      item_l_arr_[i]->translate (dx , X_AXIS);
+      if (item_l_arr_[i] == center_l_)
+       center_dx_f = where_f;
+      where_f += dims[i].length();
     }
   if (center_dx_f && !align_i_)
-       for ( int i=0 ;  i < item_l_arr_.size(); i++) 
-           item_l_arr_[i]->translate (- center_dx_f , X_AXIS);
+    for (int i=0 ;  i < item_l_arr_.size(); i++) 
+      item_l_arr_[i]->translate (- center_dx_f , X_AXIS);
   
 }
 
@@ -118,7 +112,7 @@ Horizontal_align_item::do_width() const
 }
 
 void
-Horizontal_align_item::do_print()const
+Horizontal_align_item::do_print() const
 {
 }
 
index ad7f5de1f4664be02b4bc44a8eb2b2793fdb52f6..035c93b2448334ec41fe3fb435c8c17efa3ea8ea 100644 (file)
@@ -35,7 +35,7 @@ Identifier::error (String expect)
   ::error (e);
 }
 
-Identifier::Identifier ( int code)
+Identifier::Identifier (int code)
 {
   token_code_i_ = code; 
   accessed_b_ = 0;
@@ -43,7 +43,7 @@ Identifier::Identifier ( int code)
 }
 
 void
-Identifier::print()const
+Identifier::print() const
 {
   DOUT << "identifier ";
   do_print();
@@ -70,7 +70,7 @@ DEFAULT_PRINT(Paper_def_id,Paper_def, paperdef);
 
 
 void
-Duration_id::do_print()const
+Duration_id::do_print() const
 {}
 
 void
index f7b204fcff11c58de7311c6b68179cf77be02a56..a8cbd0a9db92cff01f5c050432e97bd21beeb7e4 100644 (file)
@@ -210,10 +210,10 @@ Ineq_constrained_qp::constraint_solve (Vector start) const
 
   
 Vector
-Ineq_constrained_qp::solve (Vector start)const
+Ineq_constrained_qp::solve (Vector start) const
 { 
   /* no hassle if no constraints*/
-  if ( ! cons.size()) 
+  if (! cons.size()) 
     {
        Choleski_decomposition chol (quad);
        return - chol.solve (lin);
index 34a65b7f3e1f49f6bea2bb26c9561107b92ff3ab..ff277cc672cf4fe94d2821ac08b490c9492e5e5e 100644 (file)
@@ -27,7 +27,7 @@ void
 Input_translator::print() const
 {
 #ifndef NPRINT
-  if ( ! check_debug)
+  if (! check_debug)
        return ;
   DOUT << base_str_ <<" " << type_str_<<" {\n";
   DOUT << "Consists of ";
@@ -46,7 +46,7 @@ Input_translator::print() const
 Input_translator *
 Input_translator::recursive_find (String nm)
 {
-  if ( is_name_b (nm))
+  if (is_name_b (nm))
        return this;
 
   Input_translator * r =0;
@@ -119,7 +119,7 @@ Input_translator::add (Input_translator *ip)
 Input_translator*
 Input_translator::get_default_itrans_l()
 {
-  if ( contains_itrans_p_list_.size())
+  if (contains_itrans_p_list_.size())
        return contains_itrans_p_list_.top();
   else
        return 0;
index 6c4a7699c814da15146eba6ce18e0a8f8c9a0a00..6d72b4c5b81d0c013435b14375333672386e4a34 100644 (file)
 #include "item.hh"
 #include "p-col.hh"
 #include "elem-group.hh"
+#include "spanner.hh"
 
 Item::Item()
 {
   breakable_b_ = false;
   break_status_i_ = 0;
-  pcol_l_ = 0;
-  broken_to_a_[0] = broken_to_a_[1]=0;
+  broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Item, Score_elem);
@@ -26,21 +26,22 @@ void
 Item::do_print() const
 {
 #ifndef NPRINT
-  DOUT << "(unknown)";
+  DOUT << "breakable_b_: " << breakable_b_;
+  DOUT << "break_status_i_: " <<break_status_i_;
 #endif
 }
 
 
 Real 
-Item::hpos_f()const
+Item::hpos_f() const
 {
-  return pcol_l_->hpos_f_ + absolute_coordinate (X_AXIS);
+  return absolute_coordinate (X_AXIS);
 }
 
 Line_of_score *
-Item::line_l()const
+Item::line_l() const
 {
-  return pcol_l_->line_l_;
+  return  (axis_group_l_a_[X_AXIS])? axis_group_l_a_[X_AXIS]->line_l() : 0;
 }
 
 int
@@ -52,36 +53,37 @@ Item::break_status_i() const
 void
 Item::copy_breakable_items()
 {
-  if ( broken_to_a_[0] || broken_to_a_[1])
-       return;
-  Item *new_copies[2];
-  for (int i=0; i < 2; i++) 
+  if (broken_to_drul_[LEFT] || broken_to_drul_[RIGHT])
+    return;
+  Drul_array<Item *> new_copies;
+  Direction  i=LEFT;
+  do 
     {
-       Item * item_p = clone()->item ();
-       item_p->copy_dependencies (*this);
-       
-       item_p->break_status_i_ =  -1+ 2*i;
-       pscore_l_->typeset_item (item_p, pcol_l_);
-       item_p->handle_prebroken_dependencies();
-       new_copies[i] =item_p;
+      Item * item_p = clone()->item ();
+
+      item_p->break_status_i_ =  i;
+      pscore_l_->typeset_element (item_p);
+      item_p->handle_prebroken_dependencies();
+      new_copies[i] =item_p;
     }
-  broken_to_a_= new_copies;
+  while ((i *= -1) != LEFT);
+  broken_to_drul_= new_copies;
 }
 
 void
 Item::do_breakable_col_processing()
 {
-  if (!breakable_b_ || !pcol_l_->breakable_b())
-       return;
+  if (!breakable_b_)
+    return;
 
   copy_breakable_items();
   handle_prebroken_dependencies();
 
   /*
     Otherwise the broken items won't be pre_process()'ed.
-   */
-  add_dependency (broken_to_a_[0]);
-  add_dependency (broken_to_a_[1]);    
+    */
+  add_dependency (broken_to_drul_[LEFT]);
+  add_dependency (broken_to_drul_[RIGHT]);    
 
 }
 
@@ -89,32 +91,67 @@ Item*
 Item::find_prebroken_piece (Line_of_score*l) const
 {
   if (line_l() == l) 
-       return (Item*)this;
-  else if (broken_to_a_[0] && broken_to_a_[0]->line_l() == l)
-       return broken_to_a_[0];
-  else if (broken_to_a_[1] && broken_to_a_[1]->line_l() == l)
-       return broken_to_a_[1];
+    return (Item*)this;
+  else if (broken_to_drul_[LEFT] && broken_to_drul_[LEFT]->line_l() == l)
+    return broken_to_drul_[LEFT];
+  else if (broken_to_drul_[RIGHT] && broken_to_drul_[RIGHT]->line_l() == l)
+    return broken_to_drul_[RIGHT];
 
   return 0;
 }
 
 Item*
-Item::find_prebroken_piece (PCol*c)const
+Item::find_prebroken_piece (int breakstatus) const
 {
-  if (c == pcol_l_)
-       return (Item *) this;   // ugh
+  if (!breakstatus)
+    return (Item *) this;      // ugh
+  else
+    return (Item*) broken_to_drul_[(Direction)breakstatus];
+}
 
-  if (c == pcol_l_->prebreak_p_)
-       return (Item *) broken_to_a_[0];
-  else if (c==pcol_l_->postbreak_p_)
-       return  (Item *)broken_to_a_[1];
+void
+Item::handle_prebroken_dependencies()
+{
+  if (breakable_b_)
+    Score_elem::handle_prebroken_dependencies();
+}
 
-  assert (false);
+int
+Item::left_right_compare(Item const *l, Item const *r)
+{
+  while (!l->is_type_b (Paper_column::static_name ()))
+    l = l->axis_group_l_a_[X_AXIS]->item();
+  while (!r->is_type_b (Paper_column::static_name ()))
+    r = r->axis_group_l_a_[X_AXIS]->item();
+
+  Paper_column *p1 = (Paper_column*)l;
+  Paper_column* p2 = (Paper_column*)r;
+  return p1->rank_i () - p2->rank_i ();
+}
+
+
+bool
+Item::linked_b() const
+{
+  return Score_elem::linked_b() || attached_span_l_arr_.size();
 }
 
 void
-Item::handle_prebroken_dependencies()
+Item::do_junk_links()
+{
+  attached_span_l_arr_.set_size(0);
+}
+
+void
+Item::do_unlink()
 {
-  if ( breakable_b_)
-       Score_elem::handle_prebroken_dependencies();
+  for (int i=0; i < attached_span_l_arr_.size (); i++) {
+    Spanner *&s= attached_span_l_arr_[i];
+    if (s->spanned_drul_[LEFT] == this)
+      s->set_bounds (LEFT, 0);
+    if  (s->spanned_drul_[RIGHT] == this)
+      s->set_bounds (RIGHT,0);
+    s =0;
+  }
+  attached_span_l_arr_.set_size (0);
 }
index 96d51998c4732303ee95a695c4cbc0ca17ba9ecd..f2d81ae9073645b0ad530e4906a547464258472b 100644 (file)
@@ -65,7 +65,7 @@ Key_engraver::acknowledge_element (Score_elem_info info)
     }
   else if (info.elem_l_->name() == Bar::static_name ()) 
     {
-       if ( !keyreq_l_)
+       if (!keyreq_l_)
            default_key_b_ = true;
        create_key();
     }
index 12276dcbbf8653a20993fb586ffe1ffa818f56ac..5fbfd29f39f39eaa9558e472c15c66b5956d929a 100644 (file)
@@ -63,7 +63,7 @@ Key_item::add (int p, int a)
 
 
 Molecule*
-Key_item::brew_molecule_p()const
+Key_item::brew_molecule_p() const
 {
   Molecule*output = new Molecule;
   Real inter = paper()->internote_f ();
@@ -76,7 +76,7 @@ Key_item::brew_molecule_p()const
        Molecule m (a);
        output->add_right (m);  
     }
-  if ( pitch.size()) 
+  if (pitch.size()) 
     {
        Molecule m (paper()->lookup_l ()->fill (Box (
        Interval (0, paper()->note_width ()),
index d4d0527aa06e1d20f987da38e4ef8a0a2cf15177..160dee4a64a72c015b4a377aed084b4689ecd687 100644 (file)
@@ -28,7 +28,7 @@ void
 Key_performer::do_print() const
 {
 #ifndef NPRINT
-  if ( key_req_l_)
+  if (key_req_l_)
        key_req_l_->print();
 #endif
 }
@@ -36,21 +36,21 @@ Key_performer::do_print() const
 void
 Key_performer::process_requests()
 {
-  if ( key_req_l_)
-       play (new Audio_key (key_req_l_) );
+  if (key_req_l_)
+       play (new Audio_key (key_req_l_));
   key_req_l_ = 0;
 }
 
 bool
 Key_performer::do_try_request (Request* req_l)
 {
-  if ( key_req_l_)
+  if (key_req_l_)
        return false;
 
-  if ( req_l->command())
+  if (req_l->command())
        key_req_l_ = req_l->command()->keychange ();
 
-  if ( key_req_l_)
+  if (key_req_l_)
        return true;
 
   return false;
index f027ee86d91591151fcd7622221cf948ffbab497..0274d1653fc2bdd5a8bcc75749e8e48cf6c27343 100644 (file)
@@ -45,7 +45,7 @@ Keyword_table::Keyword_table (Keyword_ent *tab)
   lookup with binsearch, return tokencode.
 */
 int
-Keyword_table::lookup (char const *s)const
+Keyword_table::lookup (char const *s) const
 {
   int     lo,
           hi,
index 9d544d061e371867ff1451d72946b1d05d473bff..5915e7854430b973b46ed2b5156d476a3e279b60 100644 (file)
@@ -12,6 +12,7 @@
 #include "bar.hh"
 #include "debug.hh"
 #include "line-group-grav.hh"
+#include "p-col.hh"
 
 Line_group_engraver::Line_group_engraver()
 {
@@ -21,7 +22,7 @@ Line_group_engraver::Line_group_engraver()
 void
 Line_group_engraver::acknowledge_element (Score_elem_info  elem)
 {
-  if ( !elem.elem_l_->axis_group_l_a_[Y_AXIS])
+  if (!elem.elem_l_->axis_group_l_a_[Y_AXIS])
        staffline_p_->add_element (elem.elem_l_);
 }
 
@@ -29,7 +30,7 @@ Line_group_engraver::acknowledge_element (Score_elem_info  elem)
 void
 Line_group_engraver::do_removal_processing()
 {
-  staffline_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+  staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
   typeset_element (staffline_p_);
   staffline_p_ = 0;
 }
@@ -38,7 +39,7 @@ void
 Line_group_engraver::do_creation_processing()
 {
   staffline_p_ = new Vertical_group_spanner ;
-  staffline_p_->left_col_l_ = get_staff_info().command_pcol_l ();
+  staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
 
   // don't broadcast to self.
   announce_element (Score_elem_info (staffline_p_,0));
index 5f51ad3ad43929b4a8881762b643abc70d1562df..c59589481a49085f6217cf8fdb709d0dbfc3cf35 100644 (file)
@@ -14,7 +14,7 @@ Line_spacer::Line_spacer()
   paper_l_ =0;
 }
 Paper_def*
-Line_spacer::paper_l()const
+Line_spacer::paper_l() const
 { 
   return paper_l_ ;
 }
index b81adc5fcf2b6be148e965778e350fd9963dae52..33037e26ead1c56da0334263fa58bb6c13a82cba 100644 (file)
@@ -56,7 +56,7 @@ Local_key_item::do_pre_processing()
 }
 
 Molecule*
-Local_key_item::brew_molecule_p()const
+Local_key_item::brew_molecule_p() const
 {
   Molecule* output = new Molecule;
   Molecule*octmol = 0;
index b800f3d1adaeca6d94564677a208910c9949753b..9a7fef130c0f0ec011c5521e40e0d7cd8c6c69e9 100644 (file)
@@ -28,7 +28,7 @@ void
 Lyric_performer::do_print() const
 {
 #ifndef NPRINT
-  if ( lreq_arr_.size())
+  if (lreq_arr_.size())
        lreq_arr_[ 0 ]->print();
 #endif
 }
@@ -36,8 +36,8 @@ Lyric_performer::do_print() const
 void
 Lyric_performer::process_requests()
 {
-  if ( lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i() )
-       play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_) );
+  if (lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i())
+       play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_));
   lreq_arr_.clear();
 }
 
@@ -45,7 +45,7 @@ bool
 Lyric_performer::do_try_request (Request* req_l)
 {
   Musical_req* m_l = req_l->musical();
-  if ( !m_l || ! m_l->lreq_l()) 
+  if (!m_l || ! m_l->lreq_l()) 
        return false;
   lreq_arr_.push (m_l->lreq_l());
 
index eb9f611543d0df08c6262e8a973d62a68d910d61..8c68dd1bc06c9da1f4bb0a9bbcc94c18ad228eea 100644 (file)
@@ -106,14 +106,14 @@ static File_path path;
 void
 do_one_file (String init_str, String file_str)
 {
-  if ( init_str != "" && "" == path.find (init_str) 
+  if (init_str != "" && "" == path.find (init_str)
     {
-       error ( "Can not find `" + init_str +"\'");
+       error ("Can not find `" + init_str +"\'");
        return ;
     }
-  if ( file_str!= "" && path.find (file_str) == "" 
+  if (file_str!= "" && path.find (file_str) == ""
     {
-       error ( "Can not find `" + file_str + "'");
+       error ("Can not find `" + file_str + "'");
        return ;
     }
   
@@ -142,7 +142,7 @@ main (int argc, char **argv)
        path.add (env_l);
     }
   path.add ("");
-  path.add (String (DIR_DATADIR) + "/init/" );
+  path.add (String (DIR_DATADIR) + "/init/");
   
   path.push (DIR_DATADIR);
 
@@ -152,7 +152,7 @@ main (int argc, char **argv)
   
   while (Long_option_init const * opt = oparser()) 
     {
-       switch ( opt->shortname)
+       switch (opt->shortname)
          {
        case 'o':
            set_default_output (oparser.optional_argument_ch_C_);
@@ -188,7 +188,7 @@ main (int argc, char **argv)
 
   int p=0;
   const char *arg ;
-  while ( (arg= oparser.get_next_arg())) 
+  while ((arg= oparser.get_next_arg())) 
     {
        String f (arg);
        destill_inname (f);
@@ -207,7 +207,7 @@ main (int argc, char **argv)
 void
 destill_inname (String &name_str_r)
 {
-  if ( name_str_r.length_i())
+  if (name_str_r.length_i())
       {
       if (name_str_r[ 0 ] != '-') 
            {
index 0d23bb9a9bf7ce7c48a3249d12518cac448dcc68..63eb06946b4b0499bab4794b34d6ec84014153f0 100644 (file)
@@ -26,30 +26,30 @@ void
 Meter_performer::do_print() const
 {
 #ifndef NPRINT
-  if ( meter_req_l_)
-       meter_req_l_->print();
+  if (meter_req_l_)
+    meter_req_l_->print();
 #endif
 }
 
 void
 Meter_performer::process_requests()
 {
-  if ( meter_req_l_)
-       play (new Audio_meter (meter_req_l_) );
+  if (meter_req_l_)
+    play (new Audio_meter (meter_req_l_));
   meter_req_l_ = 0;
 }
 
 bool
 Meter_performer::do_try_request (Request* req_l)
 {
-  if ( meter_req_l_)
-       return false;
+  if (meter_req_l_)
+    return false;
 
-  if ( req_l->command())
-       meter_req_l_ = req_l->command()->meterchange ();
+  if (req_l->command())
+    meter_req_l_ = req_l->command()->meterchange ();
 
-  if ( meter_req_l_)
-       return true;
+  if (meter_req_l_)
+    return true;
 
   return false;
 }
index e8fcd8f9f04883c75e94c9c6d721a9af697e614d..aa41b7922bbf785aabb15792fd25a7764ee34f20 100644 (file)
@@ -11,7 +11,7 @@ Meter::Meter (Array<Scalar>a)
 }
 
 Molecule*
-Meter::brew_molecule_p()const
+Meter::brew_molecule_p() const
 {
   Symbol s = paper()->lookup_l ()->meter (args);
   return new Molecule (Atom (s));
index 47af53eb3b59591637a8bb4628a939b1dbbd52a4..e7e914782de5af34bdd6ae166f1e1acf615839bf 100644 (file)
@@ -71,7 +71,7 @@ Midi_duration::Midi_duration (Real seconds_f)
 String
 Midi_duration::str() const
 {
-  return String ("<duration: ") + String (seconds_f_ ) + ">";
+  return String ("<duration: ") + String (seconds_f_) + ">";
 }
 
 Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i)
@@ -270,14 +270,14 @@ String
 Midi_instrument::str() const
 {
   Byte program_byte = 0;
-  for ( int i = 0; instrument_name_sz_a_[i]; i++)
-    if ( instrument_str_ == String (instrument_name_sz_a_[ i ])) 
+  for (int i = 0; instrument_name_sz_a_[i]; i++)
+    if (instrument_str_ == String (instrument_name_sz_a_[ i ])) 
       {
        program_byte = (Byte)i;
        break;
       }
 
-  String str = String ((char)( 0xc0 + channel_i_) );
+  String str = String ((char)(0xc0 + channel_i_));
   str += String ((char)program_byte);
   return str;
 }
@@ -298,7 +298,7 @@ String
 Midi_item::i2varint_str (int i)
 {
   int buffer_i = i & 0x7f;
-  while ( (i >>= 7) > 0) 
+  while ((i >>= 7) > 0) 
     {
       buffer_i <<= 8;
       buffer_i |= 0x80;
@@ -306,10 +306,10 @@ Midi_item::i2varint_str (int i)
     }
 
   String str;
-  while ( 1) 
+  while (1) 
     {
       str += (char)buffer_i;
-      if ( buffer_i & 0x80)
+      if (buffer_i & 0x80)
        buffer_i >>= 8;
       else
        break;
@@ -330,7 +330,7 @@ Midi_key::str() const
   int flats_i = k->flats_i();
 
   // midi cannot handle non-conventional keys
-  if ( flats_i && sharps_i)
+  if (flats_i && sharps_i)
     return "";
   int accidentals_i = sharps_i - flats_i;
 
@@ -356,7 +356,7 @@ Midi_meter::str() const
 
   String str = "ff5804";
   str += String_convert::i2hex_str (num_i, 2, '0');
-  str += String_convert::i2hex_str (intlog2( den_i) , 2, '0' );
+  str += String_convert::i2hex_str (intlog2(den_i) , 2, '0');
   str += String_convert::i2hex_str (clocks_per_1_i_, 2, '0');
   str += String_convert::i2hex_str (8, 2, '0');
   return String_convert::hex2bin_str (str);
@@ -383,16 +383,16 @@ Midi_note::pitch_i() const
 String
 Midi_note::str() const
 {
-  if ( pitch_i() == INT_MAX)
+  if (pitch_i() == INT_MAX)
     return String ("");
 
-  Byte status_byte = (char)( 0x90 + channel_i_);
+  Byte status_byte = (char)(0x90 + channel_i_);
 
   String str = String ((char)status_byte);
-  str += (char)( pitch_i() + c0_pitch_i_c_);
+  str += (char)(pitch_i() + c0_pitch_i_c_);
 
   // poor man's staff dynamics:
-  str += (char)( dynamic_byte_ - 0x10 * channel_i_);
+  str += (char)(dynamic_byte_ - 0x10 * channel_i_);
 
   return str;
 }
@@ -414,13 +414,13 @@ Midi_note_off::pitch_i() const
 String
 Midi_note_off::str() const
 {
-  if ( pitch_i() == INT_MAX)
+  if (pitch_i() == INT_MAX)
     return String ("");
 
-  Byte status_byte = (char)( 0x80 + channel_i_);
+  Byte status_byte = (char)(0x80 + channel_i_);
 
   String str = String ((char)status_byte);
-  str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_);
+  str += (char)(pitch_i() + Midi_note::c0_pitch_i_c_);
   str += (char)aftertouch_byte_;
   return str;
 }
@@ -428,7 +428,7 @@ Midi_note_off::str() const
 Midi_tempo::Midi_tempo (Audio_item* audio_item_l)
   : Midi_item (audio_item_l)
 {
-  per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_)->per_minute_4_i_;
+  per_minute_4_i_ = ((Audio_tempo*)audio_item_l_)->per_minute_4_i_;
 }
 
 Midi_tempo::Midi_tempo (int per_minute_4_i)
@@ -449,8 +449,8 @@ Midi_tempo::str() const
 Midi_text::Midi_text (Audio_item* audio_item_l)
   : Midi_item (audio_item_l)
 {
-  text_str_ = ( (Audio_text*)audio_item_l_)->text_str_;
-  type_ = (Type)( (Audio_text*)audio_item_l_)->type_;
+  text_str_ = ((Audio_text*)audio_item_l_)->text_str_;
+  type_ = (Type)((Audio_text*)audio_item_l_)->type_;
 }
 
 Midi_text::Midi_text (Midi_text::Type type, String text_str)
@@ -512,14 +512,14 @@ Midi_track::Midi_track()
 void 
 Midi_track::add (int delta_time_i, String event_str)
 {
-  if ( delta_time_i < 0) 
+  if (delta_time_i < 0) 
     {
-      cout << String_convert::bin2hex_str (i2varint_str (delta_time_i) ) << endl;
+      cout << String_convert::bin2hex_str (i2varint_str (delta_time_i)) << endl;
       cout << String_convert::bin2hex_str (event_str) << endl;
     }
   assert (delta_time_i >= 0);
   assert(event_str.length_i());
-  Midi_chunk::add (i2varint_str (delta_time_i) + event_str );
+  Midi_chunk::add (i2varint_str (delta_time_i) + event_str);
 }
 
 void 
@@ -527,8 +527,8 @@ Midi_track::add (Moment delta_time_moment, Midi_item* mitem_l)
 {
   // use convention of 384 clocks per 4
   // use Duration_convert
-  int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4 );
-  // ? int ( delta_time_moment * 4 * 384) 
+  int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4);
+  // ? int (delta_time_moment * 4 * 384) 
   add (delta_time_i, mitem_l->str());
 }
 
index 5f1b3ee501652a6494d9463950ca771526014b7d..0521e87c756537bd54d7075da9af731bcef7ef3c 100644 (file)
@@ -28,31 +28,31 @@ Midi_stream::~Midi_stream()
 }
 
 Midi_stream&
-Midi_stream::operator <<( String str)
+Midi_stream::operator <<(String str)
 {
-  if ( check_debug)
+  if (check_debug)
        str = String_convert::bin2hex_str (str);
   
   *os_p_ << str;
 
-  if ( check_debug)
+  if (check_debug)
       *os_p_ << "\n";
 
   return *this;
 }
 
 Midi_stream&
-Midi_stream::operator <<( Midi_item const& mitem_c_r)
+Midi_stream::operator <<(Midi_item const& mitem_c_r)
 {
 //    *this << mitem_c_r.str();
   mitem_c_r.output (this);
-  if ( check_debug)
+  if (check_debug)
       *os_p_ << "\n";
   return *this;
 }
 
 Midi_stream&
-Midi_stream::operator <<( int i)
+Midi_stream::operator <<(int i)
 {
   // output binary string ourselves
   *this << Midi_item::i2varint_str (i);
@@ -63,6 +63,6 @@ void
 Midi_stream::open()
 {
   os_p_ = new ofstream (filename_str_);
-  if ( !*os_p_)
+  if (!*os_p_)
        error ("can't open `" + filename_str_ + "\'");
 }
index aea8fcc0d7091e3ce3b423d155bbc821f0af05c0..36c8000024989bc44f85b75a7febbef3cae4e4d2 100644 (file)
@@ -27,7 +27,7 @@ compare (Midi_note_event const& left, Midi_note_event const& right)
 }
 
 Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l)
-  : PCursor<Audio_item*>( audio_staff_l->audio_item_l_list_)
+  : PCursor<Audio_item*>(audio_staff_l->audio_item_l_list_)
 {
   track_l_ = track_l;
   last_mom_ = 0;
@@ -36,7 +36,7 @@ Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l)
 Midi_walker::~Midi_walker()
 { 
   // ugh
-  do_stop_notes (last_mom_ + Moment (10, 1) );
+  do_stop_notes (last_mom_ + Moment (10, 1));
 }
 
 /**
@@ -46,11 +46,11 @@ void
 Midi_walker::do_start_note (Midi_note* note_l)
 {
   Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom ();
-  for ( int i=0; i < stop_note_queue.size(); i++) 
+  for (int i=0; i < stop_note_queue.size(); i++) 
     {
-       if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) 
+       if (stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) 
          {
-           if ( stop_note_queue[ i ].key < stop_mom)
+           if (stop_note_queue[ i ].key < stop_mom)
                stop_note_queue[ i ].ignore_b_ = true;
            else // skip the stopnote 
                return; 
@@ -71,10 +71,10 @@ Midi_walker::do_start_note (Midi_note* note_l)
 void
 Midi_walker::do_stop_notes (Moment max_mom)
 {
-  while ( stop_note_queue.size() && stop_note_queue.front ().key <= max_mom) 
+  while (stop_note_queue.size() && stop_note_queue.front ().key <= max_mom) 
     {
        Midi_note_event e = stop_note_queue.get();
-       if ( e.ignore_b_) 
+       if (e.ignore_b_) 
            continue;
        
        Moment stop_mom = e.key;
@@ -101,11 +101,11 @@ Midi_walker::process()
   do_stop_notes (ptr()->audio_column_l_->at_mom ());
 
   Midi_item* p = ptr()->midi_item_p ();
-  if ( !p )
+  if (!p)
        return;
   p->channel_i_ = track_l_->number_i_;
   
-  if ( p->name() != Midi_note::static_name ())
+  if (p->name() != Midi_note::static_name ())
        output_event (ptr()->audio_column_l_->at_mom (), p);
   else
        do_start_note ((Midi_note*)p);
index 56a6476ff6d379d3e4782d88e729af88d939756a..ef36b59d149a2f552e0ed5cb475d4e05c94c459c 100644 (file)
@@ -1,26 +1,24 @@
 /*
-  music-iterator.cc -- implement {Music,Chord,Voice}_iterator
+  music-iterator.cc -- implement Music_iterator
 
   source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
-
+#include "debug.hh"
 #include "music-list.hh"
 #include "music-iterator.hh"
+#include "voice-iterator.hh"
+#include "chord-iterator.hh"
+#include "request-iterator.hh"
 #include "translator.hh"
-#include "request.hh"
-#include "debug.hh"
 
 
 IMPLEMENT_IS_TYPE_B(Music_iterator);
 
-Chord_iterator::~Chord_iterator()
-{
-}
 
 void
-Music_iterator::do_print()const
+Music_iterator::do_print() const
 {
 
 }
@@ -29,12 +27,15 @@ void
 Music_iterator::print() const
 {
 #ifndef NPRINT
-  if ( !check_debug)
-       return ;
+  if (!check_debug)
+    return ;
   DOUT << name() << "{";
   DOUT << "report to " << 
-       report_to_l() << " (" << report_to_l ()->name () << ")\n";
-  DOUT << "next at " << next_moment() << " ";
+    report_to_l() << " (" << report_to_l ()->name () << ")\n";
+  if (ok())
+    DOUT << "next at " << next_moment() << " ";
+  else
+    DOUT << "not feeling well today..";
   do_print();
   DOUT << "}\n";
 #endif
@@ -45,7 +46,7 @@ Music_iterator::get_req_translator_l()
 {
   assert (report_to_l());
   if (report_to_l()->is_bottom_engraver_b ())
-       return report_to_l();
+    return report_to_l();
 
   set_translator (report_to_l()->get_default_interpreter ());
   return report_to_l();
@@ -67,10 +68,10 @@ Music_iterator::pop_translator()
 }
 
 Translator* 
-Music_iterator::report_to_l()const
+Music_iterator::report_to_l() const
 {
   if (! report_to_l_arr_.size())
-       return 0;
+    return 0;
   return report_to_l_arr_.top();
 }
 
@@ -79,11 +80,11 @@ void
 Music_iterator::set_translator (Translator*trans)
 {   
   if (report_to_l()==trans)
-       return;
-  if ( report_to_l())
-       pop_translator();
+    return;
+  if (report_to_l())
+    pop_translator();
   if (trans)
-       push_translator (trans);
+    push_translator (trans);
 }
 
 void
@@ -98,7 +99,7 @@ Music_iterator::~Music_iterator()
 }
 
 Moment
-Music_iterator::next_moment()const
+Music_iterator::next_moment() const
 {
   return 0;
 }
@@ -110,39 +111,39 @@ Music_iterator::process_and_next (Moment)
 }
 
 bool
-Music_iterator::ok()const
+Music_iterator::ok() const
 {
   return first_b_;
 }
 
 Music_iterator*
 Music_iterator::static_get_iterator_p (Music *m,
-                                     Translator *report_l)
+                                      Translator *report_l)
 {
   Music_iterator * p =0;
   if (m->is_type_b (Request_chord::static_name()))
-       p = new Request_chord_iterator ((Request_chord*) m);
+    p = new Request_chord_iterator ((Request_chord*) m);
   else if (m->is_type_b (Chord::static_name())) 
-       p =  new Chord_iterator ((Chord*) m);
+    p =  new Chord_iterator ((Chord*) m);
   else if (m->is_type_b (Voice::static_name())) 
-       p =  new Voice_iterator ((Voice*) m);
+    p =  new Voice_iterator ((Voice*) m);
   
   if (m -> type_str_ != "") 
     {
-       Translator * a =report_l->
-           find_get_translator_l (m-> type_str_, m->id_str_);
-           p->set_translator (a);
+      Translator * a =report_l->
+       find_get_translator_l (m-> type_str_, m->id_str_);
+      p->set_translator (a);
     }
 
 
   if (! p->report_to_l())
-        p ->set_translator (report_l);
+    p ->set_translator (report_l);
   
   return p;
 }
 
 Music_iterator*
-Music_iterator::get_iterator_p (Music*m)const
+Music_iterator::get_iterator_p (Music*m) const
 {
   Music_iterator*p = static_get_iterator_p (m,report_to_l());
   p->daddy_iter_l_ = (Music_iterator*)this;
@@ -156,252 +157,3 @@ Music_iterator::Music_iterator()
   first_b_ = true;
 }
 
-/* ************** */
-
-Chord_iterator::Chord_iterator (Chord const *chord_C)
-{
-  chord_C_ = chord_C;
-}
-
-void
-Chord_iterator::construct_children()
-{
-  int j = 0;
-  for (PCursor<Music*> i (chord_C_->music_p_list_.top());  //, int j = 0; 
-       i.ok(); j++, i++) 
-         {
-       Music_iterator * mi =  get_iterator_p (i.ptr());
-       if ( mi->ok()) 
-         {
-           set_translator (mi->report_to_l()->ancestor_l (
-               chord_C_->multi_level_i_) );
-           children_p_list_.bottom().add (mi);
-         }
-       else 
-           delete mi;
-    }
-}
-void
-Chord_iterator::do_print() const
-{
-#ifndef NPRINT
-  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++) 
-    {
-       i->print();
-    }
-#endif
-}
-
-void
-Chord_iterator::process_and_next (Moment until)
-{
-  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok ();) 
-    {
-       if  (i->next_moment() == until) 
-         {
-           i->process_and_next (until);
-         }
-       if (!i->ok()) 
-           delete i.remove_p();
-       else
-           i++;
-    }
-  Music_iterator::process_and_next (until);
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator);
-
-Moment
-Chord_iterator::next_moment()const
-{
-  Moment next_ = infinity_mom;
-  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
-       next_ = next_ <? i->next_moment() ;
-  return next_;
-}
-
-
-
-bool
-Chord_iterator::ok()const
-{
-  return children_p_list_.size();
-}
-
-/* ************** */
-
-void
-Voice_iterator::do_print()const
-{
-  if (iter_p_)
-       iter_p_->print();
-}
-
-Voice_iterator::Voice_iterator (Voice const*v)
-  : PCursor<Music*> ( v->music_p_list_)
-{
-  here_mom_ = v->offset_mom_;
-  voice_C_ = v;
-  iter_p_ =0;
-}
-
-void
-Voice_iterator::construct_children()
-{
-  while (PCursor<Music*>::ok()) 
-    {
-       start_next_element();
-       if ( !iter_p_->ok()) 
-         {
-           leave_element();
-         }
-       else 
-         {
-           set_voice_translator();
-           break;
-         }
-    }
-}
-
-void 
-Voice_iterator::leave_element()
-{
-  delete iter_p_;
-  iter_p_ =0;
-  MInterval elt_time = ptr()->time_int ();
-  if (!elt_time.empty_b())
-       here_mom_ += elt_time.length();
-  PCursor<Music*>::next();
-}
-
-void
-Voice_iterator::start_next_element()
-{
-  assert (!iter_p_);
-  iter_p_ = get_iterator_p (ptr());
-}
-
-void
-Voice_iterator::set_voice_translator()
-{
-  if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
-       set_translator (iter_p_->report_to_l());
-}
-
-Voice_iterator::~Voice_iterator()
-{
-  assert (! iter_p_);
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator);
-
-void
-Voice_iterator::process_and_next (Moment until)
-{
-  while (1) 
-    {
-       Moment local_until = until - here_mom_;
-       while ( iter_p_->ok()) 
-         {
-           Moment here = iter_p_->next_moment();
-           if (here != local_until)
-               goto loopexit;
-           
-           iter_p_->process_and_next (local_until);
-         }
-
-       if (!iter_p_->ok()) 
-         {
-           leave_element();
-           if ( PCursor<Music*>::ok()) 
-             {
-               start_next_element();
-               set_voice_translator();
-             }
-           else 
-             {
-               goto loopexit;
-             }
-         }
-    }
-
-loopexit:
-
-  Music_iterator::process_and_next (until);
-}
-
-Moment
-Voice_iterator::next_moment()const
-{
-  return iter_p_->next_moment() + here_mom_;
-}
-
-bool
-Voice_iterator::ok()const
-{
-  return iter_p_;
-}
-
-
-IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator);
-
-void
-Request_chord_iterator::construct_children()
-{
-  get_req_translator_l();
-}
-
-Request_chord_iterator::Request_chord_iterator (Request_chord*el_l)
-{
-  elt_l_ = el_l;
-  elt_duration_ = el_l->time_int().length (); 
-  last_b_ = false;
-}
-
-
-bool
-Request_chord_iterator::ok()const
-{
-  return (elt_duration_ && !last_b_) || first_b_; 
-}
-
-
-
-Moment
-Request_chord_iterator::next_moment()const
-{
-  Moment m (0);
-  if  (!first_b_) 
-       m = elt_duration_;
-  return m;
-}
-
-void
-Request_chord_iterator::do_print() const
-{
-#ifndef NPRINT
-  DOUT << "duration: " << elt_duration_;
-#endif
-}
-void
-Request_chord_iterator::process_and_next (Moment mom)
-{
-  if ( first_b_) 
-    {
-       for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++) 
-         {
-           assert (i->is_type_b (Request::static_name()));
-           Request * req_l = (Request*)i.ptr();
-           bool gotcha = report_to_l()->try_request (req_l);
-           if (!gotcha)
-               req_l->warning ("Junking request: " + String (req_l->name()));
-
-         }
-       first_b_ = false;
-    }
-
-  if ( mom >= elt_duration_)
-       last_b_ = true;  
-}
index ad10bce46e277864fad7bb445557610a3d89543d..93a64e6a014703140eb77d7011f87c3b70ce30ee 100644 (file)
@@ -25,7 +25,7 @@ IMPLEMENT_IS_TYPE_B1(Voice,Music_list);
 IMPLEMENT_IS_TYPE_B1(Chord,Music_list);
 
 MInterval
-Chord::time_int()const
+Chord::time_int() const
 {
   MInterval m;
   for (iter (music_p_list_.top(), i); i.ok (); i++)
@@ -62,7 +62,7 @@ Voice::time_int() const
       /*
          c4 <> c4
       */
-       if ( !interval.empty_b())
+       if (!interval.empty_b())
            last += interval.length();
     }
   return  offset_mom_ + MInterval (0,last);
@@ -98,7 +98,7 @@ Music_list::transpose (Melodic_req const*rq)
 }
 
 void
-Music_list::do_print()const
+Music_list::do_print() const
 {
 #ifndef NPRINT
   for (iter (music_p_list_.top(),i); i.ok (); i++)
index 6cd34fc2a0ed8f91abf96da7a58b671ed09fefe2..7de77d1fc9551ee6d5eed197aa5165054593cc4c 100644 (file)
@@ -18,10 +18,10 @@ Music::time_int() const
 }
 
 void
-Music::print()const
+Music::print() const
 {
 #ifndef NPRINT
-  if ( ! check_debug)
+  if (! check_debug)
        return ;
   DOUT << name() << "{";
   if  (type_str_!="" || id_str_!="")
@@ -43,7 +43,7 @@ Music::translate (Moment)
 }
 
 void
-Music::do_print()const
+Music::do_print() const
 {
 }
 
index 857d364ede06983728cef17f530f3e72070876db..f09f0dd6c81d0274220af01bedee72382e4ccd1f 100644 (file)
@@ -101,7 +101,7 @@ My_lily_lexer::set_identifier (String name_str, Identifier*i)
   Identifier *old = lookup_identifier (name_str);
   if  (old) 
     {
-       old->warning( "redeclaration of \\" + name_str);
+       old->warning("redeclaration of \\" + name_str);
        delete old;
     }
   (*identifier_assoc_p_)[name_str] = i;
@@ -121,7 +121,7 @@ My_lily_lexer::~My_lily_lexer()
   delete identifier_assoc_p_;
 }
 void
-My_lily_lexer::print_declarations (bool init_b)const
+My_lily_lexer::print_declarations (bool init_b) const
 {
   for (Assoc_iter<String,Identifier*> ai (*identifier_assoc_p_); ai.ok(); 
         ai++) 
index dd2ac9da14b8d063210cf06fc7975565e4265a33..9ae829f7ff37f1673a9cdedf62af86decb0b921d 100644 (file)
@@ -26,7 +26,7 @@ void
 Note_performer::do_print() const
 {
 #ifndef NPRINT
-  if ( note_req_l_) 
+  if (note_req_l_) 
     {
        note_req_l_->print();
     }
@@ -37,20 +37,20 @@ void
 Note_performer::process_requests() 
 {
   // this is _really_ braindead, but it generates some output
-  if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic ())
+  if (!note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic ())
        return;
 
-  play (new Audio_note (note_req_l_) );
+  play (new Audio_note (note_req_l_));
   note_req_l_ = 0;
 }
 
 bool 
 Note_performer::do_try_request (Request* req_l)
 {
-  if ( note_req_l_)
+  if (note_req_l_)
        return false;
   
-  if ( !req_l->musical() || !req_l->musical ()->note ())
+  if (!req_l->musical() || !req_l->musical ()->note ())
        return false;
 
   note_req_l_ = req_l->musical()->melodic ();
index 9e5be116646cac5dc2ba974513f8778e1d1f5c95..715adecd83122c555615721e43cfce11ad90658c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  p-col.cc -- implement PCol
+  p-col.cc -- implement Paper_column
 
   source file of the GNU LilyPond music typesetter
 
 
 #include "p-col.hh"
 #include "p-score.hh"
-
 #include "debug.hh"
 
-Interval
-PCol::width() const
-{
-  Interval w;
-
-  for (iter_top (its,i); i.ok(); i++)
-       w.unite (i->width());
-  if (w.empty_b())
-       w.unite (Interval (0,0));
-  return w;
-}
-
-void
-PCol::clean_breakable_items()
-{
-  if (!line_l_) 
-    {
-       its.junk_links();
-    }
-  if (prebreak_p_) 
-       prebreak_p_->clean_breakable_items();
-  if (postbreak_p_) 
-       postbreak_p_->clean_breakable_items();
-}
 
 int
-PCol::rank_i() const
+Paper_column::rank_i() const
 {
   return rank_i_;
 }
 
 void
-PCol::set_rank (int i)
+Paper_column::set_rank (int i)
 {
   rank_i_ = i;
-  if (prebreak_p_)
-       prebreak_p_->rank_i_ = i;
-  if (postbreak_p_)
-       postbreak_p_->rank_i_ = i;
+  if (prebreak_l())
+    prebreak_l()->rank_i_ = i;
+  if (postbreak_l())
+    postbreak_l()->rank_i_ = i;
 }
 
 void
-PCol::print() const
+Paper_column::do_print() const
 {
 #ifndef NPRINT
-  DOUT << "PCol {";
-
   DOUT << "rank: " << rank_i_ << '\n';
-
-  DOUT << "# symbols: " << its.size() ;
-     if (prebreak_p_){
-        DOUT << "\npre: ";
-        prebreak_p_->print();
+  if (prebreak_l())
+    {
+      DOUT << "\npre: ";
+      prebreak_l()->print();
     }
-    if (postbreak_p_) {
+  if (postbreak_l()) 
+    {
       DOUT << "post: ";
-      postbreak_p_->print();
+      postbreak_l()->print();
     } 
-  else if (daddy_l_) 
+  if (break_status_i_)
     {
-       DOUT <<'\n' << ((this == daddy_l_->prebreak_p_) ?
-                      "prebreak" : "postbreak");
-       DOUT << '\n';
+      DOUT <<'\n' << ((break_status_i_ == -1)? "prebreak" : "postbreak");
+      DOUT << '\n';
     }
   DOUT << "extent: " << width().str () << "\n";
-  DOUT << "}\n";
 #endif 
 }
 
 int
-PCol::compare (PCol const &c1, PCol const &c2)
+Paper_column::compare (Paper_column const &c1, Paper_column const &c2)
 {
   return c1.rank_i() - c2.rank_i ();
 }
 
-void
-PCol::OK() const
+Paper_column*
+Paper_column::prebreak_l() const
 {
-#ifndef NDEBUG
-  if (prebreak_p_ || postbreak_p_) 
-    {
-       assert (prebreak_p_&&postbreak_p_);
-       assert (prebreak_p_->daddy_l_ == this);
-       assert (postbreak_p_->daddy_l_ == this);
-    }
-#endif
+  return (Paper_column*)broken_to_drul_[LEFT];
 }
 
-void
-PCol::set_breakable()
+Paper_column*
+Paper_column::postbreak_l() const
 {
-  if (breakable_b())
-       return;
-
-  do_set_breakable();
-  prebreak_p_->pscore_l_ = pscore_l_;
-  postbreak_p_->pscore_l_ = pscore_l_;
-
-  prebreak_p_->daddy_l_ = postbreak_p_->daddy_l_ = this;
+  return(Paper_column*) broken_to_drul_[RIGHT];
 }
-void
-PCol::do_set_breakable()
-{
-   prebreak_p_ = new PCol;
-  postbreak_p_ = new PCol;
-}
-  
-
 bool
-PCol::breakpoint_b() const
+Paper_column::breakpoint_b() const
 {
   return !line_l_;
 }
 
-bool
-PCol::breakable_b() const
-{
-  return prebreak_p_||postbreak_p_||daddy_l_;
-}
-
-PCol::PCol()
+Paper_column::Paper_column()
 {
   used_b_ = false;
   error_mark_b_ = false;
-  daddy_l_ = 0;
-  prebreak_p_=0;
-  postbreak_p_=0;
   line_l_=0;
-  hpos_f_ = -1.0;
-  pscore_l_ = 0;
   rank_i_ = -1;
 }
 
-PCol::~PCol()
-{
-  delete prebreak_p_;
-  delete postbreak_p_;
-}
-
-void
-PCol::add (Item *i)
+Line_of_score*
+Paper_column::line_l() const
 {
-  its.bottom().add (i);
-  i->pcol_l_ = this; 
+  return line_l_;
 }
 
 bool
-PCol::used_b()const
+Paper_column::used_b() const
 {
-  return daddy_l_ || breakable_b() || its.size ()|| used_b_;
+  return linked_b();
 }
+
+IMPLEMENT_IS_TYPE_B1(Paper_column, Horizontal_group_item);
+
index ea11129e2543602e1d9ea9deb98dd8b4b6765ff8..ae1e93dd6fc595a68f7ed7e8a4055c9adc6d644b 100644 (file)
@@ -53,17 +53,17 @@ Performer_group_performer::depth_i() const
 void
 Performer_group_performer::do_creation_processing()
 {
-  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
        i->creation_processing();
 }
 
 void
-Performer_group_performer::do_print()const
+Performer_group_performer::do_print() const
 {
 #ifndef NPRINT
-  if ( !check_debug)
+  if (!check_debug)
        return ;
-  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
        i->print();
 #endif
 }
@@ -71,7 +71,7 @@ Performer_group_performer::do_print()const
 void
 Performer_group_performer::do_removal_processing()
 {
-  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
        i->do_removal_processing();
 }
 
@@ -81,7 +81,7 @@ Performer_group_performer::do_try_request (Request* req_l)
   bool hebbes_b =false;
   for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
        hebbes_b =nongroup_l_arr_[i]->try_request (req_l);
-  if ( !hebbes_b && daddy_perf_l_)
+  if (!hebbes_b && daddy_perf_l_)
        hebbes_b = daddy_perf_l_->try_request (req_l);
   return hebbes_b ;
 }
@@ -90,7 +90,7 @@ Translator*
 Performer_group_performer::find_get_translator_l (String n,String id)
 {
   Translator * ret=0;
-  Input_translator* itrans_l= itrans_l_-> recursive_find ( n);
+  Input_translator* itrans_l= itrans_l_-> recursive_find (n);
   if (itrans_l) 
     {
        ret = find_performer_l (n,id);
@@ -102,7 +102,7 @@ Performer_group_performer::find_get_translator_l (String n,String id)
            add (group);
            ret = group;
            
-           if (group->itrans_l_->is_name_b (n) )
+           if (group->itrans_l_->is_name_b (n))
                ret ->id_str_ = id;
            else
                return ret->find_get_translator_l (n,id);
@@ -137,7 +137,7 @@ Translator*
 Performer_group_performer::get_default_interpreter()
 {
   // ? 
-  if ( is_bottom_performer_b())
+  if (is_bottom_performer_b())
        return daddy_perf_l_->get_default_interpreter();
 
   Performer_group_performer *perf_p= itrans_l_->
@@ -164,7 +164,7 @@ Performer_group_performer::print() const
 void
 Performer_group_performer::process_requests()
 {
-  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++)
        i->process_requests();
 }
 
index ad2f9805ed00e7057ba77f7d6df497e0c3f3eb17..ed72f2a2cee5f948f4f8dc00bb328189ad6d08d5 100644 (file)
@@ -36,7 +36,7 @@ Performer::play (Audio_element* p)
 }
 
 int
-Performer::get_tempo_i()const
+Performer::get_tempo_i() const
 {
   return daddy_perf_l_->get_tempo_i();
 }
diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc
new file mode 100644 (file)
index 0000000..8209317
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+  request-iterator.cc -- implement Request_chord_iterator
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "translator.hh"
+#include "debug.hh"
+#include "request-iterator.hh"
+#include "music-list.hh"
+#include "request.hh"
+
+IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator);
+
+void
+Request_chord_iterator::construct_children()
+{
+  get_req_translator_l();
+}
+
+Request_chord_iterator::Request_chord_iterator (Request_chord*el_l)
+{
+  elt_l_ = el_l;
+  MInterval elt_dur =el_l->time_int();
+  elt_duration_ = elt_dur.length (); 
+  last_b_ = false;
+}
+
+
+bool
+Request_chord_iterator::ok() const
+{
+  return (elt_duration_ && !last_b_) || first_b_; 
+}
+
+
+
+Moment
+Request_chord_iterator::next_moment() const
+{
+  Moment m (0);
+  if  (!first_b_) 
+    m = elt_duration_;
+  return m;
+}
+
+void
+Request_chord_iterator::do_print() const
+{
+#ifndef NPRINT
+  DOUT << "duration: " << elt_duration_;
+#endif
+}
+void
+Request_chord_iterator::process_and_next (Moment mom)
+{
+  if (first_b_) 
+    {
+      for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++) 
+       {
+         assert (i->is_type_b (Request::static_name()));
+         Request * req_l = (Request*)i.ptr();
+         bool gotcha = report_to_l()->try_request (req_l);
+         if (!gotcha)
+           req_l->warning ("Junking request: " + String (req_l->name()));
+
+       }
+      first_b_ = false;
+    }
+
+  if (mom >= elt_duration_)
+    last_b_ = true;  
+}
index 1b431d2f2d270e51efdbb1d3e2384b1c3769131c..488b2cad953d6a6ecdf62167b0b78853f17a7010 100644 (file)
@@ -25,18 +25,18 @@ Request::time_int() const
 
 
 bool
-Request::equal_b (Request *r)const
+Request::equal_b (Request *r) const
 {
-  if ( is_type_b ( r->name()) )
+  if (is_type_b (r->name()))
        return r->do_equal_b ((Request*)this);
-  if ( r->is_type_b (name()))
+  if (r->is_type_b (name()))
        return do_equal_b (r);
         
   return false;
 }
 
 bool
-Request::do_equal_b (Request*)const
+Request::do_equal_b (Request*) const
 {
   return false;
 }
index 86a4030bdfcd5ffdcca1d5d8d7ebfb32462903ba..fbd6d0ba5ed99ad04049b9750a8158ad51d7d228 100644 (file)
@@ -62,7 +62,7 @@ void
 Rest_collision_engraver::do_print() const
 {
 #ifndef NPRINT
-  if ( rest_collision_p_)
+  if (rest_collision_p_)
        rest_collision_p_->print();
 #endif
 }
index d86903eb7bddd907ad5c19e7e842a792f0789647..7f8ee615e1b31be5c2fce593545f6b025bfc3ec2 100644 (file)
@@ -41,7 +41,7 @@ Score_align_engraver::acknowledge_element (Score_elem_info inf)
            announce_element (Score_elem_info (align_p_,0));
          }
        Score_elem * unbound_elem = inf.elem_l_;
-       while ( unbound_elem->axis_group_l_a_[X_AXIS])
+       while (unbound_elem->axis_group_l_a_[X_AXIS])
            unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS];
        align_p_->add_element (unbound_elem);
     }
index d6f4e739a5da518cbf77194882aba931e78121fb..1827c046393de0e10719120ea9078ec6b8d16928 100644 (file)
@@ -17,16 +17,15 @@ Score_column::Score_column (Moment w)
 }
 
 void
-Score_column::print() const
+Score_column::do_print() const
 {
 #ifndef NPRINT
-  DOUT << "Score_column { mus "<< musical_b_ <<" at " <<  when_<<'\n';
+  DOUT << "mus "<< musical_b_ <<" at " <<  when_<<'\n';
   DOUT << "durations: [";
   for (int i=0; i < durations.size(); i++)
-       DOUT << durations[i] << " ";
+    DOUT << durations[i] << " ";
   DOUT << "]\n";
-  PCol::print();
-  DOUT << "}\n";
+  Paper_column::do_print();
 #endif
 }
 
@@ -48,21 +47,10 @@ Score_column::add_duration (Moment d)
   assert (d);
   for (int i = 0; i< durations.size(); i++) 
     {
-       if (d == durations[i])
-           return ;
+      if (d == durations[i])
+       return ;
     }
   durations.push (d);
 }
 
-void
-Score_column::do_set_breakable()
-{
-  Score_column *c1 = new Score_column (when_);
-  Score_column *c2 = new Score_column (when_);
-  prebreak_p_ =c1;
-  postbreak_p_ = c2;
-  c1->durations = durations;
-  c2->durations = durations;
-  c1->musical_b_ 
-       = c2->musical_b_ = musical_b_;
-}
+IMPLEMENT_IS_TYPE_B1(Score_column, Paper_column);
index 5569e5bf8354685112d3a6ab789d008b2216ea18..9d7b090dafc733a31823c8cc7a9c5e893086da2d 100644 (file)
 #include "p-col.hh"
 
 Score_elem*
-Score_elem::dependency (int i)const
+Score_elem::dependency (int i) const
 {
-  return (Score_elem*) get_out_edge_arr()[i];
+  return (Score_elem*) get_out_edge_arr ()[i];
 }
 
 int
-Score_elem::dependency_size() const
+Score_elem::dependency_size () const
 {
-  return get_out_edge_arr().size ();
+  return get_out_edge_arr ().size ();
 }
 
 Score_elem*
@@ -45,48 +45,37 @@ Score_elem::dependent_size() const
   return get_in_edge_arr().size ();
 }
 
-
-
 String
-Score_elem::TeX_string_without_offset (Offset o)const
+Score_elem::make_TeX_string (Offset o)const
 {
-  if (transparent_b_)
-       return "";
   String s ("\\placebox{%}{%}{%}");
   Array<String> a;
   a.push (print_dimen (o.y()));
   a.push (print_dimen (o.x()));
   String t = output->TeX_string();
   if (t == "")
-       return t;
+    return t;
 
   a.push (t);
   String r;
   if (check_debug)
-       r = String ("\n%start: ") + name() + "\n";
-  r += substitute_args (s, a);;
+    r = String ("\n%start: ") + name() + "\n";
+  r += substitute_args (s, a);
   return r;
 }
-
 String
-Score_elem::TeX_string() const
+Score_elem::do_TeX_output_str () const
 {
-  assert (status_ > POSTCALCED);
-  return TeX_string_without_offset (offset_);
+  return make_TeX_string(absolute_offset());
 }
 
-void
-Score_elem::copy_dependencies (Score_elem const &s)
+Score_elem::Score_elem (Score_elem const&s)
 {
   /* called from derived ctor, so most info points to the same deps
-    as (Directed_graph_node&)s. Nobody points to us, so don't copy
-    dependents.      
+     as (Directed_graph_node&)s. Nobody points to us, so don't copy
+     dependents.      
    */
   copy_edges_out (s);
-}
-
-Score_elem::Score_elem (Score_elem const&s)
-{
   transparent_b_ = s.transparent_b_;
   empty_b_ = s.empty_b_;
   axis_group_l_a_[0] = axis_group_l_a_[1] =0;
@@ -104,20 +93,19 @@ Score_elem::~Score_elem()
   delete output;
   status_ = DELETED;
   output = 0;
-
 }
 
 /*
   GEOMETRY
  */
 Real
-Score_elem::absolute_coordinate (Axis a)const
+Score_elem::absolute_coordinate (Axis a) const
 {
   Real r = offset_[a];
-  for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
-         axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
+  for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+       axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
        
-       r += axis_group_l->offset_[a];
+    r += axis_group_l->offset_[a];
   return r;
 }
  
@@ -128,38 +116,38 @@ Score_elem::absolute_offset() const
   return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
 }
 
- void
+void
 Score_elem::translate (Real y, Axis a)
 {
   offset_[a] += y;
 }
 
 Real
-Score_elem::relative_coordinate (Axis_group_element*e, Axis a)const
+Score_elem::relative_coordinate (Axis_group_element*e, Axis a) const
 {
   Real r =0.0;
-  for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
-         axis_group_l != e;
-         axis_group_l = axis_group_l->axis_group_l_a_[a])
-       r +=  axis_group_l->offset_[a];
+  for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+       axis_group_l != e;
+       axis_group_l = axis_group_l->axis_group_l_a_[a])
+    r +=  axis_group_l->offset_[a];
 
   return r;
 }
 
 Axis_group_element* 
-Score_elem::common_group (Score_elem const* s, Axis a)const
+Score_elem::common_group (Score_elem const* s, Axis a) const
 {
   Link_array<Axis_group_element> my_groups;
-  for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
-         axis_group_l;
-         axis_group_l = axis_group_l->axis_group_l_a_[a])
-       my_groups.push (axis_group_l);
+  for (Axis_group_element * axis_group_l = axis_group_l_a_[a];
+       axis_group_l;
+       axis_group_l = axis_group_l->axis_group_l_a_[a])
+    my_groups.push (axis_group_l);
 
   Axis_group_element* common_l=0;
-  for ( Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
-         !common_l && axis_group_l;
-         axis_group_l = axis_group_l->axis_group_l_a_[a])
-       common_l = my_groups.find_l (axis_group_l);
+  for (Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
+       !common_l && axis_group_l;
+       axis_group_l = axis_group_l->axis_group_l_a_[a])
+    common_l = my_groups.find_l (axis_group_l);
 
   return common_l;
 }
@@ -179,12 +167,12 @@ Score_elem::do_width() const
 
   if (!output)
     {
-       Molecule*m = brew_molecule_p();
-       r = m->extent().x ();
-       delete m;
+      Molecule*m = brew_molecule_p();
+      r = m->extent().x ();
+      delete m;
     }
   else
-       r = output->extent().x ();
+    r = output->extent().x ();
   return r;
 }
 
@@ -195,17 +183,17 @@ Score_elem::width() const
 }
 
 Interval
-Score_elem::extent (Axis a)const
+Score_elem::extent (Axis a) const
 {
   Interval r;
-  if ( !empty_b_) 
+  if (!empty_b_) 
     {
        
-       r = (a == X_AXIS)? do_width(): do_height ();
+      r = (a == X_AXIS)? do_width(): do_height ();
     }
   
   if (!r.empty_b()) // float exception on DEC Alpha
-       r+=offset_[a];
+    r+=offset_[a];
 
   return r;
 }
@@ -216,12 +204,12 @@ Score_elem::do_height() const
   Interval r;
   if (!output)
     {
-       Molecule*m = brew_molecule_p();
-       r = m->extent().y ();
-       delete m;
+      Molecule*m = brew_molecule_p();
+      r = m->extent().y ();
+      delete m;
     }
   else
-       r = output->extent().y ();
+    r = output->extent().y ();
   return r;
 }
 
@@ -235,19 +223,19 @@ Score_elem::height() const
   STANDARD METHS
  */
 void
-Score_elem::print()const
+Score_elem::print() const
 {
 #ifndef NPRINT
   DOUT << name() << "{\n";
   DOUT << "dets: " << dependent_size() << "dependencies: " << 
-       dependency_size();
+    dependency_size();
   if (offset_.x() || offset_.y ())
-       DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")";
+    DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")";
   DOUT << "\n";
 
   do_print();
   if (output)
-       output->print();
+    output->print();
   
   DOUT <<  "}\n";
 #endif
@@ -275,7 +263,7 @@ void
 Score_elem::add_processing()
 {
   if (status_ >= VIRGIN)
-       return;
+    return;
   status_ = VIRGIN;
   do_add_processing();
 }
@@ -284,17 +272,17 @@ void
 Score_elem::pre_processing()
 {
   if (status_ >= PRECALCED)
-       return;
+    return;
 
   assert (status_ != PRECALCING); // cyclic dependency
   status_ = PRECALCING;
 
   for (int i=0; i < dependency_size(); i++)
-       dependency (i)->pre_processing();
+    dependency (i)->pre_processing();
 
   Link_array<Score_elem> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
-       extra[i]->pre_processing();
+    extra[i]->pre_processing();
   
   do_pre_processing();
   status_ = PRECALCED;
@@ -304,21 +292,21 @@ void
 Score_elem::breakable_col_processing()
 {
   if (status_ >= PREBROKEN)
-       return;
+    return;
 
   if (status_== PREBREAKING) 
     {
-       status_ = PREBROKEN;
-       return ;
+      status_ = PREBROKEN;
+      return ;
     }
   status_ = PREBREAKING;
 
   for (int i=0; i < dependency_size(); i++)
-       dependency (i)->breakable_col_processing();
+    dependency (i)->breakable_col_processing();
 
-    Link_array<Score_elem> extra (get_extra_dependencies());
+  Link_array<Score_elem> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
-       extra[i]->breakable_col_processing();
+    extra[i]->breakable_col_processing();
   
   
   do_breakable_col_processing();
@@ -329,21 +317,21 @@ void
 Score_elem::break_processing()
 {
   if (status_ >= BROKEN)
-       return;
+    return;
 
   if (status_ == BREAKING) 
     {
-       status_ = BROKEN;
-       return;
+      status_ = BROKEN;
+      return;
     }
   status_ = BREAKING;
 
   for (int i=0; i < dependency_size(); i++)
-       dependency (i)->break_processing();
+    dependency (i)->break_processing();
 
   Link_array<Score_elem> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
-       extra[i]->break_processing();
+    extra[i]->break_processing();
   
 
   
@@ -363,17 +351,17 @@ void
 Score_elem::post_processing()
 {
   if (status_ >= POSTCALCED)
-       return;
+    return;
   assert (status_ != POSTCALCING);// cyclic dependency
   status_=POSTCALCING; 
 
   
   for (int i=0; i < dependency_size(); i++)
-       dependency (i)->post_processing();
+    dependency (i)->post_processing();
 
   Link_array<Score_elem> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
-       extra[i]->post_processing();
+    extra[i]->post_processing();
   
 
   do_post_processing();
@@ -381,7 +369,7 @@ Score_elem::post_processing()
 }
 
 Score_elem::Status
-Score_elem::status()const
+Score_elem::status() const
 {
   return status_;
 }
@@ -389,23 +377,45 @@ Score_elem::status()const
 void 
 Score_elem::molecule_processing()
 {
-  if (status_ >= OUTPUT)
-       return;
-  status_ = OUTPUT;            // do it only once.
+  if (status_ >= BREWED)
+    return;
+  status_ = BREWED;            // do it only once.
   
   for (int i=0; i < dependency_size(); i++)
-       dependency (i)->molecule_processing();
+    dependency (i)->molecule_processing();
 
   Link_array<Score_elem> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
-       extra[i]->molecule_processing();
+    extra[i]->molecule_processing();
   
 
   if (transparent_b_)
-       return ;
+    return ;
   output= brew_molecule_p();
 }
 
+String
+Score_elem::TeX_output_str() const
+{
+  String s;
+  if (status_ >= TEXOUTPUT)
+    return "";
+
+  ((Score_elem*)this)->status_ = TEXOUTPUT;
+
+  for (int i=0; i < dependency_size(); i++)
+    s += dependency (i)->TeX_output_str();
+
+  Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
+    s += extra[i]->TeX_output_str ();
+  
+  if (!transparent_b_)
+    s+= do_TeX_output_str();
+
+  return s;
+}
+
 /*
   
   VIRTUAL STUBS
@@ -443,12 +453,18 @@ Score_elem::do_substitute_dependent (Score_elem*,Score_elem*)
 
 void
 Score_elem::do_unlink()
-{}
+{
+}
+
+void
+Score_elem::do_junk_links()
+{
+}
 
 IMPLEMENT_IS_TYPE_B(Score_elem);
 
 Molecule*
-Score_elem::brew_molecule_p()const
+Score_elem::brew_molecule_p() const
 {
   Atom a (paper()->lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
   return new Molecule (a);
@@ -456,7 +472,7 @@ Score_elem::brew_molecule_p()const
 
 
 Line_of_score *
-Score_elem::line_l()const
+Score_elem::line_l() const
 {
   return 0;
 }
@@ -486,52 +502,43 @@ Score_elem::substitute_dependency (Score_elem* old, Score_elem* new_l)
   old->do_substitute_dependent (this, 0);
 }
 
-void
-Score_elem::junk_dependencies()
-{
-  while ( dependency_size()) 
-    {
-       remove_edge_out (dependency (0));
-    }
-}
-
 void
 Score_elem::handle_broken_dependencies()
 {
   Line_of_score *line  = line_l();
   if (!line)
-       return;
+    return;
 
   Link_array<Score_elem> remove_us_arr;
   for (int i=0; i < dependency_size(); i++) 
     {
-       Score_elem * elt = dependency (i);
-       if (elt->line_l() != line)
-         {
-           if (elt->spanner()) 
-             {
-               Spanner * sp = elt->spanner();
-               Spanner * broken = sp->find_broken_piece (line);
-               substitute_dependency (sp, broken);
-
-               add_dependency (broken);
-             }
-           else if (elt->item() && elt->item ()->pcol_l_->breakpoint_b ()
-                      && elt->item()->break_status_i () == 0) 
-                        {
-               Item * my_item = elt->item()->find_prebroken_piece (line);
-               substitute_dependency (elt, my_item);
-               if (my_item)
-                   add_dependency (my_item);
-             }
-           remove_us_arr.push (elt);
-         }
+      Score_elem * elt = dependency (i);
+      if (elt->line_l() != line)
+       {
+         if (elt->spanner()) 
+           {
+             Spanner * sp = elt->spanner();
+             Spanner * broken = sp->find_broken_piece (line);
+             substitute_dependency (sp, broken);
+
+             add_dependency (broken);
+           }
+         else if (elt->item())
+           {
+             Item * my_item = elt->item()->find_prebroken_piece (line);
+               
+             substitute_dependency (elt, my_item);
+             if (my_item)
+               add_dependency (my_item);
+           }
+         remove_us_arr.push (elt);
+       }
     }
 
   remove_us_arr.default_sort();
   remove_us_arr.uniq();
   for (int i=0;  i <remove_us_arr.size(); i++)
-       remove_dependency (remove_us_arr[i]);
+    remove_dependency (remove_us_arr[i]);
 
   status_ = BROKEN;
 }
@@ -556,29 +563,30 @@ Score_elem::handle_prebroken_dependencies()
   
   for (int i=0; i < dependency_size(); i++) 
     {
-       Score_elem * elt = dependency (i);
-       Item *it_l = elt->item();
-       if (it_l && it_l->breakable_b_)
-           if (item()) 
-             {
-               Score_elem *new_l = it_l->find_prebroken_piece (item()->pcol_l_);
-               if (new_l != elt) 
-                 {
-                   new_arr.push (new_l);
-                   old_arr.push (elt);
-                 }
-           }else 
+      Score_elem * elt = dependency (i);
+      Item *it_l = elt->item();
+      if (it_l && it_l->breakable_b_)
+       if (item()) 
+         {
+           Score_elem *new_l = it_l->find_prebroken_piece (item()->break_status_i_);
+           if (new_l != elt) 
              {
-               new_arr.push (it_l->broken_to_a_[0]);
-               old_arr.push (0);
-               old_arr.push (0);               
-               new_arr.push (it_l->broken_to_a_[1]);           
+               new_arr.push (new_l);
+               old_arr.push (elt);
              }
+         }
+       else 
+         {
+           new_arr.push (it_l->broken_to_drul_[LEFT]);
+             old_arr.push (0);
+             old_arr.push (0);         
+             new_arr.push (it_l->broken_to_drul_[RIGHT]);              
+         }
     }
   
   for (int i=0;  i < old_arr.size(); i++)
-       if (old_arr[i])
-           substitute_dependency (old_arr[i], new_arr[i]);
+    if (old_arr[i])
+      substitute_dependency (old_arr[i], new_arr[i]);
        
        
   status_ = PREBROKEN;
@@ -590,48 +598,56 @@ void
 Score_elem::unlink_all()
 {
   for (int i=0; i < dependency_size(); i++) 
-       dependency (i)->unlink_all();
+    dependency (i)->unlink_all();
   Link_array<Score_elem> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
-       extra[i]->unlink_all();
+    extra[i]->unlink_all();
   
   junk_links();
-  axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+  axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0;
+  do_unlink();
 }
 
 void
 Score_elem::unlink()
 {
   do_unlink();
-  while ( dependency_size()) 
+  while (dependency_size()) 
     {
-       do_substitute_dependency (dependency (0),0);
-       remove_edge_out_idx (0);
+      do_substitute_dependency (dependency (0),0);
+      remove_edge_out_idx (0);
     }
-  while  ( dependent_size()) 
+  while  (dependent_size()) 
     {
-       dependent (0)->remove_dependency (this);
+      dependent (0)->remove_dependency (this);
     }
   for (int j=0; j < 2; j++)
-       if ( axis_group_l_a_[j])
-           axis_group_l_a_[j]->remove_element (this);
+    if (axis_group_l_a_[j])
+      axis_group_l_a_[j]->remove_element (this);
 
 }
 
 void
-Score_elem::OK()const
+Score_elem::OK() const
 {
 #ifndef NDEBUG
   for (int i=0; i < dependency_size(); i++) 
     {
-       dependency (i)->OK();
+      dependency (i)->OK();
     }
 #endif
 }
 
 Link_array<Score_elem>
-Score_elem::get_extra_dependencies()const
+Score_elem::get_extra_dependencies() const
 {
   Link_array<Score_elem> empty;
   return empty;
 }
+
+bool
+Score_elem::linked_b() const
+{
+  return get_extra_dependencies().size() || 
+    dependency_size();
+}
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();
+}
index 152e9a7cd8f3d961f79804ebf36184d14ccc01de..5f19f84177b93538ac1e13d3c2f89d86efcb698c 100644 (file)
@@ -60,7 +60,7 @@ Span_bar::do_width() const
 void
 Span_bar::do_pre_processing()
 {
-  if ( spanning_l_arr_.size() < 1) 
+  if (spanning_l_arr_.size() < 1) 
     {
        transparent_b_ = true;
        empty_b_ =true;
@@ -74,11 +74,11 @@ Span_bar::do_pre_processing()
            transparent_b_=true;
            empty_b_ = true;
          }
-       else if ( type_str_ == "|:") 
+       else if (type_str_ == "|:") 
          {
            type_str_ = ".|";
          }
-       else if ( type_str_ == ":|")
+       else if (type_str_ == ":|")
          {
            type_str_ = "|.";
          }
@@ -93,7 +93,7 @@ Span_bar::get_bar_sym (Real dy) const
 
 
 Molecule*
-Span_bar::brew_molecule_p()const
+Span_bar::brew_molecule_p() const
 {
   Interval y_int;
   for (int i=0; i < spanning_l_arr_.size(); i++) 
@@ -109,7 +109,7 @@ Span_bar::brew_molecule_p()const
 
   Symbol s = get_bar_sym (y_int.length());
   Molecule*output = new Molecule (Atom (s));
-  output->translate (  y_int[-1], Y_AXIS);
+  output->translate (y_int[-1], Y_AXIS);
   return output;
 }
 
index a7592d532056ce3711d9d7d0f347a134359e7f6c..96c73a9d1dfa553d8eabc90e854e295287dac5f6 100644 (file)
@@ -21,7 +21,7 @@ Span_score_bar::do_pre_processing()
 {
   Span_bar::do_pre_processing();
   
-  if ( break_status_i() != 1) 
+  if (break_status_i() != 1) 
     {
        empty_b_ = transparent_b_ = true;
     }
@@ -29,12 +29,12 @@ Span_score_bar::do_pre_processing()
 
 
 Symbol
-Piano_brace::get_bar_sym (Real dy)const
+Piano_brace::get_bar_sym (Real dy) const
 {
   return paper()->lookup_l ()->vbrace (dy);
 }
 Interval
-Piano_brace::do_width()const
+Piano_brace::do_width() const
 {
   return Interval (0,0);
 }
index eac107ba8dc113e7c4d51a2c529cc9feb2edd5c4..397cfdb6c5fbf37c9bd8fd20a4f3c2230460d6ea 100644 (file)
 IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem);
 
 void
-Spanner::do_print()const
+Spanner::do_print() const
 {
 #ifndef NPRINT
   DOUT << "Between col ";
-  if ( left_col_l_)
-       DOUT << left_col_l_->rank_i();
-  else 
-       DOUT << "nop";
-  DOUT << ", ";
-  if ( right_col_l_)
-       DOUT << right_col_l_->rank_i();
-  else 
-       DOUT << "nop";
   if (broken_into_l_arr_.size())
-       DOUT << "with broken pieces\n";
+    DOUT << "with broken pieces\n";
 #endif
 }
 
 void
-Spanner::break_into_pieces (bool copy_deps_b)
+Spanner::break_into_pieces ()
 {
-  if (  broken_into_l_arr_.size())
-       return; 
+  if (broken_into_l_arr_.size())
+    return; 
         
-  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_;
+  Item * left = spanned_drul_[LEFT];
+  Item * right = spanned_drul_[RIGHT];
   
   
-  Link_array<PCol> break_cols = pscore_l_->broken_col_range (left,right);
+  Link_array<Item> break_cols = pscore_l_->broken_col_range (left,right);
   Link_array<Spanner> broken_into_l_arr;
 
   break_cols.insert (left,0);
@@ -53,23 +42,21 @@ Spanner::break_into_pieces (bool copy_deps_b)
 
   for (int i=1; i < break_cols.size(); i++) 
     {
-       Spanner* span_p = clone()->spanner ();
-       if (copy_deps_b)
-           span_p->copy_dependencies (*this);
-       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;
+      Spanner* span_p = clone()->spanner ();
+      left = break_cols[i-1];
+      right = break_cols[i];
+      if (!right->line_l())
+       right = right->find_prebroken_piece(-1);
+      if (!left->line_l())
+       left = left->find_prebroken_piece(1);
+
+            assert (left&&right && left->line_l() == right->line_l());
+
+      span_p->set_bounds(LEFT,left);
+      span_p->set_bounds(RIGHT,right);
        
-       pscore_l_->typeset_broken_spanner (span_p);
-       broken_into_l_arr.push (span_p);
+      pscore_l_->typeset_broken_spanner (span_p);
+      broken_into_l_arr.push (span_p);
     }
    
   broken_into_l_arr_ = broken_into_l_arr;
@@ -78,68 +65,110 @@ Spanner::break_into_pieces (bool copy_deps_b)
 void
 Spanner::set_my_columns()
 {
-  if (!left_col_l_->line_l_)
-       left_col_l_ = left_col_l_->postbreak_p_;
-  if (!right_col_l_->line_l_)
-       right_col_l_ = right_col_l_->prebreak_p_;
+  Direction i = (Direction)1;
+  do 
+    {
+      if (!spanned_drul_[i]->line_l())
+       set_bounds(i,spanned_drul_[i]->find_prebroken_piece(-i));
+    } 
+  while ((i*=-1) != 1);
 }       
 
+
 void
-Spanner::do_break_processing()
+Spanner::set_bounds(Direction d, Item*i)
 {
-  set_my_columns();
+  if (spanned_drul_[d])
+    spanned_drul_[d]->attached_span_l_arr_.substitute(this,0);
   
-  if (!line_l()) 
+  spanned_drul_[d] =i;
+  if (i)
+    i->attached_span_l_arr_.push(this);
+}
+
+void
+Spanner::do_break_processing()
+{
+  if (!line_l())
     {
-       break_into_pieces (true);
-       for (int i=0; i < broken_into_l_arr_.size(); i++)
-           broken_into_l_arr_[i]->handle_broken_dependencies();
+      break_into_pieces ();
+      for (int i=0; i < broken_into_l_arr_.size(); i++)
+       broken_into_l_arr_[i]->handle_broken_dependencies();
     }
   else 
     {
-       handle_broken_dependencies();
+      handle_broken_dependencies();
     }
 }
 
 
 Spanner::Spanner()
 {
-  left_col_l_ = right_col_l_ = 0;
+  spanned_drul_[LEFT]=0;
+  spanned_drul_[RIGHT]=0;
 }
 
+String
+Spanner::do_TeX_output_str () const
+{
+  Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0);
+  return make_TeX_string (absolute_offset() + left_off);
+}
 
 Interval
-Spanner::do_width()const
+Spanner::do_width() const
 {
-  Real r = right_col_l_->hpos_f_;
-  Real l = left_col_l_->hpos_f_;
-  assert (*left_col_l_ < *right_col_l_);
+  Real l = spanned_drul_[LEFT]->absolute_coordinate (X_AXIS);
+  Real r = spanned_drul_[RIGHT]->absolute_coordinate (X_AXIS);
   assert (r>=l);
        
   return Interval (0, r-l);
 }
 
 Line_of_score *
-Spanner::line_l()const
+Spanner::line_l() const
 {
-  if ( left_col_l_->line_l_ != right_col_l_->line_l_)
-       return 0;
-  return left_col_l_->line_l_;
+  if (!spanned_drul_[LEFT] || !spanned_drul_[RIGHT])
+    return 0;
+  if (spanned_drul_[LEFT]->line_l() != spanned_drul_[RIGHT]->line_l())
+    return 0;
+  return spanned_drul_[LEFT]->line_l();
 }
 
 
 Spanner*
-Spanner::find_broken_piece (Line_of_score*l)const
+Spanner::find_broken_piece (Line_of_score*l) const
 {
   for (int i=0; i < broken_into_l_arr_.size(); i++)
-       if (broken_into_l_arr_[i]->line_l() == l)
-           return broken_into_l_arr_[i];
+    if (broken_into_l_arr_[i]->line_l() == l)
+      return broken_into_l_arr_[i];
   return 0;                               
          
 }
 
 bool
-Spanner::broken_b()const
+Spanner::broken_b() const
 {
   return broken_into_l_arr_.size();
 }
+
+void
+Spanner::do_unlink() 
+{
+  if (spanned_drul_[LEFT]) 
+    {
+      spanned_drul_[LEFT]->attached_span_l_arr_.substitute (this,0);
+      spanned_drul_[LEFT] =0;
+    }
+  if (spanned_drul_[RIGHT]) 
+    {
+      spanned_drul_[RIGHT]->attached_span_l_arr_.substitute (this,0);
+      spanned_drul_[RIGHT] = 0;
+    }
+}
+
+void
+Spanner::do_junk_links()
+{
+  spanned_drul_[LEFT] = spanned_drul_[RIGHT] =0;
+}
index 0857fb9b55742f87610232700313de51cbef7f5f..75854b82a92c966bb4f1042930a9521fb2d78ef8 100644 (file)
@@ -38,13 +38,13 @@ Staff_info::command_l()
   return command_l_;
 }
 
-PCol*
+Paper_column*
 Staff_info::command_pcol_l()
 {
   return command_l();
 }
 
-PCol*
+Paper_column*
 Staff_info::musical_pcol_l()
 {
   return musical_l();
index 80bbf00a30fb5052ea154df654f0be79f90712ab..72b1ef6840339ae3b2aa0a007de0a4e88091ff04 100644 (file)
@@ -35,7 +35,7 @@ Staff_performer::do_creation_processing()
   if (instrument_str().length_i()) 
     {
        // staff name
-       play (new Audio_text ( Audio_text::TRACK_NAME, instrument_str ()));
+       play (new Audio_text (Audio_text::TRACK_NAME, instrument_str ()));
        // instrument description
        play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ()));
     }
index 6adfae18269039cca7e76e48be5c0480518cba73..f2dfad4d32e91234b7c0ebedf62b5f5a83c8c1ce 100644 (file)
@@ -12,6 +12,7 @@
 #include "p-col.hh"
 
 const NO_LINES = 5;
+
 void
 Staff_sym_engraver::fill_staff_info (Staff_info&i)
 {
@@ -32,14 +33,14 @@ void
 Staff_sym_engraver::do_creation_processing()
 {
   span_p_ = new Staff_symbol (NO_LINES);
-  span_p_->left_col_l_ = get_staff_info().command_pcol_l (); // ugh
+  span_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
   announce_element (Score_elem_info (span_p_, 0));
 }
 
 void
 Staff_sym_engraver::do_removal_processing()
 {
-  span_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+  span_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
   typeset_element (span_p_);
   span_p_ =0;
 }
index 4542d2e3dcfc0acb8aceb5ce7f2546b79786e412..6b9b288aba0e2cf1968d30350bfa69a4183bc54b 100644 (file)
@@ -22,7 +22,7 @@ Staff_symbol::Staff_symbol (int l)
 IMPLEMENT_IS_TYPE_B1(Staff_symbol,Spanner);
 
 void
-Staff_symbol::do_print()const
+Staff_symbol::do_print() const
 {
 #ifndef NPRINT
   Spanner::do_print();
@@ -37,16 +37,8 @@ Staff_symbol::brew_molecule_p() const
   return new Molecule (a);
 }
 
-void
-Staff_symbol::set_extent (PCol*p1, PCol*p2)
-{
-  assert (p1&&p2);
-  left_col_l_ = p1;
-  right_col_l_ = p2;
-}
-
 Real
-Staff_symbol::inter_note_f()const
+Staff_symbol::inter_note_f() const
 {
   return paper()->internote_f ();
 }
index 7ee2db3b9af5dc8c1761801dda60f28cb21aa52d..ef162d0a0b78b333392fe061e930ce5a2df54034 100644 (file)
 #include "string.hh"
 
 String
-Super_elem::TeX_string()const
+Super_elem::TeX_output_str() const
 {
   String s;
   for (int i=0; i < lines_arr_.size(); i++)
     {
-       s += lines_arr_[i]->TeX_string();
-       if (i + 1<lines_arr_.size())
-           s += "\\interscoreline"; // TODO
+      s += lines_arr_[i]->TeX_output_str();
+      if (i + 1<lines_arr_.size())
+       s += "\\interscoreline"; // TODO
     }
   return s;
 }
@@ -29,7 +29,7 @@ Super_elem::handle_broken_dependencies()
 {
   lines_arr_ = line_of_score_l_->get_lines();
   for (int i =0; i < lines_arr_.size(); i++) 
-       add_dependency (lines_arr_[i]);
+    add_dependency (lines_arr_[i]);
 }
   
 
@@ -37,7 +37,7 @@ void
 Super_elem::do_substitute_dependency (Score_elem*o,Score_elem* n)
 {
   if (line_of_score_l_ == o->spanner())
-       line_of_score_l_ = n?(Line_of_score*)n->spanner():0;
+    line_of_score_l_ = n? (Line_of_score*) n->spanner() : 0;
 }
 
 Super_elem::Super_elem()
@@ -52,7 +52,4 @@ Super_elem::do_add_processing()
   add_dependency (line_of_score_l_);
 }
 
-
-
-
 IMPLEMENT_IS_TYPE_B1(Super_elem,Score_elem);
index 2f7834b89cef24a205073c9074a25496d26d088d..9ba3d45f589b912f97dd16ab9f79ed3764d4ca5b 100644 (file)
@@ -15,7 +15,7 @@ Symbol::Symbol (String s, Box b)
 
 
 String
-Symbol::str()const 
+Symbol::str() const 
 {
   return  "symbol (\'"+tex+"\', (" + dim.x().str () + ", " + dim.y ().str () + "))";
 }
index b902387529c5c0bd43db60d284304f3a3e580967..642c9b94012a5b3630fee15b514956929e4cad1f 100644 (file)
@@ -24,7 +24,7 @@ Translator::try_request (Request*)
 
 
 void
-Translator::print()const
+Translator::print() const
 {
 
 }
index 2ddc1a29c6961a59b7ec43ad604010202af227fc..02d1823b25b71621aa14732001f151472ac670cc 100644 (file)
@@ -48,7 +48,7 @@ Vertical_align_element::do_post_processing()
     }
 
   Real where_f=0;
-  for ( int i=0 ;  i < elem_l_arr_.size(); i++) 
+  for (int i=0 ;  i < elem_l_arr_.size(); i++) 
     {
        elem_l_arr_[i]->translate (- dims[i][1] - where_f, Y_AXIS);
        where_f += dims[i].length();
@@ -56,7 +56,7 @@ Vertical_align_element::do_post_processing()
 }
 
 bool
-Vertical_align_element::contains_b (Score_elem const *e)const
+Vertical_align_element::contains_b (Score_elem const *e) const
 {
   return elem_l_arr_.find_l (e);
 }
index dcaaf028bd7a677c1f934143afdf739a7afaf151..65fcceec2dfedbc5954876cc540c6deee2cda894 100644 (file)
@@ -6,7 +6,7 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
-
+#include "p-col.hh"
 #include "vertical-align-grav.hh"
 #include "vertical-align-spanner.hh"
 
@@ -19,14 +19,14 @@ void
 Vertical_align_engraver::do_creation_processing()
 {
   valign_p_ =new Vertical_align_spanner;
-  valign_p_->left_col_l_ = get_staff_info().command_pcol_l () ;
+  valign_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
   announce_element (Score_elem_info (valign_p_ , 0));
 }
 
 void
 Vertical_align_engraver::do_removal_processing()
 {
-  valign_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+  valign_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
   typeset_element (valign_p_);
   valign_p_ =0;
 }
@@ -34,13 +34,13 @@ Vertical_align_engraver::do_removal_processing()
 void
 Vertical_align_engraver::acknowledge_element (Score_elem_info i)
 {
-  if ( i.origin_grav_l_arr_.size() == 2 && 
-        i.elem_l_->is_type_b (Vertical_group_element::static_name()) &&
-        !i.elem_l_->axis_group_l_a_[Y_AXIS]  
-          {
-       assert (!valign_p_->contains_b (i.elem_l_));
+  if (i.origin_grav_l_arr_.size() == 2 && 
+       i.elem_l_->is_type_b (Vertical_group_element::static_name()) &&
+       !i.elem_l_->axis_group_l_a_[Y_AXIS]
+    {
+      assert (!valign_p_->contains_b (i.elem_l_));
 
-       valign_p_->add ( i.elem_l_);
+      valign_p_->add (i.elem_l_);
     }
 }
 
diff --git a/lily/voice-iterator.cc b/lily/voice-iterator.cc
new file mode 100644 (file)
index 0000000..b8318e2
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+  voice-iter.cc -- implement Voice_iterator
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "translator.hh"
+#include "debug.hh"
+#include "voice-iterator.hh"
+#include "music-list.hh"
+
+
+void
+Voice_iterator::do_print() const
+{
+  if (iter_p_)
+    iter_p_->print();
+}
+
+Voice_iterator::Voice_iterator (Voice const*v)
+  : PCursor<Music*> (v->music_p_list_)
+{
+  here_mom_ = v->offset_mom_;
+  voice_C_ = v;
+  iter_p_ =0;
+}
+
+void
+Voice_iterator::construct_children()
+{
+  while (PCursor<Music*>::ok()) 
+    {
+      start_next_element();
+      if (!iter_p_->ok()) 
+       {
+         leave_element();
+       }
+      else 
+       {
+         set_voice_translator();
+         break;
+       }
+    }
+}
+
+void 
+Voice_iterator::leave_element()
+{
+  delete iter_p_;
+  iter_p_ =0;
+  MInterval elt_time = ptr()->time_int ();
+  if (!elt_time.empty_b())
+    here_mom_ += elt_time.length();
+  PCursor<Music*>::next();
+}
+
+void
+Voice_iterator::start_next_element()
+{
+  assert (!iter_p_);
+  iter_p_ = get_iterator_p (ptr());
+}
+
+void
+Voice_iterator::set_voice_translator()
+{
+  if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
+    set_translator (iter_p_->report_to_l());
+}
+
+Voice_iterator::~Voice_iterator()
+{
+  assert (! iter_p_);
+}
+
+
+IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator);
+
+void
+Voice_iterator::process_and_next (Moment until)
+{
+  while (1) 
+    {
+      Moment local_until = until - here_mom_;
+      while (iter_p_->ok()) 
+       {
+         Moment here = iter_p_->next_moment();
+         if (here != local_until)
+           goto loopexit;
+           
+         iter_p_->process_and_next (local_until);
+       }
+
+      if (!iter_p_->ok()) 
+       {
+         leave_element();
+         
+         if (PCursor<Music*>::ok()) 
+           {
+             start_next_element();
+             set_voice_translator();
+           }
+         else 
+           {
+             goto loopexit;
+           }
+       }
+    }
+
+loopexit:
+
+  Music_iterator::process_and_next (until);
+}
+
+Moment
+Voice_iterator::next_moment() const
+{
+  return iter_p_->next_moment() + here_mom_;
+}
+
+bool
+Voice_iterator::ok() const
+{
+  return iter_p_;
+}
+
+
index beddf0d7531b1b3a658b8b6bcb143933f6172525..5814012ca0b7f1de924335e30571e52b93f7568f 100644 (file)
 
    */
 Array<Col_hpositions>
-Word_wrap::do_solve()const
+Word_wrap::do_solve() const
 {
   problem_OK();
   
-  PCursor<PCol*> curcol (pscore_l_->col_p_list_.top());
+  PCursor<Paper_column*> curcol (pscore_l_->col_p_list_.top());
   Array<Col_hpositions> breaking;
   Line_of_cols breakpoints (find_breaks());
   assert (breakpoints.size()>=2);
 
   int break_idx_i=0;                   
-  while ( break_idx_i < breakpoints.size() -1) 
+  while (break_idx_i < breakpoints.size() -1) 
     {
-       Col_hpositions minimum;
-       Col_hpositions current;
+      Col_hpositions minimum;
+      Col_hpositions current;
 
       // do  another line
-       PCol *post = breakpoints[break_idx_i]->postbreak_p_;
-       current.add (post);
-       curcol++;               // skip the breakable.
-       break_idx_i++;
+      Paper_column *post = breakpoints[break_idx_i]->postbreak_l();
+      current.add (post);
+      curcol++;                // skip the breakable.
+      break_idx_i++;
 
-       while (break_idx_i < breakpoints.size()) 
-         {
+      while (break_idx_i < breakpoints.size()) 
+       {
        
-           // add another measure.
-           while (breakpoints[break_idx_i] != curcol.ptr())
-             {
-               current.add (curcol);
-               curcol++;
-             }
-           current.add (breakpoints[break_idx_i]->prebreak_p_);
-
-           current.spacer_l_ = generate_spacing_problem (current.cols);
-
-           // try to solve
-           if (!feasible (current.cols)) 
-             {
-               if (!minimum.cols.size()) 
-                 {
-                   warning ("Ugh, this measure is too long, breakpoint: "
-                         + String (break_idx_i) +
-                       " (generating stupido solution)");
-                   current.stupid_solution();
-                   current.energy_f_ = - 1; // make sure we break out.
-                 }
-               else
-                   current.energy_f_ = infinity_f;     // make sure we go back
-             }
-           else 
-             {
+         // add another measure.
+         while (breakpoints[break_idx_i] != curcol.ptr())
+           {
+             current.add (curcol);
+             curcol++;
+           }
+         current.add (breakpoints[break_idx_i]->prebreak_l());
+
+         current.spacer_l_ = generate_spacing_problem (current.cols);
+
+         // try to solve
+         if (!feasible (current.cols)) 
+           {
+             if (!minimum.cols.size()) 
+               {
+                 warning ("Ugh, this measure is too long, breakpoint: "
+                          + String (break_idx_i) +
+                          " (generating stupido solution)");
+                 current.stupid_solution();
+                 current.energy_f_ = - 1; // make sure we break out.
+               }
+             else
+               current.energy_f_ = infinity_f; // make sure we go back
+           }
+         else 
+           {
                
-               current.solve_line();
-               current.print();
-             }
-
-           delete current.spacer_l_;
-           current.spacer_l_ =0;
-
-           // update minimum, or backup.
-           if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0) 
-             {
-               minimum = current;
-             }
-           else {              // we're one col too far.
-               break_idx_i--;
-               while (curcol.ptr() != breakpoints[break_idx_i])
-                   curcol --;
-               break;          // do the next line.
-             }
-
-
-           // add nobreak version of breakable column
-           current.cols.top()=breakpoints[break_idx_i];
-           curcol ++;
-           break_idx_i++;
+             current.solve_line();
+             current.print();
+           }
+
+         delete current.spacer_l_;
+         current.spacer_l_ =0;
+
+         // update minimum, or backup.
+         if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0) 
+           {
+             minimum = current;
+           }
+         else {                // we're one col too far.
+           break_idx_i--;
+           while (curcol.ptr() != breakpoints[break_idx_i])
+             curcol --;
+           break;              // do the next line.
          }
 
-       *mlog << "[" <<break_idx_i<<"]"<<flush;
-       breaking.push (minimum);
+
+         // add nobreak version of breakable column
+         current.cols.top()=breakpoints[break_idx_i];
+         curcol ++;
+         break_idx_i++;
+       }
+
+      *mlog << "[" <<break_idx_i<<"]"<<flush;
+      breaking.push (minimum);
     }
   print_stats();
   return breaking;