JAL-1013 - toy menu to switch between nucleotide and blosum 62 modes of calculation...
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index af7766a..6253e36 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -221,6 +221,10 @@ public class GAlignFrame extends JInternalFrame
 
   protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
 
+  protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
+
+  protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
+
   JMenu addSequenceMenu = new JMenu();
 
   JMenuItem addFromFile = new JMenuItem();
@@ -363,8 +367,7 @@ public class GAlignFrame extends JInternalFrame
             if (evt.isControlDown()
                     || SwingUtilities.isRightMouseButton(evt))
             {
-              radioItem
-                      .removeActionListener(radioItem.getActionListeners()[0]);
+              radioItem.removeActionListener(radioItem.getActionListeners()[0]);
 
               int option = JOptionPane.showInternalConfirmDialog(
                       jalview.gui.Desktop.desktop,
@@ -492,7 +495,7 @@ public class GAlignFrame extends JInternalFrame
       default:
         noColourmenuItem.setSelected(true);
         break;
-        
+
       }
     }
 
@@ -1404,6 +1407,29 @@ public class GAlignFrame extends JInternalFrame
         autoCalculate_actionPerformed(e);
       }
     });
+    sortByTree.setText("Sort Alignment With New Tree");
+    sortByTree.setToolTipText("<html>Enable this to automatically sort<br>the alignment when you open<br> a new tree.");
+    sortByTree.setState(jalview.bin.Cache.getDefault(
+            "SORT_BY_TREE", false));
+    sortByTree.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        sortByTreeOption_actionPerformed(e);
+      }
+    });
+
+    listenToViewSelections.setText("Listen for selections");
+    listenToViewSelections.setToolTipText("<html>When selected, selections in this view will mirror<br>selections made on the same sequences in other views.");
+    listenToViewSelections.setState(false); 
+    listenToViewSelections.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        listenToViewSelections_actionPerformed(e);
+      }
+    });
+
     addSequenceMenu.setText("Add Sequences");
     addFromFile.setText("From File");
     addFromFile.addActionListener(new ActionListener()
@@ -1750,6 +1776,7 @@ public class GAlignFrame extends JInternalFrame
     calculateMenu.add(showTranslation);
     calculateMenu.add(showProducts);
     calculateMenu.add(autoCalculate);
+    calculateMenu.add(sortByTree);
     calculateMenu.addSeparator();
     calculateMenu.add(extractScores);
     webServiceNoServices = new JMenuItem("<No Services>");
@@ -1805,6 +1832,15 @@ public class GAlignFrame extends JInternalFrame
     selectMenu.add(invertColSel);
     selectMenu.add(deleteGroups);
     selectMenu.add(grpsFromSelection);
+    // TODO - determine if the listenToViewSelections button is needed : see bug JAL-574
+    //selectMenu.addSeparator();
+    //selectMenu.add(listenToViewSelections);
+  }
+
+  protected void listenToViewSelections_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
   }
 
   protected void showAllhidden_actionPerformed(ActionEvent e)
@@ -2267,6 +2303,11 @@ public class GAlignFrame extends JInternalFrame
 
   }
 
+  public void sortByTreeOption_actionPerformed(ActionEvent e)
+  {
+
+  }
+
   public void showAllSeqs_actionPerformed(ActionEvent e)
   {