]> git.mxchange.org Git - flightgear.git/blob - src/Scripting/NasalDisplay.hxx
Updates for newest scenery build.
[flightgear.git] / src / Scripting / NasalDisplay.hxx
1 // NasalDisplay.hxx - class to manage the graphical display of Nasal messages.
2 //                  - mainly copied from ATCDisplay.hxx
3 //
4 // Written by David Luff, started October 2001.
5 //
6 // Copyright (C) 2001  David C Luff - david.luff@nottingham.ac.uk
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 #ifndef _FG_NASAL_DISPLAY_HXX
23 #define _FG_NASAL_DISPLAY_HXX
24
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28
29 #include <simgear/structure/subsystem_mgr.hxx>
30
31 #include <vector>
32 #include <string>
33
34 SG_USING_STD(vector);
35 SG_USING_STD(string);
36
37 struct nasalMessage {
38     string msg;
39     bool repeating;
40     double counter;             // count of how many seconds since the message was registered
41     double start_count; // value of counter at which display should start (seconds)
42     double stop_count;  // value of counter at which display should stop (seconds)
43     int id;
44         double dsp_offset;
45 };
46
47 // ASSUMPTION - with two radios the list won't be long so we don't need to map the id's
48 typedef vector<nasalMessage> nasalMessageList;
49 typedef nasalMessageList::iterator nasalMessageListIterator;
50
51 class FGNasalDisplay : public SGSubsystem 
52 {
53
54 private:
55     bool rep_msg;               // Flag to indicate there is a repeating transmission to display
56     bool change_msg_flag;       // Flag to indicate that the repeating message has changed
57     double dsp_offset1;         // Used to set the correct position of scrolling display
58     double dsp_offset2;
59     string rep_msg_str;         // The repeating transmission to play
60     nasalMessageList msgList;
61     nasalMessageListIterator msgList_itr;
62
63 public:
64     FGNasalDisplay();
65     ~FGNasalDisplay();
66
67     void init();
68
69     void bind();
70
71     void unbind();
72
73     // Display any registered messages
74     void update(double dt);
75
76     // Register a single message for display after a delay of delay seconds
77     // Will automatically stop displaying after a suitable interval.
78     void RegisterSingleMessage(const string& msg, double delay = 0.0);
79
80     // For now we will assume only one repeating message at once
81     // This is not really robust
82
83     // Register a continuously repeating message
84     void RegisterRepeatingMessage(const string& msg);
85
86     // Change a repeating message - assume that the message changes after the string has finished for now
87     void ChangeRepeatingMessage(const string& newmsg); 
88
89     // Cancel the current repeating message
90     void CancelRepeatingMessage();
91 };
92
93 #endif // _FG_ATC_DISPLAY_HXX