boxY = evt.getY();\r
checkValid();\r
\r
- ap.setScrollValues((int) (boxX / scalew / av.getCharWidth()),\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ int col = (int) ( boxX / scalew / av.getCharWidth());\r
+\r
+ if(av.getColumnSelection().isVisible(col))\r
+ {\r
+ ap.setScrollValues(\r
+ av.getColumnSelection().findColumnPosition(col),\r
(int) (boxY / scaleh / av.getCharHeight()));\r
+ }\r
+ else\r
+ System.out.println(col +" not visible");\r
+ }\r
+ else\r
+ ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
+ (int) (boxY / scaleh / av.getCharHeight()));\r
}\r
\r
/**\r
boxY = evt.getY();\r
checkValid();\r
\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ int col = (int) ( boxX / scalew / av.getCharWidth());\r
+\r
+ if(!av.getColumnSelection().isVisible(col))\r
+ {\r
+ return;\r
+ }\r
+\r
+ ap.setScrollValues(\r
+ av.getColumnSelection().findColumnPosition( col ),\r
+ (int) (boxY / scaleh / av.getCharHeight()));\r
+ }\r
+ else\r
ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
- (int) (boxY / scaleh / av.getCharHeight()));\r
+ (int) (boxY / scaleh / av.getCharHeight()));\r
repaint();\r
}\r
\r
\r
if (boxX > (width - boxWidth))\r
{\r
- boxX = width - boxWidth;\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ //Try smallest possible box\r
+ boxWidth = (int) ( (av.endRes - av.startRes + 1) *\r
+ av.getCharWidth() * scalew);\r
+ }\r
+\r
+ boxX = width - boxWidth;\r
}\r
}\r
\r
}\r
\r
setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
- setBoxPosition();\r
+ // setBoxPosition();\r
\r
Thread thread = new Thread(this);\r
thread.start();\r
}\r
\r
int alwidth = av.alignment.getWidth();\r
- int alheight = av.alignment.getHeight();\r
+ int alheight = av.alignment.getHeight()\r
+ +av.alignment.getHiddenSequences().getSize();\r
\r
setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
\r
int lastcol=-1, lastrow=-1;\r
int color = Color.white.getRGB();\r
int row, col;\r
+ jalview.datamodel.SequenceI seq;\r
+ boolean hiddenRow = false;\r
for (row = 0; row < sequencesHeight; row++)\r
{\r
+ if((int)(row*sampleRow)==lastrow)\r
+ {\r
+ //No need to recalculate the colours,\r
+ //Just copy from the row above\r
+ for (col = 0; col < width; col++)\r
+ {\r
+ miniMe.setRGB(col, row, miniMe.getRGB(col, row-1));\r
+ }\r
+ continue;\r
+ }\r
+\r
+ lastrow = (int)(row*sampleRow);\r
+\r
+ hiddenRow = false;\r
+ if (av.hasHiddenRows)\r
+ {\r
+ seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);\r
+ if (seq == null)\r
+ {\r
+\r
+ int index =\r
+ av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(lastrow);\r
+\r
+\r
+ seq = av.alignment.getSequenceAt(index);\r
+ }\r
+ else\r
+ {\r
+ hiddenRow = true;\r
+ }\r
+ }\r
+ else\r
+ seq = av.alignment.getSequenceAt(lastrow);\r
+\r
+ if(seq==null)\r
+ {\r
+ System.out.println(lastrow+" null");\r
+ continue;\r
+ }\r
+\r
for (col = 0; col < width; col++)\r
{\r
if((int)(col*sampleCol) == lastcol && (int)(row*sampleRow)==lastrow)\r
continue;\r
}\r
\r
- lastrow = (int)(row*sampleRow);\r
+\r
lastcol = (int)(col*sampleCol);\r
\r
- if(av.alignment.getSequenceAt(lastrow).getLength()>lastcol)\r
+ if (seq.getLength() > lastcol)\r
{\r
- color = sr.getResidueBoxColour(\r
- av.alignment.getSequenceAt(lastrow), lastcol).getRGB();\r
+ color = sr.getResidueBoxColour(\r
+ seq, lastcol).getRGB();\r
\r
- if(av.showSequenceFeatures)\r
- color = fr.findFeatureColour(color, lastrow, lastcol);\r
+ if (av.showSequenceFeatures)\r
+ color = fr.findFeatureColour(color, lastrow, lastcol);\r
+ }\r
+ else\r
+ {\r
+ color = -1; //White\r
+ }\r
+\r
+ if(hiddenRow ||\r
+ (av.hasHiddenColumns && !av.getColumnSelection().isVisible(lastcol)))\r
+ {\r
+ color = new Color(color).darker().darker().getRGB();\r
+ }\r
\r
- }\r
- else\r
- {\r
- color = -1; //White\r
- }\r
\r
miniMe.setRGB(col,row,color);\r
\r
public void setBoxPosition()\r
{\r
int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();\r
- int fullsizeHeight = av.alignment.getHeight() * av.getCharHeight();\r
+ int fullsizeHeight = (av.alignment.getHeight()\r
+ +av.alignment.getHiddenSequences().getSize()) * av.getCharHeight();\r
+\r
+ int startRes = av.getStartRes();\r
+ int endRes = av.getEndRes();\r
+\r
+ if(av.hasHiddenColumns)\r
+ {\r
+ startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);\r
+ endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);\r
+ }\r
+\r
\r
scalew = (float) width / (float) fullsizeWidth;\r
scaleh = (float) sequencesHeight / (float) fullsizeHeight;\r
\r
- boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
+ boxX = (int) (startRes * av.getCharWidth() * scalew);\r
boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
- boxWidth = (int) ((av.getEndRes() - av.getStartRes() + 1) * av.getCharWidth() * scalew);\r
+\r
+ if(av.hasHiddenColumns)\r
+ boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);\r
+ else\r
+ boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);\r
+\r
boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) -\r
boxY;\r
repaint();\r