Merge branch 'develop' into JAL-1705_trialMerge
[jalview.git] / src / jalview / appletgui / AlignFrame.java
index 84e9087..e5f0053 100644 (file)
@@ -752,6 +752,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       {
         viewport.showAllHiddenColumns();
       }
+      viewport.sendSelection();
     }
   }
 
@@ -923,12 +924,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   {
     boolean showForAlignment = showAlignmentAnnotations.getState();
     boolean showForSequences = showSequenceAnnotations.getState();
-    for (AlignmentAnnotation aa : alignPanel.getAlignment()
+    if (alignPanel.getAlignment().getAlignmentAnnotation() != null)
+    {
+      for (AlignmentAnnotation aa : alignPanel.getAlignment()
             .getAlignmentAnnotation())
     {
       boolean visible = (aa.sequenceRef == null ? showForAlignment
               : showForSequences);
       aa.visible = visible;
+      }
     }
     alignPanel.validateAnnotationDimensions(true);
     validate();
@@ -1070,11 +1074,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     else if (source == invertSequenceMenuItem)
     {
       invertSequenceMenuItem_actionPerformed();
+      // uncomment to slave sequence selections in split frame
+      // viewport.sendSelection();
     }
     else if (source == invertColSel)
     {
       viewport.invertColumnSelection();
       alignPanel.paintAlignment(true);
+      viewport.sendSelection();
     }
     else if (source == remove2LeftMenuItem)
     {
@@ -1108,27 +1115,34 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       viewport.showAllHiddenColumns();
       alignPanel.paintAlignment(true);
+      viewport.sendSelection();
     }
     else if (source == showSeqs)
     {
       viewport.showAllHiddenSeqs();
       alignPanel.paintAlignment(true);
+      // uncomment if we want to slave sequence selections in split frame
+      // viewport.sendSelection();
     }
     else if (source == hideColumns)
     {
       viewport.hideSelectedColumns();
       alignPanel.paintAlignment(true);
+      viewport.sendSelection();
     }
     else if (source == hideSequences
             && viewport.getSelectionGroup() != null)
     {
       viewport.hideAllSelectedSeqs();
       alignPanel.paintAlignment(true);
+      // uncomment if we want to slave sequence selections in split frame
+      // viewport.sendSelection();
     }
     else if (source == hideAllButSelection)
     {
       toggleHiddenRegions(false, false);
       alignPanel.paintAlignment(true);
+      viewport.sendSelection();
     }
     else if (source == hideAllSelection)
     {
@@ -1137,12 +1151,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       viewport.hideAllSelectedSeqs();
       viewport.hideSelectedColumns();
       alignPanel.paintAlignment(true);
+      viewport.sendSelection();
     }
     else if (source == showAllHidden)
     {
       viewport.showAllHiddenColumns();
       viewport.showAllHiddenSeqs();
       alignPanel.paintAlignment(true);
+      viewport.sendSelection();
     }
     else if (source == showGroupConsensus)
     {
@@ -2263,7 +2279,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     ColumnSelection colSel = viewport.getColumnSelection();
     int column;
 
-    if (colSel.size() > 0)
+    if (!colSel.isEmpty())
     {
       if (trimLeft)
       {
@@ -2288,18 +2304,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       TrimRegionCommand trimRegion;
       if (trimLeft)
       {
-        trimRegion = new TrimRegionCommand("Remove Left",
-                TrimRegionCommand.TRIM_LEFT, seqs, column,
-                viewport.getAlignment(), viewport.getColumnSelection(),
-                viewport.getSelectionGroup());
+        trimRegion = new TrimRegionCommand("Remove Left", true, seqs,
+                column, viewport.getAlignment());
         viewport.setStartRes(0);
       }
       else
       {
-        trimRegion = new TrimRegionCommand("Remove Right",
-                TrimRegionCommand.TRIM_RIGHT, seqs, column,
-                viewport.getAlignment(), viewport.getColumnSelection(),
-                viewport.getSelectionGroup());
+        trimRegion = new TrimRegionCommand("Remove Right", false, seqs,
+                column, viewport.getAlignment());
       }
 
       statusBar.setText(MessageManager.formatMessage(