X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FUserDefinedColours.java;h=6e14146846376e4fdc85cc50a6316bcb5850c33a;hb=34d0e74532d41a1b46d253e0190baf6c7c29b8da;hp=af08b7529b6ac4bf1ef49123d03a88603992e25e;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index af08b75..6e14146 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -38,8 +38,10 @@ public class UserDefinedColours ColourSchemeI oldColourScheme; Frame frame; MCview.AppletPDBCanvas pdbcanvas; + AppletJmol jmol; - Component caller; + Dialog dialog; + Object caller; String originalLabel; Color originalColour; @@ -74,7 +76,36 @@ public class UserDefinedColours init(); } + public UserDefinedColours(AppletJmol jmol) + { + this.jmol = jmol; + init(); + } + + public UserDefinedColours(FeatureRenderer fr, Frame alignframe) + { + caller = fr; + originalColour = fr.colourPanel.getBackground(); + originalLabel = "Feature Colour"; + setForDialog("Select Feature Colour", alignframe); + setTargetColour(fr.colourPanel.getBackground()); + dialog.setVisible(true); + } + public UserDefinedColours(Component caller, + Color col1, + Frame alignframe) + { + this.caller = caller; + originalColour = col1; + originalLabel = "Select Colour"; + setForDialog("Select Colour", alignframe); + setTargetColour(col1); + dialog.setVisible(true); + } + + + public UserDefinedColours(Object caller, String label, Color colour) { @@ -91,6 +122,27 @@ public class UserDefinedColours frame.setSize(420, 200); } + void setForDialog(String title, Frame alignframe) + { + init(); + frame.setVisible(false); + remove(buttonPanel); + dialog = new Dialog(alignframe, title, true); + + dialog.add(this); + this.setSize(400,123); + okcancelPanel.setBounds(new Rectangle(0, 123, 400, 35)); + int height = 160 + alignframe.getInsets().top + getInsets().bottom; + int width = 400; + + dialog.setBounds(alignframe.getBounds().x + + (alignframe.getSize().width - width) / 2, + alignframe.getBounds().y + + (alignframe.getSize().height - height) / 2, + width, height); + + } + public void actionPerformed(ActionEvent evt) { if (evt.getSource() == okButton) @@ -245,6 +297,7 @@ public class UserDefinedColours R = col.getRed(); G = col.getGreen(); B = col.getBlue(); + rScroller.setValue(R); gScroller.setValue(G); bScroller.setValue(B); @@ -291,9 +344,17 @@ public class UserDefinedColours protected void okButton_actionPerformed() { applyButton_actionPerformed(); + if (dialog != null) + dialog.setVisible(false); + frame.setVisible(false); } + public Color getColor() + { + return new Color(R, G, B); + } + protected void applyButton_actionPerformed() { if (caller != null) @@ -301,21 +362,26 @@ public class UserDefinedColours if (caller instanceof FeatureSettings) { ( (FeatureSettings) caller).setUserColour - (originalLabel, new Color(R, G, B)); + (originalLabel, getColor()); } else if (caller instanceof AnnotationColourChooser) { if (originalLabel.equals("Min Colour")) { ( (AnnotationColourChooser) caller).minColour_actionPerformed - (new Color(R, G, B)); + (getColor()); } else { ( (AnnotationColourChooser) caller).maxColour_actionPerformed - (new Color(R, G, B)); + (getColor()); } } + else if(caller instanceof FeatureRenderer) + { + ((FeatureRenderer)caller).colourPanel.setBackground(getColor()); + } + return; } @@ -343,12 +409,15 @@ public class UserDefinedColours ap.av.setGlobalColourScheme(ucs); } ap.seqPanel.seqCanvas.img = null; - ap.repaint(); + ap.paintAlignment(true); + } + else if(jmol!=null) + { + jmol.setJalviewColourScheme(ucs); } else if (pdbcanvas != null) { - pdbcanvas.pdb.setColours(ucs); - pdbcanvas.updateSeqColours(); + pdbcanvas.setColours(ucs); } } @@ -374,6 +443,15 @@ public class UserDefinedColours (originalColour); } } + else if (caller instanceof FeatureRenderer) + { + ( (FeatureRenderer) caller).colourPanel.setBackground(originalColour); + + } + + if(dialog!=null) + dialog.setVisible(false); + frame.setVisible(false); return; } @@ -397,7 +475,11 @@ public class UserDefinedColours { ap.av.setGlobalColourScheme(ucs); } - ap.repaint(); + ap.paintAlignment(true); + } + else if(jmol !=null) + { + jmol.setJalviewColourScheme(ucs); } else if (pdbcanvas != null) {