JAL-1517 fix copyright for 2.8.2
[jalview.git] / src / jalview / appletgui / AlignFrame.java
index 46fa9fa..a8bd6fd 100644 (file)
@@ -1,24 +1,28 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
  *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.appletgui;
 
 import jalview.analysis.AlignmentSorter;
 import jalview.analysis.Conservation;
+import jalview.api.AlignViewControllerGuiI;
 import jalview.api.AlignViewControllerI;
 import jalview.api.SequenceStructureBinding;
 import jalview.bin.JalviewLite;
@@ -51,7 +55,7 @@ import jalview.schemes.NucleotideColourScheme;
 import jalview.schemes.PIDColourScheme;
 import jalview.schemes.PurinePyrimidineColourScheme;
 import jalview.schemes.RNAHelicesColourChooser;
-import jalview.schemes.RNAInteractionColourScheme;\r
+import jalview.schemes.RNAInteractionColourScheme;
 import jalview.schemes.ResidueProperties;
 import jalview.schemes.StrandColourScheme;
 import jalview.schemes.TCoffeeColourScheme;
@@ -93,7 +97,7 @@ import java.util.StringTokenizer;
 import java.util.Vector;
 
 public class AlignFrame extends EmbmenuFrame implements ActionListener,
-        ItemListener, KeyListener
+        ItemListener, KeyListener, AlignViewControllerGuiI
 {
   public AlignViewControllerI avc;
   public AlignmentPanel alignPanel;
@@ -121,10 +125,31 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       ex.printStackTrace();
     }
-
+    // need to get window geometry before we calculate alignment layout
+    if (applet != null)
+    {
+      String param;
+      try
+      {
+        param = applet.getParameter("windowWidth");
+        if (param != null)
+        {
+          int width = Integer.parseInt(param);
+          DEFAULT_WIDTH = width;
+        }
+        param = applet.getParameter("windowHeight");
+        if (param != null)
+        {
+          int height = Integer.parseInt(param);
+          DEFAULT_HEIGHT = height;
+        }
+      } catch (Exception ex)
+      {
+      }
+    }
     viewport = new AlignViewport(al, applet);
     alignPanel = new AlignmentPanel(this, viewport);
-    avc = new jalview.controller.AlignViewController(viewport, alignPanel);
+    avc = new jalview.controller.AlignViewController(this, viewport, alignPanel);
     viewport.updateConservation(alignPanel);
     viewport.updateConsensus(alignPanel);
 
@@ -136,7 +161,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     showConsensusHistogram.setState(viewport.isShowConsensusHistogram());
     showSequenceLogo.setState(viewport.isShowSequenceLogo());
     normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());
-
+    applyToAllGroups.setState(viewport.getColourAppliesToAllGroups());
+    
     seqLimits.setState(viewport.showJVSuffix);
 
     if (applet != null)
@@ -173,23 +199,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         centreColumnLabelFlag.setState(true);
         centreColumnLabelFlag_stateChanged();
       }
-      try
-      {
-        param = applet.getParameter("windowWidth");
-        if (param != null)
-        {
-          int width = Integer.parseInt(param);
-          DEFAULT_WIDTH = width;
-        }
-        param = applet.getParameter("windowHeight");
-        if (param != null)
-        {
-          int height = Integer.parseInt(param);
-          DEFAULT_HEIGHT = height;
-        }
-      } catch (Exception ex)
-      {
-      }
 
     }
     if (viewport.getAlignment().isNucleotide())
@@ -1039,10 +1048,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       changeColour(new PurinePyrimidineColourScheme());
     }
-    else if (source == RNAInteractionColour)\r
-    {\r
-      changeColour(new RNAInteractionColourScheme());\r
-    }\r
+    else if (source == RNAInteractionColour)
+    {
+      changeColour(new RNAInteractionColourScheme());
+    }
     else if (source == RNAHelixColour)
     {
       new RNAHelicesColourChooser(viewport, alignPanel);
@@ -2326,42 +2335,20 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       if (viewport.getAbovePIDThreshold())
       {
-        threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,
-                "Background");
-
-        cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
-
-        viewport.setGlobalColourScheme(cs);
-      }
-      else
-      {
-        cs.setThreshold(0, viewport.getIgnoreGapsConsensus());
-      }
+        viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel, cs,
+                "Background"));
+      } 
 
       if (viewport.getConservationSelected())
       {
-
-        Alignment al = (Alignment) viewport.getAlignment();
-        Conservation c = new Conservation("All",
-                ResidueProperties.propHash, 3, al.getSequences(), 0,
-                al.getWidth() - 1);
-
-        c.calculate();
-        c.verdict(false, viewport.getConsPercGaps());
-
-        cs.setConservation(c);
-
-        cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel,
+        cs.setConservationApplied(true);
+        viewport.setIncrement(SliderPanel.setConservationSlider(alignPanel,
                 cs, "Background"));
-
       }
       else
       {
-        cs.setConservation(null);
+        cs.setConservationApplied(false);
       }
-
-      cs.setConsensus(viewport.getSequenceConsensusHash());
-
     }
     viewport.setGlobalColourScheme(cs);
 
@@ -2830,8 +2817,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 
   MenuItem purinePyrimidineColour = new MenuItem();
 
-  MenuItem RNAInteractionColour = new MenuItem();\r
-\r
+  MenuItem RNAInteractionColour = new MenuItem();
+
   MenuItem RNAHelixColour = new MenuItem();
 
   MenuItem userDefinedColour = new MenuItem();
@@ -3039,8 +3026,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     buriedColour.addActionListener(this);
     purinePyrimidineColour.setLabel(MessageManager.getString("label.purine_pyrimidine"));
     purinePyrimidineColour.addActionListener(this);
-    RNAInteractionColour.setLabel(MessageManager.getString("label.rna_interaction"));\r
-    RNAInteractionColour.addActionListener(this);\r
+    RNAInteractionColour.setLabel(MessageManager.getString("label.rna_interaction"));
+    RNAInteractionColour.addActionListener(this);
     RNAHelixColour.setLabel(MessageManager.getString("action.by_rna_helixes"));
     RNAHelixColour.addActionListener(this);
     userDefinedColour.setLabel(MessageManager.getString("action.user_defined"));
@@ -3158,7 +3145,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     menu1.setLabel(MessageManager.getString("action.show"));
     showColumns.setLabel(MessageManager.getString("label.all_columns"));
     showSeqs.setLabel(MessageManager.getString("label.all_sequences"));
-    menu2.setLabel(MessageManager.getString("aciton.hide"));
+    menu2.setLabel(MessageManager.getString("action.hide"));
     hideColumns.setLabel(MessageManager.getString("label.selected_columns"));
     hideSequences.setLabel(MessageManager.getString("label.selected_sequences"));
     hideAllButSelection.setLabel(MessageManager.getString("label.all_but_selected_region"));
@@ -3267,7 +3254,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideColour);
     colourMenu.add(purinePyrimidineColour);
-    //    colourMenu.add(RNAInteractionColour);\r
+    //    colourMenu.add(RNAInteractionColour);
     colourMenu.add(tcoffeeColour);
     colourMenu.add(userDefinedColour);
     colourMenu.addSeparator();
@@ -3330,6 +3317,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 
   }
 
+  
+  public void setStatus(String string) {
+    statusBar.setText(string);
+  };
+
   MenuItem featureSettings = new MenuItem();
 
   CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();
@@ -3382,7 +3374,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       fileMenu.remove(closeMenuItem);
       fileMenu.remove(3); // Remove Seperator
       embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, "Arial",
-              Font.PLAIN, 10, false); // use our own fonts.
+              Font.PLAIN, 11, false); // use our own fonts.
       // and actually add the components to the applet area
       viewport.applet.setLayout(new BorderLayout());
       viewport.applet.add(embeddedMenu, BorderLayout.NORTH);