]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.7
authorfred <fred>
Sun, 24 Mar 2002 19:53:14 +0000 (19:53 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:53:14 +0000 (19:53 +0000)
lily/elem-group-item.cc
lily/horizontal-group-item.cc
lily/include/axis-group-item.hh [new file with mode: 0644]
lily/include/bar.hh
lily/include/elem-group-item.hh
lily/include/horizontal-group-item.hh
lily/include/spanner-elem-group.hh
lily/include/vertical-group-spanner.hh
lily/spanner-elem-group.cc
lily/vertical-align-grav.cc
lily/vertical-group-spanner.cc

index 138bd146a372a72beb3c8ee66949f9498325b42a..c22739a849cd149e70282771510049746b4cd060 100644 (file)
@@ -13,7 +13,7 @@
 void
 Horizontal_vertical_group_item::do_print()const
 {
-    Horizontal_vertical_group::do_print();
+    Horizontal_vertical_group_element::do_print();
 }
 
-IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group,Item);
+IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item);
index 15af0bd803dde19582dbb42df7202ed1d9468cd6..409f2feadf324c3bc59ef092e8679e331a83350d 100644 (file)
@@ -9,33 +9,10 @@
 #include "p-col.hh"
 #include "horizontal-group-item.hh"
 
-IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group, Item);
+IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group_element, Axis_group_item);
 
 void
-Horizontal_group_item::OK() const
-{
-    for (int i=0; i < elem_l_arr_.size(); i++) {
-       Item * it_l = elem_l_arr_[i]->item();
-       
-       assert(it_l&& it_l->pcol_l_ == pcol_l_ );
-    }
-}
-
-void
-Horizontal_group_item::do_breakable_col_processing()
-{
-    if (!pcol_l_->breakable_b())
-       return;
-    OK();
-    copy_breakable_items();
-    
-    Link_array<Score_elem> elems = 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_);
-           ((Horizontal_group_item*)broken_to_a_[j])->add_element( new_l );
-       }
-    }
+Horizontal_group_item::do_print() const
+{ 
+    Axis_group_item::do_print(); 
 }
diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh
new file mode 100644 (file)
index 0000000..a461f52
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  axis-item.hh -- declare Axis_group_item
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef AXIS_ITEM_HH
+#define AXIS_ITEM_HH
+
+#include "axis-group.hh" 
+#include "item.hh"
+
+/**
+  A grouping item. Its special support is in do_breakable_col_processing().
+ */
+
+class Axis_group_item : public virtual Axis_group_element, public Item {
+protected:
+    virtual void do_breakable_col_processing();
+    void OK()const;
+    virtual void do_print() const;
+public:
+    DECLARE_MY_RUNTIME_TYPEINFO;
+
+};
+
+#endif // AXIS_ITEM_HH
index 9a7a8b92b60d9e0e8fa4d2c17416560e37f1dfc0..c03527e6ccdc78ad91bcaa8b5dbecc94a810c458 100644 (file)
@@ -8,6 +8,8 @@
 #define BAR_HH
 #include "item.hh"
 /**
+  A vertical bar.
+  
   TODO: connections with pre and postbreak
  */
 class Bar:public Item {
index bf532c035d592a6fe5060f96176cbe2a7f47ba51..b1248cc99095cd077c59646630387250d03e4e41 100644 (file)
 #ifndef ELEM_GROUP_ITEM_HH
 #define ELEM_GROUP_ITEM_HH
 
+#include "axis-group-item.hh"
 #include "elem-group.hh"
-#include "item.hh"
 
-class Horizontal_vertical_group_item  : public Item, public Horizontal_vertical_group {
+
+/**
+  Treat a collection of items as a unity
+ */
+class Horizontal_vertical_group_item  : public Axis_group_item, public Horizontal_vertical_group_element {
+protected:
+    virtual void do_print() const;
+    virtual void remove_all() { Horizontal_vertical_group_element::remove_all(); }
 public:
+    virtual void add_element(Score_elem*e) { Horizontal_vertical_group_element::add_element(e); }
+    virtual void remove_element(Score_elem*e) { Horizontal_vertical_group_element::remove_element(e); }
+
     DECLARE_MY_RUNTIME_TYPEINFO;
     SCORE_ELEM_CLONE(Horizontal_vertical_group_item);
-protected:
-    virtual void do_print() const;
+  
+       
 };
 
 #endif // ELEM_GROUP_ITEM_HH
index 3495af9f9787ccd3a6e8d4d4716b00af77aba86c..f1fc8b3c9c6ab11f46ba0dc584c9944b1d69b35f 100644 (file)
 #define HORIZONTAL_GROUP_ITEM_HH
 
 #include "elem-group.hh"
-#include "item.hh"
+#include "axis-group-item.hh"
 
-class Horizontal_group_item : public Item, public Horizontal_group {
+class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element {
+protected:
+    virtual void remove_all() { Horizontal_group_element::remove_all(); }
+    virtual void do_print() const;
+public:
+    virtual void add_element(Score_elem*e) { Horizontal_group_element::add_element(e); }
+    virtual void remove_element(Score_elem*e) { Horizontal_group_element::remove_element(e); }
     DECLARE_MY_RUNTIME_TYPEINFO;
     SCORE_ELEM_CLONE(Horizontal_group_item);
-protected:
-    virtual void do_breakable_col_processing();
-    void OK()const;
-    virtual void do_print() const { Elbement_group::do_print(); }
+  
+
 };
 
 #endif // HORIZONTAL_GROUP_ITEM_HH
index 821c762cf00213e15b8261eec5b806b517d34dea..2f65af207b73e1c68e4b5d027aea64a29c33c162 100644 (file)
@@ -13,7 +13,7 @@
 #include "spanner.hh"
 #include "elem-group.hh"
 
-class Spanner_elem_group : public Spanner, public Horizontal_vertical_group {
+class Spanner_elem_group : public Spanner, public Horizontal_vertical_group_element {
     
 protected:
     virtual Interval do_width()const;
index d092d96488d47b63056dc798c85ef840990ae282..ab90bdb6b657cab7a39543ad0e2038e1ef21dfec 100644 (file)
 #ifndef SPAN_VERTICAL_GROUP_HH
 #define SPAN_VERTICAL_GROUP_HH
 
-#include "spanner.hh"
+#include "axis-group-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
+/** An element which groups a line. 
+ */
+class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_element
 {
 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&);
-
+    SCORE_ELEM_CLONE(Vertical_group_spanner);
+    virtual void remove_all() { Vertical_group_element::remove_all(); }
 public:
-    Vertical_group_spanner();
     DECLARE_MY_RUNTIME_TYPEINFO;
+    virtual void add_element(Score_elem*e) { Vertical_group_element::add_element(e); }
+    virtual void remove_element(Score_elem*e) { Vertical_group_element::remove_element(e); }
+  
 };
 
 #endif // SPAN_VERTICAL_GROUP_HH
index 8e2c98bf1996bba52e0d759015616ad13bdb3f28..d463c2889d6700310d86b02156f44404a677a2e5 100644 (file)
@@ -11,7 +11,7 @@
 
 
 
-IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group);
+IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group_element);
 
 Interval
 Spanner_elem_group::do_width() const
@@ -24,7 +24,7 @@ Spanner_elem_group::do_print() const
 {
 #ifndef NPRINT
     Spanner::do_print();
-    Horizontal_vertical_group::do_print();
+    Horizontal_vertical_group_element::do_print();
 #endif
 }
 
index c6690f6ef1917b3d4fe16e554f8a7cd6709dba42..1ab374c1d8de0892c72183d5a66830589eddb11e 100644 (file)
@@ -35,8 +35,8 @@ 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::static_name()) &&
-        !i.elem_l_->y_group_l_   ) {
+        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_ );
index d858349ca59bd5f7de0c2b124d6afc7d0cee9a76..2e11db74207ec83dabd550be07a2a953205c977d 100644 (file)
 #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)
-{
-}
+IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Axis_group_spanner, Vertical_group_element);