Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomPrev.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomPrev.java	(revision 42172)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomPrev.java	(revision 42173)
@@ -32,53 +32,52 @@
 
 /**
  * Extensi�n que cambia el extent de la vista al extent anterior.
- *
  */
 public class ZoomPrev extends Extension {
 
-    public void postInitialize() {
-    }
+  public void postInitialize() {}
 
-    public void initialize() {
-        IconThemeHelper.registerIcon("action", "view-navigation-zoom-back", this);
-    }
+  public void initialize() {
+    IconThemeHelper.registerIcon("action", "view-navigation-zoom-back", this);
+  }
 
-    public boolean isEnabled() {
-        ApplicationManager application = ApplicationLocator.getManager();
+  public boolean isEnabled() {
+    ApplicationManager application = ApplicationLocator.getManager();
 
-        IView view = (IView) application.getActiveComponent(ViewDocument.class);
-        if (view == null) {
-            return false;
-        }
-        ViewDocument document = view.getViewDocument();
-        ViewPort vp = document.getMapContext().getViewPort();
-        return vp.getEnvelopes().hasPrevious();
+    IView view = (IView) application.getActiveComponent(ViewDocument.class);
+    if (view == null) {
+      return false;
     }
+    ViewDocument document = view.getViewDocument();
+    ViewPort vp = document.getMapContext().getViewPort();
+    return vp.getEnvelopes().hasPrevious();
+  }
 
-    public boolean isVisible() {
-        ApplicationManager application = ApplicationLocator.getManager();
+  public boolean isVisible() {
+    ApplicationManager application = ApplicationLocator.getManager();
 
-        IView view = (IView) application.getActiveComponent(ViewDocument.class);
-        if (view == null) {
-            return false;
-        }
-        ViewDocument document = view.getViewDocument();
-        return document.getMapContext().getLayers().getLayersCount() > 0;
+    IView view = (IView) application.getActiveComponent(ViewDocument.class);
+    if (view == null) {
+      return false;
     }
+    ViewDocument document = view.getViewDocument();
+    return document.getMapContext().getLayers().getLayersCount() > 0;
+  }
 
-    public void execute(String arg0) {
-        ApplicationManager application = ApplicationLocator.getManager();
+  public void execute(String arg0) {
+    ApplicationManager application = ApplicationLocator.getManager();
 
-        IView view = (IView) application.getActiveComponent(ViewDocument.class);
-        if (view == null) {
-            return;
-        }
-        ViewDocument document = view.getViewDocument();
-        ViewPort vp = document.getMapContext().getViewPort();
-
-        vp.setPreviousEnvelope();
-        document.setModified(true);
-        ApplicationLocator.getManager().refreshMenusAndToolBars();
+    IView view = (IView) application.getActiveComponent(ViewDocument.class);
+    if (view == null) {
+      return;
     }
+    ViewDocument document = view.getViewDocument();
+    ViewPort vp = document.getMapContext().getViewPort();
 
+    vp.setPreviousEnvelope();
+    document.setModified(true);
+
+    ApplicationLocator.getManager().refreshMenusAndToolBars();
+  }
+
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomNext.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomNext.java	(revision 42172)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomNext.java	(revision 42173)
@@ -36,9 +36,9 @@
 public class ZoomNext extends Extension {
 
   public void initialize() {
-     IconThemeHelper.registerIcon("action", "view-navigation-zoom-next", this);
+    IconThemeHelper.registerIcon("action", "view-navigation-zoom-next", this);
   }
-  
+
   public boolean isEnabled() {
     ApplicationManager application = ApplicationLocator.getManager();
 
@@ -46,6 +46,7 @@
     if (view == null) {
       return false;
     }
+
     ViewDocument document = view.getViewDocument();
     ViewPort vp = document.getMapContext().getViewPort();
     return vp.getEnvelopes().hasNext();
@@ -74,6 +75,7 @@
 
     vp.setNextEnvelope();
     document.setModified(true);
+
     ApplicationLocator.getManager().refreshMenusAndToolBars();
   }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml	(revision 42172)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml	(revision 42173)
@@ -266,7 +266,6 @@
       </tool-bar>
     </extension>    
     
-    <!-- 
     <extension class-name="org.gvsig.app.extension.ZoomNext"
       description="Extensi�n encargada de gestionar los zooms siguientes al actual."
       active="true">
@@ -288,7 +287,6 @@
         <action-tool name="view-navigation-zoom-next"/>
       </tool-bar>
     </extension>
-     -->
     
     <extension class-name="org.gvsig.app.extension.InfoToolExtension"
       description="Extensi�n encargada de gestionar la herramienta de info."
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 42172)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 42173)
@@ -190,7 +190,7 @@
    * @see #getExtents()
    */
   protected ExtentHistory extentsHistory = new ExtentHistory();
-  
+
   /**
    * <p>
    * Size in <i>screen coordinates</i> of the rectangle where the image is
@@ -702,6 +702,7 @@
    */
   public void setPreviousEnvelope() {
     this.updateDrawVersion();
+    extentsHistory.putNext(extent);
     extent = extentsHistory.removePrev();
 
     // Calcula la transformaci�n af�n
@@ -722,6 +723,7 @@
    */
   public void setNextEnvelope() {
     this.updateDrawVersion();
+    extentsHistory.put(extent);
     extent = extentsHistory.removeNext();
 
     // Calcula la transformaci�n af�n
@@ -845,17 +847,21 @@
     if (this.extent != null && this.extent.equals(newExtent)) {
       return;
     }
+
     if (extent != null) {
-//      if (!extent.equals(extentsHistory.get()) && !extent.equals(extentsHistory.getNext()) ) {
-//        extentsHistory.clear();
-//      }
+      if (!extent.equals(extentsHistory.get())
+          && !extent.equals(extentsHistory.getNext())) {
+        extentsHistory.clear();
+      }
       extentsHistory.put(extent);
     }
+
     this.updateDrawVersion();
     this.extent = newExtent;
 
     // Calcula la transformaci�n af�n
     calculateAffineTransform();
+   
 
     // Lanzamos los eventos de extent cambiado
     callExtentChanged(getAdjustedExtent());
@@ -1485,7 +1491,6 @@
   public ExtentHistory getEnvelopes() {
     return extentsHistory;
   }
-  
 
   /**
    * <p>
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ExtentHistory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ExtentHistory.java	(revision 42172)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ExtentHistory.java	(revision 42173)
@@ -129,6 +129,20 @@
       }
     }
   }
+  
+  public void putNext(Rectangle2D ext) {
+    if ((ext != null) && ((numNext < 1) || (ext != extentsNext[numNext - 1])) ) {
+      if (numNext < (NUMREC)) {
+        extentsNext[numNext] = ext;
+        numNext++;
+      } else {
+        for (int i = 0; i < (NUMREC - 1); i++) {
+          extentsNext[i] = extentsNext[i+1];
+        }
+        extentsNext[numNext - 1] = ext;
+      }
+    }
+  }
 
   /**
    * <p>
@@ -166,14 +180,14 @@
 
     return ext;
   }
-  
+
   public Rectangle2D getNext() {
     if (numNext <= 0) {
       return null;
     }
-    
+
     Rectangle2D ext = extentsNext[numNext - 1];
-    
+
     return ext;
   }
 
@@ -189,16 +203,6 @@
     if (num <= 0) {
       return null;
     }
-    if (numNext < (NUMREC)) {
-      extentsNext[numNext] = extents[num - 1];
-      numNext++;
-    }
-    else {
-      for (int i = 0; i < (NUMREC - 1); i++) {
-        extentsNext[i] = extentsNext[i + 1];
-      }
-      extentsNext[numNext - 1] = extents[num - 1];
-    }
 
     Rectangle2D ext = extents[--num];
     return ext;
@@ -217,27 +221,14 @@
       return null;
     }
 
-    if (num < (NUMREC)) {
-      extents[num] = extentsNext[numNext - 1];
-    }
-    else {
-      for (int i = 0; i < (NUMREC - 1); i++) {
-        extents[i] = extents[i + 1];
-      }
-      extents[num - 1] = extentsNext[numNext - 1];
-    }
-
     Rectangle2D ext = extentsNext[--numNext];
     return ext;
   }
 
-  
   public void clear() {
-    num = 0;
     numNext = 0;
   }
 
-  
   public void loadFromState(PersistentState state) throws PersistenceException {
 
     num = state.getInt("num");
