Add floating imagery window
[potlatch2.git] / net / systemeD / potlatch2 / BackgroundSelector.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <s:BorderContainer
3     xmlns:fx="http://ns.adobe.com/mxml/2009"
4     xmlns:s="library://ns.adobe.com/flex/spark">
5
6     <s:layout>
7       <s:VerticalLayout
8           paddingLeft="5" paddingRight="5"
9           paddingTop="5" paddingBottom="5"/>
10     </s:layout>
11
12     <s:List width="100%" height="100%" id="background"
13             labelField="name"
14             change="FlexGlobals.topLevelApplication.bgButton.close(); application.theMap.tileset.setBackgroundFromImagery(background.selectedItem,true);"
15             dataProvider="{Imagery.instance().getAvailableImagery(application.theMap)}"
16             selectedItem="{application.theMap.tileset.selected}">
17       <s:layout>
18         <s:VerticalLayout requestedRowCount="{Imagery.instance().getAvailableImagery(application.theMap).length}" gap="0" horizontalAlign="contentJustify"/>
19       </s:layout>
20     </s:List>
21
22     <s:HGroup width="100%" horizontalAlign="center">
23       <s:CheckBox label="Dim" selected="{application.theMap.getDimming()}" id="dim"
24           change="setDimming(dim.selected)" />
25       <s:CheckBox label="Sharpen" selected="{application.theMap.getSharpen()}" id="sharpen"
26           change="setSharpen(sharpen.selected)" />
27     </s:HGroup>
28
29     <s:HGroup width="100%" horizontalAlign="center">
30       <s:CheckBox label="Show floating window" id="showFloatingMap" selected="{application.floatingMap.visible}" 
31                   change="application.floatingMap.setFloatingMapVisible(showFloatingMap.selected);FlexGlobals.topLevelApplication.bgButton.close();" />
32     </s:HGroup>
33
34     <s:HGroup horizontalAlign="center">
35       <s:Button id="editLabel" label="Edit..." click="FlexGlobals.topLevelApplication.bgButton.close(); new BackgroundDialog().init('Background imagery',background,Imagery.instance());" />
36       <s:Button label="Vector file..." click="FlexGlobals.topLevelApplication.bgButton.close(); new VectorSourceDialog().init();" />
37     </s:HGroup>
38
39         <fx:Script><![CDATA[
40
41                 import net.systemeD.halcyon.*;
42                 import net.systemeD.halcyon.connection.*;
43                 import net.systemeD.potlatch2.*;
44                 import net.systemeD.potlatch2.dialogs.*;
45                 import net.systemeD.potlatch2.collections.Imagery;
46                 import mx.core.*;
47                 import mx.collections.ArrayCollection;
48                 import mx.managers.PopUpManager;
49
50                 [Bindable] private var application:Object = FlexGlobals.topLevelApplication;
51
52                 public function setDimming(v:Boolean):void {
53                         FlexGlobals.topLevelApplication.theMap.setDimming(dim.selected);
54                         var obj:SharedObject=SharedObject.getLocal("user_state","/");
55                         obj.setProperty('background_dim',v);
56                         try { obj.flush(); } catch (e:Error) {}
57                 }
58                 public function setSharpen(v:Boolean):void {
59                         FlexGlobals.topLevelApplication.theMap.setSharpen(sharpen.selected);
60                         var obj:SharedObject=SharedObject.getLocal("user_state","/");
61                         obj.setProperty('background_sharpen',v);
62                         try { obj.flush(); } catch (e:Error) {}
63                 }
64     ]]></fx:Script>
65 </s:BorderContainer>