Copy hidden cols to new alignment
authoramwaterhouse <Andrew Waterhouse>
Wed, 9 Aug 2006 15:53:22 +0000 (15:53 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 9 Aug 2006 15:53:22 +0000 (15:53 +0000)
src/jalview/appletgui/AlignFrame.java

index e1d8ce8..6a8645e 100755 (executable)
@@ -521,6 +521,12 @@ public void itemStateChanged(ItemEvent evt)
       url.append( appendProtocol( viewport.applet.getParameter("features") ) );\r
     }\r
 \r
+    if(viewport.applet.getParameter("annotations")!=null)\r
+    {\r
+      url.append( "&annotations=" );\r
+      url.append( appendProtocol( viewport.applet.getParameter("annotations") ) );\r
+    }\r
+\r
     if(viewport.applet.getParameter("defaultColour")!=null)\r
     {\r
       url.append("&colour=" +\r
@@ -689,7 +695,8 @@ public void itemStateChanged(ItemEvent evt)
     alignPanel.repaint();\r
   }\r
 \r
-  StringBuffer copiedSequences;\r
+  static StringBuffer copiedSequences;\r
+  static Vector copiedHiddenColumns;\r
   protected void copy_actionPerformed()\r
   {\r
     if (viewport.getSelectionGroup() == null)\r
@@ -710,6 +717,25 @@ public void itemStateChanged(ItemEvent evt)
     int index = 0, startRes, endRes;\r
     char ch;\r
 \r
+    if (viewport.hasHiddenColumns && viewport.getSelectionGroup() != null)\r
+    {\r
+      copiedHiddenColumns = new Vector();\r
+      int hiddenOffset = viewport.getSelectionGroup().getStartRes();\r
+      for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns().size();\r
+           i++)\r
+      {\r
+        int[] region = (int[])\r
+            viewport.getColumnSelection().getHiddenColumns().elementAt(i);\r
+\r
+        copiedHiddenColumns.addElement(new int[]\r
+                                 {region[0] - hiddenOffset,\r
+                                 region[1] - hiddenOffset});\r
+      }\r
+    }\r
+    else\r
+      copiedHiddenColumns = null;\r
+\r
+\r
     for (int i = 0; i < sg.getSize(false); i++)\r
     {\r
         SequenceI seq = null;\r
@@ -821,6 +847,15 @@ public void itemStateChanged(ItemEvent evt)
                                        viewport.applet,\r
                                        newtitle,\r
                                        false);\r
+        if (copiedHiddenColumns != null)\r
+        {\r
+          for (int i = 0; i < copiedHiddenColumns.size(); i++)\r
+          {\r
+            int[] region = (int[]) copiedHiddenColumns.elementAt(i);\r
+            af.viewport.hideColumns(region[0], region[1]);\r
+          }\r
+        }\r
+\r
 \r
         jalview.bin.JalviewLite.addFrame(af, newtitle, NEW_WINDOW_WIDTH,\r
                                          NEW_WINDOW_HEIGHT);\r