X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignViewport.java;h=1d2c4bce29fffec9899f3d44410fbf4089b89434;hb=67affee2e65ca942447570c35526c04d64f41fe1;hp=c156c36ad8b6599003debfcc179a9426b93bf2af;hpb=3c75c089a56859ec8e7f674d7054e82af41e4b77;p=jalview.git diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index c156c36..1d2c4bc 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -26,6 +26,7 @@ import jalview.api.FeatureSettingsModelI; import jalview.bin.JalviewLite; import jalview.commands.CommandI; import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.datamodel.HiddenColumns; import jalview.datamodel.SearchResults; @@ -40,9 +41,9 @@ import jalview.structure.SelectionSource; import jalview.structure.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; -import jalview.viewmodel.ViewportRanges; import java.awt.Font; +import java.awt.FontMetrics; public class AlignViewport extends AlignmentViewport implements SelectionSource @@ -72,11 +73,10 @@ public class AlignViewport extends AlignmentViewport implements public AlignViewport(AlignmentI al, JalviewLite applet) { - super(); + super(al); calculator = new jalview.workers.AlignCalcManager(); this.applet = applet; - alignment = al; - ranges = new ViewportRanges(this.alignment); + // we always pad gaps this.setPadGaps(true); @@ -130,7 +130,7 @@ public class AlignViewport extends AlignmentViewport implements } } } - setFont(font); + setFont(font, true); MAC = new jalview.util.Platform().isAMac(); @@ -230,50 +230,17 @@ public class AlignViewport extends AlignmentViewport implements } - /** - * get the consensus sequence as displayed under the PID consensus annotation - * row. - * - * @return consensus sequence as a new sequence object - */ - public SequenceI getConsensusSeq() - { - if (consensus == null) - { - updateConsensus(null); - } - if (consensus == null) - { - return null; - } - StringBuilder seqs = new StringBuilder(consensus.annotations.length); - for (int i = 0; i < consensus.annotations.length; i++) - { - if (consensus.annotations[i] != null) - { - if (consensus.annotations[i].description.charAt(0) == '[') - { - seqs.append(consensus.annotations[i].description.charAt(1)); - } - else - { - seqs.append(consensus.annotations[i].displayCharacter); - } - } - } - SequenceI sq = new Sequence("Consensus", seqs.toString()); - sq.setDescription("Percentage Identity Consensus " - + ((ignoreGapsInConsensusCalculation) ? " without gaps" : "")); - return sq; - } - java.awt.Frame nullFrame; protected FeatureSettings featureSettings = null; private float heightScale = 1, widthScale = 1; - public void setFont(Font f) + /** + * {@inheritDoc} + */ + @Override + public void setFont(Font f, boolean setGrid) { font = f; if (nullFrame == null) @@ -282,14 +249,17 @@ public class AlignViewport extends AlignmentViewport implements nullFrame.addNotify(); } - java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font); - setCharHeight((int) (heightScale * fm.getHeight())); - setCharWidth((int) (widthScale * fm.charWidth('M'))); + if (setGrid) + { + FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font); + setCharHeight((int) (heightScale * fm.getHeight())); + setCharWidth((int) (widthScale * fm.charWidth('M'))); + } if (isUpperCasebold()) { Font f2 = new Font(f.getName(), Font.BOLD, f.getSize()); - fm = nullFrame.getGraphics().getFontMetrics(f2); + FontMetrics fm = nullFrame.getGraphics().getFontMetrics(f2); setCharWidth((int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10))); } } @@ -443,8 +413,9 @@ public class AlignViewport extends AlignmentViewport implements int seqOffset = findComplementScrollTarget(sr); if (!sr.isEmpty()) { - complementPanel.setFollowingComplementScroll(true); + complementPanel.setToScrollComplementPanel(false); complementPanel.scrollToCentre(sr, seqOffset); + complementPanel.setToScrollComplementPanel(true); } }