X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqPanel.java;h=f9612123aaa89f0c0bee3ff80ab7cdace3e611ea;hb=b638a305a88456b3bed6a88676c75ddb8b2ecaa0;hp=e6ed8f295dbfa9c5ee61026ca85cd2fb59c749c2;hpb=caf13e6a9dc82023cd8648420201e5ad60ce0393;p=jalview.git diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java old mode 100755 new mode 100644 index e6ed8f2..f961212 --- 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(); @@ -458,7 +458,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, SequenceI sequence = av.alignment.getSequenceAt(findSeq(evt)); if (evt.getClickCount() > 1) { - if (av.getSelectionGroup().getSize() == 1 + if (av.getSelectionGroup()!=null && av.getSelectionGroup().getSize() == 1 && av.getSelectionGroup().getEndRes() - av.getSelectionGroup().getStartRes() < 2) { @@ -639,11 +639,15 @@ public class SeqPanel extends Panel implements MouseMotionListener, 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); + } + }