temp push
[jalview.git] / src / jalview / gui / SeqPanel.java
index 18e9365..85d6025 100644 (file)
@@ -77,7 +77,8 @@ import javax.swing.Timer;
 import javax.swing.ToolTipManager;
 
 /**
- * DOCUMENT ME!
+ * The main scrollable region containing the alignment and just to the right of
+ * the IDPanel.
  * 
  * @author $author$
  * @version $Revision: 1.130 $
@@ -137,7 +138,6 @@ 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;
     }
 
@@ -1610,7 +1610,6 @@ 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))
       {
@@ -2050,11 +2049,22 @@ public class SeqPanel extends JPanel
   {
     lastMousePosition = null;
     ap.alignFrame.setStatus(" ");
+
     if (av.getWrapAlignment())
     {
       return;
     }
 
+    // BH check was:
+//    /*
+//     * start scrolling if mouse dragging, whether the drag started
+//     * in the scale panel or this panel
+//     */
+//    if (mouseDragging || ap.getScalePanel().isMouseDragging())
+//    {
+//      startScrolling(new Point(e.getX(), 0));
+//    }
+
     if (mouseDragging && scrollThread == null)
     {
       startScrolling(e.getPoint());
@@ -2280,8 +2290,8 @@ public class SeqPanel extends JPanel
     if (sequence != null)
     {
       PopupMenu pop = new PopupMenu(ap, sequence, column);
-      pop.show(this, evt.getX(), evt.getY());
-    }
+    pop.show(this, evt.getX(), evt.getY());
+  }
   }
 
   /**
@@ -2839,7 +2849,7 @@ public class SeqPanel extends JPanel
      * Map sequence selection
      */
     SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av);
-    av.setSelectionGroup(sg != null && sg.getSize() > 0 ? sg : null);
+    av.setSelectionGroup(sg);
     av.isSelectionGroupChanged(true);
 
     /*
@@ -2876,4 +2886,45 @@ 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);
+  }
+
 }