]> git.openstreetmap.org Git - potlatch2.git/blob - net/systemeD/potlatch2/options/OptionsDialog.mxml
Alter the remaining Application.application occurancies
[potlatch2.git] / net / systemeD / potlatch2 / options / OptionsDialog.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:TitleWindow
3         xmlns:mx="http://www.adobe.com/2006/mxml" 
4         layout="vertical" showCloseButton="true"
5         horizontalAlign="center" title="Options"
6         width="350" height="250" verticalGap="0">
7   <mx:Script><![CDATA[
8     import mx.managers.PopUpManager;
9     import mx.events.CloseEvent;
10     import mx.core.Application;
11     import mx.core.FlexGlobals;
12     import net.systemeD.halcyon.Globals;
13     import net.systemeD.halcyon.Map;
14     import net.systemeD.halcyon.connection.Connection;
15     import net.systemeD.halcyon.connection.StatusFetcher;
16     
17     public function init():void {
18         PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
19         PopUpManager.centerPopUp(this);
20         this.addEventListener(CloseEvent.CLOSE, optionsDialog_close);
21
22         var obj:SharedObject = SharedObject.getLocal("user_state");
23
24         tbcheck.selected = FlexGlobals.topLevelApplication.toolbox.visible;
25         cursorcheck.selected = FlexGlobals.topLevelApplication.theController.cursorsEnabled;
26         tigercheck.selected = obj.data['tiger_highlighted'];
27         latlongcheck.selected = FlexGlobals.topLevelApplication.coordsbox.visible;
28                 licencecheck.selected = Map(Globals.vars.root).editableLayer.connection.statusFetcher!=null;
29     }
30     
31     private function optionsDialog_close(evt:CloseEvent):void {
32         PopUpManager.removePopUp(this);
33     }
34
35     private function tigerToggle():void {
36         Globals.vars.highlightTiger = tigercheck.selected;
37         FlexGlobals.topLevelApplication.theMap.redraw();
38
39         var obj:SharedObject = SharedObject.getLocal("user_state");
40         obj.setProperty("tiger_highlighted",tigercheck.selected);
41         obj.flush();
42     }
43
44         private function licenceToggle():void {
45                 // ** FIXME: this is an inelegant patch for the short-term issue of highlighting licensing status
46                 var conn:Connection=Map(Globals.vars.root).editableLayer.connection;
47                 if (conn.statusFetcher) {
48                         conn.statusFetcher=null;
49                 } else {
50                         conn.statusFetcher=new StatusFetcher("http://wtfe.gryph.de/api/0.6/userlist",conn);
51                         conn.statusFetcher.fetch(conn.getAllLoadedEntities());
52                         // ** FIXME: needs to also switch map style
53                 }
54         }
55
56               ]]>
57   </mx:Script>
58         <mx:CheckBox width="100%" label="Show toolbox" selected="true" id="tbcheck"
59             change="FlexGlobals.topLevelApplication.toolbox.toggle()" />
60
61         <mx:CheckBox width="100%" label="Use custom cursors" selected="true" id="cursorcheck"
62             change="FlexGlobals.topLevelApplication.theController.cursorsEnabled=cursorcheck.selected" />
63
64     <mx:CheckBox width="100%" label="Highlight unedited TIGER (US roads)" selected="false" id="tigercheck"
65         change="tigerToggle()" />
66
67         <mx:CheckBox width="100%" label="Show mouse latitude/longitude" selected="false" id="latlongcheck" 
68                 change="FlexGlobals.topLevelApplication.coordsbox.visible=latlongcheck.selected" />
69
70     <mx:CheckBox width="100%" label="Show licence status" selected="false" id="licencecheck"
71         change="licenceToggle()" />
72
73   <mx:ControlBar>
74     <mx:Spacer width="100%"/>
75     <mx:Button label="Ok" click="PopUpManager.removePopUp(this);" styleName="titleWindowButton" />
76   </mx:ControlBar>
77
78 </mx:TitleWindow>