import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.io.HTMLOutput;
import jalview.jbgui.GAlignmentPanel;
import jalview.math.AlignmentDimension;
import jalview.schemes.ResidueProperties;
import jalview.structure.StructureSelectionManager;
+import jalview.util.ImageMaker;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Color;
*/
public boolean scrollToPosition(SearchResults results)
{
- return scrollToPosition(results, true, false);
+ return scrollToPosition(results, 0, true, false);
}
/**
*/
public boolean scrollToPosition(SearchResults searchResults, boolean redrawOverview)
{
- return scrollToPosition(searchResults, redrawOverview, false);
+ return scrollToPosition(searchResults, 0, redrawOverview, false);
}
/**
* (if any)
*
* @param results
+ * @param verticalOffset
+ * if greater than zero, allows scrolling to a position below the
+ * first displayed sequence
* @param redrawOverview
* - when set, the overview will be recalculated (takes longer)
* @param centre
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResults results,
+ int verticalOffset,
boolean redrawOverview, boolean centre)
{
int startv, endv, starts, ends;
}
}
}
+
+ /*
+ * allow for offset of target sequence (actually scroll to one above it)
+ */
+ seqIndex = Math.max(0, seqIndex - verticalOffset);
+
if (!av.getWrapAlignment())
{
if ((startv = av.getStartRes()) >= start)
/*
* Estimate available height in the AlignFrame for alignment +
- * annotations. Deduct an estimate of 75 for menu bar, scale panel,
+ * annotations. Deduct an estimate for title bar, menu bar, scale panel,
* hscroll, status bar (as these are not laid out we can't inspect their
- * actual heights). Insets gives borders including title bar.
+ * actual heights). Insets gives frame borders.
*/
+ int stuff = Platform.isAMac() ? 80 : 100;
Insets insets = alignFrame.getInsets();
- int availableHeight = alignFrame.getHeight() - 75 - insets.top
+ int availableHeight = alignFrame.getHeight() - stuff - insets.top
- insets.bottom;
/*
return idwidth.intValue() + 4;
}
- void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file)
+ void makeAlignmentImage(ImageMaker.TYPE type, File file)
{
long progress = System.currentTimeMillis();
headless = (System.getProperty("java.awt.headless") != null && System
AlignmentDimension aDimension = getAlignmentDimension();
try
{
- jalview.util.ImageMaker im;
+ ImageMaker im;
final String imageAction, imageTitle;
- if (type == jalview.util.ImageMaker.TYPE.PNG)
+ if (type == ImageMaker.TYPE.PNG)
{
imageAction = "Create PNG image from alignment";
imageTitle = null;
}
- else if (type == jalview.util.ImageMaker.TYPE.EPS)
+ else if (type == ImageMaker.TYPE.EPS)
{
imageAction = "Create EPS file from alignment";
imageTitle = alignFrame.getTitle();
imageTitle = alignFrame.getTitle();
}
- im = new jalview.util.ImageMaker(this, type, imageAction,
+ im = new ImageMaker(this, type, imageAction,
aDimension.getWidth(), aDimension.getHeight(), file,
imageTitle);
if (av.getWrapAlignment())
*/
public void makeEPS(File epsFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.TYPE.EPS, epsFile);
+ makeAlignmentImage(ImageMaker.TYPE.EPS, epsFile);
}
/**
*/
public void makePNG(File pngFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.TYPE.PNG, pngFile);
+ makeAlignmentImage(ImageMaker.TYPE.PNG, pngFile);
}
public void makeSVG(File svgFile)
{
- makeAlignmentImage(jalview.util.ImageMaker.TYPE.SVG, svgFile);
+ makeAlignmentImage(ImageMaker.TYPE.SVG, svgFile);
}
public void makePNGImageMap(File imgMapFile, String imageName)
{
.getAlignment().getWidth(), g, gSize, f, fSize, sy;
StringBuffer text = new StringBuffer();
PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
- out.println(jalview.io.HTMLOutput.getImageMapHTML());
+ out.println(HTMLOutput.getImageMapHTML());
out.println("<img src=\"" + imageName
+ "\" border=\"0\" usemap=\"#Map\" >"
+ "<map name=\"Map\">");
PaintRefresher.RemoveComponent(this);
if (av != null)
{
- jalview.structure.StructureSelectionManager ssm = av
+ StructureSelectionManager ssm = av
.getStructureSelectionManager();
ssm.removeStructureViewerListener(getSeqPanel(), null);
ssm.removeSelectionListener(getSeqPanel());
* @param sr
* holds mapped region(s) of this alignment that we are scrolling
* 'to'; may be modified for sequence offset by this method
- * @param seqOffset
+ * @param verticalOffset
* the number of visible sequences to show above the mapped region
*/
- public void scrollToCentre(SearchResults sr, int seqOffset)
+ public void scrollToCentre(SearchResults sr, int verticalOffset)
{
/*
* To avoid jumpy vertical scrolling (if some sequences are gapped or not
* This is like AlignmentI.findIndex(seq) but here we are matching the
* dataset sequence not the aligned sequence
*/
- int sequenceIndex = 0;
boolean matched = false;
for (SequenceI seq : seqs)
{
matched = true;
break;
}
- sequenceIndex++;
}
if (!matched)
{
return; // failsafe, shouldn't happen
}
- sequenceIndex = Math.max(0, sequenceIndex - seqOffset);
- sr.getResults().get(0)
- .setSequence(av.getAlignment().getSequenceAt(sequenceIndex));
/*
* Scroll to position but centring the target residue.
*/
- scrollToPosition(sr, true, true);
+ scrollToPosition(sr, verticalOffset, true, true);
}
/**