move bg and style selection to top bar, and give a choice of styles
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundSelector.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:VBox
3         xmlns:mx="http://www.adobe.com/2006/mxml"
4         paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
5         horizontalAlign="left" backgroundColor="white" >
6         
7         <mx:List width="100%" height="100%" id="background" change="updateBackground();"> 
8             <!-- This should be pulled in from an XML file rather than sitting in the source -->
9             <mx:dataProvider>
10                 <mx:Object label="None" data="" />
11                 <mx:Object label="Yahoo!" data="yahoo" />
12                 <mx:Object label="New Popular Edition" data="http://npe.openstreetmap.org/$z/$x/$y.png" />
13                 <mx:Object label="OpenCycleMap" data="http://andy.sandbox.cloudmade.com/tiles/cycle/$z/$x/$y.png" />
14             </mx:dataProvider>
15         </mx:List>
16         <mx:CheckBox width="100%" label="Dim background" selected="true" id="dim"
17             change="Globals.vars.root.tileset.setDimming(dim.selected); Globals.vars.yahoo.alpha = dim.selected ? 0.5 : 1" />
18
19         <mx:Script><![CDATA[
20                 import net.systemeD.halcyon.*;
21                 import net.systemeD.halcyon.connection.*;
22                 import net.systemeD.potlatch2.*;
23                 import com.yahoo.maps.api.YahooMap;
24                 import com.yahoo.maps.api.YahooMapEvent;
25                 import com.yahoo.maps.api.core.location.LatLon;
26
27                 private function updateBackground():void {
28             var theMap:Map = Globals.vars.root;
29             var yahoo:YahooMap = Globals.vars.yahoo;
30                         var bg:String=background.selectedItem.data;
31                         if (bg=='yahoo') {
32                                 theMap.tileset.init('',false);
33                                 yahoo.visible=true;
34                                 yahoo.zoomLevel = 18-theMap.scale;
35                                 yahoo.centerLatLon = new LatLon(theMap.centre_lat, theMap.centre_lon);
36                         } else {
37                                 theMap.tileset.init(background.selectedItem.data,true);
38                                 yahoo.visible=false;
39                         }
40                 }
41
42     ]]></mx:Script>     
43 </mx:VBox>
44