]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
new file, move from
[lilypond.git] / lily / include / translator.hh
index 1e88b13451877f14563c7e6b3ece51a7c133720d..1050cac31af4aacb15fdaaa0e9254e46ad6e1713 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,59 +35,37 @@ public:                                                     \
 class Translator
 {
   void init ();
+  
 public:
-  Music_output_def * output_def_;
-  String type_string_;
+  Context * 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 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:
-  Global_translator * top_translator () const;
-  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.
  */
@@ -97,7 +75,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\
@@ -140,9 +117,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