]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.0.1
authorfred <fred>
Sun, 24 Mar 2002 20:12:33 +0000 (20:12 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:12:33 +0000 (20:12 +0000)
lily/graphical-axis-group.cc [new file with mode: 0644]
lily/horizontal-vertical-group-item.cc

diff --git a/lily/graphical-axis-group.cc b/lily/graphical-axis-group.cc
new file mode 100644 (file)
index 0000000..b0aab89
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+  axis-group.cc -- implement Graphical_axis_group
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+#include "interval.hh"
+#include "graphical-axis-group.hh"
+#include "axis-group-element.hh"
+#include "graphical-element.hh"
+#include "debug.hh"
+
+/** don't copy anything: an element can only be in one
+  Graphical_axis_group at one time.  */
+Graphical_axis_group::Graphical_axis_group (Graphical_axis_group const&s)
+{
+  axis1_ = s.axis1_;
+  axis2_ = s.axis2_;
+}
+
+bool 
+Graphical_axis_group::contains_b (Graphical_element const *e) const
+{
+  return elem_l_arr_.find_l (e);
+}
+
+Interval
+Graphical_axis_group::extent (Axis axis) const
+{
+  Interval r;
+  for (int i=0; i < elem_l_arr_.size(); i++) 
+    r.unite (elem_l_arr_[i]->extent (axis));
+  return r;
+}
+
+void
+Graphical_axis_group::add_element (Graphical_element*e)
+{
+  Graphical_axis_group *& g1 = e->axis_group_l_a_[axis1_];
+  Graphical_axis_group *& g2 = e->axis_group_l_a_[axis2_];
+  
+  assert (!g1 || g1 == this);
+  assert (!g2 || g2 == this);
+  g1 = this;
+  g2 = this;
+  elem_l_arr_.push (e);
+}
+
+
+
+void
+Graphical_axis_group::remove_element (Graphical_element*e)
+{
+  assert (contains_b (e));
+  elem_l_arr_.unordered_substitute (e,0);
+  
+  e->axis_group_l_a_[axis1_] = 0;
+  e->axis_group_l_a_[axis2_] = 0;    
+}
+
+void
+Graphical_axis_group::remove_all ()
+{
+  for (int i=0; i < elem_l_arr_.size(); i++) 
+    {
+      Graphical_element*e=elem_l_arr_[i];
+      e->axis_group_l_a_[axis1_] = 0;
+      e->axis_group_l_a_[axis2_] = 0;  
+    }
+  elem_l_arr_.clear ();
+}
+
+
+void    
+Graphical_axis_group::do_print() const
+{
+#ifndef NPRINT
+  for (int i=0; i < elem_l_arr_.size(); i++) 
+    DOUT << elem_l_arr_[i]->name () << " ";
+#endif
+}
+
+Graphical_axis_group::Graphical_axis_group (Axis a1, Axis a2)
+{
+  axis1_ =a1;
+  axis2_ = a2;
+}
+
+IMPLEMENT_IS_TYPE_B1(Graphical_axis_group, Graphical_element);
index dd40fb8182f5d8037c5497a41fdad021add053d2..cf1917228c4837dfca35ff63d32e8c6eb28a4c07 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>
 */
 
 
@@ -17,3 +17,9 @@ Horizontal_vertical_group_item::do_print() const
 }
 
 IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item);
+
+Horizontal_vertical_group_item::Horizontal_vertical_group_item ()
+{
+  axis1_ = X_AXIS;
+  axis2_ = Y_AXIS;    
+}