Reveal All added
authoramwaterhouse <Andrew Waterhouse>
Wed, 8 Mar 2006 16:55:30 +0000 (16:55 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 8 Mar 2006 16:55:30 +0000 (16:55 +0000)
src/jalview/gui/ScalePanel.java

index 7fa3abd..87e72dc 100755 (executable)
@@ -72,14 +72,40 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
         min = res;\r
         max = res;\r
 \r
-        if(reveal != null)\r
-        {\r
-          av.getColumnSelection().revealHiddenColumns(reveal[0], av);\r
-          reveal = null;\r
-          return;\r
-        }\r
+        if(reveal != null && SwingUtilities.isRightMouseButton(evt))\r
+          {\r
+            JPopupMenu pop = new JPopupMenu();\r
+            JMenuItem item = new JMenuItem("Reveal");\r
+            item.addActionListener(new ActionListener()\r
+            {\r
+              public void actionPerformed(ActionEvent e)\r
+              {\r
+                av.getColumnSelection().revealHiddenColumns(reveal[0], av);\r
+                reveal = null;\r
+                ap.repaint();\r
+              }\r
+            });\r
+            pop.add(item);\r
 \r
-        if (av.getColumnSelection().contains(res))\r
+            if(av.getColumnSelection().hiddenColumns.size()>1)\r
+            {\r
+              item = new JMenuItem("Reveal All");\r
+              item.addActionListener(new ActionListener()\r
+              {\r
+                public void actionPerformed(ActionEvent e)\r
+                {\r
+                  av.getColumnSelection().revealAllHiddenColumns(av);\r
+                  reveal = null;\r
+                  ap.repaint();\r
+                }\r
+              });\r
+              pop.add(item);\r
+            }\r
+\r
+            pop.show(this, evt.getX(), evt.getY());\r
+\r
+          }\r
+        else if (av.getColumnSelection().contains(res))\r
         {\r
           if( SwingUtilities.isRightMouseButton(evt))\r
           {\r
@@ -90,6 +116,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
               public void actionPerformed(ActionEvent e)\r
               {\r
                 av.getColumnSelection().hideColumns(res, av);\r
+                ap.repaint();\r
               }\r
             });\r
             pop.add(item);\r
@@ -99,7 +126,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
           else\r
           {\r
             av.getColumnSelection().removeElement(res);\r
-            ap.annotationPanel.removeEditableColumn(res);\r
+            av.setSelectionGroup(null);\r
           }\r
         }\r
         else\r
@@ -133,15 +160,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
         if(av.hasHiddenColumns)\r
           res = av.getColumnSelection().adjustForHiddenColumns(res);\r
 \r
-        if (av.getColumnSelection() != null)\r
-        {\r
-            for (int i = 0; i < av.getColumnSelection().size(); i++)\r
-            {\r
-                ap.annotationPanel.addEditableColumn(av.getColumnSelection()\r
-                                                       .columnAt(i));\r
-            }\r
-        }\r
-\r
         if (!stretchingGroup)\r
         {\r
             ap.repaint();\r
@@ -211,7 +229,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList
                 if ((i < sg.getStartRes()) || (i > sg.getEndRes()))\r
                 {\r
                     av.getColumnSelection().removeElement(i);\r
-                    ap.annotationPanel.removeEditableColumn(res);\r
                 }\r
                 else\r
                 {\r