]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/context.hh
c8a366a27d8e3bf779d8fa23748b99f941bb3131
[lilypond.git] / lily / include / context.hh
1 /*
2   context.hh -- declare  Context
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef CONTEXT_HH
10 #define CONTEXT_HH
11
12 #include "moment.hh"
13 #include "lily-proto.hh"
14
15
16 class Context
17 {
18   Scheme_hash_table *properties_dict () const;
19   Context (Context const &src);
20   
21   DECLARE_SMOBS (Context, dummy);
22
23   void terminate ();
24
25 private:
26   friend class Interpretation_context_handle;
27   int iterator_count_;
28   bool init_;
29   
30 protected:
31   Context * daddy_context_;
32   SCM definition_;
33   SCM properties_scm_;
34   SCM context_list_;
35   SCM accepts_list_;
36   SCM aliases_;
37   SCM implementation_;
38   String id_string_;
39
40   friend class Context_def;
41 public:
42   String id_string () const { return id_string_; } 
43   SCM children_contexts () const { return context_list_; }
44   SCM default_child_context_name () const;
45
46   Translator_group* implementation () const;
47   Context *get_parent_context () const;
48   Context ();
49
50   /* properties:  */
51   void execute_pushpop_property (SCM prop, SCM sym, SCM val);
52   SCM internal_get_property (SCM name_sym) const;
53   SCM properties_as_alist () const;
54   void internal_set_property (SCM var_sym, SCM value);  
55   Context *where_defined (SCM name_sym) const;
56   void unset_property (SCM var_sym);
57
58   
59   Context *remove_context (Context *trans);
60   void check_removal ();
61   String context_name () const;
62   SCM context_name_symbol () const;
63   Global_context *get_global_context () const;
64   
65   virtual Score_context * get_score_context () const;  
66   virtual Output_def *get_output_def () const;
67   virtual Moment now_mom () const;
68   virtual Context *get_default_interpreter ();
69
70   bool is_alias (SCM) const;
71   void add_alias (SCM); 
72   void add_context (Context *trans);
73   bool is_bottom_context () const;
74   bool is_removable () const;
75   bool try_music (Music *);
76
77   Context *find_create_context (SCM context_name,
78                                 String id, SCM ops);
79   Link_array<Context> path_to_acceptable_context (SCM alias,
80                                                   Output_def*) const;
81
82 };
83
84 /*
85   Context arg? 
86  */
87
88 void apply_property_operations (Context *tg, SCM pre_init_ops);
89 void execute_pushpop_property (Context *trg, SCM prop, SCM eltprop, SCM val);
90 SCM updated_grob_properties (Context *tg, SCM sym);
91 Context *find_context_below (Context *where,
92                               SCM type_sym, String id);
93 bool melisma_busy (Context *);
94
95 Context *get_voice_to_lyrics (Context *lyrics);
96 Grob *get_current_note_head (Context *voice);
97 Grob *get_current_rest (Context *voice);
98 Context *unsmob_context (SCM);
99
100 DECLARE_UNSMOB(Context, context);
101
102 #endif /* CONTEXT_HH */
103