indicate which registry timed out.
[jalview.git] / src / jalview / appletgui / AnnotationPanel.java
index aef6511..38e0331 100755 (executable)
@@ -59,7 +59,13 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
   int imgWidth = 0;
 
   boolean fastPaint = false;
+  //Used For mouse Dragging and resizing graphs
+  int graphStretch = -1;
 
+  int graphStretchY = -1;
+  
+  boolean mouseDragging=false;
+  
   public static int GRAPH_HEIGHT = 40;
 
   boolean MAC = false;
@@ -262,6 +268,13 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
         {
           activeRow = i;
         }
+                else if (aa[i].graph > 0)
+        {
+          // Stretch Graph
+          graphStretch = i;
+          graphStretchY = evt.getY();
+        }
+        
 
         break;
       }
@@ -307,6 +320,9 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
 
   public void mouseReleased(MouseEvent evt)
   {
+    graphStretch = -1;
+    graphStretchY = -1;
+    mouseDragging = false;
     ap.scalePanel.mouseReleased(evt);
   }
 
@@ -316,7 +332,22 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
 
   public void mouseDragged(MouseEvent evt)
   {
-    ap.scalePanel.mouseDragged(evt);
+    if (graphStretch > -1)
+    {
+      av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
+              - evt.getY();
+      if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
+      {
+        av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
+      }
+      graphStretchY = evt.getY();
+      adjustPanelHeight();
+      ap.paintAlignment(true);
+    }
+    else
+    {
+      ap.scalePanel.mouseDragged(evt);
+    }
   }
 
   public void mouseMoved(MouseEvent evt)
@@ -720,7 +751,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
                 x1 += av.charWidth / 2;
               }
 
-              if (row.annotations[column] == null
+              if (!validRes || row.annotations[column] == null
                       || row.annotations[column].secondaryStructure != 'H')
               {
                 g.fillArc((x * av.charWidth) - av.charWidth, y + 4
@@ -852,7 +883,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
         }
       }
 
-      if (row.graph > 0)
+      if (row.graph > 0 && row.graphHeight> 0)
       {
         if (row.graph == AlignmentAnnotation.LINE_GRAPH)
         {