X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;fp=src%2Fjalview%2Fgui%2FAlignViewport.java;h=602e3a1681de6ed85eb660babd5d474c4e770799;hb=9eabd6dffd6d19b2826b887a5def80351b9bceed;hp=69f155bb393fc4bb7fb5bbe6b5c1390bfe141e93;hpb=9debcac658224e1a84ddff4c4fd9f696e812913f;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 69f155b..602e3a1 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -44,13 +44,14 @@ import jalview.datamodel.SequenceI; import jalview.renderer.ResidueShader; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.ResidueColourScheme; import jalview.schemes.UserColourScheme; -import jalview.structure.CommandListener; import jalview.structure.SelectionSource; import jalview.structure.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; +import jalview.viewmodel.ViewportRanges; import jalview.ws.params.AutoCalcSetting; import java.awt.Container; @@ -71,7 +72,7 @@ import javax.swing.JInternalFrame; * @version $Revision: 1.141 $ */ public class AlignViewport extends AlignmentViewport implements - SelectionSource, CommandListener + SelectionSource { Font font; @@ -237,10 +238,7 @@ public class AlignViewport extends AlignmentViewport implements void init() { - this.startRes = 0; - this.endRes = alignment.getWidth() - 1; - this.startSeq = 0; - this.endSeq = alignment.getHeight() - 1; + ranges = new ViewportRanges(this.alignment); applyViewProperties(); String fontName = Cache.getDefault("FONT_NAME", "SansSerif"); @@ -285,29 +283,27 @@ public class AlignViewport extends AlignmentViewport implements initAutoAnnotation(); String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC : Preferences.DEFAULT_COLOUR_PROT; - String propertyValue = Cache.getProperty(colourProperty); - if (propertyValue == null) + String schemeName = Cache.getProperty(colourProperty); + if (schemeName == null) { - // fall back on this property for backwards compatibility - propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR); + // only DEFAULT_COLOUR available in Jalview before 2.9 + schemeName = Cache.getDefault(Preferences.DEFAULT_COLOUR, + ResidueColourScheme.NONE); } - if (propertyValue != null) - { - ColourSchemeI colourScheme = ColourSchemeProperty.getColourScheme( - alignment, propertyValue); - residueShading = new ResidueShader(colourScheme); + ColourSchemeI colourScheme = ColourSchemeProperty.getColourScheme( + alignment, schemeName); + residueShading = new ResidueShader(colourScheme); - if (colourScheme instanceof UserColourScheme) - { - residueShading = new ResidueShader( - UserDefinedColours.loadDefaultColours()); - residueShading.setThreshold(0, isIgnoreGapsConsensus()); - } + if (colourScheme instanceof UserColourScheme) + { + residueShading = new ResidueShader( + UserDefinedColours.loadDefaultColours()); + residueShading.setThreshold(0, isIgnoreGapsConsensus()); + } - if (residueShading != null) - { - residueShading.setConsensus(hconsensus); - } + if (residueShading != null) + { + residueShading.setConsensus(hconsensus); } } @@ -385,11 +381,6 @@ public class AlignViewport extends AlignmentViewport implements super.setViewStyle(settingsForView); setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(), viewStyle.getFontSize()), false); - if (residueShading != null) - { - residueShading.setConservationApplied(settingsForView - .isConservationColourSelected()); - } } /** @@ -861,7 +852,7 @@ public class AlignViewport extends AlignmentViewport implements } } - setEndSeq(getAlignment().getHeight()); + ranges.setEndSeq(getAlignment().getHeight()); firePropertyChange("alignment", null, getAlignment().getSequences()); }