Parse HTML links from jalview features file
[jalview.git] / src / jalview / appletgui / SeqCanvas.java
index 5afbe23..02c9990 100755 (executable)
@@ -37,12 +37,13 @@ public class SeqCanvas
 \r
   SearchResults searchResults = null;\r
 \r
-  int chunkHeight;\r
-  int chunkWidth;\r
-\r
   boolean fastPaint = false;\r
 \r
 \r
+  int cursorX = 0;\r
+  int cursorY = 0;\r
+\r
+\r
   public SeqCanvas(AlignViewport av)\r
   {\r
     this.av = av;\r
@@ -140,7 +141,7 @@ public class SeqCanvas
           continue;\r
         }\r
 \r
-        value = av.alignment.getSequenceAt(i).findPosition(index);\r
+        value = seq.findPosition(index);\r
         break;\r
       }\r
       if (value != -1)\r
@@ -293,6 +294,8 @@ public class SeqCanvas
   int LABEL_WEST, LABEL_EAST;\r
   public int getWrappedCanvasWidth(int cwidth)\r
   {\r
+      cwidth -= cwidth % av.charWidth;\r
+\r
       FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
       LABEL_EAST = 0;\r
@@ -333,15 +336,12 @@ public class SeqCanvas
 \r
     FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
-    int LABEL_EAST = 0;\r
 \r
     if (av.scaleRightWrapped)\r
     {\r
         LABEL_EAST = fm.stringWidth(getMask());\r
     }\r
 \r
-    int LABEL_WEST = 0;\r
-\r
     if (av.scaleLeftWrapped)\r
     {\r
         LABEL_WEST = fm.stringWidth(getMask());\r
@@ -359,12 +359,19 @@ public class SeqCanvas
     av.endRes = av.startRes + cWidth;\r
 \r
 \r
-    int endx = (startRes + cWidth) - 1;\r
+    int endx;\r
     int ypos = hgap;\r
 \r
 \r
     while ((ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
     {\r
+      endx = startRes + cWidth -1;\r
+\r
+      if (endx > al.getWidth())\r
+      {\r
+        endx = al.getWidth();\r
+      }\r
+\r
         g.setColor(Color.black);\r
 \r
         if (av.scaleLeftWrapped)\r
@@ -386,13 +393,6 @@ public class SeqCanvas
             drawNorthScale(g, startRes, endx, ypos);\r
         }\r
 \r
-\r
-        if (av.vconsensus!=null && av.alignment.getWidth() >= av.vconsensus.size())\r
-        {\r
-          endx = av.vconsensus.size() - 2;\r
-        }\r
-\r
-\r
         if(g.getClip()==null)\r
           g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);\r
 \r
@@ -406,7 +406,7 @@ public class SeqCanvas
           if(annotations==null)\r
             annotations = new AnnotationPanel(av);\r
 \r
-          annotations.drawComponent( g, startRes, endx + 1);\r
+          annotations.drawComponent( g, startRes, endx+1 );\r
           g.translate(0, -cHeight - ypos-4);\r
         }\r
         g.translate(-LABEL_WEST, 0);\r
@@ -415,12 +415,6 @@ public class SeqCanvas
 \r
 \r
         startRes += cWidth;\r
-        endx = (startRes + cWidth) - 1;\r
-\r
-        if (endx > al.getWidth())\r
-        {\r
-            endx = al.getWidth();\r
-        }\r
         }\r
 \r
   }\r
@@ -474,6 +468,14 @@ public class SeqCanvas
                                 av.charWidth, av.charHeight);\r
        }\r
    }\r
+\r
+   if (av.cursorMode && cursorY == i\r
+       && cursorX >= startRes && cursorX <= endRes)\r
+   {\r
+     sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * av.charWidth,\r
+                   offset + ( (i - startSeq) * av.charHeight));\r
+   }\r
+\r
   }\r
 \r
   //\r
@@ -493,7 +495,7 @@ public class SeqCanvas
       groupIndex = 0;\r
   }\r
 \r
-  if ( group != null)\r
+  if ( group != null )\r
   {\r
       do\r
       {\r
@@ -502,6 +504,7 @@ public class SeqCanvas
           boolean inGroup = false;\r
           int top = -1;\r
           int bottom = -1;\r
+          int alHeight = av.alignment.getHeight()-1;\r
 \r
           for (i = startSeq; i < endSeq; i++)\r
           {\r
@@ -519,11 +522,11 @@ public class SeqCanvas
                       group.sequences.contains(av.alignment.getSequenceAt(\r
                               i)))\r
               {\r
-                if (bottom == -1)\r
+                if ( (bottom == -1) &&\r
+                    (i >= alHeight ||\r
+                     !group.sequences.contains(\r
+                         av.alignment.getSequenceAt(i + 1))))\r
                 {\r
-                 if(i == endSeq-1 || // Dont check for i+1 if on the bottom row\r
-                  !group.sequences.contains(av.alignment.getSequenceAt(i+1 )))\r
-\r
                     bottom = sy + av.charHeight;\r
                 }\r
 \r