]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/score-element.hh
release: 1.3.105
[lilypond.git] / lily / include / score-element.hh
index ebd656070d6d9ee485c602eb78e87da8fcd20dba..424a182932976f093dffb25dee832f73a39b55f7 100644 (file)
 #include "smobs.hh"
 #include "dimension-cache.hh"
 
-typedef Interval (*Extent_callback)(Score_element *,Axis);
-typedef Real (*Offset_callback)(Score_element *,Axis);
-
-
-
 /**
     for administration of what was done already
     */
 enum Score_element_status {
-  ORPHAN=0,                    // not yet added to pstaff
-  VIRGIN,                      // added to pstaff
+  ORPHAN=0,                    // not yet added to Paper_score
+  VIRGIN,      
   PRECALCING,
   PRECALCED,           // calcs before spacing done
   POSTCALCING,         // busy calculating. This is used to trap cyclic deps.
   POSTCALCED,          // after spacing calcs done
-  BREWING,
-  BREWED,
 };
 
 typedef void (Score_element::*Score_element_method_pointer) (void);
 
-/**
+/*
    Basic output object.
-
-    Element Properties:
-
-   transparent -- boolean: if true, do not print anything black.
-
-   dependencies -- list of score-element pointers that indicate who to
-   compute first.
-
-   interfaces -- list of symbols indicating the interfaces supported
-   by this object.
-
-   extra-offset -- pair of reals (a cons) forcing an extra offset
-   before outputting
-
-   glyph -- afm character name to output.
-   
 */
 class Score_element  {
-  /**
-     The lookup, determined by the font size. Cache this value.
-   */
-  Lookup * lookup_l_;
-
-  /**
-     properties specific for this element. Destructor will not call
-     scm_unprotect, so as to allow more flexible GC arrangements.  The
-     real alist is in (cdr element_property_alist_), to reduce the
-     need for more scm_protect calls.
-
-  */
-public:                                // ugh.
+public:
   SCM immutable_property_alist_;
   SCM mutable_property_alist_;
-
-public:
   Score_element *original_l_;
 
   /**
@@ -81,7 +44,7 @@ public:
     0 means ORPHAN,
    */
   char status_i_;
-  char const * name () const;
+  String name () const;
 
   /*
     IDEA: make this a global variable. This is the same for all
@@ -110,9 +73,6 @@ public:
     related classes.
    */
   Paper_def *paper_l () const;
-  Lookup const *lookup_l () const;
-
-  void add_processing ();
 
   /**
     add a dependency. It may be the 0 pointer, in which case, it is ignored.
@@ -133,46 +93,32 @@ public:
      #funcptr# is the function to call to update this element.
    */
   void calculate_dependencies (int final, int busy, SCM funcname);
-
-
   static SCM handle_broken_smobs (SCM, SCM criterion);
 
   virtual void do_break_processing ();
   virtual Score_element *find_broken_piece (Line_of_score*) const;
   virtual void discretionary_processing ();
-  virtual void do_derived_mark ();
+  virtual SCM do_derived_mark ();
 
-  Molecule get_molecule () const;
+  Molecule get_molecule () const;
   void suicide ();
   
-  static Interval preset_extent (Score_element *,Axis);
-  static Interval point_dimension_callback (Score_element *,Axis );
-  static Interval molecule_extent (Score_element *,Axis);
+  DECLARE_SCHEME_CALLBACK(preset_extent, (SCM smob, SCM axis));
+  DECLARE_SCHEME_CALLBACK(point_dimension_callback, (SCM smob, SCM axis));
+  DECLARE_SCHEME_CALLBACK(molecule_extent, (SCM smob, SCM axis));
+
 
-protected:
-  /**
-    Junk score element. This is protected because this is supposed to
-    be handled by GUILE gc.  */
-  virtual ~Score_element ();
-  
-  ///executed directly after the item is added to the Paper_score
-  virtual void do_add_processing ();
-  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);  
 
   bool has_interface (SCM intf);
   void set_interface (SCM intf);
 
-
-  static SCM brew_molecule (SCM);
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
 
 
-  DECLARE_SMOBS;
+  DECLARE_SMOBS(Score_element,foo);
 
   void init ();
 
@@ -180,7 +126,8 @@ public:
 
 public:
   bool empty_b (Axis a) const;
-  Interval extent (Axis) const;
+
+  Interval extent (Score_element * refpoint, Axis) const;
  
   /**
     translate in one direction
@@ -201,11 +148,14 @@ public:
   Score_element*common_refpoint (Score_element const* s, Axis a) const;
   Score_element*common_refpoint (SCM elt_list, Axis a) const;
 
-  bool has_offset_callback_b (Offset_callback, Axis)const;
-  void add_offset_callback (Offset_callback, Axis);
-  bool has_extent_callback_b (Extent_callback, Axis)const;  
-  void set_extent_callback (Extent_callback , Axis);
+  // duh. slim down interface here. (todo)
+  bool has_offset_callback_b (SCM callback, Axis)const;
+  void add_offset_callback (SCM callback, Axis);
+  bool has_extent_callback_b (SCM, Axis)const;  
+  void set_extent_callback (SCM , Axis);
+  bool has_extent_callback_b (Axis) const;
 
+  
   /**
     Invoke callbacks to get offset relative to parent.
    */
@@ -216,7 +166,7 @@ public:
   void set_parent (Score_element* e, Axis);
   
   Score_element *parent_l (Axis a) const;
-  static SCM fixup_refpoint (SCM);
+  DECLARE_SCHEME_CALLBACK(fixup_refpoint, (SCM));
 };
 
 Score_element * unsmob_element (SCM);