]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.7
authorfred <fred>
Sun, 24 Mar 2002 19:50:52 +0000 (19:50 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:50:52 +0000 (19:50 +0000)
lily/axis-group-spanner.cc [new file with mode: 0644]
lily/bar.cc
lily/span-score-bar-grav.cc

diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc
new file mode 100644 (file)
index 0000000..94aab23
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+  axis-group-spanner.cc -- implement Axis_group_spanner
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "axis-group-spanner.hh"
+#include "item.hh"
+#include "p-col.hh"
+
+/** Do stuff if we're not broken. In this case the last and first
+  columns usually are pre- and postbreak respectively,
+  so the items from these columns need adjusting.
+  */
+void
+Axis_group_spanner::do_break_processing_if_unbroken()
+{
+    Link_array<Score_elem> elems = axis_admin_.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();
+           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;
+    }
+
+    break_into_pieces( true );
+    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();
+       
+       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];
+                   
+                   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;
+                   
+                   Axis_group_spanner * v
+                       = (Axis_group_spanner*)find_broken_piece( item_line_l );
+                   if (v)
+                       v->add_element( my_item );
+               }
+                   
+           }
+       } 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 );
+       }
+    }
+    
+    Spanner::do_break_processing();
+}
+
+void
+Axis_group_spanner::do_print() const
+{
+    Axis_group_element::do_print();
+}
+
+
+
+IMPLEMENT_IS_TYPE_B2(Axis_group_spanner, Spanner, Axis_group_element);
index b45d977b2625914282ed1c060376f8e64d84ccdf..2342d227b256bbbd223e9a4a93f8c6b103c4d709 100644 (file)
@@ -15,6 +15,7 @@
 
 Bar::Bar()
 {
+    breakable_b_ = true;
     type_str_ = "|";
     spanned_i_ = 0;
 }
@@ -40,13 +41,15 @@ Bar::brew_molecule_p()const
 }
 
 /**
+  Prescriptions for splitting bars.
   TODO: parametrise this (input-settable)
  */
-char const *bar_breaks[][3] ={
+static char const *bar_breaks[][3] ={
     {":|", ":|:", "|:"},
     {"|", "|", ""},
     {"", "|:", "|:"},
     {"||.", "||.", ""},
+    {":|", ":|", ""},
     {0,0,0}
 };
 
@@ -58,7 +61,11 @@ Bar::do_pre_processing()
            type_str_ = bar_breaks[i][break_status_i()+1];
     }
   
-    // span_score_bar needs dims.
-//    transparent_b_ = empty_b_ = (type_str_ == "");
+    /*
+      span_score_bar needs dims, so don't do
+    
+      transparent_b_ = empty_b_ = (type_str_ == "");
+      
+      */
 }
     
index cccbd03b7825f2ed0878d41c2f3b3c3ed9bd6ccc..4afd1358d78b2502424a4a104a8091a71fd426ed 100644 (file)
@@ -17,7 +17,6 @@ Span_score_bar_engraver::get_span_bar_p() const
 
 
 IMPLEMENT_IS_TYPE_B1(Span_score_bar_engraver, Span_bar_engraver);
-
 IMPLEMENT_IS_TYPE_B1(Piano_bar_engraver, Span_score_bar_engraver);
 
 Span_bar*