*/
package jalview.gui;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.SequenceGroup;
-import jalview.renderer.ScaleRenderer;
-import jalview.renderer.ScaleRenderer.ScaleMark;
-import jalview.util.MessageManager;
-import jalview.util.Platform;
-import jalview.viewmodel.ViewportListenerI;
-import jalview.viewmodel.ViewportRanges;
-
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.SequenceGroup;
+import jalview.renderer.ScaleRenderer;
+import jalview.renderer.ScaleRenderer.ScaleMark;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+import jalview.viewmodel.ViewportListenerI;
+import jalview.viewmodel.ViewportRanges;
+
/**
* The panel containing the sequence ruler (when not in wrapped mode), and
* supports a range of mouse operations to select, hide or reveal columns.
if (evt.isPopupTrigger()) // Mac: mousePressed
{
rightMouseButtonPressed(evt, res);
+ return;
}
- else if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac())
+ if (Platform.isWinRightButton(evt))
{
/*
* defer right-mouse click handling to mouse up on Windows
*/
return;
}
- else
- {
- leftMouseButtonPressed(evt, res);
- }
+ leftMouseButtonPressed(evt, res);
}
/**
});
pop.add(item);
- if (av.getAlignment().getHiddenColumns().hasMultiHiddenColumnRegions())
+ if (av.getAlignment().getHiddenColumns()
+ .hasMultiHiddenColumnRegions())
{
item = new JMenuItem(MessageManager.getString("action.reveal_all"));
item.addActionListener(new ActionListener()
mouseDragging = false;
ap.getSeqPanel().stopScrolling();
+ // todo res calculation should be a method on AlignViewport
int xCords = Math.max(0, evt.getX()); // prevent negative X coordinates
ViewportRanges ranges = av.getRanges();
- int res = (xCords / av.getCharWidth())
- + ranges.getStartRes();
+ int res = (xCords / av.getCharWidth()) + ranges.getStartRes();
res = Math.min(res, ranges.getEndRes());
if (av.hasHiddenColumns())
{
{
if (mouseDragging)
{
+ mouseDragging = false;
ap.getSeqPanel().stopScrolling();
}
}
reveal = null;
if (!av.hasHiddenColumns())
{
+ int res = (evt.getX() / av.getCharWidth())
+ + av.getRanges().getStartRes();
+ highlightAllStructPos(res);
return;
}
.getRegionWithEdgeAtRes(res);
res = av.getAlignment().getHiddenColumns().visibleToAbsoluteColumn(res);
-
+ highlightAllStructPos(res);
ToolTipManager.sharedInstance().registerComponent(this);
this.setToolTipText(
MessageManager.getString("label.reveal_hidden_columns"));
repaint();
}
+ public void highlightAllStructPos(int col)
+ {
+ ap.getStructureSelectionManager().highlightPositionsOnMany(
+ ap.av.getAlignment().getSequencesArray(), new int[]
+ { col, col }, ap);
+
+ }
+
/**
* DOCUMENT ME!
*
@Override
public void paintComponent(Graphics g)
{
- super.paintComponent(g);
+ // super.paintComponent(g); // BH 2019
/*
* shouldn't get called in wrapped mode as the scale above is
gg.fillPolygon(
new int[]
- { -1 + res * avCharWidth - avCharHeight / 4,
- -1 + res * avCharWidth + avCharHeight / 4,
- -1 + res * avCharWidth }, new int[]
- { y, y, y + 2 * yOf }, 3);
+ { -1 + res * avCharWidth - avCharHeight / 4,
+ -1 + res * avCharWidth + avCharHeight / 4,
+ -1 + res * avCharWidth },
+ new int[]
+ { y, y, y + 2 * yOf }, 3);
}
}
}
|| evt.getPropertyName().equals(ViewportRanges.MOVE_VIEWPORT))
{
// scroll event, repaint panel
-
- // Call repaint on alignment panel so that repaints from other alignment
- // panel components can be aggregated. Otherwise performance of the overview
- // window and others may be adversely affected.
+
+ // Call repaint on alignment panel so that repaints from other alignment
+ // panel components can be aggregated. Otherwise performance of the
+ // overview
+ // window and others may be adversely affected.
av.getAlignPanel().repaint();
}
}