X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqPanel.java;h=b0de2ae71f867a535338a069eab6af61bd388f54;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=98dcc07b18dfce3d53444ec009eb48b178176cc9;hpb=811fb76382f3601b35dc08b8c0ceabed049c3326;p=jalview.git diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java old mode 100755 new mode 100644 index 98dcc07..b0de2ae --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -91,7 +91,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, seqCanvas.addMouseMotionListener(this); seqCanvas.addMouseListener(this); - ssm = StructureSelectionManager.getStructureSelectionManager(); + ssm = StructureSelectionManager.getStructureSelectionManager(av.applet); ssm.addStructureViewerListener(this); seqCanvas.repaint(); @@ -632,18 +632,22 @@ public class SeqPanel extends Panel implements MouseMotionListener, { String tmp = sequence.hashCode() + index + ""; if (lastMessage == null || !lastMessage.equals(tmp)) - ssm.mouseOverSequence(sequence, index, pos); + ssm.mouseOverSequence(sequence, index, pos, av); lastMessage = tmp; } public void highlightSequence(SearchResults results) { - seqCanvas.highlightSearchResults(results); if (av.followHighlight) { - ap.scrollToPosition(results); + if (ap.scrollToPosition(results, true)) + { + ap.alignFrame.repaint(); + } } + seqCanvas.highlightSearchResults(results); + } public void updateColours(SequenceI seq, int index) @@ -1683,6 +1687,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } } } + /** * modify current selection according to a received message. */ @@ -1693,9 +1698,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, // handles selection messages... // TODO: extend config options to allow user to control if selections may be // shared between viewports. - if (av!=null && (av == source - || !av.followSelection - || (source instanceof AlignViewport && ((AlignViewport) source) + if (av != null + && (av == source || !av.followSelection || (source instanceof AlignViewport && ((AlignViewport) source) .getSequenceSetId().equals(av.getSequenceSetId())))) { return; @@ -1708,13 +1712,15 @@ public class SeqPanel extends Panel implements MouseMotionListener, if (av.selectionGroup == null || !av.isSelectionGroupChanged()) { SequenceGroup sgroup = null; - if (seqsel != null) + if (seqsel != null && seqsel.getSize()>0) { if (av.alignment == null) { - System.out.println("Selection message: alignviewport av SeqSetId=" - + av.getSequenceSetId() + " ViewId=" + av.getViewId() - + " 's alignment is NULL! returning immediatly."); + System.out + .println("Selection message: alignviewport av SeqSetId=" + + av.getSequenceSetId() + " ViewId=" + + av.getViewId() + + " 's alignment is NULL! returning immediatly."); return; } sgroup = seqsel.intersect(av.alignment, @@ -1768,10 +1774,42 @@ public class SeqPanel extends Panel implements MouseMotionListener, } if (repaint) { - // probably finessing with multiple redraws here - PaintRefresher.Refresh(this, av.getSequenceSetId()); - // ap.paintAlignment(false); + ap.scalePanelHolder.repaint(); + ap.repaint(); } } + /** + * scroll to the given row/column - or nearest visible location + * @param row + * @param column + */ + public void scrollTo(int row, int column) + { + + row = row<0 ? ap.av.startSeq : row; + column = column<0 ? ap.av.startRes : column; + ap.scrollTo(row, row, column, true, true); + } + /** + * scroll to the given row - or nearest visible location + * @param row + */ + public void scrollToRow(int row) + { + + row = row<0 ? ap.av.startSeq : row; + ap.scrollTo(row, row, ap.av.startRes, true, true); + } + /** + * scroll to the given column - or nearest visible location + * @param column + */ + public void scrollToColumn(int column) + { + + column = column<0 ? ap.av.startRes : column; + ap.scrollTo(ap.av.startRes, ap.av.startRes, column, true, true); + } + }