]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.0.1
authorfred <fred>
Sun, 24 Mar 2002 20:12:50 +0000 (20:12 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:12:50 +0000 (20:12 +0000)
lily/axis-group-item.cc
lily/axis-group-spanner.cc
lily/bar.cc
lily/grouping.cc
lily/horizontal-align-item.cc
lily/p-col.cc

index 2706fa8faa658fc8dffcd57fa05489f8bab009f0..33dfdceba995273b38f630275febd21a58654d6f 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 #include "axis-group-item.hh"
 #include "p-col.hh"
@@ -13,10 +13,10 @@ IMPLEMENT_IS_TYPE_B2(Axis_group_item, Axis_group_element, Item);
 void
 Axis_group_item::OK() const
 {
-  Link_array<Score_elem> elems = elem_l_arr ();
+  Link_array<Score_element> elems = elem_l_arr ();
   for (int i=0; i < elems.size(); i++) 
     {
-      Item * it_l = elems[i]->item();
+      Item * it_l = elems[i]->access_Item ();
       assert (it_l);
     }
 }
@@ -31,15 +31,15 @@ Axis_group_item::do_breakable_col_processing()
   copy_breakable_items();
   
            
-  Link_array<Score_elem> elems = elem_l_arr ();
+  Link_array<Score_element> elems = elem_l_arr ();
   for (int i=0; i < elems.size(); i++) 
     {
-      Item* it_l = elems[i]->item();
+      Item* it_l = elems[i]->access_Item ();
       Direction  j=LEFT;
       do 
        {
          Item *new_l = 
-           it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_i_);
+           it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_dir_);
          ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l);
        }
       while (flip(&j)!=LEFT);
index 344b4060cce15e9f96d5ab215973486fd5710bca..64a28da895b44eeb6d0a3a6bf22b1695edc96924 100644 (file)
@@ -3,10 +3,11 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "axis-group-spanner.hh"
+#include "debug.hh"
 #include "item.hh"
 #include "p-col.hh"
 
 void
 Axis_group_spanner::do_break_processing_if_unbroken()
 {
-  Link_array<Score_elem> elems = elem_l_arr ();
+  Link_array<Score_element> elems = elem_l_arr ();
   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();
+         Item * item_l = elems[i]->access_Item ();
          if  (item_l
               && item_l->breakable_b_ 
-              && item_l->break_status_i() == 0) 
+              && item_l->break_status_dir() == 0) 
            {
              // last two checks are paranoia
              Item * broken_item_l = 
@@ -37,9 +38,11 @@ Axis_group_spanner::do_break_processing_if_unbroken()
        }
     }
 }
+
 void
 Axis_group_spanner::do_break_processing()
 {
+  DOUT << "do_break_processing ()\n";
   bool breaking_self_b = ! Spanner::line_l();
   if (!breaking_self_b)  
     {
@@ -49,12 +52,12 @@ Axis_group_spanner::do_break_processing()
     }
 
   break_into_pieces ();
-  Link_array<Score_elem> loose_elems = elem_l_arr ();
+  Link_array<Score_element> loose_elems = elem_l_arr ();
   remove_all();
   
   for (int i=0; i < loose_elems.size(); i++) 
     {
-      Score_elem * elt = loose_elems[i];
+      Score_element * elt = loose_elems[i];
       Line_of_score *elt_line = elt->line_l();
        
       if (! elt_line)
@@ -62,9 +65,9 @@ Axis_group_spanner::do_break_processing()
          /* this piece doesn't know where it belongs.
             Find out if it was broken, and use the broken remains
             */
-         if (elt->spanner()) 
+         if (elt->access_Spanner ()) 
            {
-             Spanner * sp = elt->spanner();
+             Spanner * sp = elt->access_Spanner ();
                
              for (int j =0; j < broken_into_l_arr_.size(); j++) 
                {
@@ -73,22 +76,22 @@ Axis_group_spanner::do_break_processing()
                    
                  Spanner * broken_span_l 
                    = sp->find_broken_piece (
-                                            ((Score_elem*)my_broken_l)->line_l());
+                                            ((Score_element*)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) 
+         else if (elt->access_Item () 
+                  && elt->access_Item ()->breakable_b_ 
+                  && elt->access_Item ()->break_status_dir () == 0) 
            {
              // broken items
              Direction  j=LEFT;
              do 
                {
-                 Item * my_item = elt->item()->broken_to_drul_[j];
+                 Item * my_item = elt->access_Item ()->broken_to_drul_[j];
                  Line_of_score * item_line_l = my_item->line_l() ;
                  if (! item_line_l) 
                    continue;
@@ -97,6 +100,14 @@ Axis_group_spanner::do_break_processing()
                    = (Axis_group_spanner*)find_broken_piece (item_line_l);
                  if (v)
                    v->add_element (my_item);
+                 else
+                   {
+                     my_item->transparent_b_ = true;
+                     my_item->set_empty (true);
+                     /*my_item->unlink ();
+                     delete my_item;*/
+                   }
+
                }
              while (flip(&j) != LEFT);
            }
@@ -119,6 +130,8 @@ void
 Axis_group_spanner::do_print() const
 {
   Axis_group_element::do_print();
+
+  Spanner::do_print ();
 }
 
 
index 701bbd7b86bd90f5ecf9122182d353cabb5759ae..32120fa1bf72ee0db17fba6092807936f9342008 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "bar.hh"
 #include "lookup.hh"
 #include "debug.hh"
 
-Bar::Bar()
+IMPLEMENT_IS_TYPE_B1 (Bar,Item);
+
+Bar::Bar ()
 {
   breakable_b_ = true;
   type_str_ = "|";
 }
 
-
-
-IMPLEMENT_IS_TYPE_B1(Bar,Item);
-
 void
-Bar::do_print() const
+Bar::do_print () const
 {
 #ifndef NPRINT
   DOUT << type_str_;
@@ -32,11 +30,10 @@ Bar::do_print() const
 }
 
 Molecule*
-Bar::brew_molecule_p() const
+Bar::brew_molecule_p () const
 {    
-  Paper_def *p = paper();
-  Atom s = p->lookup_l()->bar (type_str_, 
-                              p->get_var ("barsize"));
+  Paper_def *p = paper ();
+  Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize"));
   
   Molecule*output = new Molecule (Atom (s));
   return output;
@@ -51,19 +48,20 @@ static char const *bar_breaks[][3] ={
   {"|", "|", ""},
   {"", "|s", "|"},
   {"", "|:", "|:"},
-  {"||.", "||.", ""},
+  {"|.", "|.", ""},
   {":|", ":|", ""},
   {"||", "||", ""},
+  {".|.", ".|.", ""},
   {0,0,0}
 };
 
 void
-Bar::do_pre_processing()
+Bar::do_pre_processing ()
 {
   for (int i=0; bar_breaks[i][0]; i++) 
     {
       if (bar_breaks[i][1] == type_str_)
-       type_str_ = bar_breaks[i][break_status_i()+1];
+       type_str_ = bar_breaks[i][break_status_dir ()+1];
     }
   
   /*
index 2bdaed7db17be9beff9b8a860acb57dada0df9a1..af7d234bf4032d5ad41ae9b874cc3f1152f9c5a9 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "debug.hh"
index 82a81c230095d4da921619f49b59296710e495cd..a22f30eb5ece14cc240af320ba35e5874a05b832 100644 (file)
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "horizontal-align-item.hh"
 #include "debug.hh"
 
-IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item);
-
-bool
-Horizontal_align_item::contains_b (Item *i) const
-{
-  return item_l_arr_.find_l (i);
-}
-
-void
-Horizontal_align_item::add (Item *i,int p)
-{
-  assert (! contains_b (i));
-  priority_i_arr_.push (p);
-  item_l_arr_.push (i);
-  add_dependency (i);
-}
-
-void
-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);
-    }
-}
-
-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 (Item*i, int p) 
-  {
-    priority_i_ = p;
-    item_l_ = i;
-  }
-  Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; }
-};
-
+IMPLEMENT_IS_TYPE_B2(Horizontal_align_item,Align_element,Item);
 
 void
-Horizontal_align_item::do_pre_processing()
+Horizontal_align_item::add_item (Item *i,int p)
 {
-  {  
-    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();
-    }
-
-  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++) 
-    {
-      Real dx = where_f -dims[i][-1];
-      item_l_arr_[i]->translate_axis (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_axis (- center_dx_f , X_AXIS);
-  
-}
-
-Interval
-Horizontal_align_item::do_width() const
-{
-  return Interval (0,0);
+  add_element_priority (i,p);
 }
 
 void
@@ -116,16 +22,14 @@ Horizontal_align_item::do_print() const
 {
 #ifndef NPRINT
   Item::do_print ();
-  DOUT << "contains: ";
-  for (int i=0 ;  i < item_l_arr_.size(); i++) 
-    DOUT << item_l_arr_[i]->name () << ", ";
+  Align_element::do_print ();
 #endif
 }
 
-Horizontal_align_item::Horizontal_align_item()
+
+Horizontal_align_item::Horizontal_align_item ()
 {
-  center_l_ = 0;
-  align_i_ = 0;
-  set_empty (true);
-  transparent_b_ = true;
+  align_dir_ = CENTER;
+  stacking_dir_ = RIGHT;
+  axis_ = X_AXIS;
 }
index e776b62c926f78322a460042adc96436cebef427..74ea11e5ea64724dec5a95a03ba3276a895b458f 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "p-col.hh"
@@ -63,9 +63,9 @@ Paper_column::do_print() const
       DOUT << "post: ";
       postbreak_l()->print();
     } 
-  if (break_status_i_)
+  if (break_status_dir_)
     {
-      DOUT <<'\n' << ((break_status_i_ == LEFT) ? "prebreak" : "postbreak");
+      DOUT << '\n' << ((break_status_dir_ == LEFT) ? "prebreak" : "postbreak");
       DOUT << '\n';
     }