X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=6bfe4bd167207310af5db01b126e185b3b568323;hb=d919b93d3c0a57e36c2a90a34a6788bca86bfe81;hp=b4647ae36692bd2e997be98493ab974699471dfe;hpb=b91c00e8dba2b753769ea921dbe4404f49896db0;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index b4647ae..6bfe4bd 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * @@ -14,6 +14,7 @@ * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.gui; @@ -421,16 +422,30 @@ public class AlignmentPanel extends GAlignmentPanel implements protected void validateAnnotationDimensions(boolean adjustPanelHeight) { int height = annotationPanel.adjustPanelHeight(); - - if (hscroll.isVisible()) - { - height += hscroll.getPreferredSize().height; - } - if (height > alignFrame.getHeight() / 2) - { - height = alignFrame.getHeight() / 2; + + int theight = av.getCharHeight() * (av.getAlignment().getHeight() + (!av.hasHiddenRows() ? 0 : av.getAlignment().getHiddenSequences().getSize())); + float sscaling = (float) (theight/(1.0*theight+height)); + float ascaling=(float)(height*1.0/alignFrame.getHeight()); + int rheight = alignFrame.getHeight() - height - av.getCharHeight(); + if (adjustPanelHeight) + { + // NOTE: this logic is different in the applet. Need a better algorithm to define behaviour + // try and set height according to alignment + if (ascaling>0 && sscaling < 0.5) + { + // if the alignment is too big then + // default is 0.5 split + height = alignFrame.getHeight() / 2; + } + else + { + // if space for more than one sequence row left when annotation is fully displayed then set height to annotation height + // otherwise, leave at least two lines of sequence shown. + height = (rheight>av.getCharHeight()) ? height : (-av.getCharHeight() * 3 + + (int) (alignFrame.getHeight() * (1 - sscaling))); + } } - if (!adjustPanelHeight) + else { // maintain same window layout whilst updating sliders height = annotationScroller.getSize().height; @@ -485,7 +500,7 @@ public class AlignmentPanel extends GAlignmentPanel implements return false; } - //fastPaint = false; + fastPaint = false; vscroll.setValue(vscroll.getValue() - 1); } else @@ -495,11 +510,11 @@ public class AlignmentPanel extends GAlignmentPanel implements return false; } - //fastPaint = false; + fastPaint = false; vscroll.setValue(vscroll.getValue() + 1); } - //fastPaint = true; + fastPaint = true; return true; } @@ -521,7 +536,7 @@ public class AlignmentPanel extends GAlignmentPanel implements return false; } - //fastPaint = false; + fastPaint = false; hscroll.setValue(hscroll.getValue() - 1); } else @@ -531,11 +546,11 @@ public class AlignmentPanel extends GAlignmentPanel implements return false; } - //fastPaint = false; + fastPaint = false; hscroll.setValue(hscroll.getValue() + 1); } - //fastPaint = true; + fastPaint = true; return true; } @@ -688,7 +703,7 @@ public class AlignmentPanel extends GAlignmentPanel implements seqPanel.seqCanvas.fastPaint(scrollX, scrollY); scalePanel.repaint(); - if (av.getShowAnnotation()) + if (av.getShowAnnotation() && scrollX!=0) { annotationPanel.fastPaint(scrollX); } @@ -1094,7 +1109,9 @@ public class AlignmentPanel extends GAlignmentPanel implements void makeAlignmentImage(int type, File file) { long progress = System.currentTimeMillis(); - if (alignFrame != null) + boolean headless = (System.getProperty("java.awt.headless") != null + && System.getProperty("java.awt.headless").equals("true")); + if (alignFrame != null && !headless) { alignFrame.setProgressBar("Saving " + (type == jalview.util.ImageMaker.PNG ? "PNG image" @@ -1115,8 +1132,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (av.getWrapAlignment()) { height = getWrappedHeight(); - if (System.getProperty("java.awt.headless") != null - && System.getProperty("java.awt.headless").equals("true")) + if (headless) { // need to obtain default alignment width and then add in any // additional allowance for id margin @@ -1184,7 +1200,7 @@ public class AlignmentPanel extends GAlignmentPanel implements } } finally { - if (alignFrame != null) + if (alignFrame != null && !headless) { alignFrame.setProgressBar("Export complete.", progress); }