Ginga  0.13.6.2086-83aa
The iTV middleware.
Formatter.h
1 /* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17 
18 #ifndef FORMATTER_H
19 #define FORMATTER_H
20 
21 #include "ginga.h"
22 #include "aux-ginga.h"
23 
24 #include "Document.h"
25 
26 GINGA_NAMESPACE_BEGIN
27 
28 class Context;
29 class Event;
30 class Media;
31 class MediaSettings;
32 class Object;
33 
37 class Formatter : public Ginga
38 {
39 public:
40  // Ginga:
42 
43  bool start (const std::string &, std::string *);
44  bool stop ();
45 
46  void resize (int, int);
47  void redraw (cairo_t *);
48 
49  bool sendKey (const std::string &, bool);
50  bool sendTick (uint64_t, uint64_t, uint64_t);
51 
52  const GingaOptions *getOptions ();
53  bool getOptionBool (const std::string &);
54  void setOptionBool (const std::string &, bool);
55  int getOptionInt (const std::string &);
56  void setOptionInt (const std::string &, int);
57  string getOptionString (const std::string &);
58  void setOptionString (const std::string &, std::string);
59 
60  // Formatter:
61  Formatter (const GingaOptions *);
62  ~Formatter ();
63 
65  bool getEOS ();
66  void setEOS (bool);
67 
68  static void setOptionBackground (Formatter *, const string &, string);
69  static void setOptionDebug (Formatter *, const string &, bool);
70  static void setOptionExperimental (Formatter *, const string &, bool);
71  static void setOptionOpenGL (Formatter *, const string &, bool);
72  static void setOptionSize (Formatter *, const string &, int);
73 
74 private:
77 
80 
82  Color _background;
83 
86 
89 
91  uint64_t _lastTickFrameNo;
92 
95 
98 
100  string _docPath;
101 
103  bool _eos;
104 };
105 
106 GINGA_NAMESPACE_END
107 
108 #endif // FORMATTER_H
Definition: Object.h:29
Ginga handle.
Definition: ginga.h:80
string getOptionString(const std::string &)
Gets string option value.
bool start(const std::string &, std::string *)
Starts the presentation of an NCL file.
Definition: Formatter.cpp:123
void setEOS(bool)
Sets EOS flag.
Definition: Formatter.cpp:514
const GingaOptions * getOptions()
Gets current options.
Definition: Formatter.cpp:411
GingaOptions _opts
Current options.
Definition: Formatter.h:79
Definition: Context.h:26
bool _eos
Whether the presentation has ended naturally.
Definition: Formatter.h:103
Time _lastTickTotal
The last total time informed via Formatter::sendTick.
Definition: Formatter.h:85
void setOptionString(const std::string &, std::string)
Sets string option.
GingaState _state
Current state.
Definition: Formatter.h:76
~Formatter()
Destroys formatter.
Definition: Formatter.cpp:484
Color _background
Current background color.
Definition: Formatter.h:82
static void setOptionExperimental(Formatter *, const string &, bool)
Sets the experimental option of the given Formatter.
Definition: Formatter.cpp:571
bool stop()
Stops the presentation.
Definition: Formatter.cpp:190
static void setOptionSize(Formatter *, const string &, int)
Sets the width or height options of the given Formatter.
Definition: Formatter.cpp:603
Formatter(const GingaOptions *)
Creates a new Formatter.
Definition: Formatter.cpp:456
Ginga control options.
Definition: ginga.h:44
static void setOptionBackground(Formatter *, const string &, string)
Sets background option of the given Formatter.
Definition: Formatter.cpp:528
bool sendTick(uint64_t, uint64_t, uint64_t)
Sends tick event to presentation.
Definition: Formatter.cpp:383
GingaState getState()
Gets Ginga object state.
Definition: Formatter.cpp:117
Interface between libginga and the external world.
Definition: Formatter.h:37
bool sendKey(const std::string &, bool)
Sends key event to presentation.
Definition: Formatter.cpp:357
string _docPath
Path of the file that originated the current document.
Definition: Formatter.h:100
Definition: MediaSettings.h:25
static void setOptionOpenGL(Formatter *, const string &, bool)
Sets the OpenGL option of the given Formatter.
Definition: Formatter.cpp:585
void redraw(cairo_t *)
Draws the latest frame of the presentation on Cairo context.
Definition: Formatter.cpp:249
Definition: Media.h:26
Document * getDocument()
Gets current document.
Definition: Formatter.cpp:494
NCL document.
Definition: Document.h:34
Time _lastTickDiff
The last diff time informed via Formatter::sendTick.
Definition: Formatter.h:88
static void setOptionDebug(Formatter *, const string &, bool)
Sets debug option of the given Formatter.
Definition: Formatter.cpp:546
uint64_t _lastTickFrameNo
The last frame number informed via Formatter::sendTick.
Definition: Formatter.h:91
The libginga API.
GingaState
Ginga states.
Definition: ginga.h:69
Document * _doc
Current document tree.
Definition: Formatter.h:97
Event state machine.
Definition: Event.h:31
void setOptionBool(const std::string &, bool)
Sets boolean option.
bool getEOS()
Gets EOS flag.
Definition: Formatter.cpp:504
int getOptionInt(const std::string &)
Gets integer option value.
void resize(int, int)
Resizes the presentation screen.
Definition: Formatter.cpp:204
bool getOptionBool(const std::string &)
Gets boolean option value.
string _saved_G_MESSAGES_DEBUG
The saved value of environment variable G_MESSAGES_DEBUG.
Definition: Formatter.h:94
void setOptionInt(const std::string &, int)
Sets integer option.