]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.1
authorfred <fred>
Mon, 4 Aug 1997 23:30:28 +0000 (23:30 +0000)
committerfred <fred>
Mon, 4 Aug 1997 23:30:28 +0000 (23:30 +0000)
lily/include/vertical-group-spanner.hh [new file with mode: 0644]
lily/line-group-grav.cc
lily/vertical-group-spanner.cc [new file with mode: 0644]

diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh
new file mode 100644 (file)
index 0000000..d092d96
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  vertical-group-spanner.hh -- declare Vertical_group_spanner
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SPAN_VERTICAL_GROUP_HH
+#define SPAN_VERTICAL_GROUP_HH
+
+#include "spanner.hh"
+#include "elem-group.hh"
+
+/** An element which groups a line. Due to technical problems, this
+   cannot be used as a baseclass */
+class Vertical_group_spanner : public Spanner, public Vertical_group
+{
+protected:
+    virtual void do_break_processing();
+    virtual void do_print()const;
+    VIRTUAL_COPY_CONS(Vertical_group_spanner, Score_elem);
+
+private:
+    void remove_all();
+    /// shouldn't be copied.
+    Vertical_group_spanner(Vertical_group_spanner const&);
+
+public:
+    Vertical_group_spanner();
+    DECLARE_MY_RUNTIME_TYPEINFO;
+};
+
+#endif // SPAN_VERTICAL_GROUP_HH
index 843fa5b5518214eafef69f262e80d80d79f2d42a..2e4b5063350214cbba02b0f453aaa4ba9436af96 100644 (file)
@@ -7,12 +7,12 @@
 */
 
 #include "staff-sym.hh"
-#include "line-group-grav.hh"
+#include "vertical-group-spanner.hh"
 #include "command-request.hh"
 #include "bar.hh"
 #include "debug.hh"
 #include "staffline.hh"
-
+#include "line-group-grav.hh"
 
 Line_group_engraver::Line_group_engraver()
 {
@@ -22,7 +22,8 @@ Line_group_engraver::Line_group_engraver()
 void
 Line_group_engraver::acknowledge_element(Score_elem_info  elem)
 {
-    staffline_p_->add_element(elem.elem_l_);
+    if ( !elem.elem_l_->y_group_l_ )
+       staffline_p_->add_element(elem.elem_l_);
 }
 
 
@@ -37,7 +38,7 @@ Line_group_engraver::do_removal_processing()
 void
 Line_group_engraver::do_creation_processing()
 {
-    staffline_p_ = new Line_of_staff;
+    staffline_p_ = new Vertical_group_spanner ;
     staffline_p_->left_col_l_ = get_staff_info().command_pcol_l();
 
     // don't broadcast to self.
diff --git a/lily/vertical-group-spanner.cc b/lily/vertical-group-spanner.cc
new file mode 100644 (file)
index 0000000..d858349
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+  vertical-group-spanner.cc -- implement Vertical_group_spanner
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "vertical-group-spanner.hh"
+#include "item.hh"
+#include "p-col.hh"
+
+/**
+  Uncouple all elements of this Vertical_group. Ugh!
+ */
+void
+Vertical_group_spanner::remove_all()
+{
+    for (int i=0; i < elem_l_arr_.size(); i++){
+       elem_l_arr_[i]->y_group_l_ = 0;
+    }
+    elem_l_arr_.set_size(0);
+    junk_dependencies();   
+}
+
+void
+Vertical_group_spanner::do_break_processing()
+{
+    set_my_columns();
+    if ( line_l() ) {
+       return;
+    }
+    break_into_pieces( false );
+
+    Link_array<Score_elem> elem_l_arr = elem_l_arr_;
+    remove_all();
+    
+    
+    
+    for (int i=0; i < elem_l_arr.size(); i++) {
+       Score_elem * elt = elem_l_arr[i];
+       Line_of_score *elt_line = elt->line_l();
+       
+       if  ( elt-> y_group_l_ )
+           continue;
+       
+       if ( ! elt_line ){ 
+           if (elt->spanner()) {
+               Spanner * sp = elt->spanner();
+               
+               for (int j =0; j < broken_into_l_arr_.size(); j++) {
+                   Vertical_group_spanner * my_broken_l
+                        = (Vertical_group_spanner*)broken_into_l_arr_[j];
+                   
+                   Spanner * broken_span_l 
+                       = sp->find_broken_piece(my_broken_l->line_l());
+                   
+                   if (broken_span_l) {
+                       my_broken_l->add_element(broken_span_l );
+                   }
+               }
+           } else if (elt->item() && elt->item()->pcol_l_->breakpoint_b()
+                      && elt->item()->break_status_i() == 0) {
+               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;
+                   
+                   Vertical_group_spanner * v
+                       = (Vertical_group_spanner*)find_broken_piece( item_line_l_);
+                   if (v) {
+                       v->add_element( my_item );
+                   }
+               }
+           }
+       } else {
+           Vertical_group_spanner * my_broken_l
+               = (Vertical_group_spanner*)find_broken_piece( elt->line_l() );
+           my_broken_l->add_element( elt );
+       }
+    }
+    for (int j =0; j < broken_into_l_arr_.size(); j++) 
+       broken_into_l_arr_[j]->break_processing();      
+}
+
+Vertical_group_spanner::Vertical_group_spanner()
+{
+}
+
+void
+Vertical_group_spanner::do_print() const
+{
+    Vertical_group::do_print();
+}
+
+
+
+IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Spanner, Vertical_group);
+
+Vertical_group_spanner::Vertical_group_spanner(Vertical_group_spanner const &s)
+    : Spanner(s), Vertical_group(s)
+{
+}