/*\r
* Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
*\r
* This program is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU General Public License\r
if(!av.cursorMode)\r
{\r
alignFrame.cut_actionPerformed(null);\r
- seqPanel.seqCanvas.repaint();\r
}\r
else\r
seqPanel.deleteGapAtCursor(evt.isControlDown() || evt.isShiftDown());\r
ex.printStackTrace();\r
}\r
break;\r
+ case KeyEvent.VK_H:\r
+ {\r
+ boolean toggleSeqs = !evt.isControlDown();\r
+ boolean toggleCols = !evt.isShiftDown();\r
+\r
+ boolean hide = false;\r
+\r
+ SequenceGroup sg = av.getSelectionGroup();\r
+ if(toggleSeqs)\r
+ {\r
+ if(sg != null && sg.getSize(false) != av.alignment.getHeight())\r
+ {\r
+ alignFrame.hideSelSequences_actionPerformed(null);\r
+ hide = true;\r
+ }\r
+ else if (!(toggleCols && av.colSel.getSelected().size() > 0))\r
+ alignFrame.showAllSeqs_actionPerformed(null);\r
+ }\r
+\r
+ if (toggleCols)\r
+ {\r
+ if(av.colSel.getSelected().size() > 0)\r
+ {\r
+ alignFrame.hideSelColumns_actionPerformed(null);\r
+ if(!toggleSeqs)\r
+ av.selectionGroup = sg;\r
+ }\r
+ else if(!hide)\r
+ alignFrame.showAllColumns_actionPerformed(null);\r
+ }\r
+ break;\r
+ }\r
\r
}\r
}\r
height));\r
\r
annotationPanel.repaint();\r
+ repaint();\r
}\r
});\r
}\r
public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)\r
throws PrinterException\r
{\r
- int idWidth = calculateIdWidth().width + 4;\r
+ int idWidth = getVisibleIdWidth();\r
FontMetrics fm = getFontMetrics(av.getFont());\r
int scaleHeight = av.charHeight + fm.getDescent();\r
\r
/// How many sequences and residues can we fit on a printable page?\r
int totalRes = (pwidth - idWidth) / av.getCharWidth();\r
\r
+ System.out.println(totalRes);\r
+\r
int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) -\r
1;\r
\r
+ hgap\r
+ annotationHeight;\r
\r
- int idWidth = calculateIdWidth().width + 4;\r
+ int idWidth = getVisibleIdWidth();\r
\r
int maxwidth = av.alignment.getWidth();\r
if (av.hasHiddenColumns)\r
}\r
}\r
\r
+ int getVisibleIdWidth()\r
+ {\r
+ return\r
+ idPanel.getWidth() > 0 ? idPanel.getWidth() :\r
+ calculateIdWidth().width + 4;\r
+ }\r
+\r
void makeAlignmentImage(int type, File file)\r
{\r
int maxwidth = av.alignment.getWidth();\r
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);\r
\r
int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
- int width = idPanel.getWidth() + (maxwidth * av.charWidth);\r
- if (idPanel.getWidth() == 0)\r
- {\r
- width += calculateIdWidth().getWidth() + 4;\r
- }\r
+ int width = getVisibleIdWidth() + (maxwidth * av.charWidth);\r
\r
if (av.getWrapAlignment())\r
{\r
width = alignFrame.getWidth() - 22;\r
}\r
else\r
- width = seqPanel.getWidth() + idPanel.getWidth();\r
+ width = seqPanel.getWidth() + getVisibleIdWidth();\r
\r
}\r
else if (av.getShowAnnotation())\r
{\r
///////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS\r
//////////////////////////////////////////////\r
- int idWidth = calculateIdWidth().width + 4;\r
+ int idWidth = getVisibleIdWidth();\r
FontMetrics fm = getFontMetrics(av.getFont());\r
int scaleHeight = av.charHeight + fm.getDescent();\r
\r
if (System.getProperty("java.awt.headless") != null\r
&& System.getProperty("java.awt.headless").equals("true"))\r
{\r
- int idWidth = calculateIdWidth().width + 4;\r
- seqPanelWidth = alignFrame.getWidth() - idWidth;\r
+ seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth();\r
}\r
\r
int chunkWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(\r