From 157004a864888ed2e690b907a28f715d3d42b666 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 3 Dec 2004 16:26:08 +0000 Subject: [PATCH] Add globalcolourscheme --- src/jalview/gui/AlignViewport.java | 37 +++++++++++++++++------------------ src/jalview/gui/AlignmentPanel.java | 17 ++++++++++------ 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 03e0c5a..905255a 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -4,6 +4,7 @@ import java.awt.*; import jalview.io.*; import jalview.analysis.NJTree; import jalview.datamodel.*; +import jalview.schemes.*; import java.util.*; public class AlignViewport @@ -20,18 +21,18 @@ public class AlignViewport boolean showBoxes=true; boolean wrapAlignment=false; boolean renderGaps = false; - boolean groupEdit = false; + boolean groupDefiningMode = true; + + ColourSchemeI globalColourScheme = null; - RendererI renderer = new SequenceRenderer(); + RendererI renderer = new SequenceRenderer(this); int charHeight; - double charWidth; + int charWidth; int chunkWidth; int chunkHeight; - Color backgroundColour; - Font font = new Font("SansSerif",Font.PLAIN,10); AlignmentI alignment; @@ -87,18 +88,6 @@ public class AlignViewport setFont( font ); } - public AlignViewport(int startRes, int endRes, - int startSeq, int endSeq, - boolean showScores, - boolean showText, - boolean showBoxes, - boolean wrapAlignment, - Color backgroundColour) { - this(startRes,endRes,startSeq,endSeq,showScores,showText,showBoxes,wrapAlignment); - - this.backgroundColour = backgroundColour; - } - public String getVisibleConsensus() { @@ -138,6 +127,16 @@ public class AlignViewport return startSeq; } + public void setGlobalColourScheme(ColourSchemeI cs) + { + globalColourScheme = cs; + } + + public ColourSchemeI getGlobalColourScheme() + { + return globalColourScheme; + } + public void setStartRes(int res) { this.startRes = res; @@ -180,10 +179,10 @@ public class AlignViewport public Font getFont() { return font; } - public void setCharWidth(double w) { + public void setCharWidth(int w) { this.charWidth = w; } - public double getCharWidth() { + public int getCharWidth() { return charWidth; } public void setCharHeight(int h) { diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 33b8665..605450b 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -93,6 +93,9 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene public void setColourScheme(jalview.schemes.ColourSchemeI cs, boolean conservation) { seqPanel.setColourScheme(cs, conservation); + + av.setGlobalColourScheme(cs); + if(overviewPanel!=null) overviewPanel.updateOverviewImage(); } @@ -118,7 +121,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene public void setScrollValues(int x, int y) { - hextent = (int)(seqPanel.seqCanvas.getWidth()/av.getCharWidth()); + hextent = seqPanel.seqCanvas.getWidth()/av.getCharWidth(); vextent = seqPanel.seqCanvas.getHeight()/av.getCharHeight(); if(hextent+x > av.getAlignment().getWidth()) @@ -147,7 +150,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene { int x = hscroll.getValue(); av.setStartRes(x); - av.setEndRes(x + (int)(seqPanel.seqCanvas.getWidth()/av.getCharWidth()-1)); + av.setEndRes(x + seqPanel.seqCanvas.getWidth()/av.getCharWidth()-1); } if (evt.getSource() == vscroll) @@ -175,15 +178,13 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene int pheight = (int)pf.getImageableHeight(); int idWidth = (int)idPanel.idCanvas.getLabelWidth().getWidth(); - //BufferedImage printImage = new BufferedImage(pwidth,pheight,BufferedImage.TYPE_INT_RGB); - // Graphics pg = printImage.getGraphics(); pg.setColor(Color.white); pg.fillRect(0,0,pwidth, pheight); pg.setFont( av.getFont() ); //////////////////////////////////// /// How many sequences and residues can we fit on a printable page? - int totalRes = (int)((pwidth - idWidth)/av.getCharWidth()); + int totalRes = (pwidth - idWidth)/av.getCharWidth(); int totalSeq = (int)((pheight - 30)/av.getCharHeight())-1; int pagesWide = av.getAlignment().getWidth() / totalRes +1; int pagesHigh = av.getAlignment().getHeight() / totalSeq +1; @@ -230,7 +231,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene pg.setColor(currentColor); pg.fillRect(0, jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i, av.getCharHeight()), - getWidth(), + idWidth, av.getCharHeight()); pg.setColor(currentTextColor); @@ -242,9 +243,13 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene // draw main sequence panel pg.translate(idWidth,0); + pg.setClip(0,0,pwidth-idWidth, pheight); seqPanel.seqCanvas.drawPanel(pg,startRes,endRes,startSeq,endSeq,startRes,startSeq,0); return Printable.PAGE_EXISTS; } + } + + -- 1.7.10.2