header updated
[jalview.git] / src / jalview / appletgui / AnnotationLabels.java
index 651d44c..0523d1f 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
@@ -29,6 +29,7 @@ public class AnnotationLabels
 {\r
   boolean active = false;\r
   AlignmentPanel ap;\r
+  AlignViewport av;\r
   boolean resizing = false;\r
   int oldY, mouseX;\r
   static String ADDNEW = "Add new row";\r
@@ -42,6 +43,7 @@ public class AnnotationLabels
   public AnnotationLabels(AlignmentPanel ap)\r
   {\r
     this.ap = ap;\r
+    this.av = ap.av;\r
     setLayout(null);\r
     addMouseListener(new MouseAdapter()\r
     {\r
@@ -52,6 +54,12 @@ public class AnnotationLabels
     });\r
   }\r
 \r
+  public AnnotationLabels(AlignViewport av)\r
+{\r
+  this.av = av;\r
+}\r
+\r
+\r
   public void setScrollOffset(int y)\r
   {\r
     scrollOffset = y;\r
@@ -60,7 +68,7 @@ public class AnnotationLabels
 \r
   public void actionPerformed(ActionEvent evt)\r
   {\r
-    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
 \r
     if (evt.getActionCommand().equals(HIDE))\r
     {\r
@@ -75,7 +83,7 @@ public class AnnotationLabels
     }\r
     else if (evt.getActionCommand().equals(OUTPUT_TEXT))\r
     {\r
-      CutAndPasteTransfer cap = new CutAndPasteTransfer(false);\r
+      CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);\r
       Frame frame = new Frame();\r
       frame.add(cap);\r
       jalview.bin.JalviewLite.addFrame(frame,\r
@@ -126,7 +134,7 @@ public class AnnotationLabels
     {\r
       pop.addSeparator();\r
       final CheckboxMenuItem cbmi = new CheckboxMenuItem(\r
-          "Ignore gaps in consensus",\r
+          "Ignore Gaps In Consensus",\r
           ap.av.getIgnoreGapsConsensus());\r
 \r
       cbmi.addItemListener(new ItemListener()\r
@@ -146,19 +154,20 @@ public class AnnotationLabels
 \r
   public void paint(Graphics g)\r
   {\r
-    drawComponent(g);\r
+    drawComponent(g, getSize().width);\r
   }\r
 \r
-  public void drawComponent(Graphics g)\r
+  public void drawComponent(Graphics g, int width)\r
   {\r
-    FontMetrics fm = g.getFontMetrics(g.getFont());\r
+    g.setFont(av.getFont());\r
+    FontMetrics fm = g.getFontMetrics(av.getFont());\r
     g.setColor(Color.white);\r
     g.fillRect(0, 0, getSize().width, getSize().height);\r
 \r
     g.translate(0, scrollOffset);\r
     g.setColor(Color.black);\r
 \r
-    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
     int y = g.getFont().getSize();\r
     int x = 0;\r
 \r
@@ -171,16 +180,16 @@ public class AnnotationLabels
           continue;\r
         }\r
 \r
-        x = getSize().width - fm.stringWidth(aa[i].label) - 3;\r
+        x = width - fm.stringWidth(aa[i].label) - 3;\r
 \r
-        if (aa[i].isGraph)\r
+        if (aa[i].graph>0)\r
         {\r
           y += (aa[i].height / 3);\r
         }\r
 \r
         g.drawString(aa[i].label, x, y);\r
 \r
-        if (aa[i].isGraph)\r
+        if (aa[i].graph>0)\r
         {\r
           y += (2 * aa[i].height / 3);\r
         }\r