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