]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/score-element.hh
release: 1.3.33
[lilypond.git] / lily / include / score-element.hh
index 2a0a7805eff19ad5e42a1055bdf7db684e571f45..8eb39f509bb0adc799303eda1e109c215a8f20c9 100644 (file)
@@ -9,10 +9,9 @@
 
 #include "parray.hh"
 #include "virtual-methods.hh"
-#include "directed-graph.hh"
-#include "graphical-element.hh"
 #include "lily-guile.hh"
-
+#include "lily-proto.hh"
+#include "smobs.hh"
 
 typedef void (Score_element::*Score_element_method_pointer) (void);
 
@@ -35,9 +34,12 @@ Boolean (true iff defined)
  transparent -- do not calc. output
 
 */
-class Score_element : public virtual Graphical_element {
-
-  friend class Paper_score;
+class Score_element  {
+  /**
+     The lookup, determined by the font size. Cache this value.
+   */
+  Lookup * lookup_l_;
+public:
   /**
      properties specific for this element. Destructor will not call
      scm_unprotect, so as to allow more flexible GC arrangements.  The
@@ -46,12 +48,7 @@ class Score_element : public virtual Graphical_element {
 
   */
   SCM element_property_alist_;
-  Link_array<Score_element> dependency_arr_;
-  /**
-     The lookup, determined by the font size. Cache this value.
-   */
-  Lookup * lookup_l_;
-public:
+  
   Score_element *original_l_;
 
   /**
@@ -65,7 +62,7 @@ public:
   int status_i_;
 
   Paper_score *pscore_l_;
-  Molecule * output_p_;
+
   Score_element ();
   Score_element (Score_element const&);
   virtual void print () const;
@@ -73,9 +70,28 @@ public:
   /*
     properties
    */
-  SCM get_elt_property (SCM sym) const;
-  void set_elt_property (SCM sym, SCM val);
-  SCM remove_elt_property (SCM key);
+  SCM get_elt_property (String nm) const;
+  void set_elt_property (String, SCM val);
+
+  /**
+     UGH! JUNKME ?
+
+     This gets messy because it changes state
+
+     calling 
+
+     Bar::proc ()
+     {
+       s->remove_elt_property ("foo")
+     } 
+
+     twice may do weird things if Bar::foo has a default set.
+     
+   */
+  SCM remove_elt_property (String nm);
+
+  void Score_element::set_real (String, Real);
+  Real Score_element::get_real (String s) const;
 
   /*
     related classes.
@@ -83,11 +99,8 @@ public:
   Paper_def *paper_l () const;
   Lookup const *lookup_l () const;
 
-  virtual ~Score_element ();
   void add_processing ();
 
-  void substitute_dependency (Score_element*,Score_element*);
-  void remove_dependency (Score_element*);
   /**
     add a dependency. It may be the 0 pointer, in which case, it is ignored.
     */
@@ -106,40 +119,93 @@ public:
    */
   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
 
+  static SCM handle_broken_smobs (SCM, SCM criterion);
+  void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
+
+  virtual void do_break_processing ();
+  virtual Score_element *find_broken_piece (Line_of_score*) const;
 protected:
-  Score_element* dependency (int) const;
-  int dependency_size () const;
+
+  /**
+    Junk score element. This is protected because this is supposed to
+    be handled by GUILE gc.  */
+  virtual ~Score_element ();
   
   virtual void output_processing ();
-  virtual Interval do_height () const;
-  virtual Interval do_width () const;
-    
+  static Interval molecule_extent (Dimension_cache const*);
+
   /// do printing of derived info.
   virtual void do_print () const;
   /// generate the molecule    
-  virtual Molecule* do_brew_molecule_p () const;
+  virtual Molecule do_brew_molecule () const;
   ///executed directly after the item is added to the Paper_score
   virtual void do_add_processing ();
   /// do calculations before determining horizontal spacing
-  virtual void do_pre_processing ();
+  virtual void before_line_breaking ();
 
   /// generate rods & springs
   virtual void do_space_processing ();
 
   virtual void do_breakable_col_processing ();
   /// do calculations after determining horizontal spacing
-  virtual void do_post_processing ();
+  virtual void after_line_breaking ();
     
-  virtual void do_substitute_element_pointer (Score_element * , Score_element *);
-  virtual void do_break_processing ();
+  virtual Link_array<Score_element> get_extra_dependencies () const;
+
+  static Interval dim_cache_callback (Dimension_cache const*);
+public:
+  static SCM ly_set_elt_property (SCM, SCM,SCM);
+  static SCM ly_get_elt_property (SCM, SCM);  
+  
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
-  virtual void handle_prebroken_dependents ();
-  virtual Link_array<Score_element> get_extra_dependencies () const;
 
-  static Interval dim_cache_callback (Dimension_cache*);
+
+  DECLARE_SMOBS;
+
+  void init ();
+
+public:
+  Dimension_cache *dim_cache_[NO_AXES];
+
+  /**
+     Set this if anyone points to me, or if I point to anyone.
+   */
+  bool used_b_;
+  
+  char const * name () const;
+  /**
+     Set empty in direction A.
+   */
+  void set_empty (Axis a);
+  bool empty_b (Axis a) const;
+  Interval extent (Axis) const;
+  /**
+    translate in one direction
+    */
+    
+  void translate_axis (Real, Axis);
+
+  Real relative_coordinate (Score_element const* refp, Axis) const;
+  /**
+    Find the group-element which has both #this# and #s#
+   */
+  Score_element*common_refpoint (Score_element const* s, Axis a) const;
+  Score_element*common_refpoint (Link_array<Score_element> elems, Axis a) const;
+
+  /**
+     Set the  parent refpoint of THIS to E
+   */
+  void set_parent (Score_element* e, Axis);
+  
+  Score_element *parent_l (Axis a) const;
+  void fixup_refpoint ();
 };
 
+Score_element * unsmob_element (SCM);
+
+
 
 #endif // STAFFELEM_HH