X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=8994743c8db269830ab9a4cc576c2f96ebebadfe;hb=53e0350c1c4464442938e4bace4e85bdbca665be;hp=b080a25341af9267b3eb8f6b33d889715ee342ac;hpb=985fd5ff517f3eb5221a7aefec88138341514779;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index b080a25..8994743 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -22,8 +22,10 @@ package jalview.gui; import jalview.analysis.AlignmentSorter; import jalview.analysis.AlignmentUtils; +import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.analysis.CrossRef; import jalview.analysis.Dna; +import jalview.analysis.GeneticCodeI; import jalview.analysis.ParseProperties; import jalview.analysis.SequenceIdMatcher; import jalview.api.AlignExportSettingI; @@ -135,6 +137,7 @@ import java.util.Hashtable; import java.util.List; import java.util.Vector; +import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JEditorPane; import javax.swing.JInternalFrame; @@ -360,9 +363,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sortPairwiseMenuItem_actionPerformed(null); } - this.alignPanel.av - .setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); - setMenusFromViewport(viewport); buildSortByAnnotationScoresMenu(); calculateTree.addActionListener(new ActionListener() @@ -479,6 +479,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } }); + alignPanel.sortAnnotations(false); } /** @@ -972,7 +973,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void setStatus(String text) { - statusBar.setText(text); + statusBar.setText(text == null || text.isEmpty() ? " " : text); } /* @@ -2740,6 +2741,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, newap.av.setRedoList(viewport.getRedoList()); /* + * copy any visualisation settings that are not saved in the project + */ + newap.av.setColourAppliesToAllGroups( + viewport.getColourAppliesToAllGroups()); + + /* * Views share the same mappings; need to deregister any new mappings * created by copyAlignPanel, and register the new reference to the shared * mappings @@ -3096,7 +3103,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleAbove_actionPerformed(ActionEvent e) { viewport.setScaleAboveWrapped(scaleAbove.isSelected()); - // TODO: do we actually need to update overview for scale above change ? + alignPanel.updateLayout(); alignPanel.paintAlignment(true, false); } @@ -3110,6 +3117,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleLeft_actionPerformed(ActionEvent e) { viewport.setScaleLeftWrapped(scaleLeft.isSelected()); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, false); } @@ -3123,6 +3131,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void scaleRight_actionPerformed(ActionEvent e) { viewport.setScaleRightWrapped(scaleRight.isSelected()); + alignPanel.updateLayout(); alignPanel.paintAlignment(true, false); } @@ -3344,6 +3353,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * otherwise set the chosen colour scheme (or null for 'None') */ ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name, + viewport, viewport.getAlignment(), viewport.getHiddenRepSequences()); changeColour(cs); } @@ -4276,14 +4286,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * frame's DNA sequences to their aligned protein (amino acid) equivalents. */ @Override - public void showTranslation_actionPerformed(ActionEvent e) + public void showTranslation_actionPerformed(GeneticCodeI codeTable) { AlignmentI al = null; try { Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); - al = dna.translateCdna(); + al = dna.translateCdna(codeTable); } catch (Exception ex) { jalview.bin.Cache.log.error( @@ -4312,7 +4322,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, af.setFileFormat(this.currentFileFormat); final String newTitle = MessageManager .formatMessage("label.translation_of_params", new Object[] - { this.getTitle() }); + { this.getTitle(), codeTable.getId() }); af.setTitle(newTitle); if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { @@ -4681,7 +4691,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (isAnnotation) { - + alignPanel.sortAnnotations(false); alignPanel.adjustAnnotationHeight(); viewport.updateSequenceIdColours(); buildSortByAnnotationScoresMenu(); @@ -5300,7 +5310,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true, true); + alignPanel.paintAlignment(true, + viewport.needToUpdateStructureViews()); } } @@ -5398,14 +5409,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } /** - * Store selected annotation sort order for the view and repaint. + * Sorts annotations and repaints the alignment */ @Override - protected void sortAnnotations_actionPerformed() + public void sortAnnotations(boolean autoCalcOnly) { - this.alignPanel.av.setSortAnnotationsBy(getAnnotationSortOrder()); - this.alignPanel.av - .setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); + alignPanel.sortAnnotations(autoCalcOnly); alignPanel.paintAlignment(false, false); } @@ -5586,15 +5595,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, colourMenu.add(textColour); colourMenu.addSeparator(); - ColourMenuHelper.addMenuItems(colourMenu, this, viewport.getAlignment(), - false); + ButtonGroup bg = ColourMenuHelper.addMenuItems(colourMenu, this, + viewport.getAlignment(), false); + colourMenu.add(annotationColour); + bg.add(annotationColour); colourMenu.addSeparator(); colourMenu.add(conservationMenuItem); colourMenu.add(modifyConservation); colourMenu.add(abovePIDThreshold); colourMenu.add(modifyPID); - colourMenu.add(annotationColour); ColourSchemeI colourScheme = viewport.getGlobalColourScheme(); ColourMenuHelper.setColourSelected(colourMenu, colourScheme); @@ -5632,6 +5642,40 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } + + /** + * Sets the flag for whether auto-calculated annotations should be shown above + * other annotations. If the given value is the same as the current setting, + * simply returns false. Otherwise updates the setting, and returns true. If + * annotation sort order is currently set to 'Custom', this is changed to + * 'None', because 'Custom' ordering ignores all sort options. + */ + @Override + public boolean setShowAutoCalculatedAbove(boolean b) + { + if (viewport.isShowAutocalculatedAbove() != b) + { + viewport.setShowAutocalculatedAbove(b); + + /* + * change CUSTOM annotation ordering to NONE + * so that sorting actually does something + */ + if (viewport.getSortAnnotationsBy() == SequenceAnnotationOrder.CUSTOM) + { + viewport.setSortAnnotationsBy(SequenceAnnotationOrder.NONE); + } + return true; + } + return false; + } + + @Override + public void setAnnotationSortOrder( + SequenceAnnotationOrder annotationSortOrder) + { + viewport.setSortAnnotationsBy(annotationSortOrder); + } } class PrintThread extends Thread