+ if (viewport.cursorMode\r
+ && evt.getKeyCode() >= KeyEvent.VK_0\r
+ && evt.getKeyCode() <= KeyEvent.VK_9)\r
+ {\r
+ alignPanel.seqPanel.numberPressed(evt.getKeyChar());\r
+ }\r
+\r
+ switch (evt.getKeyCode())\r
+ {\r
+ case 27: // escape key\r
+ deselectAllSequenceMenuItem_actionPerformed();\r
+ break;\r
+ case KeyEvent.VK_X:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ cut_actionPerformed();\r
+ }\r
+ break;\r
+ case KeyEvent.VK_C:\r
+ if (viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.setCursorColumn();\r
+ }\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ copy_actionPerformed();\r
+ }\r
+ break;\r
+ case KeyEvent.VK_V:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ paste(true);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_A:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ selectAllSequenceMenuItem_actionPerformed();\r
+ }\r
+ break;\r
+ case KeyEvent.VK_DOWN:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.moveCursor(0,1);\r
+ }\r
+ else\r
+ moveSelectedSequences(false);\r
+ break;\r
+\r
+ case KeyEvent.VK_UP:\r
+ if (viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.moveCursor(0,-1);\r
+ }\r
+ else\r
+ moveSelectedSequences(true);\r
+ break;\r
+\r
+ case KeyEvent.VK_LEFT:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.moveCursor(-1,0);\r
+ }\r
+ break;\r
+\r
+ case KeyEvent.VK_RIGHT:\r
+ if (viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.moveCursor(1,0);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_SPACE:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown());\r
+ }\r
+ break;\r
+\r
+ case KeyEvent.VK_DELETE:\r
+ case KeyEvent.VK_BACK_SPACE:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown());\r
+ }\r
+ else\r
+ {\r
+ cut_actionPerformed();\r
+ alignPanel.seqPanel.seqCanvas.repaint();\r
+ }\r
+ break;\r
+\r
+ case KeyEvent.VK_S:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.setCursorRow();\r
+ }\r
+ break;\r
+ case KeyEvent.VK_P:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.setCursorPosition();\r
+ }\r
+ break;\r
+\r
+ case KeyEvent.VK_ENTER:\r
+ case KeyEvent.VK_COMMA:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.setCursorRowAndColumn();\r
+ }\r
+ break;\r
+\r
+ case KeyEvent.VK_Q:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.setSelectionAreaAtCursor(true);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_M:\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.setSelectionAreaAtCursor(false);\r
+ }\r
+ break;\r
+\r
+ case KeyEvent.VK_F2:\r
+ viewport.cursorMode = ! viewport.cursorMode;\r
+ statusBar.setText("Keyboard editing mode is "+\r
+ (viewport.cursorMode ? "on" : "off"));\r
+ if(viewport.cursorMode)\r
+ {\r
+ alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;\r
+ alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;\r
+ }\r
+ alignPanel.seqPanel.seqCanvas.repaint();\r
+ break;\r
+\r
+ case KeyEvent.VK_F:\r
+ if (evt.isControlDown())\r
+ {\r
+ findMenuItem_actionPerformed();\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ public void keyReleased(KeyEvent evt)\r
+ {}\r
+ public void keyTyped(KeyEvent evt)\r
+ {}\r
+\r
+public void itemStateChanged(ItemEvent evt)\r
+ {\r
+ if(evt.getSource()==colourTextMenuItem)\r
+ colourTextMenuItem_actionPerformed();\r
+ else if(evt.getSource()==wrapMenuItem)\r
+ wrapMenuItem_actionPerformed();\r
+ else if(evt.getSource()==scaleAbove)\r
+ scaleAbove_actionPerformed();\r
+ else if(evt.getSource()==scaleLeft)\r
+ scaleLeft_actionPerformed();\r
+ else if(evt.getSource()==scaleRight)\r
+ scaleRight_actionPerformed();\r
+ else if(evt.getSource()==seqLimits)\r
+ seqLimits_itemStateChanged();\r
+ else if(evt.getSource()==viewBoxesMenuItem)\r
+ viewBoxesMenuItem_actionPerformed();\r
+ else if(evt.getSource()==viewTextMenuItem)\r
+ viewTextMenuItem_actionPerformed();\r
+ else if(evt.getSource()==renderGapsMenuItem)\r
+ renderGapsMenuItem_actionPerformed();\r
+ else if(evt.getSource()==annotationPanelMenuItem)\r
+ annotationPanelMenuItem_actionPerformed();\r
+ else if(evt.getSource()==sequenceFeatures)\r
+ {\r
+ viewport.showSequenceFeatures(sequenceFeatures.getState());\r
+ alignPanel.seqPanel.seqCanvas.repaint();\r
+ }\r
+ else if(evt.getSource()==conservationMenuItem)\r
+ conservationMenuItem_actionPerformed();\r
+ else if(evt.getSource()==abovePIDThreshold)\r
+ abovePIDThreshold_actionPerformed();\r
+ else if(evt.getSource()==applyToAllGroups)\r
+ applyToAllGroups_actionPerformed();\r
+ else if(evt.getSource()==autoCalculate)\r
+ viewport.autocalculateConsensus = autoCalculate.getState();\r
+ }\r
+ public void actionPerformed(ActionEvent evt)\r
+ {\r
+ if(evt.getSource()==inputText)\r
+ inputText_actionPerformed();\r
+ else if(evt.getSource()==loadTree)\r
+ loadTree_actionPerformed();\r
+ else if(evt.getSource()==closeMenuItem)\r
+ closeMenuItem_actionPerformed();\r
+ else if(evt.getSource()==copy)\r
+ copy_actionPerformed();\r
+ else if(evt.getSource()==undoMenuItem)\r
+ undoMenuItem_actionPerformed();\r
+ else if(evt.getSource()==redoMenuItem)\r
+ redoMenuItem_actionPerformed();\r
+ else if(evt.getSource()==inputText)\r
+ inputText_actionPerformed();\r
+ else if(evt.getSource()==closeMenuItem)\r
+ closeMenuItem_actionPerformed();\r
+ else if(evt.getSource()==undoMenuItem)\r
+ undoMenuItem_actionPerformed();\r
+ else if(evt.getSource()==redoMenuItem)\r
+ redoMenuItem_actionPerformed();\r
+ else if(evt.getSource()==copy)\r
+ copy_actionPerformed();\r
+ else if(evt.getSource()==pasteNew)\r
+ pasteNew_actionPerformed();\r
+ else if(evt.getSource()==pasteThis)\r
+ pasteThis_actionPerformed();\r
+ else if(evt.getSource()==cut)\r
+ cut_actionPerformed();\r
+ else if(evt.getSource()==delete)\r
+ delete_actionPerformed();\r
+ else if(evt.getSource()==deleteGroups)\r
+ deleteGroups_actionPerformed();\r
+ else if(evt.getSource()==selectAllSequenceMenuItem)\r
+ selectAllSequenceMenuItem_actionPerformed();\r
+ else if(evt.getSource()==deselectAllSequenceMenuItem)\r
+ deselectAllSequenceMenuItem_actionPerformed();\r
+ else if(evt.getSource()==invertSequenceMenuItem)\r
+ invertSequenceMenuItem_actionPerformed();\r
+ else if(evt.getSource()==remove2LeftMenuItem)\r
+ remove2LeftMenuItem_actionPerformed();\r
+ else if(evt.getSource()==remove2RightMenuItem)\r
+ remove2RightMenuItem_actionPerformed();\r
+ else if(evt.getSource()==removeGappedColumnMenuItem)\r
+ removeGappedColumnMenuItem_actionPerformed();\r
+ else if(evt.getSource()==removeAllGapsMenuItem)\r
+ removeAllGapsMenuItem_actionPerformed();\r
+ else if(evt.getSource()==findMenuItem)\r
+ findMenuItem_actionPerformed();\r
+ else if(evt.getSource()==font)\r
+ font_actionPerformed();\r
+ else if(evt.getSource()==featureSettings)\r
+ featureSettings_actionPerformed();\r
+ else if(evt.getSource()==overviewMenuItem)\r
+ overviewMenuItem_actionPerformed();\r
+ else if(evt.getSource()==noColourmenuItem)\r
+ noColourmenuItem_actionPerformed();\r
+ else if(evt.getSource()==clustalColour)\r
+ clustalColour_actionPerformed();\r
+ else if(evt.getSource()==zappoColour)\r
+ zappoColour_actionPerformed();\r
+ else if(evt.getSource()==taylorColour)\r
+ taylorColour_actionPerformed();\r
+ else if(evt.getSource()==hydrophobicityColour)\r
+ hydrophobicityColour_actionPerformed();\r
+ else if(evt.getSource()==helixColour)\r
+ helixColour_actionPerformed();\r
+ else if(evt.getSource()==strandColour)\r
+ strandColour_actionPerformed();\r
+ else if(evt.getSource()==turnColour)\r
+ turnColour_actionPerformed();\r
+ else if(evt.getSource()==buriedColour)\r
+ buriedColour_actionPerformed();\r
+ else if(evt.getSource()==nucleotideColour)\r
+ nucleotideColour_actionPerformed();\r
+ else if(evt.getSource()==modifyPID)\r
+ modifyPID_actionPerformed();\r
+ else if(evt.getSource()==modifyConservation)\r
+ modifyConservation_actionPerformed();\r
+ else if(evt.getSource()==userDefinedColour)\r
+ userDefinedColour_actionPerformed();\r
+ else if(evt.getSource()==PIDColour)\r
+ PIDColour_actionPerformed();\r
+ else if(evt.getSource()==BLOSUM62Colour)\r
+ BLOSUM62Colour_actionPerformed();\r
+ else if(evt.getSource()==annotationColour)\r
+ new AnnotationColourChooser(viewport, alignPanel);\r
+ else if(evt.getSource()==sortPairwiseMenuItem)\r
+ sortPairwiseMenuItem_actionPerformed();\r
+ else if(evt.getSource()==sortIDMenuItem)\r
+ sortIDMenuItem_actionPerformed();\r
+ else if(evt.getSource()==sortGroupMenuItem)\r
+ sortGroupMenuItem_actionPerformed();\r
+ else if(evt.getSource()==removeRedundancyMenuItem)\r
+ removeRedundancyMenuItem_actionPerformed();\r
+ else if(evt.getSource()==pairwiseAlignmentMenuItem)\r
+ pairwiseAlignmentMenuItem_actionPerformed();\r
+ else if(evt.getSource()==PCAMenuItem)\r
+ PCAMenuItem_actionPerformed();\r
+ else if(evt.getSource()==averageDistanceTreeMenuItem)\r
+ averageDistanceTreeMenuItem_actionPerformed();\r
+ else if(evt.getSource()==neighbourTreeMenuItem)\r
+ neighbourTreeMenuItem_actionPerformed();\r
+ else if(evt.getSource()==njTreeBlosumMenuItem)\r
+ njTreeBlosumMenuItem_actionPerformed();\r
+ else if(evt.getSource()==avDistanceTreeBlosumMenuItem)\r
+ avTreeBlosumMenuItem_actionPerformed();\r
+ else if(evt.getSource()==documentation)\r
+ documentation_actionPerformed();\r
+ else if(evt.getSource()==about)\r
+ about_actionPerformed();\r
+\r
+ }\r
+\r
+ public void inputText_actionPerformed()\r
+ {\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r