]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/context.hh
* lily/context.cc (Context): take key argument in ctor.
[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   Object_key const * key_;
32   Context * daddy_context_;
33   SCM definition_;
34   SCM properties_scm_;
35   SCM context_list_;
36   SCM accepts_list_;
37   SCM aliases_;
38   SCM implementation_;
39   String id_string_;
40
41   friend class Context_def;
42
43 public:
44   Object_key const *get_key () const;
45   String id_string () const { return id_string_; } 
46   SCM children_contexts () const { return context_list_; }
47   SCM default_child_context_name () const;
48
49   Translator_group* implementation () const;
50   Context *get_parent_context () const;
51   Context (Object_key const*);
52   
53   /* properties:  */
54   void execute_pushpop_property (SCM prop, SCM sym, SCM val);
55   SCM internal_get_property (SCM name_sym) const;
56   SCM properties_as_alist () const;
57   void internal_set_property (SCM var_sym, SCM value);  
58   Context *where_defined (SCM name_sym) const;
59   void unset_property (SCM var_sym);
60
61   
62   Context *remove_context (Context *trans);
63   void check_removal ();
64   String context_name () const;
65   SCM context_name_symbol () const;
66   Global_context *get_global_context () const;
67   
68   virtual Score_context * get_score_context () const;  
69   virtual Output_def *get_output_def () const;
70   virtual Moment now_mom () const;
71   virtual Context *get_default_interpreter ();
72
73   bool is_alias (SCM) const;
74   void add_alias (SCM); 
75   void add_context (Context *trans);
76   bool is_bottom_context () const;
77   bool is_removable () const;
78   bool try_music (Music *);
79
80   Context *find_create_context (SCM context_name,
81                                 String id, SCM ops);
82   Link_array<Context> path_to_acceptable_context (SCM alias,
83                                                   Output_def*) const;
84
85 };
86
87 /*
88   Context arg? 
89  */
90
91 void apply_property_operations (Context *tg, SCM pre_init_ops);
92 void execute_pushpop_property (Context *trg, SCM prop, SCM eltprop, SCM val);
93 SCM updated_grob_properties (Context *tg, SCM sym);
94 Context *find_context_below (Context *where,
95                               SCM type_sym, String id);
96 bool melisma_busy (Context *);
97
98 Context *get_voice_to_lyrics (Context *lyrics);
99 Grob *get_current_note_head (Context *voice);
100 Grob *get_current_rest (Context *voice);
101 DECLARE_UNSMOB(Context, context);
102
103 #endif /* CONTEXT_HH */
104