From c9fd7ec6f8096c6659cccfc0aad0c2d5fd9ed9d1 Mon Sep 17 00:00:00 2001
From: Jim Procter <jprocter@compbio.dundee.ac.uk>
Date: Thu, 17 Oct 2013 12:33:32 +0100
Subject: [PATCH] fix for JAL-1398 - original colourscheme is enabled if
 colourscheme has a BaseColour setting. See JAL-1399 for
 future improvements.

---
 src/jalview/appletgui/AnnotationColourChooser.java |    8 +++++---
 src/jalview/gui/AnnotationColourChooser.java       |    7 ++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java
index f9594eb..3c0f704 100644
--- a/src/jalview/appletgui/AnnotationColourChooser.java
+++ b/src/jalview/appletgui/AnnotationColourChooser.java
@@ -81,18 +81,19 @@ public class AnnotationColourChooser extends Panel implements
 
     setDefaultMinMax();
 
+    adjusting = true;
     if (oldcs instanceof AnnotationColourGradient)
     {
       AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
-      currentColours.setState(acg.isPredefinedColours());
-      if (!acg.isPredefinedColours())
+      currentColours.setState(acg.isPredefinedColours() || acg.getBaseColour()!=null);
+      if (!acg.isPredefinedColours() && acg.getBaseColour()==null)
       {
         minColour.setBackground(acg.getMinColour());
         maxColour.setBackground(acg.getMaxColour());
       }
+      // seqAssociated.setState(acg.isSeqAssociated());
     }
 
-    adjusting = true;
 
     Vector list = new Vector();
     int index = 1;
@@ -492,6 +493,7 @@ public class AnnotationColourChooser extends Panel implements
     }
 
     // update colours in linked windows
+    ap.alignmentChanged();
     ap.paintAlignment(true);
   }
 
diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java
index 3278a76..5ee69f2 100644
--- a/src/jalview/gui/AnnotationColourChooser.java
+++ b/src/jalview/gui/AnnotationColourChooser.java
@@ -120,18 +120,19 @@ public class AnnotationColourChooser extends JPanel
     // Always get default shading from preferences.
     setDefaultMinMax();
 
+    adjusting = true;
     if (oldcs instanceof AnnotationColourGradient)
     {
       AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
-      currentColours.setSelected(acg.isPredefinedColours());
-      if (!acg.isPredefinedColours())
+      currentColours.setSelected(acg.isPredefinedColours() || acg.getBaseColour()!=null);
+      if (!acg.isPredefinedColours() && acg.getBaseColour()==null)
       {
         minColour.setBackground(acg.getMinColour());
         maxColour.setBackground(acg.getMaxColour());
       }
       seqAssociated.setSelected(acg.isSeqAssociated());
+      
     }
-    adjusting = true;
     annotations = new JComboBox(
             getAnnotationItems(seqAssociated.isSelected()));
 
-- 
1.7.10.2