Debian Codegraph @

Aircraft/c172p/c172p-mice.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4 Copyright (c) 2015 onox
5
6 This program 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 2 of the License, or
9 (at your option) any later version.
10
11 This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
18 -->
19
20 <PropertyList>
21
22 <mouse n="0">
23
24 <mode n="0">
25 <button n="3">
26 <binding n="0">
27 <script></script>
28 </binding>
29 <binding n="1">
30 <condition>
31 <property>/sim/current-view/can-change-z-offset</property>
32 </condition>
33 <command>nasal</command>
34 <script>
35 var distance = getprop("/sim/current-view/z-offset-m");
36 var multiple = getprop("/sim/current-view/z-offset-inc-step");
37 var min_dist = getprop("/sim/current-view/z-offset-min-m");
38
39 # Round distance to a multiple of the step
40 distance = math.round(std.min(-min_dist, distance + multiple) / multiple) * multiple;
41 setprop("/sim/current-view/z-offset-m", distance);
42
43 gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
44 </script>
45 </binding>
46 <binding n="2">
47 <condition>
48 <and>
49 <not>
50 <property>/sim/current-view/can-change-z-offset</property>
51 </not>
52 <property>/devices/status/mice/mouse[0]/button[2]</property>
53 <not><property>/sim/mouse/right-button-mode-cycle-enabled</property></not>
54 </and>
55 </condition>
56 <command>nasal</command>
57 <script>view.decrease()</script>
58 </binding>
59 </button>
60
61 <button n="4">
62 <binding n="0">
63 <script></script>
64 </binding>
65 <binding n="1">
66 <condition>
67 <property>/sim/current-view/can-change-z-offset</property>
68 </condition>
69 <command>nasal</command>
70 <script>
71 var distance = getprop("/sim/current-view/z-offset-m");
72 var multiple = getprop("/sim/current-view/z-offset-dec-step");
73 var max_dist = getprop("/sim/current-view/z-offset-max-m");
74
75 # Round distance to a multiple of the step
76 distance = math.round(std.max(-max_dist, distance + multiple) / multiple) * multiple;
77 setprop("/sim/current-view/z-offset-m", distance);
78
79 gui.popupTip(sprintf("%d meter", abs(getprop("/sim/current-view/z-offset-m"))));
80 </script>
81 </binding>
82 <binding n="2">
83 <condition>
84 <and>
85 <not>
86 <property>/sim/current-view/can-change-z-offset</property>
87 </not>
88 <property>/devices/status/mice/mouse[0]/button[2]</property>
89 <not><property>/sim/mouse/right-button-mode-cycle-enabled</property></not>
90 </and>
91 </condition>
92 <command>nasal</command>
93 <script>view.increase()</script>
94 </binding>
95 </button>
96 </mode>
97
98 </mouse>
99
100 </PropertyList>