X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=93d8c19261f9454e541365486d045c835584d05b;hb=97a31ae1fe3095b9d332f655103e334342ee9a19;hp=2129db156c9f6e8c0f01c5af362d75ef946e5f4a;hpb=839db4a2e67d4b250e079511d51444d64237d3f4;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 2129db1..93d8c19 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -46,6 +46,7 @@ import jalview.api.AlignViewportI; import jalview.api.ViewStyleI; import jalview.bin.Cache; import jalview.commands.CommandI; +import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; @@ -107,6 +108,13 @@ public class AlignViewport extends AlignmentViewport implements String viewName; + /* + * Flag set true on the view that should 'gather' multiple views of the same + * sequence set id when a project is reloaded. Set false on all views when + * they are 'exploded' into separate windows. Set true on the current view + * when 'Gather' is performed, and also on the first tab when the first new + * view is created. + */ private boolean gatherViewsHere = false; private AnnotationColumnChooser annotationColumnSelectionState; @@ -293,10 +301,18 @@ public class AlignViewport extends AlignmentViewport implements showConsensus = Cache.getDefault("SHOW_IDENTITY", true); } initAutoAnnotation(); - if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null) + String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC + : Preferences.DEFAULT_COLOUR_PROT; + String propertyValue = Cache.getProperty(colourProperty); + if (propertyValue == null) + { + // fall back on this property for backwards compatibility + propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR); + } + if (propertyValue != null) { globalColourScheme = ColourSchemeProperty.getColour(alignment, - jalview.bin.Cache.getProperty("DEFAULT_COLOUR")); + propertyValue); if (globalColourScheme instanceof UserColourScheme) { @@ -1053,7 +1069,8 @@ public class AlignViewport extends AlignmentViewport implements if (openSplitPane) { - protein = openSplitFrame(newAlignFrame, thisAlignment); + protein = openSplitFrame(newAlignFrame, + thisAlignment.getSequencesArray(), protein.getCodonFrames()); } /* @@ -1073,18 +1090,20 @@ public class AlignViewport extends AlignmentViewport implements * * @param newAlignFrame * containing a new alignment to be shown - * @param existingAlignment - * an existing alignment to be copied for display in the split frame + * @param seqs + * 'complementary' sequences to show in the other split half + * @param mappings * @return the protein alignment in the split frame */ protected AlignmentI openSplitFrame(AlignFrame newAlignFrame, - AlignmentI existingAlignment) + SequenceI[] seqs, Set mappings) { + AlignmentI complementAlignment = new Alignment(seqs); // TODO: move this to a factory/controller method ? /* * Open in split pane. DNA sequence above, protein below. */ - AlignFrame copyMe = new AlignFrame(existingAlignment, + AlignFrame copyMe = new AlignFrame(complementAlignment, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); copyMe.setTitle(getAlignPanel().alignFrame.getTitle()); @@ -1094,6 +1113,7 @@ public class AlignViewport extends AlignmentViewport implements final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame : copyMe; AlignmentI protein = proteinFrame.viewport.getAlignment(); + protein.setCodonFrames(mappings); cdnaFrame.setVisible(true); proteinFrame.setVisible(true); @@ -1102,20 +1122,6 @@ public class AlignViewport extends AlignmentViewport implements JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame); Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1); - /* - * Set the frames to listen for each other's edit and sort commands. - */ - final StructureSelectionManager ssm = StructureSelectionManager - .getStructureSelectionManager(Desktop.instance); - ssm.addCommandListener(cdnaFrame.getViewport()); - ssm.addCommandListener(proteinFrame.getViewport()); - - /* - * 'Coding complement' (dna/protein) views will mirror each others' edits, - * selections, sorting etc as decided from time to time by the relevant - * authorities. - */ - proteinFrame.getViewport().setCodingComplement(cdnaFrame.getViewport()); return protein; }