From 31aef90c8108c0c781d77c7c32402a940b122aa2 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 8 Mar 2006 16:55:30 +0000 Subject: [PATCH] Reveal All added --- src/jalview/gui/ScalePanel.java | 53 ++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 7fa3abd..87e72dc 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -72,14 +72,40 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList min = res; max = res; - if(reveal != null) - { - av.getColumnSelection().revealHiddenColumns(reveal[0], av); - reveal = null; - return; - } + if(reveal != null && SwingUtilities.isRightMouseButton(evt)) + { + JPopupMenu pop = new JPopupMenu(); + JMenuItem item = new JMenuItem("Reveal"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + av.getColumnSelection().revealHiddenColumns(reveal[0], av); + reveal = null; + ap.repaint(); + } + }); + pop.add(item); - if (av.getColumnSelection().contains(res)) + if(av.getColumnSelection().hiddenColumns.size()>1) + { + item = new JMenuItem("Reveal All"); + item.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + av.getColumnSelection().revealAllHiddenColumns(av); + reveal = null; + ap.repaint(); + } + }); + pop.add(item); + } + + pop.show(this, evt.getX(), evt.getY()); + + } + else if (av.getColumnSelection().contains(res)) { if( SwingUtilities.isRightMouseButton(evt)) { @@ -90,6 +116,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList public void actionPerformed(ActionEvent e) { av.getColumnSelection().hideColumns(res, av); + ap.repaint(); } }); pop.add(item); @@ -99,7 +126,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList else { av.getColumnSelection().removeElement(res); - ap.annotationPanel.removeEditableColumn(res); + av.setSelectionGroup(null); } } else @@ -133,15 +160,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList if(av.hasHiddenColumns) res = av.getColumnSelection().adjustForHiddenColumns(res); - if (av.getColumnSelection() != null) - { - for (int i = 0; i < av.getColumnSelection().size(); i++) - { - ap.annotationPanel.addEditableColumn(av.getColumnSelection() - .columnAt(i)); - } - } - if (!stretchingGroup) { ap.repaint(); @@ -211,7 +229,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, MouseList if ((i < sg.getStartRes()) || (i > sg.getEndRes())) { av.getColumnSelection().removeElement(i); - ap.annotationPanel.removeEditableColumn(res); } else { -- 1.7.10.2