int wrappedBlock = -1;
- MousePos findMousePosition(MouseEvent evt)
- {
- return findMousePosition(evt, null);
- }
-
/**
* Computes the column and sequence row (and possibly annotation row when in
* wrapped mode) for the given mouse position
* @param evt
* @return
*/
- MousePos findMousePosition(MouseEvent evt, String debug)
+ MousePos findMousePosition(MouseEvent evt)
{
- int col = findColumn(evt, debug);
+ int col = findColumn(evt);
int seqIndex = -1;
int annIndex = -1;
int y = evt.getY();
int charHeight = av.getCharHeight();
int alignmentHeight = av.getAlignment().getHeight();
- if (debug != null)
- {
- System.out.println(String.format(
- "%s: charHeight %d alHeight %d canvasWidth %d canvasHeight %d",
- debug, charHeight, alignmentHeight, seqCanvas.getWidth(),
- seqCanvas.getHeight()));
- }
if (av.getWrapAlignment())
{
seqCanvas.calculateWrappedGeometry(seqCanvas.getWidth(),
*/
int findColumn(MouseEvent evt)
{
- return findColumn(evt, null);
- }
-
- int findColumn(MouseEvent evt, String debug)
- {
int res = 0;
int x = evt.getX();
int y = evt.getY();
y = Math.max(0, y - hgap);
x -= seqCanvas.getLabelWidthWest();
- if (debug != null)
- {
- System.out.println(
- String.format("%s: %s %d x %d labelWest %d charWidth %d ",
- debug, Thread.currentThread().getName(),
- System.currentTimeMillis(), x,
- seqCanvas.getLabelWidthWest(), charWidth));
- }
if (x < 0)
{
// mouse is over left scale
}
if (x >= cwidth * charWidth)
{
- if (debug != null)
- {
- System.out.println(debug + ": cwidth = " + cwidth);
- }
// mouse is over right scale
return -1;
}
av.setScaleAboveWrapped(false);
av.setScaleLeftWrapped(false);
av.setScaleRightWrapped(false);
- alignFrame.alignPanel.paintAlignment(false, false);
- waitForSwing(); // for Swing thread
+
+ alignFrame.alignPanel.updateLayout();
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y,
0, 0, 0, false, 0);
- MousePos pos = testee.findMousePosition(evt, "291");
+ MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
av.setScaleAboveWrapped(true);
av.setScaleLeftWrapped(false);
av.setScaleRightWrapped(false);
- alignFrame.alignPanel.paintAlignment(false, false);
- waitForSwing();
+ alignFrame.alignPanel.updateLayout();
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y,
0, 0, 0, false, 0);
- MousePos pos = testee.findMousePosition(evt, "466");
+ MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
av.setScaleAboveWrapped(false);
av.setScaleLeftWrapped(false);
av.setScaleRightWrapped(false);
- alignFrame.alignPanel.paintAlignment(false, false);
- waitForSwing();
+ alignFrame.alignPanel.updateLayout();
final int charHeight = av.getCharHeight();
final int charWidth = av.getCharWidth();
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y,
0, 0, 0, false, 0);
- MousePos pos = testee.findMousePosition(evt, "662");
+ MousePos pos = testee.findMousePosition(evt);
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
av.setScaleAboveWrapped(false);
av.setScaleLeftWrapped(false);
av.setScaleRightWrapped(false);
- alignFrame.alignPanel.paintAlignment(false, false);
- // need to wait for repaint to finish!
- waitForSwing();
+ alignFrame.alignPanel.updateLayout();
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
int x = 0;
final int charWidth = av.getCharWidth();
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0,
0, 0, 0, false, 0);
- assertEquals(testee.findColumn(evt, "808"), 0);
+ assertEquals(testee.findColumn(evt), 0);
/*
* not quite one charWidth across
* x over scale left (before drawn columns) results in -1
*/
av.setScaleLeftWrapped(true);
- alignFrame.alignPanel.paintAlignment(false, false);
- waitForSwing();
+ alignFrame.alignPanel.updateLayout();
SeqCanvas seqCanvas = testee.seqCanvas;
int labelWidth = (int) PA.getValue(seqCanvas, "labelWidthWest");
assertTrue(labelWidth > 0);
* x over scale right (beyond drawn columns) results in -1
*/
av.setScaleRightWrapped(true);
- alignFrame.alignPanel.paintAlignment(false, false);
- waitForSwing();
+ alignFrame.alignPanel.updateLayout();
labelWidth = (int) PA.getValue(seqCanvas, "labelWidthEast");
assertTrue(labelWidth > 0);
int residuesWide2 = av.getRanges().getViewportWidth();
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import jalview.bin.Jalview;
import jalview.gui.JvOptionPane;
import java.awt.Button;
import java.awt.Event;
-import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import org.testng.annotations.BeforeClass;
int buttonNo = MouseEvent.BUTTON1;
boolean mac = true;
- assertFalse(Jalview.isHeadlessMode());
- Toolkit toolkit = Toolkit.getDefaultToolkit();
- System.err.println("Toolkit is " + toolkit.getClass().getName());
- System.err.println("getMenuShortcutKeyMask is "
- + toolkit.getMenuShortcutKeyMask());
-
int mods = 0;
// not concerned with MouseEvent id, when, x, y, xAbs, yAbs values
assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,