X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=7befa207bab66e77f33397b52e29b71bc28abcc9;hb=353cb52722490edcba2c13b18836b6d37c5455de;hp=9fb1a231ad7039be4ad328c8e94f598ae5be75de;hpb=8df2de111af18978bb5254650cab7ba28bc84e82;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 9fb1a23..7befa20 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -48,6 +48,7 @@ import jalview.analysis.AnnotationSorter; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.bin.Cache; +import jalview.bin.Console; import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.HiddenColumns; @@ -64,6 +65,7 @@ import jalview.structure.StructureSelectionManager; import jalview.util.Comparison; import jalview.util.ImageMaker; import jalview.util.MessageManager; +import jalview.util.imagemaker.BitmapImageSizing; import jalview.viewmodel.ViewportListenerI; import jalview.viewmodel.ViewportRanges; @@ -229,6 +231,10 @@ public class AlignmentPanel extends GAlignmentPanel implements // to prevent drawing old image FontMetrics fm = getFontMetrics(av.getFont()); + // update the flag controlling whether the grid is too small to render the + // font + av.validCharWidth = fm.charWidth('M') <= av.getCharWidth(); + scalePanelHolder.setPreferredSize( new Dimension(10, av.getCharHeight() + fm.getDescent())); idSpaceFillerPanel1.setPreferredSize( @@ -804,7 +810,7 @@ public class AlignmentPanel extends GAlignmentPanel implements // could not be validated and it is not clear if it is now being // called. Log warning here in case it is called and unforeseen // problems occur - Cache.log.warn( + Console.warn( "Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences"); // scroll to start of panel @@ -1041,6 +1047,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ alignmentGraphics.translate(alignmentGraphicsOffset, alignmentDrawnHeight); + updateLayout(); getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av, alignmentGraphics, -1, startRes, endRes + 1); } @@ -1167,14 +1174,23 @@ public class AlignmentPanel extends GAlignmentPanel implements return (w > 0 ? w : calculateIdWidth().width); } + void makeAlignmentImage(ImageMaker.TYPE type, File file, String renderer) + { + makeAlignmentImage(type, file, renderer, + BitmapImageSizing.nullBitmapImageSizing()); + } + /** * Builds an image of the alignment of the specified type (EPS/PNG/SVG) and * writes it to the specified file * * @param type * @param file + * @param textrenderer + * @param bitmapscale */ - void makeAlignmentImage(ImageMaker.TYPE type, File file) + void makeAlignmentImage(ImageMaker.TYPE type, File file, String renderer, + BitmapImageSizing userBis) { final int borderBottomOffset = 5; @@ -1204,7 +1220,8 @@ public class AlignmentPanel extends GAlignmentPanel implements int imageWidth = aDimension.getWidth(); int imageHeight = aDimension.getHeight() + borderBottomOffset; String of = MessageManager.getString("label.alignment"); - exporter.doExport(file, this, imageWidth, imageHeight, of); + exporter.doExport(file, this, imageWidth, imageHeight, of, renderer, + userBis); } /** @@ -1464,9 +1481,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } else { - if (Cache.log.isDebugEnabled()) + if (Console.isDebugEnabled()) { - Cache.log.warn("Closing alignment panel which is already closed."); + Console.warn("Closing alignment panel which is already closed."); } } } @@ -1541,13 +1558,17 @@ public class AlignmentPanel extends GAlignmentPanel implements } catch (Exception ex) { } - if (b) { - alignFrame.setDisplayedView(this); + setAlignFrameView(); } } + public void setAlignFrameView() + { + alignFrame.setDisplayedView(this); + } + @Override public StructureSelectionManager getStructureSelectionManager() { @@ -1763,4 +1784,16 @@ public class AlignmentPanel extends GAlignmentPanel implements return overviewTitle; } + /** + * If this alignment panel has an Overview panel open, closes it + */ + public void closeOverviewPanel() + { + if (overviewPanel != null) + { + overviewPanel.close(); + overviewPanel = null; + } + } + }