]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.52
authorfred <fred>
Sun, 24 Mar 2002 20:07:32 +0000 (20:07 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:07:32 +0000 (20:07 +0000)
flower/NEWS
flower/VERSION
flower/include/interval.hh
lily/include/item.hh
lily/item.cc
lily/single-malt-grouping-item.cc [new file with mode: 0644]
lily/spanner.cc

index 13485d6a142d126689ecb4d6f8d95dffde54f1f9..351d36c051023ee076c0e2a425f8bd36facd8808 100644 (file)
@@ -1,6 +1,7 @@
 
 pl 39
        - fixes to Array
+       - fixes to Interval
 
 
 pl 38
index d2435e29708d72d60f0f8a17fd1b594ea8745aff..ff98ffea7adc3601719913013736ef3a97021bc1 100644 (file)
@@ -1,6 +1,7 @@
 MAJOR_VERSION=1
 MINOR_VERSION=1
-PATCH_LEVEL=38
+PATCH_LEVEL=39
 # use to send patches, always empty for released version:
-MY_PATCH_LEVEL=# include separator: "-1" or ".a"
+# include separator: "-1" or ".a"
 #
+MY_PATCH_LEVEL=
index b0207e0556f61d3997e76d8c79e5b386cbb757e6..7a868a31ab9b92b8eac30849c01eae4c092613ac 100644 (file)
@@ -86,6 +86,12 @@ struct Interval_t {
   String str() const;    
   void print () const;
   bool elt_b (T r);
+  void negate () {
+    T r = -left;
+    T l = -right;
+    left = l;
+    right =r;
+  }
 };
 
 
@@ -121,6 +127,23 @@ Interval_t<T> operator +(T a,Interval_t<T> i)
   return i;
 }
 
+template<class T>
+inline
+Interval_t<T> operator - (Interval_t<T> i, T a)
+{
+  i += -a;
+  return i;
+}
+
+template<class T>
+inline
+Interval_t<T> operator - (T a,Interval_t<T> i)
+{
+  i.negate ();
+  i += a;
+  return i;
+}
+
 template<class T>
 inline
 Interval_t<T> operator +(Interval_t<T> i,T a){
index df5b6757ec1383895b5d957f5dc140105262e3de..64bcca5e700ba347abe2d38d2d66e18db446e5af 100644 (file)
@@ -31,12 +31,12 @@ public:
 
   /// should be put in a breakable col.
   bool breakable_b_;
-  int break_status_i_;
+  Direction break_status_i_;
   int break_priority_i_;
   
   /// nobreak = 0, pre = -1, post = 1
   int break_status_i() const;
-  Item * find_prebroken_piece (int) const;
+  Item * find_prebroken_piece (Direction) const;
   Item * find_prebroken_piece (Line_of_score*) const;    
 
   virtual Item *item() { return this; }
@@ -44,6 +44,7 @@ public:
   Real hpos_f() const;
   DECLARE_MY_RUNTIME_TYPEINFO;
   virtual Line_of_score * line_l() const;
+  virtual Paper_column * column_l () const;
     
   static int left_right_compare (Item const *, Item const*);
 protected:
index daaf880a96abd8b5df2add34fdef3f979637af09..11d4568635be2aae04a6d092b9bb733c7470dbc6 100644 (file)
 #include "debug.hh"
 #include "item.hh"
 #include "p-col.hh"
-#include "elem-group.hh"
+// #include "elem-group.hh"
 #include "spanner.hh"
 
 Item::Item()
 {
   break_priority_i_ = 0;
   breakable_b_ = false;
-  break_status_i_ = 0;
+  break_status_i_ = CENTER;
   broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0;
 }
 
@@ -67,7 +67,7 @@ Item::copy_breakable_items()
       item_p->handle_prebroken_dependencies();
       new_copies[i] =item_p;
     }
-  while ((i *= -1) != LEFT);
+  while (flip(&i) != LEFT);
   broken_to_drul_= new_copies;
 }
 
@@ -102,12 +102,12 @@ Item::find_prebroken_piece (Line_of_score*l) const
 }
 
 Item*
-Item::find_prebroken_piece (int breakstatus) const
+Item::find_prebroken_piece (Direction breakstatus) const
 {
   if (!breakstatus)
     return (Item *) this;      // ugh
   else
-    return (Item*) broken_to_drul_[(Direction)breakstatus];
+    return (Item*) broken_to_drul_[breakstatus];
 }
 
 void
@@ -158,3 +158,9 @@ Item::do_unlink()
   }
   attached_span_l_arr_.set_size (0);
 }
+
+Paper_column *
+Item::column_l () const
+{
+  return axis_group_l_a_[X_AXIS]->item ()->column_l ();
+}
diff --git a/lily/single-malt-grouping-item.cc b/lily/single-malt-grouping-item.cc
new file mode 100644 (file)
index 0000000..f6975f7
--- /dev/null
@@ -0,0 +1,50 @@
+/*   
+  single-malt-grouping-item.cc --  implement Single_malt_grouping_item
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
+  
+ */
+
+#include "single-malt-grouping-item.hh"
+#include "p-col.hh"
+
+Single_malt_grouping_item ::Single_malt_grouping_item()
+{
+  transparent_b_ = true;
+}
+
+void
+Single_malt_grouping_item::add (Item* i)
+{
+  assert (i);
+  item_l_arr_.push (i);
+  add_dependency (i);
+}
+
+Interval
+Single_malt_grouping_item::do_width () const
+{
+  Paper_column * pc = column_l ();
+  Interval w;
+  for (int i=0; i < item_l_arr_.size (); i++)
+    {
+      Item *il = item_l_arr_[i];
+      assert (pc == il->column_l ());
+      w.unite  (il->width () + il->relative_coordinate (pc, X_AXIS));
+    }
+  
+  return w + (- relative_coordinate (pc, X_AXIS)); // TODO
+}
+
+IMPLEMENT_IS_TYPE_B1(Single_malt_grouping_item, Item);
+
+void
+Single_malt_grouping_item::do_substitute_dependency (Score_elem*o, Score_elem*n)
+{
+  if (o->item ())
+    {
+      item_l_arr_.unordered_substitute (o->item (),  n ? n->item () : 0);
+    }
+}
index a10cf1446f3cee6378d278b618615500ec8b457d..85221d3c94a9f141dea8472b026dbc152a02454c 100644 (file)
@@ -46,9 +46,9 @@ Spanner::break_into_pieces ()
       left = break_cols[i-1];
       right = break_cols[i];
       if (!right->line_l())
-       right = right->find_prebroken_piece(-1);
+       right = right->find_prebroken_piece(LEFT);
       if (!left->line_l())
-       left = left->find_prebroken_piece(1);
+       left = left->find_prebroken_piece(RIGHT);
 
             assert (left&&right && left->line_l() == right->line_l());
 
@@ -69,9 +69,9 @@ Spanner::set_my_columns()
   do 
     {
       if (!spanned_drul_[i]->line_l())
-       set_bounds(i,spanned_drul_[i]->find_prebroken_piece(-i));
+       set_bounds(i,spanned_drul_[i]->find_prebroken_piece((Direction)-i));
     } 
-  while ((i*=-1) != 1);
+  while (flip(&i) != 1);
 }       
 
 
@@ -172,3 +172,20 @@ Spanner::do_junk_links()
 {
   spanned_drul_[LEFT] = spanned_drul_[RIGHT] =0;
 }
+
+Array<Rod>
+Spanner::get_rods () const
+{
+  Array<Rod> r;
+  return r;
+}
+
+void
+Spanner::do_space_processing ()
+{
+  Array<Rod> rs (get_rods ());
+  for (int i=0; i < rs.size (); i++)
+    {
+      rs[i].add_to_cols ();
+    }
+}