X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignmentPanel.java;h=98f44c6078b1ebffc6955d1c10df6945afd64cfc;hb=a8f483d04205bb8273ee311c12968b7e86d205fa;hp=6c866ee740cfdf930324f3a6f7558a18d156a970;hpb=59d682209891099d46b960509907c79e3fb276fe;p=jalview.git diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 6c866ee..98f44c6 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/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.2) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * @@ -14,13 +14,12 @@ * 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.appletgui; import java.awt.*; import java.awt.event.*; -import java.util.Hashtable; -import java.util.Vector; import jalview.api.AlignmentViewPanel; import jalview.datamodel.*; @@ -85,7 +84,6 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, annotationPanelHolder.add(annotationPanel, BorderLayout.CENTER); sequenceHolderPanel.add(annotationPanelHolder, BorderLayout.SOUTH); - alabels = new AnnotationLabels(this); setAnnotationVisible(av.showAnnotation); @@ -139,7 +137,6 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, } } }); - } public SequenceRenderer getSequenceRenderer() @@ -436,6 +433,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, { annotationSpaceFillerHolder.setVisible(b); annotationPanelHolder.setVisible(b); + } else { + annotationSpaceFillerHolder.setVisible(false); + annotationPanelHolder.setVisible(false); } validate(); repaint(); @@ -481,12 +481,27 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, int mheight = height; Dimension d = sequenceHolderPanel.getSize(), e = idPanel.getSize(); int seqandannot = d.height - scalePanelHolder.getSize().height; - // sets initial preferred height - if ((height + 40) > seqandannot / 2) + + if (adjustPanelHeight) { - height = seqandannot / 2; + // NOTE: this logic is different in the application. Need a better algorithm to define behaviour + // sets initial preferred height + // try and set height according to alignment + float sscaling = (float) ((av.getCharHeight() * av.getAlignment().getHeight())/(1.0*mheight)); + if (sscaling > 0.5) + { + // if the alignment is too big then + // default is 0.5 split + height = seqandannot / 2; + } + else + { + // otherwise just set the panel so that one row of sequence is visible + height = -av.getCharHeight() * 1 + + (int) (seqandannot * (1 - sscaling)); + } } - if (!adjustPanelHeight) + else { // maintain same window layout whilst updating sliders height = annotationPanelHolder.getSize().height; @@ -500,7 +515,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, alabels.setSize(new Dimension(e.width, height)); annotationSpaceFillerHolder.setSize(new Dimension(e.width, height)); annotationPanelHolder.setSize(new Dimension(d.width, height)); - seqPanelHolder.setSize(d.width, seqandannot - height); + // seqPanelHolder.setSize(d.width, seqandannot - height); seqPanel.seqCanvas .setSize(d.width, seqPanel.seqCanvas.getSize().height); int s = apvscroll.getValue(); @@ -509,8 +524,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, s = 0; } apvscroll.setValues(s, height, 0, mheight); - annotationPanel.setScrollOffset(apvscroll.getValue()); - alabels.setScrollOffset(apvscroll.getValue()); + annotationPanel.setScrollOffset(apvscroll.getValue(), false); + alabels.setScrollOffset(apvscroll.getValue(), false); } public void setWrapAlignment(boolean wrap) @@ -532,12 +547,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, annotationPanelHolder.setVisible(true); annotationSpaceFillerHolder.setVisible(true); } - + idSpaceFillerPanel1.setVisible(!wrap); fontChanged(); // This is so that the scalePanel is resized correctly validate(); + sequenceHolderPanel.revalidate(); repaint(); } @@ -674,8 +690,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, if (evt == null || evt.getSource() == apvscroll) { - annotationPanel.setScrollOffset(apvscroll.getValue()); - alabels.setScrollOffset(apvscroll.getValue()); + annotationPanel.setScrollOffset(apvscroll.getValue(), false); + alabels.setScrollOffset(apvscroll.getValue(), false); // annotationPanel.image=null; // alabels.image=null; // alabels.repaint(); @@ -805,12 +821,18 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, setScrollValues(av.getStartRes(), av.getStartSeq()); } - alabels.repaint(); - seqPanel.seqCanvas.repaint(); - scalePanel.repaint(); - annotationPanel.repaint(); idPanel.idCanvas.repaint(); + if (!av.wrapAlignment) + { + if (av.showAnnotation) + { + alabels.repaint(); + annotationPanel.repaint(); + } + scalePanel.repaint(); + } + } protected Panel sequenceHolderPanel = new Panel();