X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=b11838ce2473dbee03b7add60370998a907b96ec;hb=fb1cdebe4a9d93839c81a2d3eb39e8da9cb83d64;hp=2451a964763c92692084ea10dadfb2d67223980b;hpb=521ce3c96d5977a9bd941894eda7a13dd09deea9;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 2451a96..b11838c 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.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) 2007 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 @@ -18,20 +18,17 @@ */ package jalview.gui; -import jalview.datamodel.*; - -import jalview.jbgui.*; - -import jalview.schemes.*; +import java.beans.*; +import java.io.*; import java.awt.*; import java.awt.event.*; import java.awt.print.*; - -import java.io.*; - import javax.swing.*; +import jalview.datamodel.*; +import jalview.jbgui.*; +import jalview.schemes.*; /** * DOCUMENT ME! @@ -39,8 +36,8 @@ import javax.swing.*; * @author $author$ * @version $Revision$ */ -public class AlignmentPanel extends GAlignmentPanel - implements AdjustmentListener, Printable +public class AlignmentPanel + extends GAlignmentPanel implements AdjustmentListener, Printable { public AlignViewport av; OverviewPanel overviewPanel; @@ -81,165 +78,48 @@ public class AlignmentPanel extends GAlignmentPanel annotationPanel = new AnnotationPanel(this); alabels = new AnnotationLabels(this); - annotationScroller.setViewportView(annotationPanel); annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER); - fontChanged(); - scalePanelHolder.add(scalePanel, BorderLayout.CENTER); seqPanelHolder.add(seqPanel, BorderLayout.CENTER); setScrollValues(0, 0); - adjustAnnotationHeight(); - setAnnotationVisible(av.getShowAnnotation()); hscroll.addAdjustmentListener(this); vscroll.addAdjustmentListener(this); - af.addKeyListener(new KeyAdapter() + final AlignmentPanel ap = this; + av.addPropertyChangeListener(new PropertyChangeListener() { - public void keyPressed(KeyEvent evt) + public void propertyChange(PropertyChangeEvent evt) { - if(av.cursorMode - && evt.getKeyCode()>=KeyEvent.VK_0 - && evt.getKeyCode()<=KeyEvent.VK_9) + if (evt.getPropertyName().equals("alignment")) { - seqPanel.numberPressed(evt.getKeyChar()); + PaintRefresher.Refresh(ap, + av.getSequenceSetId(), + true, + true); + alignmentChanged(); } + } + }); - switch (evt.getKeyCode()) - { - case 27: // escape key - alignFrame.deselectAllSequenceMenuItem_actionPerformed(null); - - break; - - case KeyEvent.VK_DOWN: - if(av.cursorMode) - { - seqPanel.moveCursor(0,1); - } - else - alignFrame.moveSelectedSequences(false); - break; - - case KeyEvent.VK_UP: - if (av.cursorMode) - { - seqPanel.moveCursor(0,-1); - } - else - alignFrame.moveSelectedSequences(true); - break; - - case KeyEvent.VK_LEFT: - if(av.cursorMode) - { - seqPanel.moveCursor(-1,0); - } - break; - - case KeyEvent.VK_RIGHT: - if (av.cursorMode) - { - seqPanel.moveCursor(1,0); - } - break; - - case KeyEvent.VK_SPACE: - if(av.cursorMode) - { - seqPanel.insertGapAtCursor(evt.isControlDown() || evt.isShiftDown()); - } - break; - - case KeyEvent.VK_DELETE: - case KeyEvent.VK_BACK_SPACE: - if(!av.cursorMode) - { - alignFrame.cut_actionPerformed(null); - seqPanel.seqCanvas.repaint(); - } - else - seqPanel.deleteGapAtCursor(evt.isControlDown() || evt.isShiftDown()); - - break; + fontChanged(); + adjustAnnotationHeight(); - case KeyEvent.VK_S: - if(av.cursorMode) - { - seqPanel.setCursorRow(); - } - break; - case KeyEvent.VK_C: - if(av.cursorMode && !evt.isControlDown()) - { - seqPanel.setCursorColumn(); - } - break; - case KeyEvent.VK_P: - if(av.cursorMode) - { - seqPanel.setCursorPosition(); - } - break; + } - case KeyEvent.VK_ENTER: - case KeyEvent.VK_COMMA: - if(av.cursorMode) - { - seqPanel.setCursorRowAndColumn(); - } - break; + public void alignmentChanged() + { + av.alignmentChanged(this); - case KeyEvent.VK_Q: - if(av.cursorMode) - { - seqPanel.setSelectionAreaAtCursor(true); - } - break; - case KeyEvent.VK_M: - if(av.cursorMode) - { - seqPanel.setSelectionAreaAtCursor(false); - } - break; - - case KeyEvent.VK_F2: - av.cursorMode = ! av.cursorMode; - alignFrame.statusBar.setText("Keyboard editing mode is "+ - (av.cursorMode ? "on" : "off")); - if(av.cursorMode) - { - seqPanel.seqCanvas.cursorX = av.startRes; - seqPanel.seqCanvas.cursorY = av.startSeq; - } - seqPanel.seqCanvas.repaint(); - break; - - case KeyEvent.VK_F1: - try - { - ClassLoader cl = jalview.gui.Desktop.class.getClassLoader(); - java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help"); - javax.help.HelpSet hs = new javax.help.HelpSet(cl, url); + alignFrame.updateEditMenuBar(); - javax.help.HelpBroker hb = hs.createHelpBroker(); - hb.setCurrentID("home"); - hb.setDisplayed(true); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - break; + paintAlignment(true); - } - } - }); } /** @@ -265,21 +145,10 @@ public class AlignmentPanel extends GAlignmentPanel idPanel.idCanvas.setPreferredSize(d); hscrollFillerPanel.setPreferredSize(d); - if (av.getWrapAlignment()) - { - int max = av.alignment.getWidth() / - seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); - vscroll.setMaximum(max); - vscroll.setUnitIncrement(1); - vscroll.setVisibleAmount(1); - } - else - { - setScrollValues(av.getStartRes(), av.getStartSeq()); - } - if (overviewPanel != null) + { overviewPanel.setBoxPosition(); + } repaint(); } @@ -293,7 +162,9 @@ public class AlignmentPanel extends GAlignmentPanel { Container c = new Container(); - FontMetrics fm = c.getFontMetrics(av.font); + FontMetrics fm = c.getFontMetrics( + new Font(av.font.getName(), Font.ITALIC, av.font.getSize())); + AlignmentI al = av.getAlignment(); int i = 0; @@ -354,10 +225,10 @@ public class AlignmentPanel extends GAlignmentPanel int start = seq.findIndex(results.getResultStart(0)) - 1; int end = seq.findIndex(results.getResultEnd(0)) - 1; - if(!av.wrapAlignment) + if (!av.wrapAlignment) { - if ( (av.getStartRes() > end) || (av.getEndRes() < start) || - ( (av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex))) + if ( (av.getStartRes() > end) || (av.getEndRes() < start) || + ( (av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex))) { setScrollValues(start, seqIndex); } @@ -367,12 +238,15 @@ public class AlignmentPanel extends GAlignmentPanel scrollToWrappedVisible(start); } } + + paintAlignment(true); } void scrollToWrappedVisible(int res) { - int cwidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); - if( res<=av.getStartRes() || res>=(av.getStartRes()+cwidth) ) + int cwidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas. + getWidth()); + if (res <= av.getStartRes() || res >= (av.getStartRes() + cwidth)) { vscroll.setValue(res / cwidth); av.startRes = vscroll.getValue() * cwidth; @@ -416,33 +290,33 @@ public class AlignmentPanel extends GAlignmentPanel public void adjustAnnotationHeight() { - javax.swing.SwingUtilities.invokeLater(new Runnable() + if (alignFrame.getHeight() == 0) { - public void run() - { - while(alignFrame.getHeight()==0) - { - Thread.yield(); - } + System.out.println("NEEDS FIXING"); + } - int height = annotationPanel.adjustPanelHeight(); + int height = annotationPanel.adjustPanelHeight(); - if (height > alignFrame.getHeight() / 2) - { - height = alignFrame.getHeight() / 2; - } + if (hscroll.isVisible()) + { + height += hscroll.getPreferredSize().height; + } + if (height > alignFrame.getHeight() / 2) + { + height = alignFrame.getHeight() / 2; + } - annotationScroller.setPreferredSize( - new Dimension(annotationScroller.getWidth(), - height)); + hscroll.addNotify(); - annotationSpaceFillerHolder.setPreferredSize(new Dimension( - annotationSpaceFillerHolder.getWidth(), - height)); + annotationScroller.setPreferredSize( + new Dimension(annotationScroller.getWidth(), height)); - annotationPanel.repaint(); - } - }); + + annotationSpaceFillerHolder.setPreferredSize(new Dimension( + annotationSpaceFillerHolder.getWidth(), + height)); + + repaint(); } /** @@ -549,10 +423,12 @@ public class AlignmentPanel extends GAlignmentPanel int width = av.alignment.getWidth(); int height = av.alignment.getHeight(); - if(av.hasHiddenColumns) - width = av.getColumnSelection().findColumnPosition(width); + if (av.hasHiddenColumns) + { + width = av.getColumnSelection().findColumnPosition(width); + } - av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) -1); + av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) - 1); hextent = seqPanel.seqCanvas.getWidth() / av.charWidth; vextent = seqPanel.seqCanvas.getHeight() / av.charHeight; @@ -616,7 +492,7 @@ public class AlignmentPanel extends GAlignmentPanel if (av.getWrapAlignment()) { - if(offy>-1) + if (offy > -1) { int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel. seqCanvas.getWidth()); @@ -629,12 +505,12 @@ public class AlignmentPanel extends GAlignmentPanel //was wrapped when saved and user has wrap alignment true //as preference setting SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - setScrollValues(av.getStartRes(), av.getStartSeq()); - } - }); + { + public void run() + { + setScrollValues(av.getStartRes(), av.getStartSeq()); + } + }); } } else @@ -661,12 +537,16 @@ public class AlignmentPanel extends GAlignmentPanel { // Make sure we're not trying to draw a panel // larger than the visible window - if(scrollX>av.endRes-av.startRes) - scrollX = av.endRes-av.startRes; - else if(scrollX av.endRes - av.startRes) + { + scrollX = av.endRes - av.startRes; + } + else if (scrollX < av.startRes - av.endRes) + { scrollX = av.startRes - av.endRes; + } - if(scrollX!=0 || scrollY!=0) + if (scrollX != 0 || scrollY != 0) { idPanel.idCanvas.fastPaint(scrollY); seqPanel.seqCanvas.fastPaint(scrollX, @@ -681,6 +561,22 @@ public class AlignmentPanel extends GAlignmentPanel } } + public void paintAlignment(boolean updateOverview) + { + repaint(); + + if(updateOverview) + { + jalview.structure.StructureSelectionManager.getStructureSelectionManager() + .sequenceColoursChanged(this); + + if (overviewPanel != null) + { + overviewPanel.updateOverviewImage(); + } + } + } + /** * DOCUMENT ME! * @@ -700,26 +596,27 @@ public class AlignmentPanel extends GAlignmentPanel int maxwidth = av.alignment.getWidth(); if (av.hasHiddenColumns) + { maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; + } - int max = maxwidth / - seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()) + - 1; - - - vscroll.setMaximum(max); - vscroll.setUnitIncrement(1); - vscroll.setVisibleAmount(1); + int canvasWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel. + seqCanvas.getWidth()); + if (canvasWidth > 0) + { + int max = maxwidth / + seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas. + getWidth()) + + 1; + vscroll.setMaximum(max); + vscroll.setUnitIncrement(1); + vscroll.setVisibleAmount(1); + } } else { setScrollValues(av.getStartRes(), av.getStartSeq()); } - - if( this.getVisibleRect().getBounds() == g.getClipBounds() - && overviewPanel != null) - overviewPanel.updateOverviewImage(); - } /** @@ -766,7 +663,7 @@ public class AlignmentPanel extends GAlignmentPanel public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi) throws PrinterException { - int idWidth = calculateIdWidth().width + 4; + int idWidth = getVisibleIdWidth(); FontMetrics fm = getFontMetrics(av.getFont()); int scaleHeight = av.charHeight + fm.getDescent(); @@ -838,21 +735,21 @@ public class AlignmentPanel extends GAlignmentPanel Color currentColor = null; Color currentTextColor = null; - pg.setFont(new Font(av.getFont().getName(), - Font.ITALIC, - av.getFont().getSize())); + pg.setFont(idPanel.idCanvas.idfont); + + SequenceI seq; for (int i = startSeq; i < endSeq; i++) { + seq = av.getAlignment().getSequenceAt(i); if ( (av.getSelectionGroup() != null) && - av.getSelectionGroup().getSequences(false).contains( - av.getAlignment().getSequenceAt(i))) + av.getSelectionGroup().getSequences(null).contains(seq)) { currentColor = Color.gray; currentTextColor = Color.black; } else { - currentColor = av.getAlignment().getSequenceAt(i).getColor(); + currentColor = av.getSequenceColour(seq); currentTextColor = Color.black; } @@ -862,10 +759,17 @@ public class AlignmentPanel extends GAlignmentPanel pg.setColor(currentTextColor); - String string = av.getAlignment().getSequenceAt(i).getDisplayId - ( av.getShowJVSuffix()); + int xPos = 0; + if (av.rightAlignIds) + { + fm = pg.getFontMetrics(); + xPos = idWidth - fm.stringWidth( + seq.getDisplayId(av.getShowJVSuffix()) + ) - 4; + } - pg.drawString(string, 0, + pg.drawString(seq.getDisplayId(av.getShowJVSuffix()), + xPos, ( ( (i - startSeq) * av.charHeight) + av.getCharHeight()) - (av.getCharHeight() / 5)); } @@ -878,9 +782,9 @@ public class AlignmentPanel extends GAlignmentPanel if (av.showAnnotation && (endSeq == av.alignment.getHeight())) { - pg.translate( -idWidth-3, (endSeq - startSeq) * av.charHeight + 3); + pg.translate( -idWidth - 3, (endSeq - startSeq) * av.charHeight + 3); alabels.drawComponent( (Graphics2D) pg, idWidth); - pg.translate(idWidth+3, 0); + pg.translate(idWidth + 3, 0); annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes + 1); } @@ -915,18 +819,21 @@ public class AlignmentPanel extends GAlignmentPanel int hgap = av.charHeight; if (av.scaleAboveWrapped) + { hgap += av.charHeight; + } int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap + annotationHeight; - int idWidth = calculateIdWidth().width + 4; + int idWidth = getVisibleIdWidth(); int maxwidth = av.alignment.getWidth(); if (av.hasHiddenColumns) + { maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; - + } int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth - idWidth); @@ -946,31 +853,33 @@ public class AlignmentPanel extends GAlignmentPanel pg.setClip(0, pi * pheight, pwidth, pheight); int ypos = hgap; - Font italic = new Font(av.getFont().getName(), Font.ITALIC, - av.getFont().getSize()); - pg.setFont(italic); do { for (int i = 0; i < av.alignment.getHeight(); i++) { + pg.setFont(idPanel.idCanvas.idfont); SequenceI s = av.alignment.getSequenceAt(i); - String string = s.getDisplayId( av.getShowJVSuffix()); - - pg.drawString(string, 0, + String string = s.getDisplayId(av.getShowJVSuffix()); + int xPos = 0; + if (av.rightAlignIds) + { + FontMetrics fm = pg.getFontMetrics(); + xPos = idWidth - fm.stringWidth(string) - 4; + } + pg.drawString(string, xPos, ( (i * av.charHeight) + ypos + av.charHeight) - (av.charHeight / 5)); } if (labels != null) { - pg.translate(-3, + pg.translate( -3, ypos + (av.getAlignment().getHeight() * av.charHeight)); pg.setFont(av.getFont()); labels.drawComponent(pg, idWidth); - pg.setFont(italic); - pg.translate(+3, + pg.translate( +3, -ypos - (av.getAlignment().getHeight() * av.charHeight)); } @@ -994,29 +903,40 @@ public class AlignmentPanel extends GAlignmentPanel } } + int getVisibleIdWidth() + { + return + idPanel.getWidth() > 0 ? idPanel.getWidth() : + calculateIdWidth().width + 4; + } + void makeAlignmentImage(int type, File file) { int maxwidth = av.alignment.getWidth(); if (av.hasHiddenColumns) - maxwidth = av.getColumnSelection().findColumnPosition(maxwidth); - - int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30; - int width = idPanel.getWidth() + (maxwidth * av.charWidth); - if (idPanel.getWidth() == 0) { - width += calculateIdWidth().getWidth() + 4; + maxwidth = av.getColumnSelection().findColumnPosition(maxwidth); } + int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + + scalePanel.getHeight(); + int width = getVisibleIdWidth() + (maxwidth * av.charWidth); + if (av.getWrapAlignment()) { height = getWrappedHeight(); if (System.getProperty("java.awt.headless") != null && System.getProperty("java.awt.headless").equals("true")) { - width = alignFrame.getWidth() - 22; + width = alignFrame.getWidth() + - vscroll.getPreferredSize().width + - alignFrame.getInsets().left + - alignFrame.getInsets().right; } else - width = seqPanel.getWidth() + idPanel.getWidth(); + { + width = seqPanel.getWidth() + getVisibleIdWidth(); + } } else if (av.getShowAnnotation()) @@ -1024,23 +944,29 @@ public class AlignmentPanel extends GAlignmentPanel height += annotationPanel.adjustPanelHeight() + 3; } - jalview.util.ImageMaker im; - if(type==jalview.util.ImageMaker.PNG) - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.PNG, - "Create PNG image from alignment", - width, height, file, null); - else - im = new jalview.util.ImageMaker(this, - jalview.util.ImageMaker.EPS, - "Create EPS file from alignment", - width, height, file, alignFrame.getTitle() ); - try { + + jalview.util.ImageMaker im; + if (type == jalview.util.ImageMaker.PNG) + { + im = new jalview.util.ImageMaker(this, + jalview.util.ImageMaker.PNG, + "Create PNG image from alignment", + width, height, file, null); + } + else + { + im = new jalview.util.ImageMaker(this, + jalview.util.ImageMaker.EPS, + "Create EPS file from alignment", + width, height, file, + alignFrame.getTitle()); + } + if (av.getWrapAlignment()) { - if(im.getGraphics()!=null) + if (im.getGraphics() != null) { printWrappedAlignment(im.getGraphics(), width, height, 0); im.writeImage(); @@ -1048,7 +974,7 @@ public class AlignmentPanel extends GAlignmentPanel } else { - if(im.getGraphics()!=null) + if (im.getGraphics() != null) { printUnwrapped(im.getGraphics(), width, height, 0); im.writeImage(); @@ -1076,6 +1002,7 @@ public class AlignmentPanel extends GAlignmentPanel ex.printStackTrace(); } } + /** * DOCUMENT ME! */ @@ -1096,7 +1023,7 @@ public class AlignmentPanel extends GAlignmentPanel { ///////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS ////////////////////////////////////////////// - int idWidth = calculateIdWidth().width + 4; + int idWidth = getVisibleIdWidth(); FontMetrics fm = getFontMetrics(av.getFont()); int scaleHeight = av.charHeight + fm.getDescent(); @@ -1120,92 +1047,107 @@ public class AlignmentPanel extends GAlignmentPanel sy = s * av.charHeight + scaleHeight; SequenceI seq = av.alignment.getSequenceAt(s); - SequenceFeature [] features = seq.getDatasetSequence().getSequenceFeatures(); + SequenceFeature[] features = seq.getDatasetSequence(). + getSequenceFeatures(); SequenceGroup[] groups = av.alignment.findAllGroups(seq); - for(res =0; resres) + if (groups[g].getStartRes() < res && groups[g].getEndRes() > res) + { text.append("
" + groups[g].getName() + ""); + } } if (features != null) { - if(text.length()<1) + if (text.length() < 1) { text.append("= seq.findPosition(res))) + if ( (features[f].getBegin() <= seq.findPosition(res)) && + (features[f].getEnd() >= seq.findPosition(res))) + { + if (features[f].getType().equals("disulfide bond")) { - if (features[f].getType().equals("disulfide bond")) + if (features[f].getBegin() == seq.findPosition(res) + || features[f].getEnd() == seq.findPosition(res)) { - if (features[f].getBegin() == seq.findPosition(res) - || features[f].getEnd() == seq.findPosition(res)) - { - text.append("
disulfide bond " + features[f].getBegin() + ":" + - features[f].getEnd()); - } + text.append("
disulfide bond " + features[f].getBegin() + + ":" + + features[f].getEnd()); } - else + } + else + { + text.append("
"); + text.append(features[f].getType()); + if (features[f].getDescription() != null && + !features[f]. + getType().equals(features[f].getDescription())) { - text.append("
"); - text.append(features[f].getType()); - if (features[f].getDescription() != null && !features[f].getType().equals(features[f].getDescription())) - text.append(" " + features[f].getDescription()); - - if (features[f].getValue("status") != null ) - { - text.append(" (" + features[f].getValue("status") + ")"); - } + text.append(" " + features[f].getDescription()); } - } + if (features[f].getValue("status") != null) + { + text.append(" (" + features[f].getValue("status") + ")"); + } + } } - } - if(text.length()>1) - { - text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">"); - out.println(text.toString()); + } } + if (text.length() > 1) + { + text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">"); + out.println(text.toString()); + } } + } out.println(""); out.close(); @@ -1222,21 +1164,25 @@ public class AlignmentPanel extends GAlignmentPanel { int seqPanelWidth = seqPanel.seqCanvas.getWidth(); - //If headless, seqPanel will have 0 width if (System.getProperty("java.awt.headless") != null - && System.getProperty("java.awt.headless").equals("true")) + && System.getProperty("java.awt.headless").equals("true")) { - int idWidth = calculateIdWidth().width + 4; - seqPanelWidth = alignFrame.getWidth() - idWidth; + seqPanelWidth = alignFrame.getWidth() + - getVisibleIdWidth() + - vscroll.getPreferredSize().width + - alignFrame.getInsets().left + - alignFrame.getInsets().right; } int chunkWidth = seqPanel.seqCanvas.getWrappedCanvasWidth( seqPanelWidth - ); + ); int hgap = av.charHeight; if (av.scaleAboveWrapped) + { hgap += av.charHeight; + } int annotationHeight = 0; if (av.showAnnotation) @@ -1250,76 +1196,12 @@ public class AlignmentPanel extends GAlignmentPanel int maxwidth = av.alignment.getWidth(); if (av.hasHiddenColumns) + { maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; - + } int height = ( (maxwidth / chunkWidth) + 1) * cHeight; return height; } - - /** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ - class Preview - extends JFrame - { - /** - * Creates a new Preview object. - * - * @param image DOCUMENT ME! - */ - public Preview(Image image) - { - setResizable(true); - setSize(image.getWidth(this), image.getHeight(this)); - setVisible(true); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(new PreviewPanel(image), BorderLayout.CENTER); - validate(); - repaint(); - } - } - - /** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ - class PreviewPanel - extends JPanel - { - Image image; - - /** - * Creates a new PreviewPanel object. - * - * @param image DOCUMENT ME! - */ - public PreviewPanel(Image image) - { - this.image = image; - } - - /** - * DOCUMENT ME! - * - * @param g DOCUMENT ME! - */ - public void paintComponent(Graphics g) - { - if (image != null) - { - g.drawImage(image, 0, 0, this); - } - else - { - System.out.println("DEBUG:image is null"); - } - } - } }