]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/score-element.hh
patch::: 1.3.58.jcn2
[lilypond.git] / lily / include / score-element.hh
index e803d487fe66a838239921c7b9c2000b6c5c05e2..2ded67f8cc51fa228fd41fe17b408b9bff2c9ae9 100644 (file)
@@ -17,6 +17,8 @@
 typedef Interval (*Extent_callback)(Score_element const *,Axis);
 typedef Real (*Offset_callback)(Score_element const *,Axis);
 
+#define READONLY_PROPS         // FIXME.
+
 
 /**
     for administration of what was done already
@@ -58,7 +60,7 @@ 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
@@ -66,8 +68,13 @@ public:
      need for more scm_protect calls.
 
   */
-  SCM element_property_alist_;
-  
+public:                                // ugh.
+  SCM property_alist_;
+  SCM pointer_alist_;
+#ifndef READONLY_PROPS
+  SCM basic_property_list_;
+#endif
+public:
   Score_element *original_l_;
 
   /**
@@ -77,13 +84,6 @@ public:
     0 means ORPHAN,
    */
   char status_i_;
-  /**
-     Set this if anyone points to me, or if I point to anyone.
-
-     JUNKME.
-   */
-  bool used_b_;
-  
   char const * name () const;
 
   /*
@@ -93,7 +93,7 @@ public:
    */
   Paper_score *pscore_l_;
 
-  Score_element ();
+  Score_element (SCM basic_props);
   Score_element (Score_element const&);
 
   /*
@@ -102,6 +102,13 @@ public:
   SCM get_elt_property (String nm) const;
   void set_elt_property (String, SCM val);
 
+  /**
+     Pointers are like properties, but they are subject to    a substitution
+     after line breaking.
+   */
+  SCM get_elt_pointer (const char*) const;
+  void set_elt_pointer (const char*, SCM val);
+  friend class Property_engraver; //  UGHUGHUGH.
   /**
      UGH! JUNKME ?
 
@@ -117,7 +124,7 @@ public:
      twice may do weird things if Bar::foo has a default set.
      
    */
-  SCM remove_elt_property (String nm);
+  SCM remove_elt_property (const char* nm);
 
   /*
     related classes.
@@ -155,7 +162,7 @@ public:
   /// generate rods & springs
   virtual void do_space_processing ();
   virtual void discretionary_processing ();
-
+  virtual void do_derived_mark ();
   /// do calculations before determining horizontal spacing
   virtual void before_line_breaking ();
   /// do calculations after determining horizontal spacing
@@ -175,17 +182,16 @@ protected:
     be handled by GUILE gc.  */
   virtual ~Score_element ();
   
-  /// generate the molecule    
-  virtual Molecule do_brew_molecule () const;
   ///executed directly after the item is added to the Paper_score
   virtual void do_add_processing ();
-    
+  Molecule do_brew_molecule ()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);  
-
+  static SCM scheme_molecule (SCM);
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
 
@@ -239,6 +245,26 @@ public:
 
 Score_element * unsmob_element (SCM);
 
+#define MAKE_SCHEME_SCORE_ELEMENT_NON_DEFAULT_CALLBACKS(TYPE)                          \
+void                                                           \
+TYPE ## __init_functions ()                                    \
+{                                                              \
+  scm_make_gsubr (#TYPE "::scheme_molecule", 1, 0, 0,          \
+  (SCM(*)(...))TYPE::scheme_molecule);                                 \
+}                                                              \
+                                                               \
+ADD_SCM_INIT_FUNC(TYPE ## _molecule, TYPE ## __init_functions);        \
+
+#define MAKE_SCHEME_SCORE_ELEMENT_CALLBACKS(TYPE)                              \
+MAKE_SCHEME_SCORE_ELEMENT_NON_DEFAULT_CALLBACKS(TYPE);\
+SCM                                                            \
+TYPE::scheme_molecule (SCM smob)                               \
+{                                                              \
+  TYPE * b = dynamic_cast<TYPE*> (unsmob_element (smob));      \
+  return b ?  b->do_brew_molecule ().create_scheme () : SCM_EOL; \
+}                                                              \
+                                                               \
+
 
 
 #endif // STAFFELEM_HH