custom imagery dialogue
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundSelector.mxml
index e85737e..75e3847 100644 (file)
@@ -2,40 +2,36 @@
 <mx:VBox
        xmlns:mx="http://www.adobe.com/2006/mxml"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
-       horizontalAlign="left" backgroundColor="white" >
+       horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
-       <mx:List width="100%" height="100%" id="background" change="updateBackground();"> 
-           <!-- This should be pulled in from an XML file rather than sitting in the source -->
-           <mx:dataProvider>
-               <mx:Object label="None" data="" />
-               <mx:Object label="Yahoo!" data="yahoo" />
-               <mx:Object label="New Popular Edition" data="http://npe.openstreetmap.org/$z/$x/$y.png" />
-               <mx:Object label="OpenCycleMap" data="http://andy.sandbox.cloudmade.com/tiles/cycle/$z/$x/$y.png" />
-           </mx:dataProvider>
-       </mx:List>
+       <mx:List width="100%" height="100%" id="background" change="updateBackground();" verticalScrollPolicy="on" 
+                dataProvider="{Application.application.theController.imagery}" />
        <mx:CheckBox width="100%" label="Dim background" selected="true" id="dim"
            change="Globals.vars.root.tileset.setDimming(dim.selected); Globals.vars.yahoo.alpha = dim.selected ? 0.5 : 1" />
 
+       <mx:HBox>
+       <mx:Button label="Edit..." click="new BackgroundDialog().init(background);" />
+       <mx:Button label="Vector file" click="new VectorSourceDialog().init();" />
+       </mx:HBox>
+
        <mx:Script><![CDATA[
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
-               import com.yahoo.maps.api.YahooMap;
-               import com.yahoo.maps.api.YahooMapEvent;
-               import com.yahoo.maps.api.core.location.LatLon;
+               import mx.core.*;
+               import mx.collections.ArrayCollection;
+               import mx.managers.PopUpManager;
+               import net.systemeD.halcyon.Globals;
 
                private function updateBackground():void {
             var theMap:Map = Globals.vars.root;
-            var yahoo:YahooMap = Globals.vars.yahoo;
                        var bg:String=background.selectedItem.data;
                        if (bg=='yahoo') {
                                theMap.tileset.init('',false);
-                               yahoo.visible=true;
-                               yahoo.zoomLevel = 18-theMap.scale;
-                               yahoo.centerLatLon = new LatLon(theMap.centre_lat, theMap.centre_lon);
+                               Globals.vars.yahoo.show();
                        } else {
                                theMap.tileset.init(background.selectedItem.data,true);
-                               yahoo.visible=false;
+                               Globals.vars.yahoo.hide();
                        }
                }