user-definable function keys for background imagery and stylesheets
[potlatch2.git] / net / systemeD / potlatch2 / EditController.as
index 8315749..769b7c7 100644 (file)
@@ -2,7 +2,9 @@ package net.systemeD.potlatch2 {
     import net.systemeD.halcyon.Map;
     import net.systemeD.halcyon.MapController;
     import net.systemeD.halcyon.connection.*;
+    import net.systemeD.halcyon.VectorLayer;
     import net.systemeD.potlatch2.controller.*;
+    import net.systemeD.potlatch2.FunctionKeyManager;
        import mx.managers.CursorManager;
        import flash.events.*;
        import flash.geom.*;
@@ -31,10 +33,11 @@ package net.systemeD.potlatch2 {
                
         public function EditController(map:Map, tagViewer:TagViewer, toolbox:Toolbox) {
             this._map = map;
+            setState(new NoSelection());
             this.tagViewer = tagViewer;
                        this.toolbox = toolbox;
                        this.toolbox.init(this);
-            setState(new NoSelection());
+
             
             map.parent.addEventListener(MouseEvent.MOUSE_MOVE, mapMouseEvent);
             map.parent.addEventListener(MouseEvent.MOUSE_UP, mapMouseEvent);
@@ -57,9 +60,15 @@ package net.systemeD.potlatch2 {
         public function get connection():Connection {
             return _connection;
         }
-        
-               public function updateSelectionUI():void {
-                       tagViewer.setEntity(state.selection);
+
+        /**
+        * Updates the various user interfaces that change when the selection changes.
+        * Currently this is the TagViewer and the Toolbox
+        *
+        * @param layer Optionally pass the layer of the currently selected entity, eg for BugLayers
+        */
+               public function updateSelectionUI(layer:VectorLayer = null):void {
+                       tagViewer.setEntity(state.selection, layer);
                        toolbox.updateSelectionUI();
                }
         
@@ -70,6 +79,7 @@ package net.systemeD.potlatch2 {
         private function keyUpHandler(event:KeyboardEvent):void {
             trace("key code "+event.keyCode);
                        if (keys[event.keyCode]) { delete keys[event.keyCode]; }
+                       if (FunctionKeyManager.instance().handleKeypress(event.keyCode)) { return; }
             var newState:ControllerState = state.processKeyboardEvent(event);
             setState(newState);            
                }