| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
<PropertyList> |
| 30 |
|
| 31 |
<checkbox-toggle-template> |
| 32 |
<name></name> |
| 33 |
<label></label> |
| 34 |
<property></property> |
| 35 |
<binding> |
| 36 |
<command>dialog-apply</command> |
| 37 |
<object-name></object-name> |
| 38 |
</binding> |
| 39 |
</checkbox-toggle-template> |
| 40 |
|
| 41 |
|
| 42 |
<zoom-template> |
| 43 |
<button> |
| 44 |
<name>zoomout</name> |
| 45 |
<legend>-</legend> |
| 46 |
<pref-width>22</pref-width> |
| 47 |
<pref-height>22</pref-height> |
| 48 |
|
| 49 |
<binding> |
| 50 |
<command>property-adjust</command> |
| 51 |
<property></property> |
| 52 |
<min>0</min> |
| 53 |
<step>-1</step> |
| 54 |
</binding> |
| 55 |
</button> |
| 56 |
|
| 57 |
<text> |
| 58 |
<label>MMMM</label> |
| 59 |
<halign>center</halign> |
| 60 |
<format>Zoom %d</format> |
| 61 |
<property></property> |
| 62 |
<live>true</live> |
| 63 |
</text> |
| 64 |
|
| 65 |
<button> |
| 66 |
<name>zoomin</name> |
| 67 |
<legend>+</legend> |
| 68 |
<pref-width>22</pref-width> |
| 69 |
<pref-height>22</pref-height> |
| 70 |
|
| 71 |
<binding> |
| 72 |
<command>property-adjust</command> |
| 73 |
<property></property> |
| 74 |
<step>1</step> |
| 75 |
<max></max> |
| 76 |
</binding> |
| 77 |
</button> |
| 78 |
|
| 79 |
<empty><stretch>true</stretch></empty> |
| 80 |
|
| 81 |
</zoom-template> |
| 82 |
|
| 83 |
<nasal> |
| 84 |
<load><![CDATA[ |
| 85 |
var my_canvas = canvas.get(cmdarg()); |
| 86 |
my_canvas.setColorBackground(0.2, 0.5, 0.2, 0.5); #TODO: support customization in XML |
| 87 |
|
| 88 |
var root = my_canvas.createGroup(); |
| 89 |
# the top level AirportMap element uses a "GenericMap" now: |
| 90 |
|
| 91 |
#TODO: features should be procedurally enabled via params (WIP) |
| 92 |
#TODO: use generic Map and instantiate via XML |
| 93 |
var map = canvas.GenericMap.new(parent:root, name:dialog_name) # FIXME: We shouldn't be using AirportMap here: |
| 94 |
# we need a high level wrapper that can instantiate |
| 95 |
# all sorts of maps, not just AirportMaps |
| 96 |
.setTranslation(300, 200) # TODO: move to Map class ctor! |
| 97 |
.setupZoom( dialog:DIALOG_CANVAS ) # TODO: make zooming configurable for non GUI use |
| 98 |
.pickupFeatures (DIALOG_CANVAS); # set up the features specified in the XML file |
| 99 |
|
| 100 |
var offset = [0,0]; |
| 101 |
my_canvas.addEventListener("drag", func(e) |
| 102 |
{ |
| 103 |
offset[0] += e.deltaX; |
| 104 |
offset[1] += e.deltaY; |
| 105 |
map.setTranslation(300 + offset[0], 200 + offset[1]); |
| 106 |
}); |
| 107 |
|
| 108 |
my_canvas.addEventListener("wheel", func(e) |
| 109 |
{ |
| 110 |
map.zoom_property.setIntValue(map.zoom_property.getValue() + e.deltaY ); |
| 111 |
}); |
| 112 |
|
| 113 |
canvas.run_callbacks(); # WORKAROUND to run dialog-specific init code - |
| 114 |
# must be set up via register_callback() in the dialog's open block currently |
| 115 |
]]> |
| 116 |
</load> |
| 117 |
</nasal> |
| 118 |
</PropertyList> |