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