From fc55c62185b9a614f56e70d860aedbc5e8735fa5 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 2 May 2006 12:21:57 +0000 Subject: [PATCH] Toggle Case added --- src/jalview/gui/PopupMenu.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 55aea5e..f99b1ed 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -73,6 +73,7 @@ public class PopupMenu extends JPopupMenu JMenuItem copy = new JMenuItem(); JMenuItem upperCase = new JMenuItem(); JMenuItem lowerCase = new JMenuItem(); + JMenuItem toggle = new JMenuItem(); /** * Creates a new PopupMenu object. @@ -398,6 +399,14 @@ public class PopupMenu extends JPopupMenu lowerCase_actionPerformed(e); } }); + toggle.setText("Toggle Case"); + toggle.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + toggle_actionPerformed(e); + } + }); add(groupMenu); add(sequenceMenu); this.add(editMenu); @@ -454,6 +463,7 @@ public class PopupMenu extends JPopupMenu editMenu.add(cut); editMenu.add(upperCase); editMenu.add(lowerCase); + editMenu.add(toggle); noColourmenuItem.setText("None"); noColourmenuItem.addActionListener(new java.awt.event.ActionListener() { @@ -1072,4 +1082,18 @@ public class PopupMenu extends JPopupMenu ap.repaint(); } + public void toggle_actionPerformed(ActionEvent e) + { + SequenceGroup sg = ap.av.getSelectionGroup(); + if (sg == null) + return; + + for (int g = 0; g < sg.getSize(); g++) + { + sg.getSequenceAt(g).toggleCase(sg.getStartRes(), sg.getEndRes() + 1); + } + + ap.repaint(); + } + } -- 1.7.10.2