X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdPanel.java;h=6cb4e17bbbe0bbd4c58466184070f46c75c97b85;hb=489909eb49db19b0980e49bedb0ff2add11bea2e;hp=54aeef2284852fbc345669dd21bac7b6ac01d0ed;hpb=620da661f54acba8fdb13f388dbed8b77d9113ed;p=jalview.git diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 54aeef2..6cb4e17 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -40,6 +40,7 @@ import java.awt.event.MouseWheelListener; import java.util.List; import javax.swing.JPanel; +import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; @@ -306,11 +307,6 @@ public class IdPanel extends JPanel } MousePos pos = alignPanel.getSeqPanel().findMousePosition(e); - if (pos.isOverAnnotation()) - { - // mouse is over an annotation label in wrapped mode - return; - } if (e.isPopupTrigger()) // Mac reports this in mousePressed { @@ -358,6 +354,12 @@ public class IdPanel extends JPanel */ void showPopupMenu(MouseEvent e, MousePos pos) { + if (pos.isOverAnnotation()) + { + showAnnotationMenu(e, pos); + return; + } + Sequence sq = (Sequence) av.getAlignment().getSequenceAt(pos.seqIndex); /* @@ -380,6 +382,38 @@ public class IdPanel extends JPanel } /** + * On right mouse click on a Consensus annotation label, shows a limited popup + * menu, with options to configure the consensus calculation and rendering. + * + * @param e + * @param pos + * @see AnnotationLabels#showPopupMenu(MouseEvent) + */ + void showAnnotationMenu(MouseEvent e, MousePos pos) + { + if (pos.annotationIndex == -1) + { + return; + } + AlignmentAnnotation[] anns = this.av.getAlignment() + .getAlignmentAnnotation(); + if (anns == null || pos.annotationIndex >= anns.length) + { + return; + } + AlignmentAnnotation ann = anns[pos.annotationIndex]; + if (!ann.label.contains("Consensus")) + { + return; + } + + JPopupMenu pop = new JPopupMenu( + MessageManager.getString("label.annotations")); + AnnotationLabels.addConsensusMenuOptions(this.alignPanel, ann, pop); + pop.show(this, e.getX(), e.getY()); + } + + /** * Toggle whether the sequence is part of the current selection group. * * @param seq @@ -442,11 +476,6 @@ public class IdPanel extends JPanel scrollThread.running = false; } MousePos pos = alignPanel.getSeqPanel().findMousePosition(e); - if (pos.isOverAnnotation()) - { - // mouse is over an annotation label in wrapped mode - return; - } mouseDragging = false; PaintRefresher.Refresh(this, av.getSequenceSetId());