JAL-1953 2.11.2 with Archeopteryx!
[jalview.git] / src / jalview / gui / OverviewPanel.java
index 1785e70..b3e3e66 100755 (executable)
@@ -87,12 +87,12 @@ public class OverviewPanel extends JPanel
     this.ap = alPanel;
 
     showHidden = Cache.getDefault(Preferences.SHOW_OV_HIDDEN_AT_START,
-            true);
+            false);
     if (showHidden)
     {
       od = new OverviewDimensionsShowHidden(av.getRanges(),
-            (av.isShowAnnotation()
-                    && av.getAlignmentConservationAnnotation() != null));
+              (av.isShowAnnotation()
+                      && av.getAlignmentConservationAnnotation() != null));
     }
     else
     {
@@ -171,22 +171,23 @@ public class OverviewPanel extends JPanel
       @Override
       public void mouseMoved(MouseEvent evt)
       {
-        if (!draggingBox)
-        // don't bother changing the cursor if we're dragging the box
-        // as we can't have moved inside or out of the box in that case
+        if (od.isPositionInBox(evt.getX(), evt.getY()))
         {
-          if (od.isPositionInBox(evt.getX(), evt.getY()))
-          {
-            // display drag cursor at mouse position
-            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
-          }
-          else
-          {
-            // reset cursor
-            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-          }
+          /*
+           * using HAND_CURSOR rather than DRAG_CURSOR 
+           * as the latter is not supported on Mac
+           */
+          getParent().setCursor(
+                  Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+        }
+        else
+        {
+          // reset cursor
+          getParent().setCursor(
+                  Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
         }
       }
+
     });
 
     addMouseListener(new MouseAdapter()
@@ -194,37 +195,38 @@ public class OverviewPanel extends JPanel
       @Override
       public void mousePressed(MouseEvent evt)
       {
+
+        if (Platform.isWinRightButton(evt))
+        {
+          showPopupMenu(evt);
+          return;
+        }
         if (SwingUtilities.isRightMouseButton(evt))
         {
-          if (!Platform.isAMacAndNotJS())
-          {
-               // BH - MAC L&F here - forces popup and cancels any drag operation
-            showPopupMenu(evt);
-          }
+          return;
         }
-        else
+        // don't do anything if the mouse press is in the overview's box
+        // (wait to see if it's a drag instead)
+        // otherwise update the viewport
+        if (!od.isPositionInBox(evt.getX(), evt.getY()))
         {
-          // don't do anything if the mouse press is in the overview's box
-          // (wait to see if it's a drag instead)
-          // otherwise update the viewport
-          if (!od.isPositionInBox(evt.getX(), evt.getY()))
-          {
-            draggingBox = false;
+          draggingBox = false;
 
-            // display drag cursor at mouse position
-            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+          // display drag cursor at mouse position
+          setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
 
-            od.updateViewportFromMouse(evt.getX(), evt.getY(),
-                    av.getAlignment().getHiddenSequences(),
-                    av.getAlignment().getHiddenColumns());
-          }
-          else
-          {
-            draggingBox = true;
-            od.setDragPoint(evt.getX(), evt.getY(),
-                    av.getAlignment().getHiddenSequences(),
-                    av.getAlignment().getHiddenColumns());
-          }
+          od.updateViewportFromMouse(evt.getX(), evt.getY(),
+                  av.getAlignment().getHiddenSequences(),
+                  av.getAlignment().getHiddenColumns());
+          getParent().setCursor(
+                  Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+        }
+        else
+        {
+          draggingBox = true;
+          od.setDragPoint(evt.getX(), evt.getY(),
+                  av.getAlignment().getHiddenSequences(),
+                  av.getAlignment().getHiddenColumns());
         }
       }
 
@@ -249,9 +251,10 @@ public class OverviewPanel extends JPanel
      * Javascript does not call componentResized on initial display,
      * so do the update here
      */
-    boolean doUpdate =  /** @j2sNative true || */ false;
-    if (doUpdate)
+    if (Platform.isJS())
+    {
       updateOverviewImage();
+    }
   }
 
   /*
@@ -321,7 +324,7 @@ public class OverviewPanel extends JPanel
       od.setWidth(getWidth());
       od.setHeight(getHeight() - progressPanel.getHeight());
     }
-    
+
     setPreferredSize(new Dimension(od.getWidth(),
             od.getHeight() + progressPanel.getHeight()));
 
@@ -330,11 +333,10 @@ public class OverviewPanel extends JPanel
       return;
     }
 
-    Thread thread = new Thread(this);
+    Thread thread = new Thread(this, "UpdateOverview");
     thread.start();
     repaint();
 
-    
   }
 
   @Override
@@ -405,8 +407,9 @@ public class OverviewPanel extends JPanel
        * close the parent frame (which also removes it from the
        * Desktop Windows menu)
        */
-      ((JInternalFrame) SwingUtilities.getAncestorOfClass(
-              JInternalFrame.class, (this))).setClosed(true);
+      ((JInternalFrame) SwingUtilities
+              .getAncestorOfClass(JInternalFrame.class, (this)))
+                      .setClosed(true);
     } catch (PropertyVetoException e)
     {
       // ignore