]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/global-context.hh
f940561739a4e2b5800caba811c2f7b4d4e0d4f3
[lilypond.git] / lily / include / global-context.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2014 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 class Global_context : public Context
27 {
28   PQueue<Moment> extra_mom_pq_;
29   Output_def *output_def_;
30
31   DECLARE_CLASSNAME (Global_context);
32
33   friend class Output_def;
34 public:
35   Global_context (Output_def *);
36   int get_moments_left () const;
37   Moment sneaky_insert_extra_moment (Moment);
38   void add_moment_to_process (Moment);
39   void run_iterator_on_me (Music_iterator *);
40   virtual Context *get_score_context () const;
41
42   void apply_finalizations ();
43   void add_finalization (SCM);
44
45   DECLARE_LISTENER (prepare);
46   virtual SCM get_output ();
47   virtual Output_def *get_output_def () const;
48   virtual Moment now_mom () const;
49   virtual Context *get_default_interpreter (const string &context_id = "");
50
51   static Global_context *unsmob (SCM x) {
52     return dynamic_cast<Global_context *> (Context::unsmob (x));
53   }
54   static bool is_smob (SCM x) {
55     return Context::is_smob (x) && unsmob (x);
56   }
57
58   Moment previous_moment () const;
59 protected:
60   Moment prev_mom_;
61   Moment now_mom_;
62 };
63
64 SCM ly_format_output (SCM);
65
66 #endif // GLOBAL_CONTEXT_HH