Merge remote-tracking branch 'gravitystorm/sparkification'
authorRichard Fairhurst <richard@systemeD.net>
Sun, 25 Mar 2012 15:55:08 +0000 (16:55 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Sun, 25 Mar 2012 15:55:08 +0000 (16:55 +0100)
1  2 
net/systemeD/potlatch2/BackgroundSelector.mxml
net/systemeD/potlatch2/StyleSelector.mxml
net/systemeD/potlatch2/collections/Imagery.as
net/systemeD/potlatch2/collections/Stylesheets.as
net/systemeD/potlatch2/dialogs/BackgroundDialog.mxml
net/systemeD/potlatch2/dialogs/OptionsDialog.mxml
net/systemeD/potlatch2/dialogs/VectorSourceDialog.mxml
potlatch2.mxml

@@@ -18,8 -26,7 +26,8 @@@
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
                import net.systemeD.potlatch2.collections.Stylesheets;
 +              import net.systemeD.potlatch2.dialogs.*;
                import mx.core.*;
      ]]></fx:Script>
- </mx:VBox>
+ </s:BorderContainer>
  
@@@ -3,11 -3,16 +3,15 @@@ package net.systemeD.potlatch2.collecti
        import flash.events.EventDispatcher;
        import flash.events.Event;
        import flash.net.*;
 -      import net.systemeD.halcyon.DebugURLRequest;
 +      import net.systemeD.halcyon.FileBank;
        import net.systemeD.halcyon.Map;
+       import net.systemeD.halcyon.Stylesheet;
        import net.systemeD.potlatch2.FunctionKeyManager;
 -      import net.systemeD.potlatch2.Yahoo;
        import mx.collections.ArrayCollection;
  
+     /**
+     *  A collection of available stylesheets
+     */
        public class Stylesheets extends EventDispatcher {
  
          private static const GLOBAL_INSTANCE:Stylesheets = new Stylesheets();
  
                public function init(request_url:String=null):void {
                        // First, we set _selected in case it's needed before the stylesheet catalogue loads
-                       _selected=request_url;
-                       _selected=_selected ? _selected : SharedObject.getLocal("user_state").data['stylesheet_url'];
-                       _selected=_selected ? _selected : DEFAULT;
+                       var url:String = request_url;
+                       url = url ? url : SharedObject.getLocal("user_state").data['stylesheet_url'];
+                       url = url ? url : DEFAULT;
+                       _selected = new Stylesheet("Default", url);
                        
                        // Load the stylesheet catalogue
 -                      var request:DebugURLRequest = new DebugURLRequest("stylesheets.xml");
 -                      var loader:URLLoader = new URLLoader();
 -              loader.addEventListener(Event.COMPLETE, function(e:Event):void { onStylesheetsLoad(e,request_url); });
 -              loader.load(request.request);
 +            FileBank.getInstance().addFromFile("stylesheets.xml", function (fb:FileBank, name:String):void {
 +                onStylesheetsLoad(fb, name, request_url);
 +            });
                }
  
 -              private function onStylesheetsLoad(event:Event, request_url:String=null):void {
 -                      var xml:XML = new XML(URLLoader(event.target).data);
 +              private function onStylesheetsLoad(fileBank:FileBank, filename:String, request_url:String=null):void {
 +                      var xml:XML = new XML(fileBank.getAsString(filename));
                        var saved_url:String = SharedObject.getLocal("user_state").data['stylesheet_url'];
                        var saved_name:String= SharedObject.getLocal("user_state").data['stylesheet_name'];
                        if (request_url && request_url!=saved_url) { saved_url=request_url; saved_name='Custom'; }
      <mx:columns>
          <mx:DataGridColumn editable="true"  dataField="name" headerText="Name"/>
          <mx:DataGridColumn editable="true"  dataField="url" headerText="URL"/>
-         <mx:DataGridColumn editable="false" headerText="Key" width="70">
+         <mx:DataGridColumn editable="false" dataField="name" headerText="Key" width="70">
                        <mx:itemRenderer>
                                <fx:Component>
 -                              <mx:ComboBox
 -                                      selectedItem="{FunctionKeyManager.instance().getKeyFor(outerDocument.title,data.name)}"
 -                                  dataProvider="{FunctionKeyManager.fkeysCollection}"
 -                                      change="FunctionKeyManager.instance().setKeyFromFString(selectedItem as String,outerDocument.title,data.name)" />
 +                                      <mx:ComboBox
 +                                              selectedItem="{FunctionKeyManager.instance().getKeyFor(outerDocument.title,data.name)}"
 +                                          dataProvider="{FunctionKeyManager.fkeysCollection}"
 +                                              change="FunctionKeyManager.instance().setKeyFromFString(selectedItem as String,outerDocument.title,data.name)">
 +                                              <fx:Script><![CDATA[ import net.systemeD.potlatch2.FunctionKeyManager; ]]></fx:Script>
 +                                      </mx:ComboBox>
                                </fx:Component>
                        </mx:itemRenderer>
                </mx:DataGridColumn>
diff --cc potlatch2.mxml
Simple merge