Merge branch 'master' into snapshotserver
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundSelector.mxml
index 1e899a713c8ec4e5f108e15a46ce5ecf95389ae9..2c483390bf15a7e5b6f1035ea24c2a5dfb850aa8 100644 (file)
@@ -4,44 +4,46 @@
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
-       <mx:List width="100%" height="100%" id="background" change="updateBackground();" verticalScrollPolicy="on" 
-                dataProvider="{_layers}" />
-       <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:List width="100%" height="100%" id="background"
+                       labelField="name"
+                       change="Application.application.bgButton.close(); Imagery.instance().setBackground(background.selectedItem);"
+               dataProvider="{Imagery.instance().getAvailableImagery()}"
+               rowCount="{Imagery.instance().getAvailableImagery().length}"/>
+       <mx:HBox>
+       <mx:CheckBox width="100%" label="Dim" selected="{Application.application.theMap.getDimming()}" id="dim"
+           change="setDimming(dim.selected)" />
+       <mx:CheckBox width="100%" label="Sharpen" selected="{Application.application.theMap.getSharpen()}" id="sharpen"
+           change="setSharpen(sharpen.selected)" />
+       </mx:HBox>
 
-       <mx:Button label="Load vector file..." click="new VectorSourceDialog().init();"/>
+       <mx:HBox>
+       <mx:Button label="Edit..." click="Application.application.bgButton.close(); new BackgroundDialog().init('Background imagery',background,Imagery.instance());" />
+       <mx:Button label="Vector file..." click="Application.application.bgButton.close(); new VectorSourceDialog().init();" />
+       </mx:HBox>
 
        <mx:Script><![CDATA[
+
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
+               import net.systemeD.potlatch2.collections.Imagery;
                import mx.core.*;
                import mx.collections.ArrayCollection;
                import mx.managers.PopUpManager;
-               import net.systemeD.halcyon.Globals;
-
-               [Bindable] private var _layers:Array=new Array(
-                       { label: "None", data: "" },
-                       { label: "Yahoo", data: "yahoo" } );
 
-               public function populate(xml:XML):void {
-            for each(var set:XML in xml.set) {
-                _layers.push({ label:set.child("name"), data:set.child("url") });
-            }           
+               public function setDimming(v:Boolean):void {
+                       Application.application.theMap.setDimming(dim.selected);
+                       Application.application.yahoo.alpha = dim.selected ? 0.5 : 1;
+                       var obj:SharedObject=SharedObject.getLocal("user_state");
+                       obj.setProperty('background_dim',v);
+                       obj.flush();
                }
-
-               private function updateBackground():void {
-            var theMap:Map = Globals.vars.root;
-                       var bg:String=background.selectedItem.data;
-                       if (bg=='yahoo') {
-                               theMap.tileset.init('',false);
-                               Globals.vars.yahoo.show();
-                       } else {
-                               theMap.tileset.init(background.selectedItem.data,true);
-                               Globals.vars.yahoo.hide();
-                       }
+               public function setSharpen(v:Boolean):void {
+                       Application.application.theMap.setSharpen(sharpen.selected);
+                       var obj:SharedObject=SharedObject.getLocal("user_state");
+                       obj.setProperty('background_sharpen',v);
+                       obj.flush();
                }
-
     ]]></mx:Script>    
 </mx:VBox>