gt: 		if (state==DNAState.G) {
context: /* Mesquite Chromaseq source code.  Copyright 2005-2011 David Maddison and Wayne Maddison.
  Version 1.0   December 2011
  Disclaimer:  The Mesquite source code is lengthy and we are few.  There are no doubt inefficiencies and goofs in this code. 
  The commenting leaves much to be desired. Please approach this source code with the spirit of helping out.
  Perhaps with your help we can be more than a few, and make Mesquite better.
  
  Mesquite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
  Mesquite's web site is http://mesquiteproject.org
  
  This source code and its compiled class files are free and modifiable under the terms of 
  GNU Lesser General Public License.  (http://www.gnu.org/copyleft/lesser.html)
   */
  
  package mesquite.chromaseq.ViewChromatograms; 
  
  import java.awt.*;
  import java.awt.event.KeyEvent;
  import java.awt.event.KeyListener;
  import java.awt.geom.CubicCurve2D;
  import java.awt.geom.QuadCurve2D;
  
  import mesquite.align.lib.*;
  import mesquite.chromaseq.lib.*;
  import mesquite.lib.*;
  import mesquite.categ.lib.*;
  
  public class ChromatogramCloseupPanel extends ChromatogramPanel{
  	CloseupChromatogramCanvas chromCanvas;
  	Color backgroundColor = Color.white;
  	int id;
  	boolean showA = true;
  	boolean showC = true;
  	boolean showG = true;
  	boolean showT = true;
  	int readBaseNumber;
  	Chromatogram currentChromatogram = null;
  	boolean showCenterBase = false;
  	boolean showSourceBase = true;
  	boolean showTouchedBase = false;
  	int touchedBase = 0;
  
  
  	public ChromatogramCloseupPanel(ClosablePanelContainer container, Chromatogram myChrom, ContigDisplay panel, int id, int contigID) {
  		this.id = id;  // this is the read number
  		this.contigID = contigID;  //this is the taxon number or other id for contig
  		this.contigDisplay = panel;
  		open=true;
  		chromatograms = new Chromatogram[1];
  		//	setChromatogram(myChrom);
  		setChromatogram(null);
  		setBackground(getBackgroundColor());
  		backgroundColor = panel.getBackgroundColor();
  		chromCanvas = new CloseupChromatogramCanvas(this, id);
  		chromCanvas.setBounds(0, 0, getWidth(), getHeight());
  		this.add("Center",chromCanvas);
  		setThickTrace(true);
  	}
  	public void centerPanelAtOverallPosition(int i){
  		centerBase = i;
  		readBaseNumber = chromCanvas.getReadBaseFromUniversalBase(CloseupChromatogramCanvas.SINGLEREAD,centerBase);
  		chromCanvas.setCenterReadBase(readBaseNumber);
  		chromCanvas.repaint();
  	}
  	/*.................................................................................................................*/
  	public void setChromatogram(Chromatogram myChrom) {
  		if (myChrom==null){
  			backgroundColor = contigDisplay.getBackgroundColor();
  			chromatograms[0] = null;
  			if (chromCanvas!=null){
  				chromCanvas.setChromatograms(chromatograms);
  			}
  		}
  		else {
  			if (showCenterBase)
  				backgroundColor = ChromaseqUtil.veryVeryLightBlue;
  			else
  				backgroundColor = contigDisplay.getBackgroundColor();
  			chromatograms[0] = myChrom;
  			chromatograms[0].setWindow(contigDisplay);
  			if (chromCanvas!=null){
  				chromCanvas.setChromatograms(chromatograms);
  			}
  		}
  		setBackground(getBackgroundColor());
  		currentChromatogram = chromatograms[0];
  	}
  	/*.................................................................................................................*/
  	public boolean isCurrentChromatogram(Chromatogram chromatogram) {
  		return (chromatogram.equals(chromatograms[0]));
  	}
  
  	/*_________________________________________________*/
  	public void setCloseupPanel(boolean showCenterBase, Chromatogram newChromatogram, boolean centerPanel) {
  		
  		if (!getShowCenterBase() && getChromatogram()!=null)
  			setChromatogram(null);
  
  		setShowCenterBase(showCenterBase);
  
  		Chromatogram chromatogram = getChromatogram();
  
  		if (!newChromatogram.equals(chromatogram)) {
  			BasicChromatogramPanel oldChromatogramPanel = contigDisplay.getChromatogramPanel(chromatogram);
  
  			//repaint previous one
  			setChromatogram(newChromatogram);
  			if (oldChromatogramPanel!=null)
  				oldChromatogramPanel.repaint();
  			if (centerPanel)
  				centerPanelAtOverallPosition(centerBase);
  
  			BasicChromatogramPanel newChromatogramPanel = contigDisplay.getChromatogramPanel(newChromatogram);
  			newChromatogramPanel.repaint();
  		}
  
  	}
  	/*.................................................................................................................*/
  	public boolean getShowCenterBase() {
  		return showCenterBase;
  	}
  	public void setShowCenterBase(boolean showCenterBase) {
  		this.showCenterBase = showCenterBase;
  	}
  	/*.................................................................................................................*/
  	public boolean getShowTouchedBase() {
  		return showTouchedBase;
  	}
  	public void setShowTouchedBase(boolean showTouchedBase) {
  		this.showTouchedBase = showTouchedBase;
  	}
  	/*.................................................................................................................*/
  	public boolean getShowSourceBase() {
  		return showSourceBase;
  	}
  	public void setShowSourceBase(boolean showSourceBase) {
  		this.showSourceBase = showSourceBase;
  	}
  
  	/*.................................................................................................................*/
  	public int getTouchedBase() {
  		return touchedBase;
  	}
  	public void setTouchedBase(int touchedBase) {
  		this.touchedBase = touchedBase;
  	}
  
  	/*.................................................................................................................*/
  	public void setShowA(boolean showA) {
  		this.showA = showA;
  	}
  	/*.................................................................................................................*/
  	public boolean getShowA() {
  		return showA;
  	}
  	/*.................................................................................................................*/
  	public void setShowC(boolean showC) {
  		this.showC = showC;
  	}
  	/*.................................................................................................................*/
  	public boolean getShowC() {
  		return showC;
  	}
  	/*.................................................................................................................*/
  	public void setShowG(boolean showG) {
  		this.showG = showG;
  	}
  	/*.................................................................................................................*/
  	public boolean getShowG() {
  		return showG;
  	}
  	/*.................................................................................................................*/
  	public void setShowT(boolean showT) {
  		this.showT = showT;
  	}
  	/*.................................................................................................................*/
  	public boolean getShowT() {
  		return showT;
  	}
  	public void repaintPanel(){
  		if (chromCanvas != null ) {
  			chromCanvas.repaint();
  		}
  	}
  	public  void setBounds(int x, int y, int width, int height) {
  		super.setBounds(x,y,width,height);
  		this.width = width;
  		this.height = height;
  		chromCanvas.setBounds(0, 0, getWidth(), getHeight());
  		//chromArea.repaint();
  	}
  	public  void setSize( int width, int height) {
  		super.setSize(width,height);
  		this.width = width;
  		this.height = height;
  		chromCanvas.setBounds(0, 0, getWidth(), getHeight());
  		chromCanvas.repaint();
  	}
  	public int getReadBaseNumber() {
  		return readBaseNumber;
  	}
  	public void setReadBaseNumber(int readBaseNumber) {
  		this.readBaseNumber = readBaseNumber;
  		chromCanvas.setCenterReadBase(readBaseNumber);
  	}
  	public Color getBackgroundColor() {
  		return backgroundColor;
  	}
  	public void setBackgroundColor(Color backgroundColor) {
  		this.backgroundColor = backgroundColor;
  	}
  }
  
  /*-----------------------------*/
  class CloseupChromatogramCanvas extends ChromatogramCanvas {
  
  	boolean darkBackground=false;
  	Color darkBackgroundColor = Color.gray;
  	boolean simplerGraphics=true;
  	int centerReadBase = MesquiteInteger.unassigned;
  
  	static final double NONSOURCEDIMFRACTION = 0.2;
  	static final double NONSOURCELOWERQUALITYDIMFRACTION = 0.15;
  
  
  	/*..........................*/
  	public CloseupChromatogramCanvas(ChromatogramCloseupPanel parentV, int id) {
  		super(parentV,  id);
  		closeupPanel = parentV;
  		setBackgroundColor();
  
  	}
  	public void setCenterReadBase(int base) {
  		centerReadBase = base;
  		repaint();
  	}
  	/*
  	protected void drawLine(Graphics g, int width, int x, int y, int x2, int y2){
  		if (isShownReversed()){
  			g.drawLine(width-x, y, width-x2, y2);
  			if (closeupPanel.getThickTrace())
  				g.drawLine(width-x, y-1, width-x2, y2-1);
  		}
  		else {
  			g.drawLine(x, y, x2, y2);
  			if (closeupPanel.getThickTrace())
  				g.drawLine(x+1, y, x2+1, y2);
  		}
  	}
  	protected void drawLine(Graphics g, int width, int posPrev, int pos, int posNext, int[] trace, int peakBottom, double vertScale, double horizScale, int firstReadLocation){
  		int pixels = (int)((pos-firstReadLocation)*horizScale);//+ offsetForInserted);  //returns scaled horizontal pixels
  		drawLine(g, width, pixels,getX(trace,peakBottom,pos,vertScale),pixels+2,getX(trace,peakBottom,pos+2,vertScale));
  	}
  	 */
  	public void setBackgroundColor() {
  		if (closeupPanel!=null)
  			setBackground(closeupPanel.getBackgroundColor());
  		else
  			setBackground(Color.white);
  	}
  
  	protected void drawBaseInfo(Graphics2D g, Color inverseBlackColor, long state, long complementState, String baseString, String complementString, int[] trace, int pos, int textLeft, int baseVert) {
  		Color baseColor;
  		if (isShownComplemented())
  			baseColor = contigDisplay.getBaseColor(complementState, contigDisplay.getBackgroundColor());
  		else 
  			baseColor = contigDisplay.getBaseColor(state,contigDisplay.getBackgroundColor());
  		if (baseColor.equals(Color.black) && darkBackground)
  			baseColor = inverseBlackColor;
  		g.setColor(baseColor);
  		if (isShownComplemented()) 
  			g.drawString(complementString+": " + trace[pos], textLeft,baseVert);
  		else
  			g.drawString(baseString+": " + trace[pos], textLeft,baseVert);
  	}
  
  	protected void drawBaseInfo(Graphics2D g, Color inverseBlackColor, long state, int pos, int textLeft, int baseVert) {
  		if (state==DNAState.A) {
  			drawBaseInfo(g,  inverseBlackColor, DNAState.A, DNAState.T, "A", "T", A, pos,  textLeft,  baseVert);
  		}
  		if (state==DNAState.C) {
  			drawBaseInfo(g,  inverseBlackColor, DNAState.C, DNAState.G, "C", "G", C, pos,  textLeft,  baseVert);
  		}
  