]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
* lily/include/context.hh (class Context): make members protected.
[lilypond.git] / lily / include / translator.hh
index 97784a82a980136b90e27b5bc44c2cc6e97fb407..69b09852ad931bb47dfb2bb8d3c21177e6b405e5 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
@@ -23,8 +23,8 @@
 
 #define TRANSLATOR_DECLARATIONS(NAME)                  \
 public:                                                        \
-  NAME();\
-  VIRTUAL_COPY_CONS (Translator);                              \
+  NAME ();                                             \
+  VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME);         \
   static SCM static_description_;                      \
   virtual SCM static_translator_description () const;  \
   virtual SCM translator_description () const;
@@ -35,57 +35,38 @@ public:                                                     \
 class Translator
 {
   void init ();
+  
 public:
-  Music_output_def * output_def_;
-  String type_string_;
+  Context * get_parent_context () const { return daddy_context_; }
   
-  bool is_alias_b (String) const;
-    
-
   Translator (Translator const &);
 
-  
-  Translator_group * daddy_trans_ ;
   void removal_processing ();
-  /**
-    ask daddy for a feature
-    */
-  Music_output_def *get_output_def () const;
-
   SCM internal_get_property (SCM symbol) const;
   
+  virtual Music_output_def *get_output_def () const;
+  virtual Translator_group* get_daddy_translator ()const;
   virtual Moment now_mom () const;  
-
-  /*
-    ugh: bubbled up from Translator_group. 
-   */
-  SCM simple_trans_list_;
-  SCM trans_group_list_;
-  SCM definition_;
-  
-  SCM properties_scm_;
-  DECLARE_SMOBS (Translator, dummy);
-
-public:
-  TRANSLATOR_DECLARATIONS(Translator);
-    /**
-    try to fit the request in this engraver
-
-    @return
-    false: not noted,  not taken.
-
-    true: request swallowed. Don't try to put the request elsewhere.
-
-    */
   virtual bool try_music (Music *req);
   virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
-  virtual void do_announces () ;
   virtual void initialize () ;
+  virtual void process_music ();
+  virtual void do_announces ();
   virtual void finalize ();
+  
+  Score_context * get_score_context () const;
+  Global_context * get_global_context () const;
+  
+  TRANSLATOR_DECLARATIONS(Translator);
+  DECLARE_SMOBS (Translator, dummy);
+protected:                     // should be private.
+  Context * daddy_context_ ;
+  SCM simple_trans_list_;
+  friend class Context_def;
+  friend class Context;
 };
 
-
 /**
   A macro to automate administration of translators.
  */
@@ -95,7 +76,6 @@ static void  _ ## T ## _adder () {\
       T *t = new T;\
       T::static_description_ = t->static_translator_description ();\
       scm_permanent_object (T::static_description_);\
-      t->type_string_ = classname (t);\
       add_translator (t);\
 }\
 SCM T::translator_description() const\
@@ -107,7 +87,7 @@ ADD_GLOBAL_CTOR (_ ## T ## _adder);
 
 
 
-#define ENTER_DESCRIPTION(classname,desc,grobs,acked,read,write)                                               \
+#define ENTER_DESCRIPTION(classname,desc,grobs,accepted,acked,read,write)                                              \
 ADD_THIS_TRANSLATOR (classname);\
 SCM                                                                                            \
 classname::static_translator_description () const \
@@ -124,6 +104,8 @@ classname::static_translator_description () const \
                                                                                                \
   static_properties= scm_acons (ly_symbol2scm ("interfaces-acked"),                            \
                              parse_symbol_list (acked), static_properties);                    \
+  static_properties= scm_acons (ly_symbol2scm ("events-accepted"),                             \
+                             parse_symbol_list (accepted), static_properties);                 \
                                                                                                \
   static_properties= scm_acons (ly_symbol2scm ("properties-read"),                             \
                              parse_symbol_list (read), static_properties);                     \
@@ -136,9 +118,8 @@ classname::static_translator_description () const \
 
 
 
-extern Dictionary<Translator*> *global_translator_dict;
 void add_translator (Translator*trans);
 
-Translator*get_translator (String s);
+Translator*get_translator (SCM s);
 DECLARE_UNSMOB(Translator,translator);
 #endif // TRANSLATOR_HH