|
From: <mig...@us...> - 2006-03-27 21:44:23
|
Revision: 4792 Author: migueljmol Date: 2006-03-27 13:44:15 -0800 (Mon, 27 Mar 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4792&view=rev Log Message: ----------- r4595 & r4596 to eliminate java.awt.Color from org.jmol.viewer Modified Paths: -------------- branches/r4453rollback/Jmol/src/org/jmol/viewer/Axes.java branches/r4453rollback/Jmol/src/org/jmol/viewer/AxesRenderer.java branches/r4453rollback/Jmol/src/org/jmol/viewer/Bbcage.java branches/r4453rollback/Jmol/src/org/jmol/viewer/BbcageRenderer.java branches/r4453rollback/Jmol/src/org/jmol/viewer/ColorManager.java branches/r4453rollback/Jmol/src/org/jmol/viewer/Eval.java branches/r4453rollback/Jmol/src/org/jmol/viewer/Uccage.java branches/r4453rollback/Jmol/src/org/jmol/viewer/UccageRenderer.java branches/r4453rollback/Jmol/src/org/jmol/viewer/Viewer.java Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/Axes.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/Axes.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/Axes.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,9 +3,9 @@ * $Date$ * $Revision$ * - * Copyright (C) 2002-2005 The Jmol Development Team + * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org * - * Contact: jmo...@li... + * Contact: mi...@jm... * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -59,8 +59,6 @@ axisPoint.z *= corner.z; axisPoint.add(originPoint); - colix = viewer.getColixAxes(); - font3d = g3d.getFont3D(JmolConstants.AXES_DEFAULT_FONTSIZE); } } Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/AxesRenderer.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/AxesRenderer.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/AxesRenderer.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,9 +3,9 @@ * $Date$ * $Revision$ * - * Copyright (C) 2002-2005 The Jmol Development Team + * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org * - * Contact: jmo...@li... + * Contact: mi...@jm... * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -53,6 +53,8 @@ if (mad >= 20) widthPixels = viewer.scaleToScreen(originScreen.z, mad); short colix = axes.colix; + if (colix == 0) + colix = Graphics3D.OLIVE; for (int i = 6; --i >= 0; ) { if (mad < 0) g3d.drawDottedLine(colix, originScreen, axisScreens[i]); Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/Bbcage.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/Bbcage.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/Bbcage.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,9 +3,9 @@ * $Date$ * $Revision$ * - * Copyright (C) 2002-2005 The Jmol Development Team + * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org * - * Contact: jmo...@li... + * Contact: mi...@jm... * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jmol.viewer; +import org.jmol.g3d.Graphics3D; class Bbcage extends SelectionIndependentShape { @@ -29,8 +30,4 @@ final static byte edges[] = {0,1, 0,2, 0,4, 1,3, 1,5, 2,3, 2,6, 3,7, 4,5, 4,6, 5,7, 6,7}; - void initShape() { - colix = viewer.getColixAxes(); // do this, or it will be BLACK - } - } Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/BbcageRenderer.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/BbcageRenderer.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/BbcageRenderer.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,9 +3,9 @@ * $Date$ * $Revision$ * - * Copyright (C) 2002-2005 The Jmol Development Team + * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org * - * Contact: jmo...@li... + * Contact: mi...@jm... * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,10 @@ short mad = bbcage.mad; if (mad == 0) return; - render(viewer, g3d, mad, bbcage.colix, frame.bboxVertices, screens); + short colix = bbcage.colix; + if (colix == 0) + colix = Graphics3D.OLIVE; + render(viewer, g3d, mad, colix, frame.bboxVertices, screens); } static void render(Viewer viewer, Graphics3D g3d, Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/ColorManager.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/ColorManager.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/ColorManager.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -25,8 +25,6 @@ import org.jmol.g3d.*; -import java.awt.Color; - class ColorManager { Viewer viewer; @@ -96,20 +94,6 @@ g3d.setBackground(colixBackground); } - Color colorAxes = new Color(128, 128, 0); - short colixAxes = Graphics3D.OLIVE; - void setColorAxes(Color color) { - colorAxes = color; - colixAxes = Graphics3D.getColix(color); - } - - Color colorAxesText = colorAxes; - short colixAxesText = Graphics3D.OLIVE; - void setColorAxesText(Color color) { - colorAxesText = color; - colixAxesText = Graphics3D.getColix(color); - } - void setColorBackground(String colorName) { if (colorName != null && colorName.length() > 0) setBackgroundArgb(Graphics3D.getArgbFromString(colorName)); Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/Eval.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/Eval.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -27,7 +27,6 @@ import org.jmol.smiles.InvalidSmilesException; import java.io.*; -import java.awt.Color; import java.util.BitSet; import java.util.Hashtable; import java.util.Properties; @@ -1450,15 +1449,6 @@ } - // note that text color names are mapped to color argb values at compile time - Color getColorParam(int itoken) throws ScriptException { - if (itoken >= statementLength) - colorExpected(); - if (statement[itoken].tok != Token.colorRGB) - colorExpected(); - return new Color(statement[itoken].intValue); - } - int getArgbParam(int itoken) throws ScriptException { if (itoken >= statementLength) colorExpected(); @@ -1467,16 +1457,6 @@ return statement[itoken].intValue; } - Color getColorOrNoneParam(int itoken) throws ScriptException { - if (itoken >= statementLength) - colorExpected(); - if (statement[itoken].tok == Token.colorRGB) - return new Color(statement[itoken].intValue); - if (statement[itoken].tok != Token.none) - colorExpected(); - return null; - } - int getArgbOrNoneParam(int itoken) throws ScriptException { if (itoken >= statementLength) colorExpected(); @@ -1494,8 +1474,8 @@ if (tok == Token.colorRGB) viewer.setBackgroundArgb(getArgbParam(1)); else - viewer.setShapeProperty(getShapeType(tok), - "bgcolor", getColorOrNoneParam(2)); + viewer.setShapePropertyArgb(getShapeType(tok), "bgcolor", + getArgbOrNoneParam(2)); } // mth - 2003 01 @@ -1540,24 +1520,24 @@ case Token.identifier: case Token.hydrogen: String str = (String)statement[1].value; - Color color = getColorOrNoneParam(2); + int argb = getArgbOrNoneParam(2); if (str.equalsIgnoreCase("dotsConvex")) { - viewer.setShapeProperty(JmolConstants.SHAPE_DOTS, "colorConvex", - color); + viewer.setShapePropertyArgb(JmolConstants.SHAPE_DOTS, + "colorConvex", argb); return; } if (str.equalsIgnoreCase("dotsConcave")) { - viewer.setShapeProperty(JmolConstants.SHAPE_DOTS, "colorConcave", - color); + viewer.setShapePropertyArgb(JmolConstants.SHAPE_DOTS, + "colorConcave", argb); return; } if (str.equalsIgnoreCase("dotsSaddle")) { - viewer.setShapeProperty(JmolConstants.SHAPE_DOTS, "colorSaddle", - color); + viewer.setShapePropertyArgb(JmolConstants.SHAPE_DOTS, + "colorSaddle", argb); return; } if (str.equalsIgnoreCase("selectionHalo")) { - viewer.setSelectionArgb(color == null ? 0 : color.getRGB()); + viewer.setSelectionArgb(argb); return; } for (int i = JmolConstants.elementNames.length; --i >= 0; ) { @@ -1630,7 +1610,8 @@ notImplemented(itoken); return; case Token.colorRGB: - colorvalue = getColorParam(itoken); + int argb = getArgbParam(itoken); + colorvalue = argb == 0 ? null : new Integer(argb); break; default: invalidArgument(); Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/Uccage.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/Uccage.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/Uccage.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,9 +3,9 @@ * $Date$ * $Revision$ * - * Copyright (C) 2002-2005 The Jmol Development Team + * Copyright (C) 2003-2006 Miguel, Jmol Development, www.jmol.org * - * Contact: jmo...@li... + * Contact: mi...@jm... * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,7 +32,6 @@ Point3f[] vertices; void initShape() { - colix = viewer.getColixAxes(); // do this, or it will be BLACK float[] notionalUnitcell = frame.notionalUnitcell; hasUnitcell = notionalUnitcell != null; Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/UccageRenderer.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/UccageRenderer.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/UccageRenderer.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,9 +3,9 @@ * $Date$ * $Revision$ * - * Copyright (C) 2002-2005 The Jmol Development Team + * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org * - * Contact: jmo...@li... + * Contact: mi...@jm... * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,7 @@ import javax.vecmath.Point3i; import java.text.NumberFormat; +import org.jmol.g3d.Graphics3D; class UccageRenderer extends ShapeRenderer { @@ -45,9 +46,11 @@ void render() { Uccage uccage = (Uccage)shape; short mad = uccage.mad; - short colix = uccage.colix; if (mad == 0 || ! uccage.hasUnitcell) return; + short colix = uccage.colix; + if (colix == 0) + colix = Graphics3D.OLIVE; BbcageRenderer.render(viewer, g3d, mad, colix, frame.unitcellVertices, screens); /* Modified: branches/r4453rollback/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- branches/r4453rollback/Jmol/src/org/jmol/viewer/Viewer.java 2006-03-27 21:34:39 UTC (rev 4791) +++ branches/r4453rollback/Jmol/src/org/jmol/viewer/Viewer.java 2006-03-27 21:44:15 UTC (rev 4792) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2003-2006 Miguel, Jmol Development, www.jmol.org + * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org * * Contact: mi...@jm... * @@ -28,7 +28,6 @@ import java.awt.Graphics; import java.awt.Image; -import java.awt.Color; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Component; @@ -94,11 +93,12 @@ strJavaVendor = System.getProperty("java.vendor"); strOSName = System.getProperty("os.name"); strJavaVersion = System.getProperty("java.version"); - jvm11orGreater = (strJavaVersion.compareTo("1.1") >= 0 && - // Netscape on MacOS does not implement 1.1 event model - ! (strJavaVendor.startsWith("Netscape") && - strJavaVersion.compareTo("1.1.5") <= 0 && - "Mac OS".equals(strOSName))); + jvm11orGreater = + (strJavaVersion.compareTo("1.1") >= 0 && + // Netscape on MacOS does not implement 1.1 event model + !(strJavaVendor.startsWith("Netscape") && + strJavaVersion.compareTo("1.1.5") <= 0 && + "Mac OS".equals(strOSName))); jvm12orGreater = (strJavaVersion.compareTo("1.2") >= 0); jvm14orGreater = (strJavaVersion.compareTo("1.4") >= 0); @@ -696,14 +696,6 @@ return colorManager.getColixHbondType(order); } - short getColixAxes() { - return colorManager.colixAxes; - } - - short getColixAxesText() { - return colorManager.colixAxesText; - } - short getColixFromPalette(float val, float rangeMin, float rangeMax, String palette) { return colorManager.getColixFromPalette(val, rangeMin, rangeMax, palette); @@ -1711,9 +1703,17 @@ refresh(); } + void setShapeProperty(int shapeID, String propertyName, int value) { + setShapeProperty(shapeID, propertyName, new Integer(value)); + } + + void setShapePropertyArgb(int shapeID, String propertyName, int argb) { + setShapeProperty(shapeID, propertyName, + argb == 0 ? null : new Integer(argb|0xFF000000)); + } + void setShapeColorProperty(int shapeType, int argb) { - setShapeProperty(shapeType, "color", - argb == 0 ? null : new Color(argb|0xFF000000)); + setShapePropertyArgb(shapeType, "color", argb); } Object getShapeProperty(int shapeType, String propertyName) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |