]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/global-context.hh
New upstream version 2.19.65
[lilypond.git] / lily / include / global-context.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef GLOBAL_CONTEXT_HH
21 #define GLOBAL_CONTEXT_HH
22
23 #include "context.hh"
24 #include "pqueue.hh"
25
26 struct Preinit_Global_context
27 {
28   Output_def *output_def_;
29   Preinit_Global_context ();
30 };
31
32 class Global_context : Preinit_Global_context, public Context
33 {
34   PQueue<Moment> extra_mom_pq_;
35   virtual void derived_mark () const;
36
37   DECLARE_CLASSNAME (Global_context);
38
39   friend class Output_def;
40 public:
41   Global_context (Output_def *);
42   int get_moments_left () const;
43   Moment sneaky_insert_extra_moment (Moment);
44   void add_moment_to_process (Moment);
45   void run_iterator_on_me (Music_iterator *);
46   virtual Context *get_score_context () const;
47
48   void apply_finalizations ();
49   void add_finalization (SCM);
50
51   void prepare (SCM);
52   virtual SCM get_output ();
53   virtual Output_def *get_output_def () const;
54   virtual Moment now_mom () const;
55   virtual Context *get_default_interpreter (const string &context_id = "");
56
57   Moment previous_moment () const;
58 protected:
59   Moment prev_mom_;
60   Moment now_mom_;
61 };
62
63 SCM ly_format_output (SCM);
64
65 #endif // GLOBAL_CONTEXT_HH