Remove development code
[jalview.git] / src / jalview / gui / SeqCanvas.java
index 3cf7f9a..7f9ee97 100755 (executable)
@@ -43,8 +43,6 @@ public class SeqCanvas extends JComponent
     AlignViewport av;\r
     boolean displaySearch = false;\r
     int[] searchResults = null;\r
-    int chunkHeight;\r
-    int chunkWidth;\r
     boolean fastPaint = false;\r
     int LABEL_WEST;\r
     int LABEL_EAST;\r
@@ -191,8 +189,12 @@ public class SeqCanvas extends JComponent
             return;\r
         }\r
 \r
-        gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth,\r
-            -vertical * av.charHeight);\r
+        gg.copyArea(horizontal * av.charWidth,\r
+                    vertical * av.charHeight,\r
+                    imgWidth,\r
+                    imgHeight,\r
+                    -horizontal * av.charWidth,\r
+                    -vertical * av.charHeight);\r
 \r
         int sr = av.startRes;\r
         int er = av.endRes;\r
@@ -290,11 +292,6 @@ public class SeqCanvas extends JComponent
         gg.setColor(Color.white);\r
         gg.fillRect(0, 0, imgWidth, imgHeight);\r
 \r
-        chunkWidth = getWrappedCanvasWidth(getWidth());\r
-        chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
-\r
-        av.setChunkHeight(chunkHeight);\r
-        av.setChunkWidth(chunkWidth);\r
 \r
         if (av.getWrapAlignment())\r
         {\r
@@ -381,16 +378,25 @@ public class SeqCanvas extends JComponent
             LABEL_WEST = fm.stringWidth(getMask());\r
         }\r
 \r
+        int hgap = av.charHeight;\r
+        if(av.scaleAboveWrapped)\r
+          hgap += av.charHeight;\r
+\r
         int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
-        int cHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
+        int cHeight = av.getAlignment().getHeight() * av.charHeight;\r
+\r
+        av.setWrappedWidth(cWidth);\r
 \r
         av.endRes = av.startRes + cWidth;\r
 \r
+\r
         int endx = (startRes + cWidth) - 1;\r
-        int ypos = 2 * av.charHeight;\r
+        int ypos = hgap;\r
+\r
 \r
         while ((ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
         {\r
+            g.setFont(av.getFont());\r
             g.setColor(Color.black);\r
 \r
             if (av.scaleLeftWrapped)\r
@@ -426,11 +432,30 @@ public class SeqCanvas extends JComponent
                     cWidth * av.charWidth, (int) clip.getBounds().getHeight());\r
             }\r
 \r
+            if (av.vconsensus!=null && av.alignment.getWidth() >= av.vconsensus.size())\r
+            {\r
+              endx = av.vconsensus.size() - 2;\r
+            }\r
+\r
+\r
             drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
+\r
+            if(av.showAnnotation)\r
+            {\r
+              g.translate(0, cHeight + ypos + 3);\r
+              if(annotations==null)\r
+                annotations = new AnnotationPanel(av);\r
+\r
+              annotations.drawComponent( (Graphics2D) g, startRes, endx + 1);\r
+              g.translate(0, -cHeight - ypos);\r
+            }\r
             g.setClip(clip);\r
             g.translate(-LABEL_WEST, 0);\r
 \r
-            ypos += cHeight;\r
+            ypos += cHeight+getAnnotationHeight()+hgap;\r
+            if(av.showAnnotation)\r
+              ypos -= 3;\r
+\r
             startRes += cWidth;\r
             endx = (startRes + cWidth) - 1;\r
 \r
@@ -441,6 +466,18 @@ public class SeqCanvas extends JComponent
         }\r
     }\r
 \r
+    AnnotationPanel annotations;\r
+    int getAnnotationHeight()\r
+    {\r
+      if(!av.showAnnotation)\r
+        return 0;\r
+\r
+      if(annotations==null)\r
+        annotations = new AnnotationPanel(av);\r
+\r
+      return annotations.adjustPanelHeight();\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -453,24 +490,51 @@ public class SeqCanvas extends JComponent
      * @param starty DOCUMENT ME!\r
      * @param offset DOCUMENT ME!\r
      */\r
+\r
+    float aaRatio = 2f/3f;\r
+    public void increaseAARatio()\r
+    {\r
+      aaRatio += .025;\r
+      if(aaRatio>1)\r
+        aaRatio = 1;\r
+\r
+      repaint();\r
+    }\r
+\r
+    public void decreaseAARation()\r
+    {\r
+      aaRatio -= .025;\r
+      if(aaRatio<0)\r
+        aaRatio = 0;\r
+\r
+      repaint();\r
+    }\r
+\r
     synchronized public void drawPanel(Graphics g1, int x1, int x2, int y1,\r
         int y2, int startx, int starty, int offset)\r
     {\r
         Graphics2D g = (Graphics2D) g1;\r
         g.setFont(av.getFont());\r
 \r
-        SequenceI nextSeq;\r
+\r
+  SequenceI nextSeq;\r
+\r
 \r
         /// First draw the sequences\r
         /////////////////////////////\r
         for (int i = y1; i < y2; i++)\r
         {\r
             nextSeq = av.alignment.getSequenceAt(i);\r
+            g.setFont(av.getFont());\r
+\r
 \r
             sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq),\r
-                x1, x2, (x1 - startx) * av.charWidth,\r
-                offset + ((i - starty) * av.charHeight), av.charWidth,\r
-                av.charHeight);\r
+                            x1, x2, (x1 - startx) * av.charWidth,\r
+                            offset + ( (i - starty) * av.charHeight), av.charWidth,\r
+                            av.charHeight);\r
+\r
+\r
+\r
 \r
             if (av.showSequenceFeatures)\r
             {\r