]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.0.1
authorfred <fred>
Sun, 24 Mar 2002 20:12:31 +0000 (20:12 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:12:31 +0000 (20:12 +0000)
lily/axis-group-element.cc
lily/include/graphical-element.hh

index b4061af7f5b5c94ff293d33cb6f3463047eb7936..8aa8263668e3f13dfc3cb3b6442d782e13ac9db0 100644 (file)
@@ -3,10 +3,11 @@
 
   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>
 */
 
 #include "axis-group-element.hh"
+#include "graphical-axis-group.hh"
 
 void
 Axis_group_element::do_unlink()
@@ -17,45 +18,69 @@ Axis_group_element::do_unlink()
 void
 Axis_group_element::do_junk_links()
 {
-  axis_admin_.elem_l_arr_.set_size (0);
+  elem_l_arr_.set_size (0);
 }
 
 
-bool
-Axis_group_element::contains_b (Graphical_element const*e) const
-{
-  return axis_admin_.contains_b (e);
-}
-
-Link_array<Score_elem>
+Link_array<Score_element>
 Axis_group_element::get_extra_dependencies() const
 {
   return elem_l_arr ();
 }
 
-Link_array<Score_elem>
+Link_array<Score_element>
 Axis_group_element::elem_l_arr () const
 {  
   /*
     ugh. I know
-   */
-  Link_array<Score_elem> r;
-  for (int i=0; i < axis_admin_.elem_l_arr_.size (); i++)
-    r.push ((Score_elem*)axis_admin_.elem_l_arr_[i]);
+  */
+  Link_array<Score_element> r;
+  for (int i=0; i < elem_l_arr_.size (); i++)
+    r.push (elem_l_arr_[i]->access_Score_element());
   return r;
 }
 
+Link_array<Score_element> 
+Axis_group_element::get_children ()
+{
+  Link_array<Score_element> childs;
+  Link_array<Score_element> elems = elem_l_arr ();
+  for (int i=0; i < elems.size (); i++) 
+    {
+      Score_element* e = elems[i];
+      childs.push (e) ;
+      Axis_group_element * axis_group= e->access_Axis_group_element ();
+      if (axis_group)
+       childs.concat (axis_group->get_children ());      
+    }
+  
+  return childs;
+}
+
 void
 Axis_group_element::do_print() const
 {
-  axis_admin_.print();
+  Graphical_axis_group::do_print();
 }
 
+Axis_group_element::Axis_group_element(Axis a1, Axis a2)
+  : Graphical_axis_group (a1,a2)
+{
+  transparent_b_ = true;
+}
 
-Axis_group_element::Axis_group_element()
+Axis_group_element::Axis_group_element ()
+  : Graphical_axis_group (X_AXIS, Y_AXIS)
 {
   transparent_b_ = true;
 }
 
+Axis_group_element*
+Axis_group_element::access_Axis_group_element ()
+{
+  return this;
+}
+
+
 
-IMPLEMENT_IS_TYPE_B1(Axis_group_element, Score_elem);
+IMPLEMENT_IS_TYPE_B2(Axis_group_element, Score_element, Graphical_axis_group);
index 6dce57708b5e1f6dd23a55d9fb5cfc6f2e5bb468..3a57588a7d3e9162af42a1da6d23df9a4448cff2 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>
 */
 
 
@@ -16,7 +16,7 @@
 #include "virtual-methods.hh"
 
 /** The 2d geometric aspects of a score-element.  It was put in a
-  separate class, because Score_elem got quite big.
+  separate class, because Score_element got quite big.
 
   */
 class Graphical_element 
@@ -27,24 +27,23 @@ class Graphical_element
    */
   bool empty_b_;
   
+  Offset offset_;
+  Interval cached_dimension_a_[NO_AXES];
+  bool cached_valid_b_a_[NO_AXES];
 public:
+
+  // suck me plenty
+  virtual Score_element* access_Score_element () { return 0; }
   void set_empty (bool);
+
   bool empty_b () const;
   
   DECLARE_MY_RUNTIME_TYPEINFO;
-  /**
-    This is  needed, because #output# may still be
-    NULL.
-    */
-  Offset offset_;
   
-  Axis_group_element * axis_group_l_a_[NO_AXES];
-  Interval cached_dimension_a_[NO_AXES];
-  bool cached_valid_b_a_[NO_AXES];
+  Graphical_axis_group * axis_group_l_a_[NO_AXES];
   
   Graphical_element ();
   Graphical_element (Graphical_element const&);
-  virtual ~Graphical_element ();
   
   void invalidate_cache (Axis);
   Interval extent (Axis) const;
@@ -61,16 +60,16 @@ public:
     
   void translate_axis (Real, Axis);
 
-  Real relative_coordinate (Axis_group_element*group, Axis) const;
+  Real relative_coordinate (Graphical_axis_group*group, Axis) const;
   Offset absolute_offset() const;
   Real absolute_coordinate (Axis) const;
   /**
     Find the group-element which has both #this# and #s#
    */
-  Axis_group_element*common_group (Graphical_element const* s, Axis a) const;
+  Graphical_axis_group*common_group (Graphical_element const* s, Axis a) const;
   void unlink ();
   void junk_links ();
-  void print () const;
+  virtual void do_print () const;
 protected:
   virtual Interval do_height () const=0;
   virtual Interval do_width () const=0;