]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/context.hh
* scm/define-music-properties.scm (all-music-properties):
[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--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef CONTEXT_HH
10 #define CONTEXT_HH
11
12
13 #include "moment.hh"
14 #include "lily-proto.hh"
15 #include "virtual-methods.hh"
16 #include "context-key-manager.hh"
17
18 class Context
19 {
20   Scheme_hash_table *properties_dict () const;
21   Context (Context const &src);
22
23   DECLARE_SMOBS (Context, dummy);
24   DECLARE_CLASSNAME(Context);
25   void terminate ();
26
27 private:
28   friend class Context_handle;
29   int iterator_count_;
30   bool init_;
31
32 protected:
33   Context *daddy_context_;
34   SCM definition_;
35   Context_key_manager key_manager_;
36   
37   SCM properties_scm_;
38   SCM context_list_;
39   SCM accepts_list_;
40   SCM aliases_;
41   Translator_group *implementation_;
42   string id_string_;
43
44   friend class Context_def;
45   void clear_key_disambiguations ();
46
47   
48 public:
49   Object_key const *get_grob_key (string name);
50   Object_key const *get_context_key (string name, string id);
51
52   Context *create_context (Context_def *, string, SCM);
53   string id_string () const { return id_string_; }
54   SCM children_contexts () const { return context_list_; }
55   SCM default_child_context_name () const;
56
57   Translator_group *implementation () const { return implementation_; }
58   Context *get_parent_context () const;
59   Context (Object_key const *);
60
61   /* properties:  */
62   SCM internal_get_property (SCM name_sym) const;
63   SCM properties_as_alist () const;
64   void internal_set_property (SCM var_sym, SCM value);
65   Context *where_defined (SCM name_sym, SCM *value) const;
66   void unset_property (SCM var_sym);
67
68   Context *remove_context (Context *trans);
69   void check_removal ();
70   string context_name () const;
71   SCM context_name_symbol () const;
72   Global_context *get_global_context () const;
73
74   virtual Score_context *get_score_context () const;
75   virtual Output_def *get_output_def () const;
76   virtual Moment now_mom () const;
77   virtual Context *get_default_interpreter ();
78
79   bool is_alias (SCM) const;
80   void add_alias (SCM);
81   void add_context (Context *trans);
82   bool is_bottom_context () const;
83   bool is_removable () const;
84   bool try_music (Music *);
85
86   Context *find_create_context (SCM context_name,
87                                 string id, SCM ops);
88   Context *create_unique_context (SCM context_name, string context_id,
89                                   SCM ops);
90   vector<Context*> path_to_acceptable_context (SCM alias,
91                                                   Output_def *) const;
92 };
93
94 /*
95   Context arg?
96 */
97
98 void apply_property_operations (Context *tg, SCM pre_init_ops);
99 void execute_pushpop_property (Context *trg, SCM prop, SCM eltprop, SCM val);
100 void execute_general_pushpop_property (Context *context,
101                                        SCM context_property, SCM grob_property_path, SCM val);
102 SCM updated_grob_properties (Context *tg, SCM sym);
103 Context *find_context_below (Context *where,
104                              SCM type_sym, string id);
105 bool melisma_busy (Context *);
106
107 Context *get_voice_to_lyrics (Context *lyrics);
108 Grob *get_current_note_head (Context *voice);
109 Grob *get_current_rest (Context *voice);
110 DECLARE_UNSMOB (Context, context);
111
112 Moment measure_position (Context const *context);
113 Rational measure_length (Context const *context);
114 void set_context_property_on_children (Context *trans, SCM sym, SCM val);
115
116 #endif /* CONTEXT_HH */
117