Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java	(revision 20211)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java	(revision 20214)
@@ -91,13 +91,17 @@
  * 1.7 12-Dec-2009 - Change URL's changes for cookie and downgrade imgs resolution due to WMS changes
  * 1.8 xxx         - filter the mouse button 1 during georeferencing
- *                 - possibility to modify the auto-sourcing text just before upload 
  *                 - retry if getting a new cookie failed (10 times during 30 seconds)
  *                 - cookie expiration automatically detected and renewed (after 30 minutes)
  *                 - proper WMS layer cleanup at destruction (workaround for memory leak)
  *                 - new cache format (v3) storing original image and cropped image bbox + angle
- *                 - cache management compatible with previous v2 format
- *                 - raster image rotation using shift+ctrl key instead of ctrl
+ *                 - new cache format (v4) storing original image size for later rotation 
+ *                 - cache files read compatible with previous formats
+ *                 - raster image rotation issues fixed, now using shift+ctrl key instead of ctrl
  *                 - raster image adjustment using default system menu modifier (ctrl for windows) for Mac support
- *                 - from Clément Ménier, new option allowing an auto-selection of the first cadastre layer for grab  
+ *                 - from Erik Amzallag:
+ *                 -     possibility to modify the auto-sourcing text just before upload 
+ *                 - from Clément Ménier:
+ *                 -     new option allowing an auto-selection of the first cadastre layer for grab
+ *                 -     non-modal JDialog in MenuActionGrabPlanImage  
  */
 public class CadastrePlugin extends Plugin {
@@ -184,5 +188,5 @@
             cadastreJMenu.add(menuSettings);
             cadastreJMenu.add(menuSource);
-            cadastreJMenu.add(menuResetCookie);
+            //cadastreJMenu.add(menuResetCookie); not required any more
             //cadastreJMenu.add(menuLambertZone);
             cadastreJMenu.add(menuLoadFromCache);
Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 20211)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 20214)
@@ -8,6 +8,9 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
 
+import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -37,7 +40,10 @@
     private int cGetLambertCrosspieces = 2;
     private EastNorth ea1;
+    private EastNorth ea2;
     private long mouseClickedTime = 0;
     private EastNorth georefpoint1;
     private EastNorth georefpoint2;
+    private boolean ignoreMouseClick = false;
+    
     /**
      * The time which needs to pass between two clicks during georeferencing, in milliseconds
@@ -126,4 +132,5 @@
         if (e.getButton() != MouseEvent.BUTTON1)
             return;
+        if (ignoreMouseClick) return; // In case we are currently just allowing zooming to read lambert coordinates
         countMouseClicked++;
         EastNorth ea = Main.proj.latlon2eastNorth(Main.map.mapView.getLatLon(e.getX(), e.getY()));
@@ -146,15 +153,9 @@
             if (countMouseClicked == 1) {
                 ea1 = ea;
-                if (inputLambertPosition())
-                    continueGeoreferencing();
+                inputLambertPosition(); // This will automatically asks for second point and continue the georeferencing
             }
             if (countMouseClicked == 2) {
-                if (inputLambertPosition()) {
-                    Main.map.mapView.removeMouseListener(this);
-                    affineTransform(ea1, ea, georefpoint1, georefpoint2);
-                    wmsLayer.saveNewCache();
-                    Main.map.mapView.repaint();
-                    actionCompleted();
-                }
+                ea2 = ea;
+                inputLambertPosition(); // This will automatically ends the georeferencing
             }
         }
@@ -237,4 +238,15 @@
 	    }
 	    return true;
+    }
+    
+    /**
+     * Ends the georeferencing by computing the affine transformation
+     */
+    private void endGeoreferencing() {
+        Main.map.mapView.removeMouseListener(this);
+        affineTransform(ea1, ea2, georefpoint1, georefpoint2);
+        wmsLayer.saveNewCache();
+        Main.map.mapView.repaint();
+        actionCompleted();
     }
 
@@ -261,7 +273,9 @@
     }
 
-    private boolean inputLambertPosition() {
-        JLabel labelEnterPosition = new JLabel(tr("Enter cadastre east,north position"));
-        JLabel labelWarning = new JLabel(tr("(Warning: verify north with arrow !!)"));
+    private void inputLambertPosition() {
+        JLabel labelEnterPosition = new JLabel(
+                tr("Enter cadastre east,north position"));
+        JLabel labelWarning = new JLabel(
+                tr("(Warning: verify north with arrow !!)"));
         JPanel p = new JPanel(new GridBagLayout());
         JLabel labelEast = new JLabel(tr("East"));
@@ -275,28 +289,47 @@
         p.add(labelNorth, GBC.std().insets(0, 0, 10, 0));
         p.add(inputNorth, GBC.eol().fill(GBC.HORIZONTAL).insets(10, 5, 0, 5));
-        JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null);
+        final JOptionPane pane = new JOptionPane(p,
+                JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION,
+                null);
         String number;
-        if (countMouseClicked == 1) number = "first";
-        else number = "second";
-        pane.createDialog(Main.parent, tr("Set {0} Lambert coordinates",number)).setVisible(true);
-        if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) {
-            if (canceledOrRestartCurrAction("georeferencing"))
-                startGeoreferencing();
-            return false;
-        }
-        if (inputEast.getText().length() != 0 && inputNorth.getText().length() != 0) {
-            try {
-                double e = Double.parseDouble(inputEast.getText());
-                double n = Double.parseDouble(inputNorth.getText());
-                if (countMouseClicked == 1)
-                    georefpoint1 = new EastNorth(e, n);
-                else
-                    georefpoint2 = new EastNorth(e, n);
-                return true;
-            } catch (NumberFormatException e) {
-                return false;
-            }
-        }
-        return false;
+        if (countMouseClicked == 1)
+            number = "first";
+        else
+            number = "second";
+        JDialog dialog = pane.createDialog(Main.parent, tr(
+                "Set {0} Lambert coordinates", number));
+        dialog.setModal(false);
+        ignoreMouseClick = true; // To avoid mouseClicked from being called
+                                 // during coordinates reading
+        dialog.setAlwaysOnTop(true);
+        dialog.setVisible(true);
+        pane.addPropertyChangeListener(new PropertyChangeListener() {
+            public void propertyChange(PropertyChangeEvent evt) {
+                if (JOptionPane.VALUE_PROPERTY.equals(evt.getPropertyName())) {
+                    ignoreMouseClick = false;
+                    if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(
+                            pane.getValue())) {
+                        if (canceledOrRestartCurrAction("georeferencing"))
+                            startGeoreferencing();
+                    }
+                    if (inputEast.getText().length() != 0
+                            && inputNorth.getText().length() != 0) {
+                        try {
+                            double e = Double.parseDouble(inputEast.getText());
+                            double n = Double.parseDouble(inputNorth.getText());
+                            if (countMouseClicked == 1) {
+                                georefpoint1 = new EastNorth(e, n);
+                                continueGeoreferencing();
+                            } else {
+                                georefpoint2 = new EastNorth(e, n);
+                                endGeoreferencing();
+                            }
+                        } catch (NumberFormatException e) {
+                            return;
+                        }
+                    }
+                }
+            }
+        });
     }
 
