import jalview.io.*;\r
import jalview.analysis.NJTree;\r
import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
import java.util.*;\r
\r
public class AlignViewport\r
boolean showBoxes=true;\r
boolean wrapAlignment=false;\r
boolean renderGaps = false;\r
-\r
boolean groupEdit = false;\r
+ boolean groupDefiningMode = true;\r
+\r
+ ColourSchemeI globalColourScheme = null;\r
\r
- RendererI renderer = new SequenceRenderer();\r
+ RendererI renderer = new SequenceRenderer(this);\r
\r
int charHeight;\r
- double charWidth;\r
+ int charWidth;\r
int chunkWidth;\r
int chunkHeight;\r
\r
- Color backgroundColour;\r
-\r
Font font = new Font("SansSerif",Font.PLAIN,10);\r
AlignmentI alignment;\r
\r
setFont( font );\r
}\r
\r
- public AlignViewport(int startRes, int endRes,\r
- int startSeq, int endSeq,\r
- boolean showScores,\r
- boolean showText,\r
- boolean showBoxes,\r
- boolean wrapAlignment,\r
- Color backgroundColour) {\r
- this(startRes,endRes,startSeq,endSeq,showScores,showText,showBoxes,wrapAlignment);\r
-\r
- this.backgroundColour = backgroundColour;\r
- }\r
-\r
\r
public String getVisibleConsensus()\r
{\r
return startSeq;\r
}\r
\r
+ public void setGlobalColourScheme(ColourSchemeI cs)\r
+ {\r
+ globalColourScheme = cs;\r
+ }\r
+\r
+ public ColourSchemeI getGlobalColourScheme()\r
+ {\r
+ return globalColourScheme;\r
+ }\r
+\r
\r
public void setStartRes(int res) {\r
this.startRes = res;\r
public Font getFont() {\r
return font;\r
}\r
- public void setCharWidth(double w) {\r
+ public void setCharWidth(int w) {\r
this.charWidth = w;\r
}\r
- public double getCharWidth() {\r
+ public int getCharWidth() {\r
return charWidth;\r
}\r
public void setCharHeight(int h) {\r
public void setColourScheme(jalview.schemes.ColourSchemeI cs, boolean conservation)\r
{\r
seqPanel.setColourScheme(cs, conservation);\r
+\r
+ av.setGlobalColourScheme(cs);\r
+\r
if(overviewPanel!=null)\r
overviewPanel.updateOverviewImage();\r
}\r
\r
public void setScrollValues(int x, int y)\r
{\r
- hextent = (int)(seqPanel.seqCanvas.getWidth()/av.getCharWidth());\r
+ hextent = seqPanel.seqCanvas.getWidth()/av.getCharWidth();\r
vextent = seqPanel.seqCanvas.getHeight()/av.getCharHeight();\r
\r
if(hextent+x > av.getAlignment().getWidth())\r
{\r
int x = hscroll.getValue();\r
av.setStartRes(x);\r
- av.setEndRes(x + (int)(seqPanel.seqCanvas.getWidth()/av.getCharWidth()-1));\r
+ av.setEndRes(x + seqPanel.seqCanvas.getWidth()/av.getCharWidth()-1);\r
}\r
\r
if (evt.getSource() == vscroll)\r
int pheight = (int)pf.getImageableHeight();\r
int idWidth = (int)idPanel.idCanvas.getLabelWidth().getWidth();\r
\r
- //BufferedImage printImage = new BufferedImage(pwidth,pheight,BufferedImage.TYPE_INT_RGB);\r
- // Graphics pg = printImage.getGraphics();\r
pg.setColor(Color.white);\r
pg.fillRect(0,0,pwidth, pheight);\r
pg.setFont( av.getFont() );\r
\r
////////////////////////////////////\r
/// How many sequences and residues can we fit on a printable page?\r
- int totalRes = (int)((pwidth - idWidth)/av.getCharWidth());\r
+ int totalRes = (pwidth - idWidth)/av.getCharWidth();\r
int totalSeq = (int)((pheight - 30)/av.getCharHeight())-1;\r
int pagesWide = av.getAlignment().getWidth() / totalRes +1;\r
int pagesHigh = av.getAlignment().getHeight() / totalSeq +1;\r
\r
pg.setColor(currentColor);\r
pg.fillRect(0, jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i, av.getCharHeight()),\r
- getWidth(),\r
+ idWidth,\r
av.getCharHeight());\r
\r
pg.setColor(currentTextColor);\r
\r
// draw main sequence panel\r
pg.translate(idWidth,0);\r
+ pg.setClip(0,0,pwidth-idWidth, pheight);\r
seqPanel.seqCanvas.drawPanel(pg,startRes,endRes,startSeq,endSeq,startRes,startSeq,0);\r
\r
return Printable.PAGE_EXISTS;\r
}\r
+\r
}\r
\r
+\r
+\r