X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;fp=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=39a1c187827064fc414351c485e0cc212f80241a;hb=b5667f39acdf309cd92881b73edfda591e0acaf4;hp=abca11096c5c54279d64cf114d5a449cb2a8e02e;hpb=1903e771d3dae79e9a57fcc1147efd37e8a51421;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index abca110..39a1c18 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -702,7 +702,8 @@ public abstract class AlignmentViewport * retain any colour thresholds per group while * changing choice of colour scheme (JAL-2386) */ - sg.setColourScheme(cs); + sg.setColourScheme( + cs == null ? null : cs.getInstance(this, sg)); if (cs != null) { sg.getGroupColourScheme().alignmentChanged(sg, @@ -1736,6 +1737,7 @@ public abstract class AlignmentViewport public void invertColumnSelection() { colSel.invertColumnSelection(0, alignment.getWidth(), alignment); + isColSelChanged(true); } @Override @@ -3084,4 +3086,68 @@ public abstract class AlignmentViewport { hmmNormaliseSequenceLogo = state; } + + /** + * flag set to indicate if structure views might be out of sync with sequences + * in the alignment + */ + + private boolean needToUpdateStructureViews = false; + + @Override + public boolean isUpdateStructures() + { + return needToUpdateStructureViews; + } + + @Override + public void setUpdateStructures(boolean update) + { + needToUpdateStructureViews = update; + } + + @Override + public boolean needToUpdateStructureViews() + { + boolean update = needToUpdateStructureViews; + needToUpdateStructureViews = false; + return update; + } + + @Override + public void addSequenceGroup(SequenceGroup sequenceGroup) + { + alignment.addGroup(sequenceGroup); + + Color col = sequenceGroup.idColour; + if (col != null) + { + col = col.brighter(); + + for (SequenceI sq : sequenceGroup.getSequences()) + { + setSequenceColour(sq, col); + } + } + + if (codingComplement != null) + { + SequenceGroup mappedGroup = MappingUtils + .mapSequenceGroup(sequenceGroup, this, codingComplement); + if (mappedGroup.getSequences().size() > 0) + { + codingComplement.getAlignment().addGroup(mappedGroup); + + if (col != null) + { + for (SequenceI seq : mappedGroup.getSequences()) + { + codingComplement.setSequenceColour(seq, col); + } + } + } + // propagate the structure view update flag according to our own setting + codingComplement.setUpdateStructures(needToUpdateStructureViews); + } + } }