JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / gui / SeqPanel.java
index 134e284..2df55ad 100644 (file)
@@ -74,8 +74,7 @@ import javax.swing.Timer;
 import javax.swing.ToolTipManager;
 
 /**
- * The main scrollable region containing the alignment and just to the right of
- * the IDPanel.
+ * DOCUMENT ME!
  * 
  * @author $author$
  * @version $Revision: 1.130 $
@@ -135,6 +134,7 @@ public class SeqPanel extends JPanel
       MousePos o = (MousePos) obj;
       boolean b = (column == o.column && seqIndex == o.seqIndex
               && annotationIndex == o.annotationIndex);
+      // System.out.println(obj + (b ? "= " : "!= ") + this);
       return b;
     }
 
@@ -224,7 +224,7 @@ public class SeqPanel extends JPanel
   SearchResultsI lastSearchResults;
 
   /**
-   * Create a new SeqPanel.
+   * Creates a new SeqPanel object
    * 
    * @param viewport
    * @param alignPanel
@@ -1504,6 +1504,7 @@ public class SeqPanel extends JPanel
         return;
       }
 
+      // System.out.print(y1+" "+y2+" "+fixedLeft+" "+fixedRight+"~~");
       // Selection spans a hidden region
       if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1))
       {
@@ -1943,21 +1944,12 @@ public class SeqPanel extends JPanel
   {
     lastMousePosition = null;
     ap.alignFrame.setStatus(" ");
-
     if (av.getWrapAlignment())
     {
       return;
     }
 
-    /*
-     * start scrolling if mouse dragging, whether the drag started
-     * in the scale panel or this panel
-     */
-    if (ap.getScalePanel().isMouseDragging())
-    {
-      ap.getScalePanel().mouseExited(e);
-    }
-    else if (mouseDragging && scrollThread == null)
+    if (mouseDragging && scrollThread == null)
     {
       startScrolling(e.getPoint());
     }
@@ -2432,22 +2424,29 @@ public class SeqPanel extends JPanel
               // if (!scrollOnce() {t.stop();}) gives compiler error :-(
               scrollThread.scrollOnce();
             }
+          }
+        });
+        t.addActionListener(new ActionListener()
+        {
+          @Override
+          public void actionPerformed(ActionEvent e)
+          {
             if (scrollThread == null)
             {
               // SeqPanel.stopScrolling called
-              ((Timer) e.getSource()).stop();
+              t.stop();
             }
           }
         });
         t.start();
       }
-      else
-      {
-        /*
-         * Java - run in a new thread
-         */
-        scrollThread.start();
-      }
+    }
+    else
+    {
+      /*
+       * Java - run in a new thread
+       */
+      scrollThread.start();
     }
   }
 
@@ -2771,45 +2770,4 @@ public class SeqPanel extends JPanel
   {
     return lastSearchResults;
   }
-
-  /**
-   * scroll to the given row/column - or nearest visible location
-   * 
-   * @param row
-   * @param column
-   */
-  public void scrollTo(int row, int column)
-  {
-
-    row = row < 0 ? ap.av.getRanges().getStartSeq() : row;
-    column = column < 0 ? ap.av.getRanges().getStartRes() : column;
-    ap.scrollTo(column, column, row, true, true);
-  }
-
-  /**
-   * scroll to the given row - or nearest visible location
-   * 
-   * @param row
-   */
-  public void scrollToRow(int row)
-  {
-
-    row = row < 0 ? ap.av.getRanges().getStartSeq() : row;
-    ap.scrollTo(ap.av.getRanges().getStartRes(),
-            ap.av.getRanges().getStartRes(), row, true, true);
-  }
-
-  /**
-   * scroll to the given column - or nearest visible location
-   * 
-   * @param column
-   */
-  public void scrollToColumn(int column)
-  {
-
-    column = column < 0 ? ap.av.getRanges().getStartRes() : column;
-    ap.scrollTo(column, column, ap.av.getRanges().getStartSeq(), true,
-            true);
-  }
-
 }