]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.14
authorfred <fred>
Sun, 24 Mar 2002 19:56:25 +0000 (19:56 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:56:25 +0000 (19:56 +0000)
lily/include/elem-group-item.hh
lily/include/graphical-element.hh [new file with mode: 0644]

index 52475d905a6667b6bab809fc2123e9e4a83494bb..ab79afea9c827dfa34c131dd943240c4d182fcb6 100644 (file)
@@ -24,8 +24,8 @@ protected:
   virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); }
   SCORE_ELEM_CLONE(Horizontal_vertical_group_item);
 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); }
+  virtual void add_element (Graphical_element*e) { Horizontal_vertical_group_element::add_element (e); }
+  virtual void remove_element (Graphical_element*e) { Horizontal_vertical_group_element::remove_element (e); }
 
   DECLARE_MY_RUNTIME_TYPEINFO;
 };
diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh
new file mode 100644 (file)
index 0000000..fae4032
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+  graphical-element.hh -- declare Graphical_element
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef GRAPHICAL_ELEMENT_HH
+#define GRAPHICAL_ELEMENT_HH
+
+#include "offset.hh"
+#include "lily-proto.hh"
+#include "interval.hh"
+#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.
+
+  */
+class Graphical_element 
+{
+  void init ();
+  /** Is this element dimensionless?.
+    This is private to guarantee correctness of the cache
+   */
+  bool empty_b_;
+  
+public:
+  void set_empty (bool);
+  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_element ();
+  Graphical_element (Graphical_element const&);
+  virtual ~Graphical_element ();
+  
+  void invalidate_cache (Axis);
+  Interval extent (Axis) const;
+  Interval width() const;
+  Interval height() const;
+  /**
+    translate the symbol. The symbol does not have to be created yet. 
+    */
+  void translate (Offset);
+  /**
+    translate in one direction
+    */
+    
+  void translate (Real, Axis);
+
+  Real relative_coordinate (Axis_group_element*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;
+  void unlink ();
+  void junk_links ();
+  void print () const;
+protected:
+  virtual Interval do_height () const=0;
+  virtual Interval do_width () const=0;
+};
+
+#endif // GRAPHICAL_ELEMENT_HH
+