]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/translator-group.hh
4a1a10c361c7499feeee875b90b8fd27e120d349
[lilypond.git] / lily / include / translator-group.hh
1 /*
2   translator-group.hh -- declare Translator_group
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef TRANSLATOR_GROUP_HH
11 #define TRANSLATOR_GROUP_HH
12
13 #include "string.hh"
14 #include "lily-proto.hh"
15 #include "virtual-methods.hh"
16 #include "translator.hh"
17 #include "parray.hh"
18 #include "smobs.hh"
19
20 // egcs
21 typedef void (Translator::*Method_pointer) (void);
22 #define set_property(x,y) internal_set_property(ly_symbol2scm(x),y)
23
24 class Scheme_hash_table;
25
26
27 /** Make some kind of Elements from Events. Elements are made by
28   hierarchically grouped Translators
29   */
30 class Translator_group : public virtual Translator {
31
32   Scheme_hash_table *properties_dict () const;
33   int iterator_count_;
34
35   friend class Interpretation_context_handle;
36   SCM add_translator (SCM, Translator*);
37   
38 protected:
39   ~Translator_group ();
40
41   virtual SCM get_simple_trans_list ();
42 public:
43   void execute_pushpop_property (SCM prop, SCM sym, SCM val);
44   SCM internal_get_property (SCM name_sym) const;
45   SCM properties_as_alist () const;
46   
47   void unset_property (SCM var_sym);
48   void internal_set_property (SCM var_sym, SCM value);  
49   Translator_group *where_defined (SCM name_sym) const;
50
51   String id_string_;
52   String context_name () const;  
53   VIRTUAL_COPY_CONS (Translator);
54   Translator_group (Translator_group const &);
55   Translator_group ();
56   void add_fresh_group_translator (Translator *trans);
57   void add_used_group_translator (Translator *trans);
58   
59   /// Score_register = 0, Staff_registers = 1, etc)
60   Translator_group* get_ancestor (int l=1);
61   int get_depth () const;
62   bool is_bottom_translator_b () const;
63   bool is_removable () const;
64   void terminate_translator (Translator*r);
65   Translator *remove_translator (Translator*trans);
66   void check_removal ();
67   // Translator *get_simple_translator (String) const;
68   Translator_group *find_existing_translator (SCM context_name, String id);
69   Translator_group *find_create_translator (SCM context_name, String id, SCM ops);
70   Link_array<Translator_group> path_to_acceptable_translator (SCM alias,
71                                                               Music_output_def*) const;
72   Translator_group*get_default_interpreter ();
73
74 public:
75   bool try_music_on_nongroup_children (Music *m);
76   
77   virtual void do_announces ();
78   virtual bool try_music (Music* req);       
79   virtual void stop_translation_timestep ();
80   virtual void start_translation_timestep ();   
81   virtual void initialize ();
82   virtual void finalize ();
83   virtual void each (Method_pointer);
84 };
85
86
87 bool melisma_busy (Translator* tr); // where to put this? --hwn
88 void apply_property_operations (Translator_group*tg, SCM pre_init_ops);
89 SCM names_to_translators (SCM namelist, Translator_group*tg);
90
91 #endif // TRANSLATOR_GROUP_HH