Debian Codegraph @

Aircraft/c172p/gui/dialogs/c172p-save.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2
3 <PropertyList>
4
5 <name>save</name>
6 <layout>vbox</layout>
7 <default-padding>1</default-padding>
8 <modal>false</modal>
9 <width>500</width>
10
11 <group>
12 <layout>hbox</layout>
13 <empty><stretch>true</stretch></empty>
14 <text><label>Save and Resume</label></text>
15 <empty><stretch>true</stretch></empty>
16 <button>
17 <legend>X</legend>
18 <key>Esc</key>
19 <halign>right</halign>
20 <pref-width>20</pref-width>
21 <pref-height>20</pref-height>
22 <binding>
23 <command>dialog-close</command>
24 </binding>
25 </button>
26 </group>
27
28 <hrule/>
29
30 <group>
31 <layout>table</layout>
32
33 <text>
34 <row>0</row>
35 <col>0</col>
36 <label>Slot</label>
37 </text>
38
39 <text>
40 <row>0</row>
41 <col>1</col>
42 <label>Description</label>
43 </text>
44
45 <text>
46 <row>0</row>
47 <col>2</col>
48 <label>Time</label>
49 </text>
50
51 <list>
52 <name>save-slots</name>
53 <row>1</row>
54 <col>0</col>
55 <pref-height>110</pref-height>
56 <property>/sim/gui/dialogs/c172p/save/selected</property>
57 <value>Slot 1</value>
58 <value>Slot 2</value>
59 <value>Slot 3</value>
60 <value>Slot 4</value>
61 <value>Slot 5</value>
62 <binding>
63 <command>dialog-apply</command>
64 <object-name>save-slots</object-name>
65 </binding>
66 <binding>
67 <command>nasal</command>
68 <script>read_description()</script>
69 </binding>
70 <binding>
71 <command>dialog-update</command>
72 <object-name>save-description</object-name>
73 </binding>
74 </list>
75
76 <textbox>
77 <row>1</row>
78 <col>1</col>
79 <name>save-description</name>
80 <halign>fill</halign>
81 <stretch>true</stretch>
82 <pref-width>200</pref-width>
83 <pref-height>100</pref-height>
84 <slider>0</slider>
85 <editable>true</editable>
86 <wrap>true</wrap>
87 <live>false</live>
88 <property>/sim/gui/dialogs/c172p/save/description</property>
89 </textbox>
90
91 <textbox>
92 <row>1</row>
93 <col>2</col>
94 <name>save-timestamp</name>
95 <halign>fill</halign>
96 <stretch>true</stretch>
97 <pref-width>150</pref-width>
98 <pref-height>100</pref-height>
99 <slider>0</slider>
100 <editable>false</editable>
101 <wrap>true</wrap>
102 <live>true</live>
103 <property>/sim/gui/dialogs/c172p/save/timestamp</property>
104 </textbox>
105 </group>
106
107 <empty>
108 <pref-height>4</pref-height>
109 </empty>
110
111 <hrule/>
112
113 <empty>
114 <pref-height>4</pref-height>
115 </empty>
116
117 <group>
118 <layout>table</layout>
119
120 <button>
121 <row>0</row>
122 <col>0</col>
123 <legend>Save</legend>
124 <binding>
125 <command>dialog-apply</command>
126 <object-name>save-description</object-name>
127 </binding>
128 <binding>
129 <command>nasal</command>
130 <script>c172p.save_state()</script>
131 </binding>
132 </button>
133
134 <button>
135 <row>0</row>
136 <col>1</col>
137 <legend>Resume</legend>
138 <binding>
139 <command>nasal</command>
140 <script>c172p.resume_state()</script>
141 </binding>
142 </button>
143 </group>
144
145 <empty>
146 <pref-height>12</pref-height>
147 </empty>
148
149 <hrule/>
150
151 <group>
152 <layout>hbox</layout>
153 <default-padding>6</default-padding>
154
155 <empty><stretch>true</stretch></empty>
156
157 <button>
158 <legend>Close</legend>
159 <equal>true</equal>
160 <key>Esc</key>
161 <default>true</default>
162 <binding>
163 <command>dialog-close</command>
164 </binding>
165 </button>
166 </group>
167
168 <nasal>
169 <open>
170 var read_description = func {
171 setprop("/save/description", "");
172 setprop("/save/timestring", "");
173
174 var string = "";
175 var sel_slot = getprop("/sim/gui/dialogs/c172p/save/selected");
176
177 if (sel_slot == "Slot 1") {string = "save1.xml";}
178 else if (sel_slot == "Slot 2") {string = "save2.xml";}
179 else if (sel_slot == "Slot 3") {string = "save3.xml";}
180 else if (sel_slot == "Slot 4") {string = "save4.xml";}
181 else if (sel_slot == "Slot 5") {string = "save5.xml";}
182
183 c172p.read_state_from_file(string);
184
185 var description = getprop("/save/description");
186 var timestamp = getprop("/save/timestring");
187
188 setprop("/sim/gui/dialogs/c172p/save/description", description);
189 setprop("/sim/gui/dialogs/c172p/save/timestamp", timestamp);
190 setprop("/sim/gui/dialogs/c172p/save/filename", string);
191 }
192 </open>
193 </nasal>
194
195 </PropertyList>