git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2831 Removed unwanted hidden sequences checks
[jalview.git]
/
src
/
jalview
/
gui
/
SeqPanel.java
diff --git
a/src/jalview/gui/SeqPanel.java
b/src/jalview/gui/SeqPanel.java
index
203dc4b
..
e11af48
100644
(file)
--- a/
src/jalview/gui/SeqPanel.java
+++ b/
src/jalview/gui/SeqPanel.java
@@
-215,8
+215,8
@@
public class SeqPanel extends JPanel
+ hgap + seqCanvas.getAnnotationHeight();
int y = evt.getY();
+ hgap + seqCanvas.getAnnotationHeight();
int y = evt.getY();
- y -= hgap;
- x = Math.max(0, x - seqCanvas.labelWidthWest);
+ y = Math.max(0, y - hgap);
+ x = Math.max(0, x - seqCanvas.getLabelWidthWest());
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
if (cwidth < 1)
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
if (cwidth < 1)
@@
-320,13
+320,13
@@
public class SeqPanel extends JPanel
void setCursorRow()
{
seqCanvas.cursorY = getKeyboardNo1() - 1;
void setCursorRow()
{
seqCanvas.cursorY = getKeyboardNo1() - 1;
- scrollToVisible();
+ scrollToVisible(true);
}
void setCursorColumn()
{
seqCanvas.cursorX = getKeyboardNo1() - 1;
}
void setCursorColumn()
{
seqCanvas.cursorX = getKeyboardNo1() - 1;
- scrollToVisible();
+ scrollToVisible(true);
}
void setCursorRowAndColumn()
}
void setCursorRowAndColumn()
@@
-339,7
+339,7
@@
public class SeqPanel extends JPanel
{
seqCanvas.cursorX = getKeyboardNo1() - 1;
seqCanvas.cursorY = getKeyboardNo2() - 1;
{
seqCanvas.cursorX = getKeyboardNo1() - 1;
seqCanvas.cursorY = getKeyboardNo2() - 1;
- scrollToVisible();
+ scrollToVisible(true);
}
}
}
}
@@
-348,7
+348,7
@@
public class SeqPanel extends JPanel
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
- scrollToVisible();
+ scrollToVisible(true);
}
void moveCursor(int dx, int dy)
}
void moveCursor(int dx, int dy)
@@
-376,10
+376,16
@@
public class SeqPanel extends JPanel
}
}
}
}
- scrollToVisible();
+ scrollToVisible(false);
}
}
- void scrollToVisible()
+ /**
+ * Scroll to make the cursor visible in the viewport.
+ *
+ * @param jump
+ * just jump to the location rather than scrolling
+ */
+ void scrollToVisible(boolean jump)
{
if (seqCanvas.cursorX < 0)
{
{
if (seqCanvas.cursorX < 0)
{
@@
-400,20
+406,41
@@
public class SeqPanel extends JPanel
}
endEditing();
}
endEditing();
- if (av.getWrapAlignment())
+
+ boolean repaintNeeded = true;
+ if (jump)
{
{
- av.getRanges().scrollToWrappedVisible(seqCanvas.cursorX);
+ // only need to repaint if the viewport did not move, as otherwise it will
+ // get a repaint
+ repaintNeeded = !av.getRanges().setViewportLocation(seqCanvas.cursorX,
+ seqCanvas.cursorY);
}
else
{
}
else
{
- av.getRanges().scrollToVisible(seqCanvas.cursorX, seqCanvas.cursorY);
+ if (av.getWrapAlignment())
+ {
+ av.getRanges().scrollToWrappedVisible(seqCanvas.cursorX);
+ }
+ else
+ {
+ av.getRanges().scrollToVisible(seqCanvas.cursorX,
+ seqCanvas.cursorY);
+ }
}
}
- setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
+
+ if (av.getAlignment().getHiddenColumns().isVisible(seqCanvas.cursorX))
+ {
+ setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
seqCanvas.cursorX, seqCanvas.cursorY);
seqCanvas.cursorX, seqCanvas.cursorY);
+ }
- seqCanvas.repaint();
+ if (repaintNeeded)
+ {
+ seqCanvas.repaint();
+ }
}
}
+
void setSelectionAreaAtCursor(boolean topLeft)
{
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
void setSelectionAreaAtCursor(boolean topLeft)
{
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
@@
-484,7
+511,7
@@
public class SeqPanel extends JPanel
av.setSelectionGroup(sg);
}
av.setSelectionGroup(sg);
}
- ap.paintAlignment(false);
+ ap.paintAlignment(false, false);
av.sendSelection();
}
av.sendSelection();
}
@@
-719,10
+746,12
@@
public class SeqPanel extends JPanel
}
/**
}
/**
- * DOCUMENT ME!
+ * Action on mouse movement is to update the status bar to show the current
+ * sequence position, and (if features are shown) to show any features at the
+ * position in a tooltip. Does nothing if the mouse move does not change
+ * residue position.
*
* @param evt
*
* @param evt
- * DOCUMENT ME!
*/
@Override
public void mouseMoved(MouseEvent evt)
*/
@Override
public void mouseMoved(MouseEvent evt)
@@
-735,7
+764,8
@@
public class SeqPanel extends JPanel
}
final int column = findColumn(evt);
}
final int column = findColumn(evt);
- int seq = findSeq(evt);
+ final int seq = findSeq(evt);
+
if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
{
lastMouseSeq = -1;
if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
{
lastMouseSeq = -1;
@@
-852,11
+882,12
@@
public class SeqPanel extends JPanel
/**
* set when the current UI interaction has resulted in a change that requires
/**
* set when the current UI interaction has resulted in a change that requires
- * overview shading to be recalculated. this could be changed to something
- * more expressive that indicates what actually has changed, so selective
- * redraws can be applied
+ * shading in overviews and structures to be recalculated. this could be
+ * changed to a something more expressive that indicates what actually has
+ * changed, so selective redraws can be applied (ie. only structures, only
+ * overview, etc)
*/
*/
- private boolean needOverviewUpdate = false; // TODO: refactor to avcontroller
+ private boolean updateOverviewAndStructs = false; // TODO: refactor to avcontroller
/**
* set if av.getSelectionGroup() refers to a group that is defined on the
/**
* set if av.getSelectionGroup() refers to a group that is defined on the
@@
-1057,7
+1088,7
@@
public class SeqPanel extends JPanel
}
if (newWidth > 0)
{
}
if (newWidth > 0)
{
- ap.paintAlignment(false);
+ ap.paintAlignment(false, false);
if (copyChanges)
{
/*
if (copyChanges)
{
/*
@@
-1111,7
+1142,7
@@
public class SeqPanel extends JPanel
}
mouseDragging = true;
}
mouseDragging = true;
- if (scrollThread != null)
+ if ((scrollThread != null) && (scrollThread.isRunning()))
{
scrollThread.setEvent(evt);
}
{
scrollThread.setEvent(evt);
}
@@
-1537,9
+1568,9
@@
public class SeqPanel extends JPanel
oldSeq = 0;
}
oldSeq = 0;
}
- if (scrollThread != null)
+ if ((scrollThread != null) && (scrollThread.isRunning()))
{
{
- scrollThread.running = false;
+ scrollThread.stopScrolling();
scrollThread = null;
}
}
scrollThread = null;
}
}
@@
-1558,7
+1589,7
@@
public class SeqPanel extends JPanel
return;
}
return;
}
- if (mouseDragging)
+ if (mouseDragging && scrollThread == null)
{
scrollThread = new ScrollThread();
}
{
scrollThread = new ScrollThread();
}
@@
-1626,7
+1657,7
@@
public class SeqPanel extends JPanel
av.getRanges().scrollRight(true);
}
av.getRanges().scrollRight(true);
}
- else if (!av.getWrapAlignment())
+ else
{
av.getRanges().scrollUp(false);
}
{
av.getRanges().scrollUp(false);
}
@@
-1637,12
+1668,18
@@
public class SeqPanel extends JPanel
{
av.getRanges().scrollRight(false);
}
{
av.getRanges().scrollRight(false);
}
- else if (!av.getWrapAlignment())
+ else
{
av.getRanges().scrollUp(true);
}
}
{
av.getRanges().scrollUp(true);
}
}
- // TODO Update tooltip for new position.
+
+ /*
+ * update status bar and tooltip for new position
+ * (need to synthesize a mouse movement to refresh tooltip)
+ */
+ mouseMoved(e);
+ ToolTipManager.sharedInstance().mouseMoved(e);
}
/**
}
/**
@@
-1656,7
+1693,7
@@
public class SeqPanel extends JPanel
final int res = findColumn(evt);
final int seq = findSeq(evt);
oldSeq = seq;
final int res = findColumn(evt);
final int seq = findSeq(evt);
oldSeq = seq;
- needOverviewUpdate = false;
+ updateOverviewAndStructs = false;
startWrapBlock = wrappedBlock;
startWrapBlock = wrappedBlock;
@@
-1821,7
+1858,7
@@
public class SeqPanel extends JPanel
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
boolean vischange = stretchGroup.recalcConservation(true);
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
boolean vischange = stretchGroup.recalcConservation(true);
- needOverviewUpdate |= vischange && av.isSelectionDefinedGroup()
+ updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup()
&& afterDrag;
if (stretchGroup.cs != null)
{
&& afterDrag;
if (stretchGroup.cs != null)
{
@@
-1841,8
+1878,10
@@
public class SeqPanel extends JPanel
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
- ap.paintAlignment(needOverviewUpdate);
- needOverviewUpdate = false;
+ // TODO: structure colours only need updating if stretchGroup used to or now
+ // does contain sequences with structure views
+ ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs);
+ updateOverviewAndStructs = false;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
@@
-1896,7
+1935,7
@@
public class SeqPanel extends JPanel
if (res > (stretchGroup.getStartRes() - 1))
{
stretchGroup.setEndRes(res);
if (res > (stretchGroup.getStartRes() - 1))
{
stretchGroup.setEndRes(res);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
}
else if (changeStartRes)
}
}
else if (changeStartRes)
@@
-1904,7
+1943,7
@@
public class SeqPanel extends JPanel
if (res < (stretchGroup.getEndRes() + 1))
{
stretchGroup.setStartRes(res);
if (res < (stretchGroup.getEndRes() + 1))
{
stretchGroup.setStartRes(res);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
}
}
}
@@
-1938,7
+1977,7
@@
public class SeqPanel extends JPanel
if (stretchGroup.getSequences(null).contains(nextSeq))
{
stretchGroup.deleteSequence(seq, false);
if (stretchGroup.getSequences(null).contains(nextSeq))
{
stretchGroup.deleteSequence(seq, false);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
else
{
}
else
{
@@
-1948,7
+1987,7
@@
public class SeqPanel extends JPanel
}
stretchGroup.addSequence(nextSeq, false);
}
stretchGroup.addSequence(nextSeq, false);
- needOverviewUpdate |= av.isSelectionDefinedGroup();
+ updateOverviewAndStructs |= av.isSelectionDefinedGroup();
}
}
}
}
@@
-1959,7
+1998,7
@@
public class SeqPanel extends JPanel
mouseDragging = true;
mouseDragging = true;
- if (scrollThread != null)
+ if ((scrollThread != null) && (scrollThread.isRunning()))
{
scrollThread.setEvent(evt);
}
{
scrollThread.setEvent(evt);
}
@@
-1969,9
+2008,9
@@
public class SeqPanel extends JPanel
{
if (evt == null)
{
{
if (evt == null)
{
- if (scrollThread != null)
+ if ((scrollThread != null) && (scrollThread.isRunning()))
{
{
- scrollThread.running = false;
+ scrollThread.stopScrolling();
scrollThread = null;
}
mouseDragging = false;
scrollThread = null;
}
mouseDragging = false;
@@
-1994,7
+2033,7
@@
public class SeqPanel extends JPanel
{
MouseEvent evt;
{
MouseEvent evt;
- boolean running = false;
+ private volatile boolean threadRunning = true;
public ScrollThread()
{
public ScrollThread()
{
@@
-2008,37
+2047,40
@@
public class SeqPanel extends JPanel
public void stopScrolling()
{
public void stopScrolling()
{
- running = false;
+ threadRunning = false;
+ }
+
+ public boolean isRunning()
+ {
+ return threadRunning;
}
@Override
public void run()
{
}
@Override
public void run()
{
- running = true;
-
- while (running)
+ while (threadRunning)
{
if (evt != null)
{
if (mouseDragging && (evt.getY() < 0)
&& (av.getRanges().getStartSeq() > 0))
{
{
if (evt != null)
{
if (mouseDragging && (evt.getY() < 0)
&& (av.getRanges().getStartSeq() > 0))
{
- running = av.getRanges().scrollUp(true);
+ av.getRanges().scrollUp(true);
}
if (mouseDragging && (evt.getY() >= getHeight()) && (av
.getAlignment().getHeight() > av.getRanges().getEndSeq()))
{
}
if (mouseDragging && (evt.getY() >= getHeight()) && (av
.getAlignment().getHeight() > av.getRanges().getEndSeq()))
{
- running = av.getRanges().scrollUp(false);
+ av.getRanges().scrollUp(false);
}
if (mouseDragging && (evt.getX() < 0))
{
}
if (mouseDragging && (evt.getX() < 0))
{
- running = av.getRanges().scrollRight(false);
+ av.getRanges().scrollRight(false);
}
else if (mouseDragging && (evt.getX() >= getWidth()))
{
}
else if (mouseDragging && (evt.getX() >= getWidth()))
{
- running = av.getRanges().scrollRight(true);
+ av.getRanges().scrollRight(true);
}
}
}
}