From 3b5ad2b93c9765e2f381ef66dc755184657d7d71 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 28 Apr 2006 12:32:12 +0000 Subject: [PATCH] Case shifter --- src/jalview/appletgui/APopupMenu.java | 77 ++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index b85c7d2..1d5eace 100755 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -53,6 +53,11 @@ public class APopupMenu CheckboxMenuItem showBoxes = new CheckboxMenuItem(); CheckboxMenuItem showText = new CheckboxMenuItem(); CheckboxMenuItem showColourText = new CheckboxMenuItem(); + Menu editMenu = new Menu("Edit"); + MenuItem copy = new MenuItem("Copy (Jalview Only)"); + MenuItem cut = new MenuItem("Cut (Jalview Only)"); + MenuItem toUpper = new MenuItem("To Upper Case"); + MenuItem toLower = new MenuItem("To Lower Case"); public APopupMenu(AlignmentPanel apanel, final Sequence seq, Vector links) { @@ -145,38 +150,70 @@ public class APopupMenu public void actionPerformed(ActionEvent evt) { - if(evt.getSource()==clustalColour) + Object source = evt.getSource(); + if(source==clustalColour) clustalColour_actionPerformed(); - else if(evt.getSource()==zappoColour) + else if(source==zappoColour) zappoColour_actionPerformed(); - else if(evt.getSource()==taylorColour) + else if(source==taylorColour) taylorColour_actionPerformed(); - else if(evt.getSource()==hydrophobicityColour) + else if(source==hydrophobicityColour) hydrophobicityColour_actionPerformed(); - else if(evt.getSource()==helixColour) + else if(source==helixColour) helixColour_actionPerformed(); - else if(evt.getSource()==strandColour) + else if(source==strandColour) strandColour_actionPerformed(); - else if(evt.getSource()==clustalColour) + else if(source==clustalColour) turnColour_actionPerformed(); - else if(evt.getSource()==buriedColour) + else if(source==buriedColour) buriedColour_actionPerformed(); - else if(evt.getSource()==nucleotideMenuItem) + else if(source==nucleotideMenuItem) nucleotideMenuItem_actionPerformed(); - else if(evt.getSource()==userDefinedColour) + else if(source==userDefinedColour) userDefinedColour_actionPerformed(); - else if(evt.getSource()==PIDColour) + else if(source==PIDColour) PIDColour_actionPerformed(); - else if(evt.getSource()==BLOSUM62Colour) + else if(source==BLOSUM62Colour) BLOSUM62Colour_actionPerformed(); - else if(evt.getSource()==noColourmenuItem) + else if(source==noColourmenuItem) noColourmenuItem_actionPerformed(); - else if(evt.getSource()==conservationMenuItem) + else if(source==conservationMenuItem) conservationMenuItem_itemStateChanged(); - else if(evt.getSource()==unGroupMenuItem) + else if(source==unGroupMenuItem) unGroupMenuItem_actionPerformed(); + else if(source==copy) + ap.alignFrame.copy_actionPerformed(); + else if(source==cut) + ap.alignFrame.cut_actionPerformed(); + else if(source==toUpper) + { + SequenceGroup sg = ap.av.getSelectionGroup(); + if (sg != null) + { + for (int g = 0; g < sg.getSize(); g++) + { + sg.getSequenceAt(g).changeCase(true, sg.getStartRes(), + sg.getEndRes() + 1); + } + ap.seqPanel.seqCanvas.repaint(); + } + } + else if(source==toLower) + { + SequenceGroup sg = ap.av.getSelectionGroup(); + if (sg != null) + { + for (int g = 0; g < sg.getSize(); g++) + { + sg.getSequenceAt(g).changeCase(false, sg.getStartRes(), + sg.getEndRes() + 1); + } + ap.seqPanel.seqCanvas.repaint(); + } + } + } void addPDB(Sequence seq) @@ -265,6 +302,16 @@ public class APopupMenu BLOSUM62Colour.addActionListener(this); conservationMenuItem.setLabel("Conservation"); + add(editMenu); + editMenu.add(copy); + copy.addActionListener(this); + editMenu.add(cut); + cut.addActionListener(this); + editMenu.add(toUpper); + toUpper.addActionListener(this); + editMenu.add(toLower); + toLower.addActionListener(this); + } void refresh() -- 1.7.10.2