Add menu bindings/dialog to save/load flight recorder tapes.
[fg:toms-fgdata.git] / gui / dialogs / flight-recorder-save.xml
1 <?xml version="1.0"?>
2
3 <PropertyList>
4     <name>flight-recorder-save</name>
5     <layout>vbox</layout>
6     <resizable>true</resizable>
7         <default-padding>3</default-padding>
8         <nasal>
9                 <open><![CDATA[
10                 var setdefault = func (prop, value) { if (getprop(prop) == nil) setprop(prop, value);}
11                 setdefault("/sim/gui/dialogs/flightrecorder/start-time", "00:00:00");
12                 setdefault("/sim/gui/dialogs/flightrecorder/stop-time", "99:00:00");
13                 setdefault("/sim/gui/dialogs/flightrecorder/save-all", 1);
14                 setdefault("/sim/gui/dialogs/flightrecorder/author-name", "");
15                 props.globals.getNode("/sim/gui/dialogs/flightrecorder/author-name", 1).setAttribute("userarchive", 1);
16                 ]]></open>
17         </nasal>
18     <!-- titlebar -->
19     <group>
20         <layout>hbox</layout>
21         <empty><stretch>1</stretch></empty>
22
23         <text>
24             <label>Save Flight Recorder Tape</label>
25         </text>
26
27         <empty><stretch>1</stretch></empty>
28
29         <button>
30             <pref-width>16</pref-width>
31             <pref-height>16</pref-height>
32             <legend></legend>
33             <keynum>27</keynum>
34             <border>2</border>
35             <binding>
36                 <command>dialog-close</command>
37             </binding>
38         </button>
39     </group>
40     <hrule/>
41
42     <!-- main dialog area -->
43
44     <group>
45         <layout>table</layout>
46
47         <text>
48             <row>0</row><col>0</col>
49             <label>Tape Directory:</label>
50             <halign>left</halign>
51                         <valign>top</valign>
52         </text>
53                 <text>
54                         <row>0</row><col>1</col>
55                         <halign>left</halign>
56                         <valign>top</valign>
57                         <label>MMMMMMMMMMMMMMMMM</label>
58                         <stretch>1</stretch>
59                         <format>%s</format>
60                         <property>/sim/replay/tape-directory</property>
61                         <live>true</live>
62                         <color>
63                                 <red>0.7</red>
64                                 <green>0.7</green>
65                                 <blue>0.7</blue>
66                                 <alpha>1</alpha>
67                         </color>
68         </text>
69         <button>
70                         <equal>false</equal>
71             <row>0</row><col>2</col>
72             <legend>Change</legend>
73                         <halign>left</halign>
74                         <valign>top</valign>
75             <binding>
76                 <command>nasal</command>
77                                 <script>
78                                         #var set_tapedir_sel = nil;
79                                         #var set_tapedir = func {
80                                                 #if (set_tapedir_sel == nil)
81                                         var set_tapedir_sel = gui.DirSelector.new(
82                                                                 func(result) { setprop("/sim/replay/tape-directory", result.getValue()); },
83                                                                 "Select Tape Directory", "Ok", getprop("/sim/replay/tape-directory"));
84                                         set_tapedir_sel.open();
85                                         #}
86                                 </script>
87             </binding>
88         </button>
89                 <text>
90                         <row>1</row><col>0</col>
91                         <label>Author/Pilot:</label>
92                         <halign>left</halign>
93                 </text>
94                 <input>
95             <row>1</row><col>1</col>
96                         <halign>fill</halign>
97                         <length>30</length>
98                         <width>200</width>
99                         <stretch>true</stretch>
100             <property>/sim/gui/dialogs/flightrecorder/author-name</property>
101                 </input>
102
103 <!--
104                 <text>
105                         <row>1</row><col>0</col>
106                         <label>Quality:</label>
107                         <halign>left</halign>
108                 </text>
109         <combo>
110             <name>quality</name>
111             <halign>left</halign>
112             <row>1</row><col>1</col>
113             <pref-width>100</pref-width>
114             <property>/sim/gui/dialogs/flightrecorder/quality</property>
115             <editable>false</editable>
116             <value>maximum</value>
117             <value>medium</value>
118             <value>low</value>
119         </combo>
120
121                 <text>
122                         <row>2</row><col>0</col>
123                         <label>Time Range:</label>
124                         <halign>left</halign>
125                 </text>
126
127                 <group>
128                         <row>2</row><col>1</col><colspan>2</colspan>
129                         <layout>hbox</layout>
130                         <checkbox>
131                         <row>4</row><col>0</col>
132                                 <property>/sim/gui/dialogs/flightrecorder/save-all</property>
133                                 <label>All</label>
134                                 <name>save-all</name>
135                                 <binding>
136                                         <command>dialog-apply</command>
137                                         <object-name>save-all</object-name>
138                                 </binding>
139                         </checkbox>
140                         <text>
141                                 <label>From:</label>
142                                 <halign>right</halign>
143                                 <enable>
144                                         <not>
145                                                 <property>/sim/gui/dialogs/flightrecorder/save-all</property>
146                                         </not>
147                                 </enable>
148                         </text>
149                         <input>
150                                 <halign>left</halign>
151                                 <width>50</width>
152                                 <property>/sim/gui/dialogs/flightrecorder/start-time</property>
153                                 <enable>
154                                         <not>
155                                                 <property>/sim/gui/dialogs/flightrecorder/save-all</property>
156                                         </not>
157                                 </enable>
158                         </input>
159                         <text>
160                                 <label>To:</label>
161                                 <halign>right</halign>
162                                 <enable>
163                                         <not>
164                                                 <property>/sim/gui/dialogs/flightrecorder/save-all</property>
165                                         </not>
166                                 </enable>
167                         </text>
168                         <input>
169                                 <halign>left</halign>
170                                 <width>50</width>
171                                 <property>/sim/gui/dialogs/flightrecorder/stop-time</property>
172                                 <enable>
173                                         <not>
174                                                 <property>/sim/gui/dialogs/flightrecorder/save-all</property>
175                                         </not>
176                                 </enable>
177                         </input>
178                         <empty><stretch>1</stretch></empty>
179                 </group>
180 -->
181         <text>
182             <row>5</row>
183             <col>0</col>
184                         <colspan>3</colspan>
185             <label>Description:</label>
186             <halign>left</halign>
187             <valign>top</valign>
188         </text>
189         </group>
190
191         <group>
192         <layout>vbox</layout>
193                 <stretch>10</stretch>
194                 <halign>fill</halign>
195                 <valign>fill</valign>
196                 <textbox>
197                     <wrap>false</wrap>
198                     <live>false</live>
199                     <name>description-string</name>
200                         <halign>fill</halign>
201                         <valign>fill</valign>
202                     <stretch>1</stretch>
203                     <pref-width>550</pref-width>
204                     <pref-height>200</pref-height>
205                     <editable>true</editable>
206                         <top-line>1</top-line>
207                     <property>/sim/gui/dialogs/flightrecorder/description-string</property>
208                     <binding>
209                       <command>dialog-apply</command>
210                       <object-name>description-string</object-name>
211                     </binding>
212                   </textbox>
213     </group>
214
215         <!-- button area -->
216         <hrule/>
217         <group>
218                 <layout>hbox</layout>
219                 <default-padding>10</default-padding>
220                 <empty><stretch>true</stretch></empty>
221
222                 <button>
223                         <legend>Save</legend>
224                         <equal>true</equal>
225                         <binding>
226                                 <command>dialog-apply</command>
227                         </binding>
228                         <binding>
229                                 <command>nasal</command>
230                                 <script>
231                                         var descr     = getprop("/sim/gui/dialogs/flightrecorder/description-string");
232                                         var author    = getprop("/sim/gui/dialogs/flightrecorder/author-name");
233                                         var quality   = getprop("/sim/gui/dialogs/flightrecorder/quality");
234                                         var rangeall  = getprop("/sim/gui/dialogs/flightrecorder/save-all");
235                                         var starttime = getprop("/sim/gui/dialogs/flightrecorder/start-time");
236                                         var stoptime  = getprop("/sim/gui/dialogs/flightrecorder/stop-time");
237                                         if (rangeall)
238                                         {
239                                                 starttime="";stoptime="";
240                                         }
241                                         var Config = props.Node.new({
242                                                 "user-data":{ "description": descr, "author-name": author },
243                                                 "tape-data": { "quality": quality, "start": starttime, "stop": stoptime }
244                                                 });
245                                         fgcommand("save-tape", Config);
246                                 </script>
247                         </binding>
248                         <binding>
249                                 <command>dialog-close</command>
250                         </binding>
251         </button>
252
253         <button>
254           <legend>Cancel</legend>
255           <default>true</default>
256           <equal>true</equal>
257           <binding>
258             <command>dialog-close</command>
259           </binding>
260         </button>
261
262         <empty><stretch>true</stretch></empty>
263     </group>
264
265 </PropertyList>