Conservation colour scheme is no more
[jalview.git] / src / jalview / gui / PopupMenu.java
index 40c51cb..137ca14 100755 (executable)
@@ -172,7 +172,7 @@ public class PopupMenu extends JPopupMenu
                 noColourmenuItem.setSelected(true);\r
             }\r
 \r
-            if (sg.cs instanceof ConservationColourScheme)\r
+            if (sg.cs!=null && sg.cs.conservationApplied())\r
             {\r
                 conservationMenuItem.setSelected(true);\r
             }\r
@@ -615,22 +615,13 @@ public class PopupMenu extends JPopupMenu
             int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs,\r
                     getGroup().getName());\r
 \r
-            if (sg.cs instanceof ResidueColourScheme)\r
-            {\r
-                ((ResidueColourScheme) sg.cs).setThreshold(threshold, ap.av.getIgnoreGapsConsensus());\r
-            }\r
-            else if (sg.cs instanceof ScoreColourScheme)\r
-            {\r
-                ((ScoreColourScheme) sg.cs).setThreshold(threshold, ap.av.getIgnoreGapsConsensus());\r
-            }\r
+           sg.cs.setThreshold(threshold, ap.av.getIgnoreGapsConsensus());\r
 \r
             SliderPanel.showPIDSlider();\r
         }\r
         else // remove PIDColouring\r
         {\r
-            ResidueColourScheme rcs = (ResidueColourScheme) sg.cs;\r
-            rcs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
-            sg.cs = rcs;\r
+            sg.cs.setThreshold(0, ap.av.getIgnoreGapsConsensus());\r
         }\r
 \r
         refresh();\r
@@ -715,17 +706,14 @@ public class PopupMenu extends JPopupMenu
             c.calculate();\r
             c.verdict(false, ap.av.ConsPercGaps);\r
 \r
-            ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
-\r
-            sg.cs = ccs;\r
+            sg.cs.setConservation(c);\r
 \r
-            SliderPanel.setConservationSlider(ap, ccs, sg.getName());\r
+            SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());\r
             SliderPanel.showConservationSlider();\r
         }\r
         else // remove ConservationColouring\r
         {\r
-            ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
-            sg.cs = ccs.cs;\r
+            sg.cs.setConservation(null);\r
         }\r
 \r
         refresh();\r