Merge branch 'master' of github.com:systemed/potlatch2
[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                         maxHeight="{this.screen.height-120}"
17             selectedItem="{application.theMap.tileset.selected}">
18       <s:layout>
19         <s:VerticalLayout requestedRowCount="{Imagery.instance().getAvailableImagery(application.theMap).length}" gap="0" horizontalAlign="contentJustify"/>
20       </s:layout>
21     </s:List>
22
23     <s:HGroup width="100%" horizontalAlign="center">
24       <s:CheckBox label="Dim" selected="{application.theMap.getDimming()}" id="dim"
25           change="setDimming(dim.selected)" />
26       <s:CheckBox label="Sharpen" selected="{application.theMap.getSharpen()}" id="sharpen"
27           change="setSharpen(sharpen.selected)" />
28     </s:HGroup>
29
30     <s:HGroup width="100%" horizontalAlign="center">
31       <s:CheckBox label="Show floating window" id="showFloatingMap" selected="{application.floatingMap.visible}" 
32                   change="application.floatingMap.setFloatingMapVisible(showFloatingMap.selected);FlexGlobals.topLevelApplication.bgButton.close();" />
33     </s:HGroup>
34
35     <s:HGroup horizontalAlign="center">
36       <s:Button id="editLabel" label="Edit..." click="FlexGlobals.topLevelApplication.bgButton.close(); new BackgroundDialog().init('Background imagery',background,Imagery.instance());" />
37       <s:Button label="Vector file..." click="FlexGlobals.topLevelApplication.bgButton.close(); new VectorSourceDialog().init();" />
38     </s:HGroup>
39
40         <fx:Script><![CDATA[
41
42                 import net.systemeD.halcyon.*;
43                 import net.systemeD.halcyon.connection.*;
44                 import net.systemeD.potlatch2.*;
45                 import net.systemeD.potlatch2.dialogs.*;
46                 import net.systemeD.potlatch2.collections.Imagery;
47                 import mx.core.*;
48                 import mx.collections.ArrayCollection;
49                 import mx.managers.PopUpManager;
50
51                 [Bindable] private var application:Object = FlexGlobals.topLevelApplication;
52
53                 public function setDimming(v:Boolean):void {
54                         FlexGlobals.topLevelApplication.theMap.setDimming(dim.selected);
55                         var obj:SharedObject=SharedObject.getLocal("user_state","/");
56                         obj.setProperty('background_dim',v);
57                         try { obj.flush(); } catch (e:Error) {}
58                 }
59                 public function setSharpen(v:Boolean):void {
60                         FlexGlobals.topLevelApplication.theMap.setSharpen(sharpen.selected);
61                         var obj:SharedObject=SharedObject.getLocal("user_state","/");
62                         obj.setProperty('background_sharpen',v);
63                         try { obj.flush(); } catch (e:Error) {}
64                 }
65     ]]></fx:Script>
66 </s:BorderContainer>