]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/translator-group.hh
release: 1.3.82
[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--2000 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
23 class Scheme_hash_table;
24
25 /*
26   should make a struct out of this, and move SCM list stuff in here.
27  */
28 struct Translator_group_initializer {
29   static SCM modify_definition (SCM, SCM, bool);
30
31   static void set_acceptor (Translator*,SCM accepts, bool add);
32   static void add_element (Translator*,SCM name);
33   static void remove_element (Translator*,SCM name);
34   static void add_last_element (Translator*,SCM name);
35   static void apply_pushpop_property (Translator*trans, SCM syms, SCM eprop, SCM val);
36   static void add_push_property (Translator*, SCM,SCM,SCM);
37   static void add_pop_property (Translator*, SCM,SCM);  
38   
39 };
40
41 /** Make some kind of Elements from Requests. Elements are made by
42   hierarchically grouped Translators
43   */
44 class Translator_group : public virtual Translator {
45
46   Scheme_hash_table *properties_dict () const;
47   int iterator_count_;
48
49
50   friend class Interpretation_context_handle;
51 protected:
52   ~Translator_group ();
53 public:
54   SCM add_translator (SCM, Translator*);
55   void execute_single_pushpop_property (SCM prop, SCM sym, SCM val);
56   SCM get_property (SCM name_sym) const;
57   void set_property (String var_name, SCM value);
58   void set_property (SCM var_sym, SCM value);  
59   Translator_group *where_defined (SCM name_sym) const;
60
61   String id_str_;
62
63   VIRTUAL_COPY_CONS(Translator);
64   Translator_group(Translator_group const &);
65   Translator_group();
66   void add_simple_translator (Translator *trans_p);
67   void add_group_translator (Translator *trans_p);
68
69   
70   /// Score_register = 0, Staff_registers = 1, etc)
71   Translator_group* ancestor_l (int l=1);
72   int depth_i() const;
73   bool is_bottom_translator_b () const;
74   bool removable_b() const;
75   void terminate_translator (Translator*r_l);
76   Translator *remove_translator_p (Translator*trans_l);
77   void check_removal ();
78   Translator *get_simple_translator (String) const;
79   Translator_group *find_existing_translator_l (String n, String id);
80   Translator_group *find_create_translator_l (String n, String id);
81   Link_array<Translator_group> path_to_acceptable_translator (String alias, Music_output_def*) const;
82
83   Translator_group*get_default_interpreter();
84   
85 protected:
86   bool try_music_on_nongroup_children (Music *m);
87   
88   virtual void do_print () const;
89   virtual void do_process_music ();
90   virtual void do_add_processing ();
91   virtual bool do_try_music (Music* req_l);       
92   virtual void do_pre_move_processing();
93   virtual void do_post_move_processing();   
94   virtual void do_creation_processing();
95   virtual void do_removal_processing();
96   virtual void each (Method_pointer);
97
98 };
99
100 #endif // TRANSLATOR_GROUP_HH