/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
 * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt 
 * for the full text of the license. */

/**
* Class: OpenLayers.Control
* Controls affect the display or behavior of the map. They allow everything
* from panning and zooming to displaying a scale indicator.
*/
OpenLayers.Control = OpenLayers.Class.create();

OpenLayers.Control.TYPE_BUTTON = 1;
OpenLayers.Control.TYPE_TOGGLE = 2;
OpenLayers.Control.TYPE_TOOL   = 3;

OpenLayers.Control.prototype = {

    /** 
	 * Property: id 
	 * {String} 
	 */
	id: null,
    
    /** 
	 * Property: map 
     * {<OpenLayers.Map>} this gets set in the addControl() function in
     * OpenLayers.Map 
	 */
	map: null,

    /** 
	 * Property: div 
	 * {DOMElement} 
	 */
	div: null,

    /** 
	 * Property: type 
     * {OpenLayers.Control.TYPES} Controls can have a 'type'. The type
     * determines the type of interactions which are possible with them when
     * they are placed into a toolbar. 
	 */
	type: null, 

    /** 
	 * Property: displayClass 
     * {string}  This property is used for CSS related to the drawing of the
     * Control. 
	 */
	displayClass: "",

    /** 
	 * Property: active 
	 * {boolean} null
	 */
	active: null,

    /** 
	 * Property: handler 
	 * {<OpenLayers.Handler}> null
	 */
	handler: null,

    /**
     * Constructor: OpenLayers.Control
     * Create an OpenLayers Control.
     * 
     * Parameters:
     * options - {Object} 
     */
    initialize: function (options) {
        // We do this before the extend so that instances can override
        // className in options.
        this.displayClass = 
            this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, "");
        
        OpenLayers.Util.extend(this, options);
        
        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
    },

    /**
     * Method: destroy
     */
    destroy: function () {
        // eliminate circular references
        if (this.handler) {
            this.handler.destroy();
        }    
        this.map = null;
    },

    /** 
     * Method: setMap
     * Set the map property for the control. This is done through an accessor
     *   so that subclasses can override this and take special action once 
     *   they have their map variable set. 
     *
     * Parameters:
     * map - {<OpenLayers.Map>} 
     */
    setMap: function(map) {
        this.map = map;
        if (this.handler) {
            this.handler.setMap(map);
        }
    },
  
    /**
     * Method: draw 
     *
     * Parameters:
     * px - {<OpenLayers.Pixel>} 
     *
     * Return:
     * {DOMElement} A reference to the DIV DOMElement containing the control
     */
    draw: function (px) {
        if (this.div == null) {
            this.div = OpenLayers.Util.createDiv();
            this.div.id = this.id;
            this.div.className = this.displayClass;
        }
        if (px != null) {
            this.position = px.clone();
        }
        this.moveTo(this.position);        
        return this.div;
    },

    /**
     * Method: moveTo
     *
     * Parameters:
     * px - {<OpenLayers.Pixel>}
     */
    moveTo: function (px) {
        if ((px != null) && (this.div != null)) {
            this.div.style.left = px.x + "px";
            this.div.style.top = px.y + "px";
        }
    },

    /**
     * Method: activate
     * 
     * Return:
     * {Boolean}
     */
    activate: function () {
        if (this.active) {
            return false;
        }
        if (this.handler) {
            this.handler.activate();
        }
        this.active = true;
        return true;
    },
    
    /**
     * Method: deactivate
     * 
     * Return:
     * {Boolean}
     */
    deactivate: function () {
        if (this.active) {
            if (this.handler) {
                this.handler.deactivate();
            }
            this.active = false;
            return true;
        }
        return false;
    },
    
    /** @final @type String */
    CLASS_NAME: "OpenLayers.Control"
};

@@ -551,33 +551,36 @@
 e = %7B%0A%0A    /** %0A
-%09
+    
  * Property: id 
@@ -580,17 +580,20 @@
 ty: id %0A
-%09
+    
  * %7BStri
@@ -597,22 +597,28 @@
 tring%7D %0A
-%09 */%0A%09
+     */%0A    
 id: null
@@ -625,33 +625,36 @@
 ,%0A    %0A    /** %0A
-%09
+    
  * Property: map
@@ -750,22 +750,28 @@
 rs.Map %0A
-%09 */%0A%09
+     */%0A    
 map: nul
@@ -775,33 +775,36 @@
 null,%0A%0A    /** %0A
-%09
+    
  * Property: div
@@ -805,17 +805,20 @@
 y: div %0A
-%09
+    
  * %7BDOME
@@ -826,22 +826,28 @@
 ement%7D %0A
-%09 */%0A%09
+     */%0A    
 div: nul
@@ -851,33 +851,36 @@
 null,%0A%0A    /** %0A
-%09
+    
  * Property: typ
@@ -1070,22 +1070,28 @@
 olbar. %0A
-%09 */%0A%09
+     */%0A    
 type: nu
@@ -1097,33 +1097,36 @@
 ull, %0A%0A    /** %0A
-%09
+    
  * Property: dis
@@ -1230,22 +1230,28 @@
 ntrol. %0A
-%09 */%0A%09
+     */%0A    
 displayC
@@ -1262,33 +1262,36 @@
 : %22%22,%0A%0A    /** %0A
-%09
+    
  * Property: act
@@ -1295,17 +1295,20 @@
 active %0A
-%09
+    
  * %7Bbool
@@ -1317,22 +1317,28 @@
 n%7D null%0A
-%09 */%0A%09
+     */%0A    
 active: 
@@ -1353,17 +1353,20 @@
    /** %0A
-%09
+    
  * Prope
@@ -1379,17 +1379,20 @@
 andler %0A
-%09
+    
  * %7B%3COpe
@@ -1418,14 +1418,20 @@
 ull%0A
-%09 */%0A%09
+     */%0A    
 hand

replace tabs with spaces